diff --git a/DO_OPENAPI_COMMIT_SHA.txt b/DO_OPENAPI_COMMIT_SHA.txt
index 67d44682..7d9a4dbd 100644
--- a/DO_OPENAPI_COMMIT_SHA.txt
+++ b/DO_OPENAPI_COMMIT_SHA.txt
@@ -1 +1 @@
-97dca99
+13a4609
diff --git a/src/pydo/_client.py b/src/pydo/_client.py
index c59a0d6d..8b589357 100644
--- a/src/pydo/_client.py
+++ b/src/pydo/_client.py
@@ -63,6 +63,7 @@
ReservedIPv6Operations,
SecurityOperations,
SessionsOperations,
+ SignalsOperations,
SizesOperations,
SnapshotsOperations,
SpacesKeyOperations,
@@ -160,6 +161,8 @@ class GeneratedClient: # pylint: disable=client-accepts-api-version-keyword,too
:vartype image_actions: pydo.operations.ImageActionsOperations
:ivar insights: InsightsOperations operations
:vartype insights: pydo.operations.InsightsOperations
+ :ivar signals: SignalsOperations operations
+ :vartype signals: pydo.operations.SignalsOperations
:ivar kubernetes: KubernetesOperations operations
:vartype kubernetes: pydo.operations.KubernetesOperations
:ivar load_balancers: LoadBalancersOperations operations
@@ -372,6 +375,9 @@ def __init__(
self.insights = InsightsOperations(
self._client, self._config, self._serialize, self._deserialize
)
+ self.signals = SignalsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.kubernetes = KubernetesOperations(
self._client, self._config, self._serialize, self._deserialize
)
diff --git a/src/pydo/aio/_client.py b/src/pydo/aio/_client.py
index cb653108..7332b4f4 100644
--- a/src/pydo/aio/_client.py
+++ b/src/pydo/aio/_client.py
@@ -63,6 +63,7 @@
ReservedIPv6Operations,
SecurityOperations,
SessionsOperations,
+ SignalsOperations,
SizesOperations,
SnapshotsOperations,
SpacesKeyOperations,
@@ -160,6 +161,8 @@ class GeneratedClient: # pylint: disable=client-accepts-api-version-keyword,too
:vartype image_actions: pydo.aio.operations.ImageActionsOperations
:ivar insights: InsightsOperations operations
:vartype insights: pydo.aio.operations.InsightsOperations
+ :ivar signals: SignalsOperations operations
+ :vartype signals: pydo.aio.operations.SignalsOperations
:ivar kubernetes: KubernetesOperations operations
:vartype kubernetes: pydo.aio.operations.KubernetesOperations
:ivar load_balancers: LoadBalancersOperations operations
@@ -372,6 +375,9 @@ def __init__(
self.insights = InsightsOperations(
self._client, self._config, self._serialize, self._deserialize
)
+ self.signals = SignalsOperations(
+ self._client, self._config, self._serialize, self._deserialize
+ )
self.kubernetes = KubernetesOperations(
self._client, self._config, self._serialize, self._deserialize
)
diff --git a/src/pydo/aio/operations/__init__.py b/src/pydo/aio/operations/__init__.py
index 163af5e7..4a4f951f 100644
--- a/src/pydo/aio/operations/__init__.py
+++ b/src/pydo/aio/operations/__init__.py
@@ -38,6 +38,7 @@
from ._operations import ImagesOperations
from ._operations import ImageActionsOperations
from ._operations import InsightsOperations
+from ._operations import SignalsOperations
from ._operations import KubernetesOperations
from ._operations import LoadBalancersOperations
from ._operations import MonitoringOperations
@@ -112,6 +113,7 @@
"ImagesOperations",
"ImageActionsOperations",
"InsightsOperations",
+ "SignalsOperations",
"KubernetesOperations",
"LoadBalancersOperations",
"MonitoringOperations",
diff --git a/src/pydo/aio/operations/_operations.py b/src/pydo/aio/operations/_operations.py
index 3273a2ff..182d6f56 100644
--- a/src/pydo/aio/operations/_operations.py
+++ b/src/pydo/aio/operations/_operations.py
@@ -446,6 +446,7 @@
build_insights_list_alert_rules_request,
build_insights_list_notification_channels_request,
build_insights_post_logs_search_request,
+ build_insights_post_spans_search_request,
build_insights_update_alert_rule_request,
build_insights_update_notification_channel_request,
build_invoices_get_by_uuid_request,
@@ -680,6 +681,16 @@
build_sessions_delete_request,
build_sessions_list_request,
build_sessions_list_search_request,
+ build_signals_create_export_request,
+ build_signals_get_consent_request,
+ build_signals_get_export_download_request,
+ build_signals_get_export_options_request,
+ build_signals_get_export_request,
+ build_signals_list_agent_sessions_request,
+ build_signals_list_consents_request,
+ build_signals_list_exports_request,
+ build_signals_list_session_dialogues_request,
+ build_signals_update_consent_request,
build_sizes_list_request,
build_snapshots_delete_request,
build_snapshots_get_request,
@@ -23816,7 +23827,8 @@ async def create(
},
"project_id": "str" # Optional. The ID of the project the app should be
assigned to. If omitted, it will be assigned to your default project.
- :code:`
`:code:`
`Requires ``project:assign_resource`` scope.
+ :code:`
`:code:`
`Requires ``project:assign_resource`` and
+ ``project:update`` scopes.
}
# response body for status code(s): 200
@@ -40539,7 +40551,8 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
},
"project_id": "str" # Optional. The ID of the project the app should be
assigned to. If omitted, it will be assigned to your default project.
- :code:`
`:code:`
`Requires ``project:assign_resource`` scope.
+ :code:`
`:code:`
`Requires ``project:assign_resource`` and
+ ``project:update`` scopes.
}
# response body for status code(s): 200
@@ -166341,6 +166354,2145 @@ async def post_logs_search(
return cast(JSON, deserialized) # type: ignore
+ @overload
+ async def post_spans_search(
+ self,
+ region: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Search spans.
+
+ To search spans in a region, send a POST request to
+ ``/v2/insights/query/{region}/spans/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ The time range must not exceed 7 days. ``pagination.limit`` defaults to 100 and must be between
+ 1 and 1000. Results are ordered by ``startTime`` descending by default. Cursor-based pagination
+ is not yet supported; ``pagination.hasMore`` indicates whether additional spans matched beyond
+ the returned page.
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: str
+ :param body: Required.
+ :type body: JSON
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "timeRange": {
+ "from": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
+ },
+ "to": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
+ }
+ },
+ "filter": {
+ "type": "str", # The node kind. Required. Known values are:
+ "condition", "and", "or", "not", and "text_search".
+ "expressions": [
+ ...
+ ],
+ "field": {
+ "name": "str", # The field name. Well-known span fields
+ include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope. Use
+ ``resource`` to match a resource attribute or ``attributes`` to match a
+ span attribute. Omit for well-known fields or to search both attribute
+ maps. Known values are: "resource" and "attributes".
+ },
+ "operator": "str", # Optional. The comparison operator for a
+ ``condition`` node. Known values are: "eq", "neq", "gt", "gte", "lt", "lte",
+ "in", and "exists".
+ "query": "str", # Optional. The substring to match for a
+ ``text_search`` node.
+ "value": {}
+ },
+ "orderBy": [
+ {
+ "field": {
+ "name": "str", # The field name. Well-known span
+ fields include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope.
+ Use ``resource`` to match a resource attribute or ``attributes`` to
+ match a span attribute. Omit for well-known fields or to search both
+ attribute maps. Known values are: "resource" and "attributes".
+ },
+ "direction": "str" # Optional. The sort direction. Defaults
+ to ``desc`` when omitted. Known values are: "asc" and "desc".
+ }
+ ],
+ "pagination": {
+ "limit": 100 # Optional. Default value is 100. Maximum number of
+ spans to return. Defaults to 100 and must be between 1 and 1000.
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "attributes": {
+ "str": "str" # Optional. Span attributes.
+ },
+ "durationNs": 0, # Optional. The span duration in
+ nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The span kind.
+ "name": "str", # Optional. The span name.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for root spans.
+ "region": "str", # Optional. The datacenter region slug the
+ span was queried from.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The name of the service
+ that emitted the span.
+ "spanId": "str", # Optional. The span identifier.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The span status code.
+ "statusMessage": "str", # Optional. The span status message.
+ Omitted when empty.
+ "traceId": "str" # Optional. The trace identifier the span
+ belongs to.
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Optional. Whether more spans matched than were
+ returned in this page. Cursor-based continuation is not yet supported.
+ }
+ }
+ # response body for status code(s): 400, 403, 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+
+ @overload
+ async def post_spans_search(
+ self,
+ region: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Search spans.
+
+ To search spans in a region, send a POST request to
+ ``/v2/insights/query/{region}/spans/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ The time range must not exceed 7 days. ``pagination.limit`` defaults to 100 and must be between
+ 1 and 1000. Results are ordered by ``startTime`` descending by default. Cursor-based pagination
+ is not yet supported; ``pagination.hasMore`` indicates whether additional spans matched beyond
+ the returned page.
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: str
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "attributes": {
+ "str": "str" # Optional. Span attributes.
+ },
+ "durationNs": 0, # Optional. The span duration in
+ nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The span kind.
+ "name": "str", # Optional. The span name.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for root spans.
+ "region": "str", # Optional. The datacenter region slug the
+ span was queried from.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The name of the service
+ that emitted the span.
+ "spanId": "str", # Optional. The span identifier.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The span status code.
+ "statusMessage": "str", # Optional. The span status message.
+ Omitted when empty.
+ "traceId": "str" # Optional. The trace identifier the span
+ belongs to.
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Optional. Whether more spans matched than were
+ returned in this page. Cursor-based continuation is not yet supported.
+ }
+ }
+ # response body for status code(s): 400, 403, 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+
+ @distributed_trace_async
+ async def post_spans_search(
+ self, region: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Search spans.
+
+ To search spans in a region, send a POST request to
+ ``/v2/insights/query/{region}/spans/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ The time range must not exceed 7 days. ``pagination.limit`` defaults to 100 and must be between
+ 1 and 1000. Results are ordered by ``startTime`` descending by default. Cursor-based pagination
+ is not yet supported; ``pagination.hasMore`` indicates whether additional spans matched beyond
+ the returned page.
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "timeRange": {
+ "from": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
+ },
+ "to": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
+ }
+ },
+ "filter": {
+ "type": "str", # The node kind. Required. Known values are:
+ "condition", "and", "or", "not", and "text_search".
+ "expressions": [
+ ...
+ ],
+ "field": {
+ "name": "str", # The field name. Well-known span fields
+ include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope. Use
+ ``resource`` to match a resource attribute or ``attributes`` to match a
+ span attribute. Omit for well-known fields or to search both attribute
+ maps. Known values are: "resource" and "attributes".
+ },
+ "operator": "str", # Optional. The comparison operator for a
+ ``condition`` node. Known values are: "eq", "neq", "gt", "gte", "lt", "lte",
+ "in", and "exists".
+ "query": "str", # Optional. The substring to match for a
+ ``text_search`` node.
+ "value": {}
+ },
+ "orderBy": [
+ {
+ "field": {
+ "name": "str", # The field name. Well-known span
+ fields include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope.
+ Use ``resource`` to match a resource attribute or ``attributes`` to
+ match a span attribute. Omit for well-known fields or to search both
+ attribute maps. Known values are: "resource" and "attributes".
+ },
+ "direction": "str" # Optional. The sort direction. Defaults
+ to ``desc`` when omitted. Known values are: "asc" and "desc".
+ }
+ ],
+ "pagination": {
+ "limit": 100 # Optional. Default value is 100. Maximum number of
+ spans to return. Defaults to 100 and must be between 1 and 1000.
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "attributes": {
+ "str": "str" # Optional. Span attributes.
+ },
+ "durationNs": 0, # Optional. The span duration in
+ nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The span kind.
+ "name": "str", # Optional. The span name.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for root spans.
+ "region": "str", # Optional. The datacenter region slug the
+ span was queried from.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The name of the service
+ that emitted the span.
+ "spanId": "str", # Optional. The span identifier.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The span status code.
+ "statusMessage": "str", # Optional. The span status message.
+ Omitted when empty.
+ "traceId": "str" # Optional. The trace identifier the span
+ belongs to.
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Optional. Whether more spans matched than were
+ returned in this page. Cursor-based continuation is not yet supported.
+ }
+ }
+ # response body for status code(s): 400, 403, 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_insights_post_spans_search_request(
+ region=region,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 400, 403, 404]:
+ if _stream:
+ await response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 400:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 403:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+
+class SignalsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.aio.GeneratedClient`'s
+ :attr:`signals` attribute.
+ """
+
+ def __init__(self, *args, **kwargs) -> None:
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
+
+ @distributed_trace_async
+ async def list_consents(self, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Consent Records.
+
+ To list all signals consent records for your team, send a GET request to
+ ``/v1/consent``. Each record indicates whether signals collection is enabled
+ for a specific agent.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "consents": [
+ {
+ "agent_id": "str", # The unique identifier of the agent. For
+ Harness Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for
+ this agent. Required.
+ "id": 0, # The unique numeric identifier for the consent
+ record. Required.
+ "team_id": 0, # The team ID that owns this consent record.
+ Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in
+ ISO8601 combined date and time format. Required.
+ }
+ ]
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_list_consents_request(
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ if _stream:
+ await response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace_async
+ async def get_consent(self, agent_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve Consent for an Agent.
+
+ To retrieve the consent record for a specific agent, send a GET
+ request to ``/v1/consent/{agent_id}``. The response includes an ``allowed``
+ field indicating whether the team is permitted to use signals for this agent.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "allowed": bool, # Whether the team is permitted to use signals for this
+ agent. This is determined by the platform and cannot be set by the user.
+ Required.
+ "enabled": bool, # Whether signals collection is enabled for this agent.
+ Required.
+ "id": 0, # The unique numeric identifier for the consent record. Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601 combined
+ date and time format. Required.
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_get_consent_request(
+ agent_id=agent_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ await response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @overload
+ async def update_consent(
+ self,
+ agent_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Consent for an Agent.
+
+ To enable or disable signals collection for a specific agent, send a
+ PUT request to ``/v1/consent/{agent_id}`` with an ``enabled`` boolean in the
+ request body.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :param body: Required.
+ :type body: JSON
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "enabled": bool # Whether to enable signals collection for this agent.
+ Required.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "consent": {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for this
+ agent. Required.
+ "id": 0, # The unique numeric identifier for the consent record.
+ Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601
+ combined date and time format. Required.
+ }
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+
+ @overload
+ async def update_consent(
+ self,
+ agent_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Consent for an Agent.
+
+ To enable or disable signals collection for a specific agent, send a
+ PUT request to ``/v1/consent/{agent_id}`` with an ``enabled`` boolean in the
+ request body.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "consent": {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for this
+ agent. Required.
+ "id": 0, # The unique numeric identifier for the consent record.
+ Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601
+ combined date and time format. Required.
+ }
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+
+ @distributed_trace_async
+ async def update_consent(
+ self, agent_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Consent for an Agent.
+
+ To enable or disable signals collection for a specific agent, send a
+ PUT request to ``/v1/consent/{agent_id}`` with an ``enabled`` boolean in the
+ request body.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "enabled": bool # Whether to enable signals collection for this agent.
+ Required.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "consent": {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for this
+ agent. Required.
+ "id": 0, # The unique numeric identifier for the consent record.
+ Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601
+ combined date and time format. Required.
+ }
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_signals_update_consent_request(
+ agent_id=agent_id,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ await response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace_async
+ async def list_agent_sessions(
+ self,
+ agent_id: str,
+ *,
+ limit: int = 20,
+ after: Optional[str] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ signal_type: Optional[str] = None,
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Sessions for an Agent.
+
+ To list signals sessions for a specific agent, send a GET request to
+ ``/v1/signals/agents/{agent_id}/sessions``. Results are paginated using cursor-based
+ pagination with ``limit`` and ``after`` parameters.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :keyword start_time: Filter results to those occurring at or after this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype start_time: ~datetime.datetime
+ :keyword end_time: Filter results to those occurring at or before this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype end_time: ~datetime.datetime
+ :keyword signal_type: Filter results by signal type. Use the export options endpoint to list
+ available signal types. Default value is None.
+ :paramtype signal_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "session_id": "str", # The unique identifier for the
+ session. Required.
+ "duration_seconds": 0.0, # Optional. The duration of
+ the session in seconds.
+ "signal_count": 0, # Optional. The number of signals
+ detected in this session.
+ "started_at": "2020-02-20 00:00:00", # Optional.
+ When the session started.
+ "total_turns": 0 # Optional. The total number of
+ conversation turns in this session.
+ }
+ }
+ ],
+ "page_info": {
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_list_agent_sessions_request(
+ agent_id=agent_id,
+ limit=limit,
+ after=after,
+ start_time=start_time,
+ end_time=end_time,
+ signal_type=signal_type,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ await response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace_async
+ async def list_session_dialogues(
+ self,
+ session_id: str,
+ *,
+ limit: int = 20,
+ after: Optional[str] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ signal_type: Optional[str] = None,
+ **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Dialogues for a Session.
+
+ To list the dialogue turns within a specific session, send a GET request to
+ ``/v1/signals/sessions/{session_id}/dialogues``. Each dialogue represents a
+ single turn of conversation between a user and the agent, along with
+ any signals detected. Results are paginated using cursor-based pagination.
+
+ :param session_id: A unique identifier for a signals session. Required.
+ :type session_id: str
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :keyword start_time: Filter results to those occurring at or after this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype start_time: ~datetime.datetime
+ :keyword end_time: Filter results to those occurring at or before this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype end_time: ~datetime.datetime
+ :keyword signal_type: Filter results by signal type. Use the export options endpoint to list
+ available signal types. Default value is None.
+ :paramtype signal_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "id": "str", # The unique identifier for the
+ dialogue. Required.
+ "run_status": "str", # Optional. The execution
+ status of this dialogue turn.
+ "sequence": 0, # Optional. The sequence number of
+ this dialogue within the session.
+ "signals": [
+ "str" # Optional. A list of signal types
+ detected in this dialogue.
+ ],
+ "user_message": "str" # Optional. The user's message
+ in this dialogue turn.
+ }
+ }
+ ],
+ "page_info": {
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_list_session_dialogues_request(
+ session_id=session_id,
+ limit=limit,
+ after=after,
+ start_time=start_time,
+ end_time=end_time,
+ signal_type=signal_type,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ await response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace_async
+ async def list_exports(
+ self, *, limit: int = 20, after: Optional[str] = None, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Export Jobs.
+
+ To list signals export jobs for your team, send a GET request to
+ ``/v1/signals/exports``. Results are paginated using cursor-based pagination
+ with ``limit`` and ``after`` parameters.
+
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "agent_id": "str", # The agent whose data is being
+ exported. For Harness Runtime, this is the Environment Config ID.
+ Required.
+ "created_at": 0, # Unix timestamp when the export
+ was created. Required.
+ "export_id": "str", # The unique identifier for the
+ export job. Required.
+ "status": "str", # The current status of the export
+ job. Required. Known values are: "pending", "processing", "complete",
+ and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when
+ the export completed, or null if still in progress.
+ "error_message": "str", # Optional. Error message if
+ the export failed, or null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the
+ export download link expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session
+ IDs included in the export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types
+ included in the export.
+ ]
+ }
+ }
+ }
+ ],
+ "page_info": {
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_list_exports_request(
+ limit=limit,
+ after=after,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ if _stream:
+ await response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @overload
+ async def create_export(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create an Export Job.
+
+ To create a new signals data export, send a POST request to
+ ``/v1/signals/exports`` with an ``agent_id`` in the request body. You may
+ optionally filter the export by ``signal_type``\\ , ``session_ids``\\ , ``start_time``\\ ,
+ and ``end_time``. Use the export options endpoint to discover available signal
+ types.
+
+ The export job runs asynchronously. Poll the get export endpoint to check
+ its status. When complete, use the download endpoint to retrieve a
+ pre-signed URL.
+
+ :param body: Required.
+ :type body: JSON
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "agent_id": "str", # The agent whose data should be exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "end_time": "2020-02-20 00:00:00", # Optional. Include only sessions that
+ started at or before this timestamp.
+ "session_ids": [
+ "str" # Optional. Optional list of specific session IDs to include
+ in the export.
+ ],
+ "signal_type": [
+ "str" # Optional. Filter the export to only include the specified
+ signal types. Use the export options endpoint to list available values.
+ ],
+ "start_time": "2020-02-20 00:00:00" # Optional. Include only sessions that
+ started at or after this timestamp.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 400, 422
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+
+ @overload
+ async def create_export(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create an Export Job.
+
+ To create a new signals data export, send a POST request to
+ ``/v1/signals/exports`` with an ``agent_id`` in the request body. You may
+ optionally filter the export by ``signal_type``\\ , ``session_ids``\\ , ``start_time``\\ ,
+ and ``end_time``. Use the export options endpoint to discover available signal
+ types.
+
+ The export job runs asynchronously. Poll the get export endpoint to check
+ its status. When complete, use the download endpoint to retrieve a
+ pre-signed URL.
+
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 201
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 400, 422
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+
+ @distributed_trace_async
+ async def create_export(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Create an Export Job.
+
+ To create a new signals data export, send a POST request to
+ ``/v1/signals/exports`` with an ``agent_id`` in the request body. You may
+ optionally filter the export by ``signal_type``\\ , ``session_ids``\\ , ``start_time``\\ ,
+ and ``end_time``. Use the export options endpoint to discover available signal
+ types.
+
+ The export job runs asynchronously. Poll the get export endpoint to check
+ its status. When complete, use the download endpoint to retrieve a
+ pre-signed URL.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "agent_id": "str", # The agent whose data should be exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "end_time": "2020-02-20 00:00:00", # Optional. Include only sessions that
+ started at or before this timestamp.
+ "session_ids": [
+ "str" # Optional. Optional list of specific session IDs to include
+ in the export.
+ ],
+ "signal_type": [
+ "str" # Optional. Filter the export to only include the specified
+ signal types. Use the export options endpoint to list available values.
+ ],
+ "start_time": "2020-02-20 00:00:00" # Optional. Include only sessions that
+ started at or after this timestamp.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 400, 422
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_signals_create_export_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201, 400, 422]:
+ if _stream:
+ await response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 201:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 400:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 422:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace_async
+ async def get_export_options(self, **kwargs: Any) -> JSON:
+ """Get Export Options.
+
+ To retrieve the available filter options for creating an export, send a GET
+ request to ``/v1/signals/exports/options``. The response lists valid signal
+ types that can be used in the ``signal_type`` filter when creating an export.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "filters": {
+ "signal_type": [
+ "str" # The list of valid signal type values that can be
+ used when creating an export. Required.
+ ]
+ }
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_get_export_options_request(
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ if _stream:
+ await response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace_async
+ async def get_export(self, export_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve an Export Job.
+
+ To retrieve the status and details of a signals export job, send a GET
+ request to ``/v1/signals/exports/{export_id}``.
+
+ :param export_id: A unique identifier for an export job. Required.
+ :type export_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_get_export_request(
+ export_id=export_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ await response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace_async
+ async def get_export_download(self, export_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Get Export Download URL.
+
+ To retrieve a pre-signed download URL for a completed export, send a GET
+ request to ``/v1/signals/exports/{export_id}/download``. The export must have
+ a ``complete`` status. The URL is temporary and will expire.
+
+ :param export_id: A unique identifier for an export job. Required.
+ :type export_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "download_url": "str", # A temporary pre-signed URL to download the export
+ archive. Required.
+ "expires_at": 0 # Unix timestamp when the download URL expires. The URL is
+ valid for 15 minutes. Required.
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_get_export_download_request(
+ export_id=export_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ await self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ await response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
class KubernetesOperations: # pylint: disable=too-many-public-methods
"""
diff --git a/src/pydo/operations/__init__.py b/src/pydo/operations/__init__.py
index 163af5e7..4a4f951f 100644
--- a/src/pydo/operations/__init__.py
+++ b/src/pydo/operations/__init__.py
@@ -38,6 +38,7 @@
from ._operations import ImagesOperations
from ._operations import ImageActionsOperations
from ._operations import InsightsOperations
+from ._operations import SignalsOperations
from ._operations import KubernetesOperations
from ._operations import LoadBalancersOperations
from ._operations import MonitoringOperations
@@ -112,6 +113,7 @@
"ImagesOperations",
"ImageActionsOperations",
"InsightsOperations",
+ "SignalsOperations",
"KubernetesOperations",
"LoadBalancersOperations",
"MonitoringOperations",
diff --git a/src/pydo/operations/_operations.py b/src/pydo/operations/_operations.py
index 8ec49bf3..1195c673 100644
--- a/src/pydo/operations/_operations.py
+++ b/src/pydo/operations/_operations.py
@@ -7756,6 +7756,283 @@ def build_insights_post_logs_search_request(region: str, **kwargs: Any) -> HttpR
return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
+def build_insights_post_spans_search_request(region: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v2/insights/query/{region}/spans/search"
+ path_format_arguments = {
+ "region": _SERIALIZER.url("region", region, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header(
+ "content_type", content_type, "str"
+ )
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
+
+
+def build_signals_list_consents_request(**kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/consent"
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
+
+
+def build_signals_get_consent_request(agent_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/consent/{agent_id}"
+ path_format_arguments = {
+ "agent_id": _SERIALIZER.url("agent_id", agent_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
+
+
+def build_signals_update_consent_request(agent_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/consent/{agent_id}"
+ path_format_arguments = {
+ "agent_id": _SERIALIZER.url("agent_id", agent_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header(
+ "content_type", content_type, "str"
+ )
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs)
+
+
+def build_signals_list_agent_sessions_request( # pylint: disable=name-too-long
+ agent_id: str,
+ *,
+ limit: int = 20,
+ after: Optional[str] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ signal_type: Optional[str] = None,
+ **kwargs: Any,
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/signals/agents/{agent_id}/sessions"
+ path_format_arguments = {
+ "agent_id": _SERIALIZER.url("agent_id", agent_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if limit is not None:
+ _params["limit"] = _SERIALIZER.query(
+ "limit", limit, "int", maximum=100, minimum=1
+ )
+ if after is not None:
+ _params["after"] = _SERIALIZER.query("after", after, "str")
+ if start_time is not None:
+ _params["start_time"] = _SERIALIZER.query("start_time", start_time, "iso-8601")
+ if end_time is not None:
+ _params["end_time"] = _SERIALIZER.query("end_time", end_time, "iso-8601")
+ if signal_type is not None:
+ _params["signal_type"] = _SERIALIZER.query("signal_type", signal_type, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_signals_list_session_dialogues_request( # pylint: disable=name-too-long
+ session_id: str,
+ *,
+ limit: int = 20,
+ after: Optional[str] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ signal_type: Optional[str] = None,
+ **kwargs: Any,
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/signals/sessions/{session_id}/dialogues"
+ path_format_arguments = {
+ "session_id": _SERIALIZER.url("session_id", session_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct parameters
+ if limit is not None:
+ _params["limit"] = _SERIALIZER.query(
+ "limit", limit, "int", maximum=100, minimum=1
+ )
+ if after is not None:
+ _params["after"] = _SERIALIZER.query("after", after, "str")
+ if start_time is not None:
+ _params["start_time"] = _SERIALIZER.query("start_time", start_time, "iso-8601")
+ if end_time is not None:
+ _params["end_time"] = _SERIALIZER.query("end_time", end_time, "iso-8601")
+ if signal_type is not None:
+ _params["signal_type"] = _SERIALIZER.query("signal_type", signal_type, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_signals_list_exports_request(
+ *, limit: int = 20, after: Optional[str] = None, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/signals/exports"
+
+ # Construct parameters
+ if limit is not None:
+ _params["limit"] = _SERIALIZER.query(
+ "limit", limit, "int", maximum=100, minimum=1
+ )
+ if after is not None:
+ _params["after"] = _SERIALIZER.query("after", after, "str")
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(
+ method="GET", url=_url, params=_params, headers=_headers, **kwargs
+ )
+
+
+def build_signals_create_export_request(**kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/signals/exports"
+
+ # Construct headers
+ if content_type is not None:
+ _headers["Content-Type"] = _SERIALIZER.header(
+ "content_type", content_type, "str"
+ )
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
+
+
+def build_signals_get_export_options_request(**kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/signals/exports/options"
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
+
+
+def build_signals_get_export_request(export_id: str, **kwargs: Any) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/signals/exports/{export_id}"
+ path_format_arguments = {
+ "export_id": _SERIALIZER.url("export_id", export_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
+
+
+def build_signals_get_export_download_request( # pylint: disable=name-too-long
+ export_id: str, **kwargs: Any
+) -> HttpRequest:
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+
+ accept = _headers.pop("Accept", "application/json")
+
+ # Construct URL
+ _url = "/v1/signals/exports/{export_id}/download"
+ path_format_arguments = {
+ "export_id": _SERIALIZER.url("export_id", export_id, "str"),
+ }
+
+ _url: str = _url.format(**path_format_arguments) # type: ignore
+
+ # Construct headers
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
+
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
+
+
def build_kubernetes_list_clusters_request(
*, per_page: int = 20, page: int = 1, **kwargs: Any
) -> HttpRequest:
@@ -42150,7 +42427,8 @@ def create(
},
"project_id": "str" # Optional. The ID of the project the app should be
assigned to. If omitted, it will be assigned to your default project.
- :code:`
`:code:`
`Requires ``project:assign_resource`` scope.
+ :code:`
`:code:`
`Requires ``project:assign_resource`` and
+ ``project:update`` scopes.
}
# response body for status code(s): 200
@@ -58873,7 +59151,8 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
},
"project_id": "str" # Optional. The ID of the project the app should be
assigned to. If omitted, it will be assigned to your default project.
- :code:`
`:code:`
`Requires ``project:assign_resource`` scope.
+ :code:`
`:code:`
`Requires ``project:assign_resource`` and
+ ``project:update`` scopes.
}
# response body for status code(s): 200
@@ -184637,6 +184916,2145 @@ def post_logs_search(
return cast(JSON, deserialized) # type: ignore
+ @overload
+ def post_spans_search(
+ self,
+ region: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Search spans.
+
+ To search spans in a region, send a POST request to
+ ``/v2/insights/query/{region}/spans/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ The time range must not exceed 7 days. ``pagination.limit`` defaults to 100 and must be between
+ 1 and 1000. Results are ordered by ``startTime`` descending by default. Cursor-based pagination
+ is not yet supported; ``pagination.hasMore`` indicates whether additional spans matched beyond
+ the returned page.
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: str
+ :param body: Required.
+ :type body: JSON
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "timeRange": {
+ "from": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
+ },
+ "to": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
+ }
+ },
+ "filter": {
+ "type": "str", # The node kind. Required. Known values are:
+ "condition", "and", "or", "not", and "text_search".
+ "expressions": [
+ ...
+ ],
+ "field": {
+ "name": "str", # The field name. Well-known span fields
+ include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope. Use
+ ``resource`` to match a resource attribute or ``attributes`` to match a
+ span attribute. Omit for well-known fields or to search both attribute
+ maps. Known values are: "resource" and "attributes".
+ },
+ "operator": "str", # Optional. The comparison operator for a
+ ``condition`` node. Known values are: "eq", "neq", "gt", "gte", "lt", "lte",
+ "in", and "exists".
+ "query": "str", # Optional. The substring to match for a
+ ``text_search`` node.
+ "value": {}
+ },
+ "orderBy": [
+ {
+ "field": {
+ "name": "str", # The field name. Well-known span
+ fields include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope.
+ Use ``resource`` to match a resource attribute or ``attributes`` to
+ match a span attribute. Omit for well-known fields or to search both
+ attribute maps. Known values are: "resource" and "attributes".
+ },
+ "direction": "str" # Optional. The sort direction. Defaults
+ to ``desc`` when omitted. Known values are: "asc" and "desc".
+ }
+ ],
+ "pagination": {
+ "limit": 100 # Optional. Default value is 100. Maximum number of
+ spans to return. Defaults to 100 and must be between 1 and 1000.
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "attributes": {
+ "str": "str" # Optional. Span attributes.
+ },
+ "durationNs": 0, # Optional. The span duration in
+ nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The span kind.
+ "name": "str", # Optional. The span name.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for root spans.
+ "region": "str", # Optional. The datacenter region slug the
+ span was queried from.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The name of the service
+ that emitted the span.
+ "spanId": "str", # Optional. The span identifier.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The span status code.
+ "statusMessage": "str", # Optional. The span status message.
+ Omitted when empty.
+ "traceId": "str" # Optional. The trace identifier the span
+ belongs to.
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Optional. Whether more spans matched than were
+ returned in this page. Cursor-based continuation is not yet supported.
+ }
+ }
+ # response body for status code(s): 400, 403, 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+
+ @overload
+ def post_spans_search(
+ self,
+ region: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Search spans.
+
+ To search spans in a region, send a POST request to
+ ``/v2/insights/query/{region}/spans/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ The time range must not exceed 7 days. ``pagination.limit`` defaults to 100 and must be between
+ 1 and 1000. Results are ordered by ``startTime`` descending by default. Cursor-based pagination
+ is not yet supported; ``pagination.hasMore`` indicates whether additional spans matched beyond
+ the returned page.
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: str
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "attributes": {
+ "str": "str" # Optional. Span attributes.
+ },
+ "durationNs": 0, # Optional. The span duration in
+ nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The span kind.
+ "name": "str", # Optional. The span name.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for root spans.
+ "region": "str", # Optional. The datacenter region slug the
+ span was queried from.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The name of the service
+ that emitted the span.
+ "spanId": "str", # Optional. The span identifier.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The span status code.
+ "statusMessage": "str", # Optional. The span status message.
+ Omitted when empty.
+ "traceId": "str" # Optional. The trace identifier the span
+ belongs to.
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Optional. Whether more spans matched than were
+ returned in this page. Cursor-based continuation is not yet supported.
+ }
+ }
+ # response body for status code(s): 400, 403, 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+
+ @distributed_trace
+ def post_spans_search(
+ self, region: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Search spans.
+
+ To search spans in a region, send a POST request to
+ ``/v2/insights/query/{region}/spans/search`` with a JSON body describing the time range,
+ optional filter, ordering, and pagination.
+ The time range must not exceed 7 days. ``pagination.limit`` defaults to 100 and must be between
+ 1 and 1000. Results are ordered by ``startTime`` descending by default. Cursor-based pagination
+ is not yet supported; ``pagination.hasMore`` indicates whether additional spans matched beyond
+ the returned page.
+
+ :param region: The datacenter region slug for the query. Required.
+ :type region: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "timeRange": {
+ "from": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
+ },
+ "to": {
+ "absolute": "str", # Optional. An absolute timestamp.
+ Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds,
+ milliseconds, microseconds, or nanoseconds) encoded as a decimal string.
+ "relative": "str" # Optional. A relative time. Use ``now``
+ for the current time, a bare duration such as ``1h`` or ``7d`` to look
+ back from now, or an offset such as ``now-15m`` or ``now+30m``. Supported
+ units are ``s``"" , ``m``"" , ``h``"" , ``d``"" , and ``w``.
+ }
+ },
+ "filter": {
+ "type": "str", # The node kind. Required. Known values are:
+ "condition", "and", "or", "not", and "text_search".
+ "expressions": [
+ ...
+ ],
+ "field": {
+ "name": "str", # The field name. Well-known span fields
+ include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope. Use
+ ``resource`` to match a resource attribute or ``attributes`` to match a
+ span attribute. Omit for well-known fields or to search both attribute
+ maps. Known values are: "resource" and "attributes".
+ },
+ "operator": "str", # Optional. The comparison operator for a
+ ``condition`` node. Known values are: "eq", "neq", "gt", "gte", "lt", "lte",
+ "in", and "exists".
+ "query": "str", # Optional. The substring to match for a
+ ``text_search`` node.
+ "value": {}
+ },
+ "orderBy": [
+ {
+ "field": {
+ "name": "str", # The field name. Well-known span
+ fields include ``traceId``"" , ``spanId``"" , ``parentSpanId``"" ,
+ ``startTime``"" , ``endTime``"" , ``durationNs``"" , ``name``"" ,
+ ``serviceName``"" , ``kind``"" , ``statusCode``"" , and
+ ``statusMessage``. Any other value is treated as a span or resource
+ attribute key. Required.
+ "scope": "str" # Optional. Optional attribute scope.
+ Use ``resource`` to match a resource attribute or ``attributes`` to
+ match a span attribute. Omit for well-known fields or to search both
+ attribute maps. Known values are: "resource" and "attributes".
+ },
+ "direction": "str" # Optional. The sort direction. Defaults
+ to ``desc`` when omitted. Known values are: "asc" and "desc".
+ }
+ ],
+ "pagination": {
+ "limit": 100 # Optional. Default value is 100. Maximum number of
+ spans to return. Defaults to 100 and must be between 1 and 1000.
+ }
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "data": [
+ {
+ "attributes": {
+ "str": "str" # Optional. Span attributes.
+ },
+ "durationNs": 0, # Optional. The span duration in
+ nanoseconds.
+ "endTime": "2020-02-20 00:00:00", # Optional. The span end
+ time.
+ "kind": "str", # Optional. The span kind.
+ "name": "str", # Optional. The span name.
+ "parentSpanId": "str", # Optional. The parent span
+ identifier. Omitted for root spans.
+ "region": "str", # Optional. The datacenter region slug the
+ span was queried from.
+ "resource": {
+ "str": "str" # Optional. Resource attributes
+ associated with the span.
+ },
+ "serviceName": "str", # Optional. The name of the service
+ that emitted the span.
+ "spanId": "str", # Optional. The span identifier.
+ "startTime": "2020-02-20 00:00:00", # Optional. The span
+ start time.
+ "statusCode": "str", # Optional. The span status code.
+ "statusMessage": "str", # Optional. The span status message.
+ Omitted when empty.
+ "traceId": "str" # Optional. The trace identifier the span
+ belongs to.
+ }
+ ],
+ "pagination": {
+ "hasMore": bool # Optional. Whether more spans matched than were
+ returned in this page. Cursor-based continuation is not yet supported.
+ }
+ }
+ # response body for status code(s): 400, 403, 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_insights_post_spans_search_request(
+ region=region,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 400, 403, 404]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 400:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 403:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+
+class SignalsOperations:
+ """
+ .. warning::
+ **DO NOT** instantiate this class directly.
+
+ Instead, you should access the following operations through
+ :class:`~pydo.GeneratedClient`'s
+ :attr:`signals` attribute.
+ """
+
+ def __init__(self, *args, **kwargs):
+ input_args = list(args)
+ self._client = input_args.pop(0) if input_args else kwargs.pop("client")
+ self._config = input_args.pop(0) if input_args else kwargs.pop("config")
+ self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
+ self._deserialize = (
+ input_args.pop(0) if input_args else kwargs.pop("deserializer")
+ )
+
+ @distributed_trace
+ def list_consents(self, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """List All Consent Records.
+
+ To list all signals consent records for your team, send a GET request to
+ ``/v1/consent``. Each record indicates whether signals collection is enabled
+ for a specific agent.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "consents": [
+ {
+ "agent_id": "str", # The unique identifier of the agent. For
+ Harness Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for
+ this agent. Required.
+ "id": 0, # The unique numeric identifier for the consent
+ record. Required.
+ "team_id": 0, # The team ID that owns this consent record.
+ Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in
+ ISO8601 combined date and time format. Required.
+ }
+ ]
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_list_consents_request(
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace
+ def get_consent(self, agent_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve Consent for an Agent.
+
+ To retrieve the consent record for a specific agent, send a GET
+ request to ``/v1/consent/{agent_id}``. The response includes an ``allowed``
+ field indicating whether the team is permitted to use signals for this agent.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "allowed": bool, # Whether the team is permitted to use signals for this
+ agent. This is determined by the platform and cannot be set by the user.
+ Required.
+ "enabled": bool, # Whether signals collection is enabled for this agent.
+ Required.
+ "id": 0, # The unique numeric identifier for the consent record. Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601 combined
+ date and time format. Required.
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_get_consent_request(
+ agent_id=agent_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @overload
+ def update_consent(
+ self,
+ agent_id: str,
+ body: JSON,
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Consent for an Agent.
+
+ To enable or disable signals collection for a specific agent, send a
+ PUT request to ``/v1/consent/{agent_id}`` with an ``enabled`` boolean in the
+ request body.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :param body: Required.
+ :type body: JSON
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "enabled": bool # Whether to enable signals collection for this agent.
+ Required.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "consent": {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for this
+ agent. Required.
+ "id": 0, # The unique numeric identifier for the consent record.
+ Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601
+ combined date and time format. Required.
+ }
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+
+ @overload
+ def update_consent(
+ self,
+ agent_id: str,
+ body: IO[bytes],
+ *,
+ content_type: str = "application/json",
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Consent for an Agent.
+
+ To enable or disable signals collection for a specific agent, send a
+ PUT request to ``/v1/consent/{agent_id}`` with an ``enabled`` boolean in the
+ request body.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "consent": {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for this
+ agent. Required.
+ "id": 0, # The unique numeric identifier for the consent record.
+ Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601
+ combined date and time format. Required.
+ }
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+
+ @distributed_trace
+ def update_consent(
+ self, agent_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Update Consent for an Agent.
+
+ To enable or disable signals collection for a specific agent, send a
+ PUT request to ``/v1/consent/{agent_id}`` with an ``enabled`` boolean in the
+ request body.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "enabled": bool # Whether to enable signals collection for this agent.
+ Required.
+ }
+
+ # response body for status code(s): 200
+ response == {
+ "consent": {
+ "agent_id": "str", # The unique identifier of the agent. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "enabled": bool, # Whether signals collection is enabled for this
+ agent. Required.
+ "id": 0, # The unique numeric identifier for the consent record.
+ Required.
+ "team_id": 0, # The team ID that owns this consent record. Required.
+ "updated_at": "2020-02-20 00:00:00" # A time value given in ISO8601
+ combined date and time format. Required.
+ }
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_signals_update_consent_request(
+ agent_id=agent_id,
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace
+ def list_agent_sessions(
+ self,
+ agent_id: str,
+ *,
+ limit: int = 20,
+ after: Optional[str] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ signal_type: Optional[str] = None,
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Sessions for an Agent.
+
+ To list signals sessions for a specific agent, send a GET request to
+ ``/v1/signals/agents/{agent_id}/sessions``. Results are paginated using cursor-based
+ pagination with ``limit`` and ``after`` parameters.
+
+ :param agent_id: A unique identifier for an agent. For Harness Runtime, this is the Environment
+ Config ID. Required.
+ :type agent_id: str
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :keyword start_time: Filter results to those occurring at or after this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype start_time: ~datetime.datetime
+ :keyword end_time: Filter results to those occurring at or before this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype end_time: ~datetime.datetime
+ :keyword signal_type: Filter results by signal type. Use the export options endpoint to list
+ available signal types. Default value is None.
+ :paramtype signal_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "session_id": "str", # The unique identifier for the
+ session. Required.
+ "duration_seconds": 0.0, # Optional. The duration of
+ the session in seconds.
+ "signal_count": 0, # Optional. The number of signals
+ detected in this session.
+ "started_at": "2020-02-20 00:00:00", # Optional.
+ When the session started.
+ "total_turns": 0 # Optional. The total number of
+ conversation turns in this session.
+ }
+ }
+ ],
+ "page_info": {
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_list_agent_sessions_request(
+ agent_id=agent_id,
+ limit=limit,
+ after=after,
+ start_time=start_time,
+ end_time=end_time,
+ signal_type=signal_type,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace
+ def list_session_dialogues(
+ self,
+ session_id: str,
+ *,
+ limit: int = 20,
+ after: Optional[str] = None,
+ start_time: Optional[datetime.datetime] = None,
+ end_time: Optional[datetime.datetime] = None,
+ signal_type: Optional[str] = None,
+ **kwargs: Any,
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Dialogues for a Session.
+
+ To list the dialogue turns within a specific session, send a GET request to
+ ``/v1/signals/sessions/{session_id}/dialogues``. Each dialogue represents a
+ single turn of conversation between a user and the agent, along with
+ any signals detected. Results are paginated using cursor-based pagination.
+
+ :param session_id: A unique identifier for a signals session. Required.
+ :type session_id: str
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :keyword start_time: Filter results to those occurring at or after this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype start_time: ~datetime.datetime
+ :keyword end_time: Filter results to those occurring at or before this timestamp (RFC 3339).
+ Default value is None.
+ :paramtype end_time: ~datetime.datetime
+ :keyword signal_type: Filter results by signal type. Use the export options endpoint to list
+ available signal types. Default value is None.
+ :paramtype signal_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "id": "str", # The unique identifier for the
+ dialogue. Required.
+ "run_status": "str", # Optional. The execution
+ status of this dialogue turn.
+ "sequence": 0, # Optional. The sequence number of
+ this dialogue within the session.
+ "signals": [
+ "str" # Optional. A list of signal types
+ detected in this dialogue.
+ ],
+ "user_message": "str" # Optional. The user's message
+ in this dialogue turn.
+ }
+ }
+ ],
+ "page_info": {
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_list_session_dialogues_request(
+ session_id=session_id,
+ limit=limit,
+ after=after,
+ start_time=start_time,
+ end_time=end_time,
+ signal_type=signal_type,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace
+ def list_exports(
+ self, *, limit: int = 20, after: Optional[str] = None, **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """List Export Jobs.
+
+ To list signals export jobs for your team, send a GET request to
+ ``/v1/signals/exports``. Results are paginated using cursor-based pagination
+ with ``limit`` and ``after`` parameters.
+
+ :keyword limit: Maximum number of items to return per page. Default value is 20.
+ :paramtype limit: int
+ :keyword after: An opaque cursor string returned from a previous page. Pass this value to
+ retrieve the next page of results. Default value is None.
+ :paramtype after: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "edges": [
+ {
+ "cursor": "str", # Optional. An opaque cursor for
+ pagination.
+ "node": {
+ "agent_id": "str", # The agent whose data is being
+ exported. For Harness Runtime, this is the Environment Config ID.
+ Required.
+ "created_at": 0, # Unix timestamp when the export
+ was created. Required.
+ "export_id": "str", # The unique identifier for the
+ export job. Required.
+ "status": "str", # The current status of the export
+ job. Required. Known values are: "pending", "processing", "complete",
+ and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when
+ the export completed, or null if still in progress.
+ "error_message": "str", # Optional. Error message if
+ the export failed, or null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the
+ export download link expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session
+ IDs included in the export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types
+ included in the export.
+ ]
+ }
+ }
+ }
+ ],
+ "page_info": {
+ "has_next_page": bool # Optional. Whether there are more results
+ after this page.
+ }
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_list_exports_request(
+ limit=limit,
+ after=after,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @overload
+ def create_export(
+ self, body: JSON, *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create an Export Job.
+
+ To create a new signals data export, send a POST request to
+ ``/v1/signals/exports`` with an ``agent_id`` in the request body. You may
+ optionally filter the export by ``signal_type``\\ , ``session_ids``\\ , ``start_time``\\ ,
+ and ``end_time``. Use the export options endpoint to discover available signal
+ types.
+
+ The export job runs asynchronously. Poll the get export endpoint to check
+ its status. When complete, use the download endpoint to retrieve a
+ pre-signed URL.
+
+ :param body: Required.
+ :type body: JSON
+ :keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "agent_id": "str", # The agent whose data should be exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "end_time": "2020-02-20 00:00:00", # Optional. Include only sessions that
+ started at or before this timestamp.
+ "session_ids": [
+ "str" # Optional. Optional list of specific session IDs to include
+ in the export.
+ ],
+ "signal_type": [
+ "str" # Optional. Filter the export to only include the specified
+ signal types. Use the export options endpoint to list available values.
+ ],
+ "start_time": "2020-02-20 00:00:00" # Optional. Include only sessions that
+ started at or after this timestamp.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 400, 422
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+
+ @overload
+ def create_export(
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
+ ) -> JSON:
+ # pylint: disable=line-too-long
+ """Create an Export Job.
+
+ To create a new signals data export, send a POST request to
+ ``/v1/signals/exports`` with an ``agent_id`` in the request body. You may
+ optionally filter the export by ``signal_type``\\ , ``session_ids``\\ , ``start_time``\\ ,
+ and ``end_time``. Use the export options endpoint to discover available signal
+ types.
+
+ The export job runs asynchronously. Poll the get export endpoint to check
+ its status. When complete, use the download endpoint to retrieve a
+ pre-signed URL.
+
+ :param body: Required.
+ :type body: IO[bytes]
+ :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
+ Default value is "application/json".
+ :paramtype content_type: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 201
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 400, 422
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+
+ @distributed_trace
+ def create_export(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Create an Export Job.
+
+ To create a new signals data export, send a POST request to
+ ``/v1/signals/exports`` with an ``agent_id`` in the request body. You may
+ optionally filter the export by ``signal_type``\\ , ``session_ids``\\ , ``start_time``\\ ,
+ and ``end_time``. Use the export options endpoint to discover available signal
+ types.
+
+ The export job runs asynchronously. Poll the get export endpoint to check
+ its status. When complete, use the download endpoint to retrieve a
+ pre-signed URL.
+
+ :param body: Is either a JSON type or a IO[bytes] type. Required.
+ :type body: JSON or IO[bytes]
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # JSON input template you can fill out and use as your body input.
+ body = {
+ "agent_id": "str", # The agent whose data should be exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "end_time": "2020-02-20 00:00:00", # Optional. Include only sessions that
+ started at or before this timestamp.
+ "session_ids": [
+ "str" # Optional. Optional list of specific session IDs to include
+ in the export.
+ ],
+ "signal_type": [
+ "str" # Optional. Filter the export to only include the specified
+ signal types. Use the export options endpoint to list available values.
+ ],
+ "start_time": "2020-02-20 00:00:00" # Optional. Include only sessions that
+ started at or after this timestamp.
+ }
+
+ # response body for status code(s): 201
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 400, 422
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
+ _params = kwargs.pop("params", {}) or {}
+
+ content_type: Optional[str] = kwargs.pop(
+ "content_type", _headers.pop("Content-Type", None)
+ )
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ content_type = content_type or "application/json"
+ _json = None
+ _content = None
+ if isinstance(body, (IOBase, bytes)):
+ _content = body
+ else:
+ _json = body
+
+ _request = build_signals_create_export_request(
+ content_type=content_type,
+ json=_json,
+ content=_content,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201, 400, 422]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 201:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 400:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 422:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace
+ def get_export_options(self, **kwargs: Any) -> JSON:
+ """Get Export Options.
+
+ To retrieve the available filter options for creating an export, send a GET
+ request to ``/v1/signals/exports/options``. The response lists valid signal
+ types that can be used in the ``signal_type`` filter when creating an export.
+
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "filters": {
+ "signal_type": [
+ "str" # The list of valid signal type values that can be
+ used when creating an export. Required.
+ ]
+ }
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_get_export_options_request(
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace
+ def get_export(self, export_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Retrieve an Export Job.
+
+ To retrieve the status and details of a signals export job, send a GET
+ request to ``/v1/signals/exports/{export_id}``.
+
+ :param export_id: A unique identifier for an export job. Required.
+ :type export_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "agent_id": "str", # The agent whose data is being exported. For Harness
+ Runtime, this is the Environment Config ID. Required.
+ "created_at": 0, # Unix timestamp when the export was created. Required.
+ "export_id": "str", # The unique identifier for the export job. Required.
+ "status": "str", # The current status of the export job. Required. Known
+ values are: "pending", "processing", "complete", and "failed".
+ "completed_at": 0, # Optional. Unix timestamp when the export completed, or
+ null if still in progress.
+ "error_message": "str", # Optional. Error message if the export failed, or
+ null on success.
+ "expires_at": 0, # Optional. Unix timestamp when the export download link
+ expires.
+ "filters": {
+ "session_ids": [
+ "str" # Optional. Specific session IDs included in the
+ export.
+ ],
+ "signal_type": [
+ "str" # Optional. Signal types included in the export.
+ ]
+ }
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_get_export_request(
+ export_id=export_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
+ @distributed_trace
+ def get_export_download(self, export_id: str, **kwargs: Any) -> JSON:
+ # pylint: disable=line-too-long
+ """Get Export Download URL.
+
+ To retrieve a pre-signed download URL for a completed export, send a GET
+ request to ``/v1/signals/exports/{export_id}/download``. The export must have
+ a ``complete`` status. The URL is temporary and will expire.
+
+ :param export_id: A unique identifier for an export job. Required.
+ :type export_id: str
+ :return: JSON object
+ :rtype: JSON
+ :raises ~azure.core.exceptions.HttpResponseError:
+
+ Example:
+ .. code-block:: python
+
+ # response body for status code(s): 200
+ response == {
+ "download_url": "str", # A temporary pre-signed URL to download the export
+ archive. Required.
+ "expires_at": 0 # Unix timestamp when the download URL expires. The URL is
+ valid for 15 minutes. Required.
+ }
+ # response body for status code(s): 404
+ response == {
+ "id": "str", # A short identifier corresponding to the HTTP status code
+ returned. For example, the ID for a response returning a 404 status code would
+ be "not_found.". Required.
+ "message": "str", # A message providing additional information about the
+ error, including details to help resolve it when possible. Required.
+ "request_id": "str" # Optional. Optionally, some endpoints may include a
+ request ID that should be provided when reporting bugs or opening support
+ tickets to help identify the issue.
+ }
+ """
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ 404: ResourceNotFoundError,
+ 409: ResourceExistsError,
+ 304: ResourceNotModifiedError,
+ 401: cast(
+ Type[HttpResponseError],
+ lambda response: ClientAuthenticationError(response=response),
+ ),
+ 429: HttpResponseError,
+ 500: HttpResponseError,
+ }
+ error_map.update(kwargs.pop("error_map", {}) or {})
+
+ _headers = kwargs.pop("headers", {}) or {}
+ _params = kwargs.pop("params", {}) or {}
+
+ cls: ClsType[JSON] = kwargs.pop("cls", None)
+
+ _request = build_signals_get_export_download_request(
+ export_id=export_id,
+ headers=_headers,
+ params=_params,
+ )
+ _request.url = self._client.format_url(_request.url)
+
+ _stream = False
+ pipeline_response: PipelineResponse = (
+ self._client._pipeline.run( # pylint: disable=protected-access
+ _request, stream=_stream, **kwargs
+ )
+ )
+
+ response = pipeline_response.http_response
+
+ if response.status_code not in [200, 404]:
+ if _stream:
+ response.read() # Load the body in memory and close the socket
+ map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
+ raise HttpResponseError(response=response)
+
+ response_headers = {}
+ if response.status_code == 200:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if response.status_code == 404:
+ response_headers["ratelimit-limit"] = self._deserialize(
+ "int", response.headers.get("ratelimit-limit")
+ )
+ response_headers["ratelimit-remaining"] = self._deserialize(
+ "int", response.headers.get("ratelimit-remaining")
+ )
+ response_headers["ratelimit-reset"] = self._deserialize(
+ "int", response.headers.get("ratelimit-reset")
+ )
+
+ if response.content:
+ deserialized = response.json()
+ else:
+ deserialized = None
+
+ if cls:
+ return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore
+
+ return cast(JSON, deserialized) # type: ignore
+
class KubernetesOperations: # pylint: disable=too-many-public-methods
"""