From f6178816577b502f59a43510277537337167966a Mon Sep 17 00:00:00 2001 From: API Engineering Date: Wed, 21 Oct 2026 11:00:30 +0000 Subject: [PATCH] [bot] Updated client based on openapi-5094cda/clientgen --- DO_OPENAPI_COMMIT_SHA.txt | 2 +- .../pydo.resources.aio.inference.audio.rst | 21 + .../pydo.resources.aio.inference.videos.rst | 21 + .../source/pydo.resources.inference.audio.rst | 21 + .../pydo.resources.inference.videos.rst | 21 + docs/source/pydo.types.audio.rst | 10 + docs/source/pydo.types.videos.rst | 10 + src/pydo/aio/operations/_operations.py | 2167 +++++++++++--- src/pydo/inference/__init__.py | 1 + src/pydo/inference/aio/__init__.py | 1 + src/pydo/operations/_operations.py | 2557 ++++++++++++++--- src/pydo/resources/aio/inference/__init__.py | 4 + .../resources/aio/inference/audio/__init__.py | 20 + .../resources/aio/inference/audio/speech.py | 33 + .../aio/inference/videos/__init__.py | 48 + .../resources/aio/inference/videos/content.py | 32 + src/pydo/resources/client_surface.py | 12 + src/pydo/resources/inference/__init__.py | 4 + .../resources/inference/audio/__init__.py | 20 + src/pydo/resources/inference/audio/speech.py | 33 + .../resources/inference/videos/__init__.py | 48 + .../resources/inference/videos/content.py | 32 + src/pydo/resources/inference_surface.json | 48 + src/pydo/types/__init__.py | 8 + src/pydo/types/audio/__init__.py | 26 + src/pydo/types/videos/__init__.py | 34 + 26 files changed, 4456 insertions(+), 778 deletions(-) create mode 100644 docs/source/pydo.resources.aio.inference.audio.rst create mode 100644 docs/source/pydo.resources.aio.inference.videos.rst create mode 100644 docs/source/pydo.resources.inference.audio.rst create mode 100644 docs/source/pydo.resources.inference.videos.rst create mode 100644 docs/source/pydo.types.audio.rst create mode 100644 docs/source/pydo.types.videos.rst create mode 100644 src/pydo/resources/aio/inference/audio/__init__.py create mode 100644 src/pydo/resources/aio/inference/audio/speech.py create mode 100644 src/pydo/resources/aio/inference/videos/__init__.py create mode 100644 src/pydo/resources/aio/inference/videos/content.py create mode 100644 src/pydo/resources/inference/audio/__init__.py create mode 100644 src/pydo/resources/inference/audio/speech.py create mode 100644 src/pydo/resources/inference/videos/__init__.py create mode 100644 src/pydo/resources/inference/videos/content.py create mode 100644 src/pydo/types/audio/__init__.py create mode 100644 src/pydo/types/videos/__init__.py diff --git a/DO_OPENAPI_COMMIT_SHA.txt b/DO_OPENAPI_COMMIT_SHA.txt index 5c897da7..983375c4 100644 --- a/DO_OPENAPI_COMMIT_SHA.txt +++ b/DO_OPENAPI_COMMIT_SHA.txt @@ -1 +1 @@ -380d7ee +5094cda diff --git a/docs/source/pydo.resources.aio.inference.audio.rst b/docs/source/pydo.resources.aio.inference.audio.rst new file mode 100644 index 00000000..53b01025 --- /dev/null +++ b/docs/source/pydo.resources.aio.inference.audio.rst @@ -0,0 +1,21 @@ +pydo.resources.aio.inference.audio package +========================================== + +Submodules +---------- + +pydo.resources.aio.inference.audio.speech module +------------------------------------------------ + +.. automodule:: pydo.resources.aio.inference.audio.speech + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: pydo.resources.aio.inference.audio + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/pydo.resources.aio.inference.videos.rst b/docs/source/pydo.resources.aio.inference.videos.rst new file mode 100644 index 00000000..a4fc12f0 --- /dev/null +++ b/docs/source/pydo.resources.aio.inference.videos.rst @@ -0,0 +1,21 @@ +pydo.resources.aio.inference.videos package +=========================================== + +Submodules +---------- + +pydo.resources.aio.inference.videos.content module +-------------------------------------------------- + +.. automodule:: pydo.resources.aio.inference.videos.content + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: pydo.resources.aio.inference.videos + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/pydo.resources.inference.audio.rst b/docs/source/pydo.resources.inference.audio.rst new file mode 100644 index 00000000..4428a496 --- /dev/null +++ b/docs/source/pydo.resources.inference.audio.rst @@ -0,0 +1,21 @@ +pydo.resources.inference.audio package +====================================== + +Submodules +---------- + +pydo.resources.inference.audio.speech module +-------------------------------------------- + +.. automodule:: pydo.resources.inference.audio.speech + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: pydo.resources.inference.audio + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/pydo.resources.inference.videos.rst b/docs/source/pydo.resources.inference.videos.rst new file mode 100644 index 00000000..3bfa31fd --- /dev/null +++ b/docs/source/pydo.resources.inference.videos.rst @@ -0,0 +1,21 @@ +pydo.resources.inference.videos package +======================================= + +Submodules +---------- + +pydo.resources.inference.videos.content module +---------------------------------------------- + +.. automodule:: pydo.resources.inference.videos.content + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: pydo.resources.inference.videos + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/pydo.types.audio.rst b/docs/source/pydo.types.audio.rst new file mode 100644 index 00000000..2cda1b65 --- /dev/null +++ b/docs/source/pydo.types.audio.rst @@ -0,0 +1,10 @@ +pydo.types.audio package +======================== + +Module contents +--------------- + +.. automodule:: pydo.types.audio + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/pydo.types.videos.rst b/docs/source/pydo.types.videos.rst new file mode 100644 index 00000000..c35963b4 --- /dev/null +++ b/docs/source/pydo.types.videos.rst @@ -0,0 +1,10 @@ +pydo.types.videos package +========================= + +Module contents +--------------- + +.. automodule:: pydo.types.videos + :members: + :undoc-members: + :show-inheritance: diff --git a/src/pydo/aio/operations/_operations.py b/src/pydo/aio/operations/_operations.py index 6fbc0da9..ab61e3ac 100644 --- a/src/pydo/aio/operations/_operations.py +++ b/src/pydo/aio/operations/_operations.py @@ -486,9 +486,13 @@ build_inference_create_image_request, build_inference_create_messages_request, build_inference_create_response_request, + build_inference_create_speech_request, build_inference_create_systemone_request, + build_inference_create_video_request, build_inference_get_batch_request, build_inference_get_batch_results_request, + build_inference_get_video_content_request, + build_inference_get_video_request, build_inference_list_batches_request, build_inference_list_models_request, build_inference_upload_batch_file_request, @@ -504,15 +508,18 @@ build_insights_get_prom_query_range_request, build_insights_get_prom_query_request, build_insights_get_prom_series_request, + build_insights_get_resource_request, build_insights_get_trace_request, build_insights_list_alert_instances_request, build_insights_list_alert_rules_request, build_insights_list_notification_channels_request, + build_insights_list_resources_request, build_insights_post_logs_search_request, build_insights_post_spans_search_request, build_insights_post_traces_search_request, build_insights_update_alert_rule_request, build_insights_update_notification_channel_request, + build_insights_update_resource_signals_request, build_invoices_get_by_uuid_request, build_invoices_get_csv_by_uuid_request, build_invoices_get_pdf_by_uuid_request, @@ -185841,9 +185848,9 @@ async def post_traces_search( included when at least one of its spans matches ``filter``. The time range must not exceed 7 days (\\ ``168h``\\ ). ``pagination.limit`` defaults to 100 (also used when ``limit`` is ``0``\\ ) and must be between 0 and 1000. Results are ordered by ``started`` descending unless - ``orderBy`` is set. - JSON field names are camelCase (\\ ``timeRange``\\ , ``orderBy``\\ , ``hasMore``\\ , - ``traceId``\\ ). Unknown request properties, invalid filters, and out-of-range values are + ``order_by`` is set. + JSON field names use snake_case (\\ ``time_range``\\ , ``order_by``\\ , ``has_more``\\ , + ``trace_id``\\ ). Unknown request properties, invalid filters, and out-of-range values are rejected with ``400``. Each request searches a single region; there is no multi-region search. Supported regions are ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ , ``lon1``\\ , ``mem1``\\ , @@ -185872,7 +185879,7 @@ async def post_traces_search( # JSON input template you can fill out and use as your body input. body = { - "timeRange": { + "time_range": { "from": { "absolute": "str", # Optional. An absolute timestamp, either RFC3339 (with optional fractional seconds) or a Unix epoch integer as a @@ -185897,79 +185904,100 @@ async def post_traces_search( } }, "filter": { - "expressions": [ - ... - ], - "field": { - "name": "str", # The field name. Without ``scope``"" , these - names (case-insensitive) resolve to built-in span columns: `traceId` - (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`), `parentSpanId` - (`parent.span.id`, `parent_span_id`), `startTime` (`start_time`, - `timestamp`), `endTime` (`end_time`), `durationNs` (`duration`, in - nanoseconds), `name` (`span.name`), `kind` (`span.kind`), `statusCode` - (`status.code`, `status_code`), `statusMessage` (`status.message`, - `status_message`), and `serviceName` (`service.name`, `service_name`). - Any other name is looked up as a span attribute, falling back to a - resource attribute. With `scope` set, `name` is always treated as an - attribute key. Attribute keys may contain only letters, digits, and `.`, - `_`, `-`, `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a - trace-level sort field instead; see the ``orderBy`` field description. - Required. - "scope": "str" # Optional. Restricts the lookup to one - attribute map (case-insensitive). ``resource`` (or - ``resource.attributes``"" ) reads resource attributes; ``attribute`` (or - ``attributes``"" , ``span.attributes``"" ) reads span attributes. Omit to - use the built-in column mapping described for ``name``. Ignored in traces - ``orderBy``. Known values are: "resource", "resource.attributes", - "attribute", "attributes", and "span.attributes". + "and": { + "expressions": [ + ... + ] }, - "operator": "str", # Optional. The comparison operator for a - ``condition`` node. Matching is case-insensitive, and the symbol forms - ``=``"" , ``!=``"" , ``>``"" , ``>=``"" , ``<``"" , and ``<=`` are accepted - as aliases for ``eq``"" , ``neq``"" , ``gt``"" , ``gte``"" , ``lt``"" , and - ``lte``. ``exists`` matches spans where the field is present and non-empty - and ignores ``value``. ``in`` requires an array ``value`` with 1 to 100 - entries. ``neq`` on string fields also matches spans where the field is - absent. Known values are: "eq", "neq", "in", "exists", "gt", "gte", "lt", and - "lte". - "query": "str", # Optional. The search string for a ``text_search`` - node. Leading and trailing whitespace is trimmed; the trimmed string must be - non-empty. - "type": "condition", # Optional. Default value is "condition". The - node type. Matching is case-insensitive. Known values are: "condition", - "and", "or", "not", and "text_search". - "value": {} + "condition": { + "field": { + "name": "str", # The field name. Without ``scope``"" + , these names (case-insensitive) resolve to built-in span columns: + `trace_id`, `span_id`, `parent_span_id`, `start_time`, `end_time`, + `duration_ns`, `name` (`span.name`), `kind` (`span.kind`), + `status_code` (`status.code`, `status_code`), `status_message`, and + `service_name` (`service.name`). Any other name is looked up as a + span attribute, falling back to a resource attribute. With `scope` + set, `name` is always treated as an attribute key. Attribute keys may + contain only letters, digits, and `.`, `_`, `-`, `/`, `:`, `@`. In + traces ``order_by``"" , ``name`` must be a trace-level sort field + instead; see the ``order_by`` field description. Required. + "scope": "str" # Optional. Restricts the lookup to + one attribute map and is matched case-insensitively. + ``FIELD_SCOPE_RESOURCE`` reads resource attributes and accepts + ``resource`` or ``resource.attributes`` as aliases. + ``FIELD_SCOPE_ATTRIBUTES`` reads span attributes and accepts + ``attribute``"" , ``attributes``"" , or ``span.attributes`` as + aliases. Omit to use the built-in column mapping described for + ``name``. Ignored in traces ``order_by``. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", + "resource.attributes", "attribute", "attributes", and + "span.attributes". + }, + "operator": "str", # The comparison operator. Required. + Known values are: "FILTER_OPERATOR_EQ", "FILTER_OPERATOR_NEQ", + "FILTER_OPERATOR_IN", "FILTER_OPERATOR_EXISTS", "FILTER_OPERATOR_GTE", + and "FILTER_OPERATOR_LTE". + "value": { + "number_array_value": { + "values": [ + 0.0 # Required. + ] + }, + "number_value": 0.0, # Optional. A typed literal or + list value for a traces filter condition. Exactly one kind is set per + message. + "string_array_value": { + "values": [ + "str" # Required. + ] + }, + "string_value": "str" # Optional. A typed literal or + list value for a traces filter condition. Exactly one kind is set per + message. + } + }, + "not": ..., + "or": { + "expressions": [ + ... + ] + }, + "text_search": { + "query": "str" # The search string. Leading and trailing + whitespace is trimmed, and the remaining string must not be empty. + Required. + } }, - "orderBy": [ + "order_by": [ { "field": { "name": "str", # The field name. Without ``scope``"" , these names (case-insensitive) resolve to built-in span columns: - `traceId` (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`), - `parentSpanId` (`parent.span.id`, `parent_span_id`), `startTime` - (`start_time`, `timestamp`), `endTime` (`end_time`), `durationNs` - (`duration`, in nanoseconds), `name` (`span.name`), `kind` - (`span.kind`), `statusCode` (`status.code`, `status_code`), - `statusMessage` (`status.message`, `status_message`), and - `serviceName` (`service.name`, `service_name`). Any other name is - looked up as a span attribute, falling back to a resource attribute. - With `scope` set, `name` is always treated as an attribute key. - Attribute keys may contain only letters, digits, and `.`, `_`, `-`, - `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a - trace-level sort field instead; see the ``orderBy`` field - description. Required. + `trace_id`, `span_id`, `parent_span_id`, `start_time`, `end_time`, + `duration_ns`, `name` (`span.name`), `kind` (`span.kind`), + `status_code` (`status.code`, `status_code`), `status_message`, and + `service_name` (`service.name`). Any other name is looked up as a + span attribute, falling back to a resource attribute. With `scope` + set, `name` is always treated as an attribute key. Attribute keys may + contain only letters, digits, and `.`, `_`, `-`, `/`, `:`, `@`. In + traces ``order_by``"" , ``name`` must be a trace-level sort field + instead; see the ``order_by`` field description. Required. "scope": "str" # Optional. Restricts the lookup to - one attribute map (case-insensitive). ``resource`` (or - ``resource.attributes``"" ) reads resource attributes; ``attribute`` - (or ``attributes``"" , ``span.attributes``"" ) reads span attributes. - Omit to use the built-in column mapping described for ``name``. - Ignored in traces ``orderBy``. Known values are: "resource", + one attribute map and is matched case-insensitively. + ``FIELD_SCOPE_RESOURCE`` reads resource attributes and accepts + ``resource`` or ``resource.attributes`` as aliases. + ``FIELD_SCOPE_ATTRIBUTES`` reads span attributes and accepts + ``attribute``"" , ``attributes``"" , or ``span.attributes`` as + aliases. Omit to use the built-in column mapping described for + ``name``. Ignored in traces ``order_by``. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", "resource.attributes", "attribute", "attributes", and "span.attributes". }, - "direction": "desc" # Optional. Default value is "desc". The - sort direction (case-insensitive). Defaults to ``desc``. Known values - are: "asc" and "desc". + "direction": "str" # Optional. The sort direction, matched + case-insensitively. Omit to use the server default. Known values are: + "asc" and "desc". } ], "pagination": { @@ -185983,17 +186011,17 @@ async def post_traces_search( response == { "data": [ { - "traceId": "str", # The trace identifier. Required. - "durationNs": 0, # Optional. Wall-clock duration of the + "trace_id": "str", # The trace identifier. Required. + "duration_ns": 0, # Optional. Wall-clock duration of the trace in nanoseconds. - "errorCount": 0, # Optional. The number of spans in the + "error_count": 0, # Optional. The number of spans in the trace with an ``Error`` status code. Omitted when zero. - "serviceName": "str", # Optional. The service that emitted + "service_name": "str", # Optional. The service that emitted the root span. Omitted when the root span has no service.name resource attribute. - "spanCount": 0, # Optional. The number of spans in the + "span_count": 0, # Optional. The number of spans in the trace. - "spanNames": [ + "span_names": [ "str" # Optional. The distinct span names present in the trace. ], @@ -186005,7 +186033,7 @@ async def post_traces_search( } ], "pagination": { - "hasMore": bool # Whether more results matched the query than were + "has_more": bool # Whether more results matched the query than were returned. Required. } } @@ -186041,9 +186069,9 @@ async def post_traces_search( included when at least one of its spans matches ``filter``. The time range must not exceed 7 days (\\ ``168h``\\ ). ``pagination.limit`` defaults to 100 (also used when ``limit`` is ``0``\\ ) and must be between 0 and 1000. Results are ordered by ``started`` descending unless - ``orderBy`` is set. - JSON field names are camelCase (\\ ``timeRange``\\ , ``orderBy``\\ , ``hasMore``\\ , - ``traceId``\\ ). Unknown request properties, invalid filters, and out-of-range values are + ``order_by`` is set. + JSON field names use snake_case (\\ ``time_range``\\ , ``order_by``\\ , ``has_more``\\ , + ``trace_id``\\ ). Unknown request properties, invalid filters, and out-of-range values are rejected with ``400``. Each request searches a single region; there is no multi-region search. Supported regions are ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ , ``lon1``\\ , ``mem1``\\ , @@ -186074,17 +186102,17 @@ async def post_traces_search( response == { "data": [ { - "traceId": "str", # The trace identifier. Required. - "durationNs": 0, # Optional. Wall-clock duration of the + "trace_id": "str", # The trace identifier. Required. + "duration_ns": 0, # Optional. Wall-clock duration of the trace in nanoseconds. - "errorCount": 0, # Optional. The number of spans in the + "error_count": 0, # Optional. The number of spans in the trace with an ``Error`` status code. Omitted when zero. - "serviceName": "str", # Optional. The service that emitted + "service_name": "str", # Optional. The service that emitted the root span. Omitted when the root span has no service.name resource attribute. - "spanCount": 0, # Optional. The number of spans in the + "span_count": 0, # Optional. The number of spans in the trace. - "spanNames": [ + "span_names": [ "str" # Optional. The distinct span names present in the trace. ], @@ -186096,7 +186124,7 @@ async def post_traces_search( } ], "pagination": { - "hasMore": bool # Whether more results matched the query than were + "has_more": bool # Whether more results matched the query than were returned. Required. } } @@ -186127,9 +186155,9 @@ async def post_traces_search( included when at least one of its spans matches ``filter``. The time range must not exceed 7 days (\\ ``168h``\\ ). ``pagination.limit`` defaults to 100 (also used when ``limit`` is ``0``\\ ) and must be between 0 and 1000. Results are ordered by ``started`` descending unless - ``orderBy`` is set. - JSON field names are camelCase (\\ ``timeRange``\\ , ``orderBy``\\ , ``hasMore``\\ , - ``traceId``\\ ). Unknown request properties, invalid filters, and out-of-range values are + ``order_by`` is set. + JSON field names use snake_case (\\ ``time_range``\\ , ``order_by``\\ , ``has_more``\\ , + ``trace_id``\\ ). Unknown request properties, invalid filters, and out-of-range values are rejected with ``400``. Each request searches a single region; there is no multi-region search. Supported regions are ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ , ``lon1``\\ , ``mem1``\\ , @@ -186155,7 +186183,7 @@ async def post_traces_search( # JSON input template you can fill out and use as your body input. body = { - "timeRange": { + "time_range": { "from": { "absolute": "str", # Optional. An absolute timestamp, either RFC3339 (with optional fractional seconds) or a Unix epoch integer as a @@ -186180,79 +186208,100 @@ async def post_traces_search( } }, "filter": { - "expressions": [ - ... - ], - "field": { - "name": "str", # The field name. Without ``scope``"" , these - names (case-insensitive) resolve to built-in span columns: `traceId` - (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`), `parentSpanId` - (`parent.span.id`, `parent_span_id`), `startTime` (`start_time`, - `timestamp`), `endTime` (`end_time`), `durationNs` (`duration`, in - nanoseconds), `name` (`span.name`), `kind` (`span.kind`), `statusCode` - (`status.code`, `status_code`), `statusMessage` (`status.message`, - `status_message`), and `serviceName` (`service.name`, `service_name`). - Any other name is looked up as a span attribute, falling back to a - resource attribute. With `scope` set, `name` is always treated as an - attribute key. Attribute keys may contain only letters, digits, and `.`, - `_`, `-`, `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a - trace-level sort field instead; see the ``orderBy`` field description. - Required. - "scope": "str" # Optional. Restricts the lookup to one - attribute map (case-insensitive). ``resource`` (or - ``resource.attributes``"" ) reads resource attributes; ``attribute`` (or - ``attributes``"" , ``span.attributes``"" ) reads span attributes. Omit to - use the built-in column mapping described for ``name``. Ignored in traces - ``orderBy``. Known values are: "resource", "resource.attributes", - "attribute", "attributes", and "span.attributes". + "and": { + "expressions": [ + ... + ] + }, + "condition": { + "field": { + "name": "str", # The field name. Without ``scope``"" + , these names (case-insensitive) resolve to built-in span columns: + `trace_id`, `span_id`, `parent_span_id`, `start_time`, `end_time`, + `duration_ns`, `name` (`span.name`), `kind` (`span.kind`), + `status_code` (`status.code`, `status_code`), `status_message`, and + `service_name` (`service.name`). Any other name is looked up as a + span attribute, falling back to a resource attribute. With `scope` + set, `name` is always treated as an attribute key. Attribute keys may + contain only letters, digits, and `.`, `_`, `-`, `/`, `:`, `@`. In + traces ``order_by``"" , ``name`` must be a trace-level sort field + instead; see the ``order_by`` field description. Required. + "scope": "str" # Optional. Restricts the lookup to + one attribute map and is matched case-insensitively. + ``FIELD_SCOPE_RESOURCE`` reads resource attributes and accepts + ``resource`` or ``resource.attributes`` as aliases. + ``FIELD_SCOPE_ATTRIBUTES`` reads span attributes and accepts + ``attribute``"" , ``attributes``"" , or ``span.attributes`` as + aliases. Omit to use the built-in column mapping described for + ``name``. Ignored in traces ``order_by``. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", + "resource.attributes", "attribute", "attributes", and + "span.attributes". + }, + "operator": "str", # The comparison operator. Required. + Known values are: "FILTER_OPERATOR_EQ", "FILTER_OPERATOR_NEQ", + "FILTER_OPERATOR_IN", "FILTER_OPERATOR_EXISTS", "FILTER_OPERATOR_GTE", + and "FILTER_OPERATOR_LTE". + "value": { + "number_array_value": { + "values": [ + 0.0 # Required. + ] + }, + "number_value": 0.0, # Optional. A typed literal or + list value for a traces filter condition. Exactly one kind is set per + message. + "string_array_value": { + "values": [ + "str" # Required. + ] + }, + "string_value": "str" # Optional. A typed literal or + list value for a traces filter condition. Exactly one kind is set per + message. + } + }, + "not": ..., + "or": { + "expressions": [ + ... + ] }, - "operator": "str", # Optional. The comparison operator for a - ``condition`` node. Matching is case-insensitive, and the symbol forms - ``=``"" , ``!=``"" , ``>``"" , ``>=``"" , ``<``"" , and ``<=`` are accepted - as aliases for ``eq``"" , ``neq``"" , ``gt``"" , ``gte``"" , ``lt``"" , and - ``lte``. ``exists`` matches spans where the field is present and non-empty - and ignores ``value``. ``in`` requires an array ``value`` with 1 to 100 - entries. ``neq`` on string fields also matches spans where the field is - absent. Known values are: "eq", "neq", "in", "exists", "gt", "gte", "lt", and - "lte". - "query": "str", # Optional. The search string for a ``text_search`` - node. Leading and trailing whitespace is trimmed; the trimmed string must be - non-empty. - "type": "condition", # Optional. Default value is "condition". The - node type. Matching is case-insensitive. Known values are: "condition", - "and", "or", "not", and "text_search". - "value": {} + "text_search": { + "query": "str" # The search string. Leading and trailing + whitespace is trimmed, and the remaining string must not be empty. + Required. + } }, - "orderBy": [ + "order_by": [ { "field": { "name": "str", # The field name. Without ``scope``"" , these names (case-insensitive) resolve to built-in span columns: - `traceId` (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`), - `parentSpanId` (`parent.span.id`, `parent_span_id`), `startTime` - (`start_time`, `timestamp`), `endTime` (`end_time`), `durationNs` - (`duration`, in nanoseconds), `name` (`span.name`), `kind` - (`span.kind`), `statusCode` (`status.code`, `status_code`), - `statusMessage` (`status.message`, `status_message`), and - `serviceName` (`service.name`, `service_name`). Any other name is - looked up as a span attribute, falling back to a resource attribute. - With `scope` set, `name` is always treated as an attribute key. - Attribute keys may contain only letters, digits, and `.`, `_`, `-`, - `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a - trace-level sort field instead; see the ``orderBy`` field - description. Required. + `trace_id`, `span_id`, `parent_span_id`, `start_time`, `end_time`, + `duration_ns`, `name` (`span.name`), `kind` (`span.kind`), + `status_code` (`status.code`, `status_code`), `status_message`, and + `service_name` (`service.name`). Any other name is looked up as a + span attribute, falling back to a resource attribute. With `scope` + set, `name` is always treated as an attribute key. Attribute keys may + contain only letters, digits, and `.`, `_`, `-`, `/`, `:`, `@`. In + traces ``order_by``"" , ``name`` must be a trace-level sort field + instead; see the ``order_by`` field description. Required. "scope": "str" # Optional. Restricts the lookup to - one attribute map (case-insensitive). ``resource`` (or - ``resource.attributes``"" ) reads resource attributes; ``attribute`` - (or ``attributes``"" , ``span.attributes``"" ) reads span attributes. - Omit to use the built-in column mapping described for ``name``. - Ignored in traces ``orderBy``. Known values are: "resource", + one attribute map and is matched case-insensitively. + ``FIELD_SCOPE_RESOURCE`` reads resource attributes and accepts + ``resource`` or ``resource.attributes`` as aliases. + ``FIELD_SCOPE_ATTRIBUTES`` reads span attributes and accepts + ``attribute``"" , ``attributes``"" , or ``span.attributes`` as + aliases. Omit to use the built-in column mapping described for + ``name``. Ignored in traces ``order_by``. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", "resource.attributes", "attribute", "attributes", and "span.attributes". }, - "direction": "desc" # Optional. Default value is "desc". The - sort direction (case-insensitive). Defaults to ``desc``. Known values - are: "asc" and "desc". + "direction": "str" # Optional. The sort direction, matched + case-insensitively. Omit to use the server default. Known values are: + "asc" and "desc". } ], "pagination": { @@ -186266,17 +186315,17 @@ async def post_traces_search( response == { "data": [ { - "traceId": "str", # The trace identifier. Required. - "durationNs": 0, # Optional. Wall-clock duration of the + "trace_id": "str", # The trace identifier. Required. + "duration_ns": 0, # Optional. Wall-clock duration of the trace in nanoseconds. - "errorCount": 0, # Optional. The number of spans in the + "error_count": 0, # Optional. The number of spans in the trace with an ``Error`` status code. Omitted when zero. - "serviceName": "str", # Optional. The service that emitted + "service_name": "str", # Optional. The service that emitted the root span. Omitted when the root span has no service.name resource attribute. - "spanCount": 0, # Optional. The number of spans in the + "span_count": 0, # Optional. The number of spans in the trace. - "spanNames": [ + "span_names": [ "str" # Optional. The distinct span names present in the trace. ], @@ -186288,7 +186337,7 @@ async def post_traces_search( } ], "pagination": { - "hasMore": bool # Whether more results matched the query than were + "has_more": bool # Whether more results matched the query than were returned. Required. } } @@ -186493,8 +186542,9 @@ async def get_trace( with ``id`` and ``message``. ``403`` is also returned for accounts that are in a trial or not in good standing. If the regional traces backend cannot be reached, the response is ``502`` with a ``text/plain`` body. - JSON field names are camelCase (\\ ``traceId``\\ , ``spanId``\\ , ``startTime``\\ , - ``endTime``\\ , ``durationNs``\\ , ``serviceName``\\ , ``statusCode``\\ , ``parentSpanId``\\ ). + JSON field names use snake_case (\\ ``trace_id``\\ , ``span_id``\\ , ``start_time``\\ , + ``end_time``\\ , ``duration_ns``\\ , ``service_name``\\ , ``status_code``\\ , + ``parent_span_id``\\ ). :param region: The datacenter region slug for the query. Required. :type region: str @@ -186522,37 +186572,37 @@ async def get_trace( response == { "spans": [ { - "spanId": "str", # The span identifier. Required. - "traceId": "str", # The trace this span belongs to. + "span_id": "str", # The span identifier. Required. + "trace_id": "str", # The trace this span belongs to. Required. "attributes": { "str": "str" # Optional. Span attributes. Omitted when empty. }, - "durationNs": 0, # Optional. Span duration in nanoseconds. - "endTime": "2020-02-20 00:00:00", # Optional. The span end + "duration_ns": 0, # Optional. Span duration in nanoseconds. + "end_time": "2020-02-20 00:00:00", # Optional. The span end time. "kind": "str", # Optional. The OpenTelemetry span kind as a string, for example ``Server``"" , ``Client``"" , or ``Internal``. "name": "str", # Optional. The span name, typically the operation being performed. - "parentSpanId": "str", # Optional. The parent span + "parent_span_id": "str", # Optional. The parent span identifier. Omitted for the root span. "resource": { "str": "str" # Optional. Resource attributes associated with the span. }, - "serviceName": "str", # Optional. The service that emitted + "service_name": "str", # Optional. The service that emitted the span. Omitted when the span has no service.name resource attribute. - "startTime": "2020-02-20 00:00:00", # Optional. The span + "start_time": "2020-02-20 00:00:00", # Optional. The span start time. - "statusCode": "str", # Optional. The OpenTelemetry span + "status_code": "str", # Optional. The OpenTelemetry span status code as a string: ``Unset``"" , ``Ok``"" , or ``Error``. - "statusMessage": "str" # Optional. The status description. + "status_message": "str" # Optional. The status description. Omitted when empty. } ], - "traceId": "str", # Optional. The trace identifier. + "trace_id": "str", # Optional. The trace identifier. "truncated": bool # Optional. True when the trace has more spans than were returned in this response. Omitted when false. } @@ -186729,9 +186779,9 @@ async def post_spans_search( ``/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. + 1 and 1000. Results are ordered by ``start_time`` descending by default. Cursor-based + pagination is not yet supported; ``pagination.has_more`` indicates whether additional spans + matched beyond the returned page. :param region: The datacenter region slug for the query. Required. :type region: str @@ -186749,7 +186799,7 @@ async def post_spans_search( # JSON input template you can fill out and use as your body input. body = { - "timeRange": { + "time_range": { "from": { "absolute": "str", # Optional. An absolute timestamp. Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds, @@ -186770,46 +186820,88 @@ async def post_spans_search( } }, "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". + "and": { + "expressions": [ + ... + ] + }, + "condition": { + "field": { + "name": "str", # The field name. Well-known span + fields include ``trace_id``"" , ``span_id``"" , ``parent_span_id``"" + , ``start_time``"" , ``end_time``"" , ``duration_ns``"" , ``name``"" + , ``service_name``"" , ``kind``"" , ``status_code``"" , and + ``status_message``. Any other value is treated as a span or resource + attribute key. Required. + "scope": "str" # Optional. Optional attribute scope, + matched case-insensitively. Use ``FIELD_SCOPE_RESOURCE`` to match a + resource attribute or ``FIELD_SCOPE_ATTRIBUTES`` to match a span + attribute. The aliases ``resource`` and ``resource.attributes`` are + accepted for resource attributes; ``attribute``"" , ``attributes``"" + , and ``span.attributes`` are accepted for span attributes. Omit for + well-known fields or to search both attribute maps. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", + "resource.attributes", "attribute", "attributes", and + "span.attributes". + }, + "operator": "str", # The comparison operator. Required. + Known values are: "FILTER_OPERATOR_EQ", "FILTER_OPERATOR_NEQ", + "FILTER_OPERATOR_IN", "FILTER_OPERATOR_EXISTS", "FILTER_OPERATOR_GTE", + and "FILTER_OPERATOR_LTE". + "value": { + "number_array_value": { + "values": [ + 0.0 # Required. + ] + }, + "number_value": 0.0, # Optional. A typed literal or + list value for a spans filter condition. Exactly one kind is set per + message. + "string_array_value": { + "values": [ + "str" # Required. + ] + }, + "string_value": "str" # Optional. A typed literal or + list value for a spans filter condition. Exactly one kind is set per + message. + } }, - "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": {} + "not": ..., + "or": { + "expressions": [ + ... + ] + }, + "text_search": { + "query": "str" # The search string. Leading and trailing + whitespace is trimmed, and the remaining string must not be empty. + Required. + } }, - "orderBy": [ + "order_by": [ { "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 + fields include ``trace_id``"" , ``span_id``"" , ``parent_span_id``"" + , ``start_time``"" , ``end_time``"" , ``duration_ns``"" , ``name``"" + , ``service_name``"" , ``kind``"" , ``status_code``"" , and + ``status_message``. 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". + "scope": "str" # Optional. Optional attribute scope, + matched case-insensitively. Use ``FIELD_SCOPE_RESOURCE`` to match a + resource attribute or ``FIELD_SCOPE_ATTRIBUTES`` to match a span + attribute. The aliases ``resource`` and ``resource.attributes`` are + accepted for resource attributes; ``attribute``"" , ``attributes``"" + , and ``span.attributes`` are accepted for span attributes. Omit for + well-known fields or to search both attribute maps. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", + "resource.attributes", "attribute", "attributes", and + "span.attributes". }, - "direction": "str" # Optional. The sort direction. Defaults - to ``desc`` when omitted. Known values are: "asc" and "desc". + "direction": "str" # Optional. The sort direction, matched + case-insensitively. Omit to use the server default. Known values are: + "asc" and "desc". } ], "pagination": { @@ -186825,13 +186917,13 @@ async def post_spans_search( "attributes": { "str": "str" # Optional. Span attributes. }, - "durationNs": 0, # Optional. The span duration in + "duration_ns": 0, # Optional. The span duration in nanoseconds. - "endTime": "2020-02-20 00:00:00", # Optional. The span end + "end_time": "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 + "parent_span_id": "str", # Optional. The parent span identifier. Omitted for root spans. "region": "str", # Optional. The datacenter region slug the span was queried from. @@ -186839,20 +186931,20 @@ async def post_spans_search( "str": "str" # Optional. Resource attributes associated with the span. }, - "serviceName": "str", # Optional. The name of the service + "service_name": "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 + "span_id": "str", # Optional. The span identifier. + "start_time": "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 + "status_code": "str", # Optional. The span status code. + "status_message": "str", # Optional. The span status + message. Omitted when empty. + "trace_id": "str" # Optional. The trace identifier the span belongs to. } ], "pagination": { - "hasMore": bool # Optional. Whether more spans matched than were + "has_more": bool # Optional. Whether more spans matched than were returned in this page. Cursor-based continuation is not yet supported. } } @@ -186885,9 +186977,9 @@ async def post_spans_search( ``/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. + 1 and 1000. Results are ordered by ``start_time`` descending by default. Cursor-based + pagination is not yet supported; ``pagination.has_more`` indicates whether additional spans + matched beyond the returned page. :param region: The datacenter region slug for the query. Required. :type region: str @@ -186910,13 +187002,13 @@ async def post_spans_search( "attributes": { "str": "str" # Optional. Span attributes. }, - "durationNs": 0, # Optional. The span duration in + "duration_ns": 0, # Optional. The span duration in nanoseconds. - "endTime": "2020-02-20 00:00:00", # Optional. The span end + "end_time": "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 + "parent_span_id": "str", # Optional. The parent span identifier. Omitted for root spans. "region": "str", # Optional. The datacenter region slug the span was queried from. @@ -186924,20 +187016,20 @@ async def post_spans_search( "str": "str" # Optional. Resource attributes associated with the span. }, - "serviceName": "str", # Optional. The name of the service + "service_name": "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 + "span_id": "str", # Optional. The span identifier. + "start_time": "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 + "status_code": "str", # Optional. The span status code. + "status_message": "str", # Optional. The span status + message. Omitted when empty. + "trace_id": "str" # Optional. The trace identifier the span belongs to. } ], "pagination": { - "hasMore": bool # Optional. Whether more spans matched than were + "has_more": bool # Optional. Whether more spans matched than were returned in this page. Cursor-based continuation is not yet supported. } } @@ -186965,9 +187057,9 @@ async def post_spans_search( ``/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. + 1 and 1000. Results are ordered by ``start_time`` descending by default. Cursor-based + pagination is not yet supported; ``pagination.has_more`` indicates whether additional spans + matched beyond the returned page. :param region: The datacenter region slug for the query. Required. :type region: str @@ -186982,7 +187074,7 @@ async def post_spans_search( # JSON input template you can fill out and use as your body input. body = { - "timeRange": { + "time_range": { "from": { "absolute": "str", # Optional. An absolute timestamp. Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds, @@ -187003,46 +187095,88 @@ async def post_spans_search( } }, "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". + "and": { + "expressions": [ + ... + ] }, - "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": {} + "condition": { + "field": { + "name": "str", # The field name. Well-known span + fields include ``trace_id``"" , ``span_id``"" , ``parent_span_id``"" + , ``start_time``"" , ``end_time``"" , ``duration_ns``"" , ``name``"" + , ``service_name``"" , ``kind``"" , ``status_code``"" , and + ``status_message``. Any other value is treated as a span or resource + attribute key. Required. + "scope": "str" # Optional. Optional attribute scope, + matched case-insensitively. Use ``FIELD_SCOPE_RESOURCE`` to match a + resource attribute or ``FIELD_SCOPE_ATTRIBUTES`` to match a span + attribute. The aliases ``resource`` and ``resource.attributes`` are + accepted for resource attributes; ``attribute``"" , ``attributes``"" + , and ``span.attributes`` are accepted for span attributes. Omit for + well-known fields or to search both attribute maps. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", + "resource.attributes", "attribute", "attributes", and + "span.attributes". + }, + "operator": "str", # The comparison operator. Required. + Known values are: "FILTER_OPERATOR_EQ", "FILTER_OPERATOR_NEQ", + "FILTER_OPERATOR_IN", "FILTER_OPERATOR_EXISTS", "FILTER_OPERATOR_GTE", + and "FILTER_OPERATOR_LTE". + "value": { + "number_array_value": { + "values": [ + 0.0 # Required. + ] + }, + "number_value": 0.0, # Optional. A typed literal or + list value for a spans filter condition. Exactly one kind is set per + message. + "string_array_value": { + "values": [ + "str" # Required. + ] + }, + "string_value": "str" # Optional. A typed literal or + list value for a spans filter condition. Exactly one kind is set per + message. + } + }, + "not": ..., + "or": { + "expressions": [ + ... + ] + }, + "text_search": { + "query": "str" # The search string. Leading and trailing + whitespace is trimmed, and the remaining string must not be empty. + Required. + } }, - "orderBy": [ + "order_by": [ { "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 + fields include ``trace_id``"" , ``span_id``"" , ``parent_span_id``"" + , ``start_time``"" , ``end_time``"" , ``duration_ns``"" , ``name``"" + , ``service_name``"" , ``kind``"" , ``status_code``"" , and + ``status_message``. 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". + "scope": "str" # Optional. Optional attribute scope, + matched case-insensitively. Use ``FIELD_SCOPE_RESOURCE`` to match a + resource attribute or ``FIELD_SCOPE_ATTRIBUTES`` to match a span + attribute. The aliases ``resource`` and ``resource.attributes`` are + accepted for resource attributes; ``attribute``"" , ``attributes``"" + , and ``span.attributes`` are accepted for span attributes. Omit for + well-known fields or to search both attribute maps. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", + "resource.attributes", "attribute", "attributes", and + "span.attributes". }, - "direction": "str" # Optional. The sort direction. Defaults - to ``desc`` when omitted. Known values are: "asc" and "desc". + "direction": "str" # Optional. The sort direction, matched + case-insensitively. Omit to use the server default. Known values are: + "asc" and "desc". } ], "pagination": { @@ -187058,13 +187192,13 @@ async def post_spans_search( "attributes": { "str": "str" # Optional. Span attributes. }, - "durationNs": 0, # Optional. The span duration in + "duration_ns": 0, # Optional. The span duration in nanoseconds. - "endTime": "2020-02-20 00:00:00", # Optional. The span end + "end_time": "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 + "parent_span_id": "str", # Optional. The parent span identifier. Omitted for root spans. "region": "str", # Optional. The datacenter region slug the span was queried from. @@ -187072,20 +187206,20 @@ async def post_spans_search( "str": "str" # Optional. Resource attributes associated with the span. }, - "serviceName": "str", # Optional. The name of the service + "service_name": "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 + "span_id": "str", # Optional. The span identifier. + "start_time": "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 + "status_code": "str", # Optional. The span status code. + "status_message": "str", # Optional. The span status + message. Omitted when empty. + "trace_id": "str" # Optional. The trace identifier the span belongs to. } ], "pagination": { - "hasMore": bool # Optional. Whether more spans matched than were + "has_more": bool # Optional. Whether more spans matched than were returned in this page. Cursor-based continuation is not yet supported. } } @@ -187225,47 +187359,49 @@ async def post_spans_search( 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, *, source: Optional[str] = None, **kwargs: Any + async def list_resources( + self, + *, + filter_product_types: Optional[List[str]] = None, + filter_regions: Optional[List[str]] = None, + pagination_page: int = 1, + pagination_per_page: int = 20, + pagination_sort: Optional[str] = None, + pagination_sort_direction: Optional[str] = None, + **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """List All Consent Records. + """List Resource Signal Enablement. - 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 source: per-environment records (\\ ``source: agent``\\ ) for Harness Runtime, and - the team-level record (\\ ``source: inference``\\ ) for Serverless Inference chat - completions. + To list the resources in your account that have telemetry signal enablement + recorded, along with the current state of their metrics, logs, and traces + signals, send a GET request to ``/v2/insights/resources``. - Pass ``?source=agent`` or ``?source=inference`` to return only that source's - records. When filtered, the response also echoes the ``source``. + Results are paginated with ``pagination.page`` and ``pagination.per_page`` + (default ``20``\\ , maximum ``200``\\ ) and can be sorted with ``pagination.sort`` and + ``pagination.sort_direction``. Optionally filter by ``filter.product_types`` and + ``filter.regions``. - :keyword source: Filter consent records by source. ``agent`` returns per-environment records - (Harness Runtime); ``inference`` returns the team-level record for Serverless Inference chat - completions. When omitted, records for all sources are returned. Known values are: "agent" and - "inference". Default value is None. - :paramtype source: str + A signal is omitted from a resource when no explicit enablement has ever been + recorded for it. + + :keyword filter_product_types: Optional filter. When set, only resources of these product types + are returned. Repeat the parameter for multiple product types. Default value is None. + :paramtype filter_product_types: list[str] + :keyword filter_regions: Optional filter. When set, only resources in these regions are + returned. Repeat the parameter for multiple regions. Default value is None. + :paramtype filter_regions: list[str] + :keyword pagination_page: Which 'page' of paginated results to return. Default value is 1. + :paramtype pagination_page: int + :keyword pagination_per_page: Number of items returned per page. Default value is 20. + :paramtype pagination_per_page: int + :keyword pagination_sort: Field to sort by. Defaults to ``resource_urn``. Known values are: + "resource_urn" and "effective_at". Default value is None. + :paramtype pagination_sort: str + :keyword pagination_sort_direction: Sort direction. Defaults to ``asc``. Known values are: + "asc" and "desc". Default value is None. + :paramtype pagination_sort_direction: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -187275,29 +187411,739 @@ async def list_consents( # response body for status code(s): 200 response == { - "consents": [ + "pagination": { + "page": 0, # Optional. The current page number. + "pages": 0, # Optional. The total number of pages. Omitted when + there are no results. + "per_page": 0, # Optional. The number of items per page. + "total": 0 # Optional. The total number of resources across all + pages. Omitted when there are no results. + }, + "resources": [ { - "agent_id": "str", # The unique identifier of the - environment. For Harness Runtime, this is the Environment Config ID. - Empty for team-level records ("" ``source: inference``"" ), which are not - tied to an environment. Required. - "enabled": bool, # Whether signals collection is enabled for - this source. Required. - "id": 0, # The unique numeric identifier for the consent - record. Required. - "source": "str", # The source this consent applies to. - ``agent`` is per-environment consent for Harness Runtime; ``inference`` - is team-level consent for Serverless Inference chat completions. - Required. Known values are: "agent" and "inference". - "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. + "product_type": "str", # The product type of the resource, + for example ``droplet`` or ``kubernetes``. Required. + "resource_urn": "str", # The uniform resource name (URN) of + the resource. Required. + "logs": { + "effective_at": "2020-02-20 00:00:00", # Optional. + When this signal state last changed. + "enabled": bool # Optional. Whether the signal is + enabled for the resource. + }, + "metrics": { + "effective_at": "2020-02-20 00:00:00", # Optional. + When this signal state last changed. + "enabled": bool # Optional. Whether the signal is + enabled for the resource. + }, + "region": "str", # Optional. The region slug for + region-specific resources. Omitted when the resource has no region. + "traces": { + "effective_at": "2020-02-20 00:00:00", # Optional. + When this signal state last changed. + "enabled": bool # Optional. Whether the signal is + enabled for the resource. + } } - ], - "source": "str" # Optional. Echoes the ``source`` filter when the request - was filtered by source. Omitted when the list was not filtered. Known values are: - "agent" and "inference". + ] + } + # response body for status code(s): 400 + 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_insights_list_resources_request( + filter_product_types=filter_product_types, + filter_regions=filter_regions, + pagination_page=pagination_page, + pagination_per_page=pagination_per_page, + pagination_sort=pagination_sort, + pagination_sort_direction=pagination_sort_direction, + 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]: + 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 cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace_async + async def get_resource(self, resource_urn: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Retrieve Resource Signal Enablement. + + To retrieve the current metrics, logs, and traces signal enablement for a + single resource, send a GET request to + ``/v2/insights/resources/{resource_urn}``. + + A ``404`` is returned when no signal enablement has been recorded for the + resource. + + :param resource_urn: The uniform resource name (URN) of the resource, for example + ``do:droplet:12345``. Required. + :type resource_urn: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "resource": { + "product_type": "str", # The product type of the resource, for + example ``droplet`` or ``kubernetes``. Required. + "resource_urn": "str", # The uniform resource name (URN) of the + resource. Required. + "logs": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "metrics": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "region": "str", # Optional. The region slug for region-specific + resources. Omitted when the resource has no region. + "traces": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + } + } + } + # response body for status code(s): 400, 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_insights_get_resource_request( + resource_urn=resource_urn, + 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, 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 == 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_resource_signals( + self, + resource_urn: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Update Resource Signal Enablement. + + To enable or disable telemetry signals for a resource, send a PUT request to + ``/v2/insights/resources/{resource_urn}/signals``. + + This endpoint uses merge semantics. Set ``metrics``\\ , ``logs``\\ , or ``traces`` to + ``true`` or ``false`` to change that signal; omit a signal to leave it unchanged. + At least one signal must be set. + + ``region`` is only used when the resource has no existing enablement. On later + updates, omit it or send the stored value; changing the region is rejected + with a ``400``. + + Requires both the ``insights:update`` and ``insights:create`` scopes. + + :param resource_urn: The uniform resource name (URN) of the resource, for example + ``do:droplet:12345``. Required. + :type resource_urn: 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 = { + "logs": bool, # Optional. Enable or disable the logs signal. Omit to leave + unchanged. + "metrics": bool, # Optional. Enable or disable the metrics signal. Omit to + leave unchanged. + "region": "str", # Optional. The region slug for region-specific resources. + Only used when the resource has no existing enablement. On later updates, omit it + or send the stored value; changing the region is rejected. + "traces": bool # Optional. Enable or disable the traces signal. Omit to + leave unchanged. + } + + # response body for status code(s): 200 + response == { + "resource": { + "product_type": "str", # The product type of the resource, for + example ``droplet`` or ``kubernetes``. Required. + "resource_urn": "str", # The uniform resource name (URN) of the + resource. Required. + "logs": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "metrics": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "region": "str", # Optional. The region slug for region-specific + resources. Omitted when the resource has no region. + "traces": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + } + } + } + # response body for status code(s): 400, 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_resource_signals( + self, + resource_urn: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Update Resource Signal Enablement. + + To enable or disable telemetry signals for a resource, send a PUT request to + ``/v2/insights/resources/{resource_urn}/signals``. + + This endpoint uses merge semantics. Set ``metrics``\\ , ``logs``\\ , or ``traces`` to + ``true`` or ``false`` to change that signal; omit a signal to leave it unchanged. + At least one signal must be set. + + ``region`` is only used when the resource has no existing enablement. On later + updates, omit it or send the stored value; changing the region is rejected + with a ``400``. + + Requires both the ``insights:update`` and ``insights:create`` scopes. + + :param resource_urn: The uniform resource name (URN) of the resource, for example + ``do:droplet:12345``. Required. + :type resource_urn: 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 == { + "resource": { + "product_type": "str", # The product type of the resource, for + example ``droplet`` or ``kubernetes``. Required. + "resource_urn": "str", # The uniform resource name (URN) of the + resource. Required. + "logs": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "metrics": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "region": "str", # Optional. The region slug for region-specific + resources. Omitted when the resource has no region. + "traces": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + } + } + } + # response body for status code(s): 400, 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_resource_signals( + self, resource_urn: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Update Resource Signal Enablement. + + To enable or disable telemetry signals for a resource, send a PUT request to + ``/v2/insights/resources/{resource_urn}/signals``. + + This endpoint uses merge semantics. Set ``metrics``\\ , ``logs``\\ , or ``traces`` to + ``true`` or ``false`` to change that signal; omit a signal to leave it unchanged. + At least one signal must be set. + + ``region`` is only used when the resource has no existing enablement. On later + updates, omit it or send the stored value; changing the region is rejected + with a ``400``. + + Requires both the ``insights:update`` and ``insights:create`` scopes. + + :param resource_urn: The uniform resource name (URN) of the resource, for example + ``do:droplet:12345``. Required. + :type resource_urn: 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 = { + "logs": bool, # Optional. Enable or disable the logs signal. Omit to leave + unchanged. + "metrics": bool, # Optional. Enable or disable the metrics signal. Omit to + leave unchanged. + "region": "str", # Optional. The region slug for region-specific resources. + Only used when the resource has no existing enablement. On later updates, omit it + or send the stored value; changing the region is rejected. + "traces": bool # Optional. Enable or disable the traces signal. Omit to + leave unchanged. + } + + # response body for status code(s): 200 + response == { + "resource": { + "product_type": "str", # The product type of the resource, for + example ``droplet`` or ``kubernetes``. Required. + "resource_urn": "str", # The uniform resource name (URN) of the + resource. Required. + "logs": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "metrics": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "region": "str", # Optional. The region slug for region-specific + resources. Omitted when the resource has no region. + "traces": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + } + } + } + # response body for status code(s): 400, 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_update_resource_signals_request( + resource_urn=resource_urn, + 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, 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 == 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, *, source: Optional[str] = None, **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 source: per-environment records (\\ ``source: agent``\\ ) for Harness Runtime, and + the team-level record (\\ ``source: inference``\\ ) for Serverless Inference chat + completions. + + Pass ``?source=agent`` or ``?source=inference`` to return only that source's + records. When filtered, the response also echoes the ``source``. + + :keyword source: Filter consent records by source. ``agent`` returns per-environment records + (Harness Runtime); ``inference`` returns the team-level record for Serverless Inference chat + completions. When omitted, records for all sources are returned. Known values are: "agent" and + "inference". Default value is None. + :paramtype source: str + :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 + environment. For Harness Runtime, this is the Environment Config ID. + Empty for team-level records ("" ``source: inference``"" ), which are not + tied to an environment. Required. + "enabled": bool, # Whether signals collection is enabled for + this source. Required. + "id": 0, # The unique numeric identifier for the consent + record. Required. + "source": "str", # The source this consent applies to. + ``agent`` is per-environment consent for Harness Runtime; ``inference`` + is team-level consent for Serverless Inference chat completions. + Required. Known values are: "agent" and "inference". + "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. + } + ], + "source": "str" # Optional. Echoes the ``source`` filter when the request + was filtered by source. Omitted when the list was not filtered. Known values are: + "agent" and "inference". } # response body for status code(s): 400 response == { @@ -342499,6 +343345,655 @@ async def create_async_invoke( return cast(JSON, deserialized) # type: ignore + @overload + async def create_speech( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> Union[JSON, AsyncIterator[bytes]]: + # pylint: disable=line-too-long + """Generate speech from text. + + Convert text input to speech audio. The response may be raw audio bytes (\\ ``audio/mpeg``\\ , + ``audio/wav``\\ , and similar) or a JSON envelope with base64-encoded audio in + ``data[].b64_json``. + + :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 or AsyncIterator[bytes] + :rtype: JSON or AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "input": "str", # The text to convert to speech. Required. + "model": "str", # The text-to-speech model to use. Required. + "instructions": "str", # Optional. Optional style or delivery instructions + for the synthesizer. + "response_format": "str", # Optional. The audio format to return. Supported + values include ``mp3`` and ``wav``. The API may return raw audio bytes or a JSON + envelope with base64-encoded audio. + "voice": "str" # Optional. The voice to use for synthesis. + } + + # response body for status code(s): 200 + response == { + "data": [ + { + "b64_json": "str" # Base64-encoded audio bytes. Required. + } + ], + "created": 0 # Optional. Unix timestamp (in seconds) of when the audio was + created. + } + """ + + @overload + async def create_speech( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> Union[JSON, AsyncIterator[bytes]]: + """Generate speech from text. + + Convert text input to speech audio. The response may be raw audio bytes (\\ ``audio/mpeg``\\ , + ``audio/wav``\\ , and similar) or a JSON envelope with base64-encoded audio in + ``data[].b64_json``. + + :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 or AsyncIterator[bytes] + :rtype: JSON or AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "data": [ + { + "b64_json": "str" # Base64-encoded audio bytes. Required. + } + ], + "created": 0 # Optional. Unix timestamp (in seconds) of when the audio was + created. + } + """ + + @distributed_trace_async + async def create_speech( + self, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> Union[JSON, AsyncIterator[bytes]]: + # pylint: disable=line-too-long + """Generate speech from text. + + Convert text input to speech audio. The response may be raw audio bytes (\\ ``audio/mpeg``\\ , + ``audio/wav``\\ , and similar) or a JSON envelope with base64-encoded audio in + ``data[].b64_json``. + + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object or AsyncIterator[bytes] + :rtype: JSON or AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "input": "str", # The text to convert to speech. Required. + "model": "str", # The text-to-speech model to use. Required. + "instructions": "str", # Optional. Optional style or delivery instructions + for the synthesizer. + "response_format": "str", # Optional. The audio format to return. Supported + values include ``mp3`` and ``wav``. The API may return raw audio bytes or a JSON + envelope with base64-encoded audio. + "voice": "str" # Optional. The voice to use for synthesis. + } + + # response body for status code(s): 200 + response == { + "data": [ + { + "b64_json": "str" # Base64-encoded audio bytes. Required. + } + ], + "created": 0 # Optional. Unix timestamp (in seconds) of when the audio was + created. + } + """ + 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[Union[JSON, AsyncIterator[bytes]]] = 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_inference_create_speech_request( + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = True + 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, 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 = {} + 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") + ) + + deserialized = response.iter_bytes() + + 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") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, cast(Union[JSON, AsyncIterator[bytes]], deserialized), response_headers) # type: ignore + + return cast(Union[JSON, AsyncIterator[bytes]], deserialized) # type: ignore + + @overload + async def create_video( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Start a video generation job. + + Start an asynchronous video generation job from a text prompt. Poll ``GET + /v1/videos/{video_id}`` until the job reaches a terminal status, then download the MP4 with + ``GET /v1/videos/{video_id}/content`` or from ``output.url`` when present. + + :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 = { + "model": "str", # The video generation model to use. Required. + "prompt": "str", # A text description of the desired video. Required. + "fps": 0, # Optional. Frames per second for the generated video. + "size": "str" # Optional. The output resolution, for example ``1280x720``. + } + + # response body for status code(s): 200 + response == { + "id": "str", # The video generation job identifier. Required. + "status": "str", # Job status. Poll until the value is a terminal state such + as ``completed`` or ``failed``. Required. + "created_at": 0, # Optional. Unix timestamp (in seconds) of when the job was + created. + "error": { + "str": {} # Optional. Error details when status is ``failed``. + }, + "model": "str", # Optional. The model used for generation. + "object": "str", # Optional. Object type returned by the API. + "output": { + "url": "str" # Optional. Presigned URL for the generated MP4. + }, + "x_request_id": "str" # Optional. Request correlation identifier when + provided by the API. + } + """ + + @overload + async def create_video( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Start a video generation job. + + Start an asynchronous video generation job from a text prompt. Poll ``GET + /v1/videos/{video_id}`` until the job reaches a terminal status, then download the MP4 with + ``GET /v1/videos/{video_id}/content`` or from ``output.url`` when present. + + :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 == { + "id": "str", # The video generation job identifier. Required. + "status": "str", # Job status. Poll until the value is a terminal state such + as ``completed`` or ``failed``. Required. + "created_at": 0, # Optional. Unix timestamp (in seconds) of when the job was + created. + "error": { + "str": {} # Optional. Error details when status is ``failed``. + }, + "model": "str", # Optional. The model used for generation. + "object": "str", # Optional. Object type returned by the API. + "output": { + "url": "str" # Optional. Presigned URL for the generated MP4. + }, + "x_request_id": "str" # Optional. Request correlation identifier when + provided by the API. + } + """ + + @distributed_trace_async + async def create_video(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Start a video generation job. + + Start an asynchronous video generation job from a text prompt. Poll ``GET + /v1/videos/{video_id}`` until the job reaches a terminal status, then download the MP4 with + ``GET /v1/videos/{video_id}/content`` or from ``output.url`` when present. + + :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 = { + "model": "str", # The video generation model to use. Required. + "prompt": "str", # A text description of the desired video. Required. + "fps": 0, # Optional. Frames per second for the generated video. + "size": "str" # Optional. The output resolution, for example ``1280x720``. + } + + # response body for status code(s): 200 + response == { + "id": "str", # The video generation job identifier. Required. + "status": "str", # Job status. Poll until the value is a terminal state such + as ``completed`` or ``failed``. Required. + "created_at": 0, # Optional. Unix timestamp (in seconds) of when the job was + created. + "error": { + "str": {} # Optional. Error details when status is ``failed``. + }, + "model": "str", # Optional. The model used for generation. + "object": "str", # Optional. Object type returned by the API. + "output": { + "url": "str" # Optional. Presigned URL for the generated MP4. + }, + "x_request_id": "str" # Optional. Request correlation identifier when + provided by the API. + } + """ + 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_inference_create_video_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 [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_video(self, video_id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Retrieve a video generation job. + + Returns the current state of a video generation job. Poll until ``status`` reaches a terminal + value such as ``completed`` or ``failed``. + + :param video_id: The video generation job identifier. Required. + :type video_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # The video generation job identifier. Required. + "status": "str", # Job status. Poll until the value is a terminal state such + as ``completed`` or ``failed``. Required. + "created_at": 0, # Optional. Unix timestamp (in seconds) of when the job was + created. + "error": { + "str": {} # Optional. Error details when status is ``failed``. + }, + "model": "str", # Optional. The model used for generation. + "object": "str", # Optional. Object type returned by the API. + "output": { + "url": "str" # Optional. Presigned URL for the generated MP4. + }, + "x_request_id": "str" # Optional. Request correlation identifier when + provided by the API. + } + # 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_inference_get_video_request( + video_id=video_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_video_content( + self, video_id: str, **kwargs: Any + ) -> Union[AsyncIterator[bytes], JSON]: + # pylint: disable=line-too-long + """Download generated video content. + + Downloads the generated MP4 for a completed video generation job. + + :param video_id: The video generation job identifier. Required. + :type video_id: str + :return: AsyncIterator[bytes] or JSON object + :rtype: AsyncIterator[bytes] or JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # 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[Union[AsyncIterator[bytes], JSON]] = kwargs.pop("cls", None) + + _request = build_inference_get_video_content_request( + video_id=video_id, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = True + 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") + ) + + deserialized = response.iter_bytes() + + 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") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, cast(Union[AsyncIterator[bytes], JSON], deserialized), response_headers) # type: ignore + + return cast(Union[AsyncIterator[bytes], JSON], deserialized) # type: ignore + @overload async def create_batch_file( self, body: JSON, *, content_type: str = "application/json", **kwargs: Any diff --git a/src/pydo/inference/__init__.py b/src/pydo/inference/__init__.py index e023bca1..58a7f52f 100644 --- a/src/pydo/inference/__init__.py +++ b/src/pydo/inference/__init__.py @@ -58,6 +58,7 @@ "responses", "speech", "systemone", + "videos", ) diff --git a/src/pydo/inference/aio/__init__.py b/src/pydo/inference/aio/__init__.py index 3be8fed7..761006ed 100644 --- a/src/pydo/inference/aio/__init__.py +++ b/src/pydo/inference/aio/__init__.py @@ -36,6 +36,7 @@ "responses", "speech", "systemone", + "videos", ) diff --git a/src/pydo/operations/_operations.py b/src/pydo/operations/_operations.py index 8a6ecb77..f4ed7fc2 100644 --- a/src/pydo/operations/_operations.py +++ b/src/pydo/operations/_operations.py @@ -9480,6 +9480,109 @@ def build_insights_post_spans_search_request(region: str, **kwargs: Any) -> Http return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) +def build_insights_list_resources_request( + *, + filter_product_types: Optional[List[str]] = None, + filter_regions: Optional[List[str]] = None, + pagination_page: int = 1, + pagination_per_page: int = 20, + pagination_sort: Optional[str] = None, + pagination_sort_direction: 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 = "/v2/insights/resources" + + # Construct parameters + if filter_product_types is not None: + _params["filter.product_types"] = [ + _SERIALIZER.query("filter_product_types", q, "str") if q is not None else "" + for q in filter_product_types + ] + if filter_regions is not None: + _params["filter.regions"] = [ + _SERIALIZER.query("filter_regions", q, "str") if q is not None else "" + for q in filter_regions + ] + if pagination_page is not None: + _params["pagination.page"] = _SERIALIZER.query( + "pagination_page", pagination_page, "int", minimum=1 + ) + if pagination_per_page is not None: + _params["pagination.per_page"] = _SERIALIZER.query( + "pagination_per_page", pagination_per_page, "int", maximum=200, minimum=1 + ) + if pagination_sort is not None: + _params["pagination.sort"] = _SERIALIZER.query( + "pagination_sort", pagination_sort, "str" + ) + if pagination_sort_direction is not None: + _params["pagination.sort_direction"] = _SERIALIZER.query( + "pagination_sort_direction", pagination_sort_direction, "str" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) + + +def build_insights_get_resource_request( + resource_urn: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/insights/resources/{resource_urn}" + path_format_arguments = { + "resource_urn": _SERIALIZER.url("resource_urn", resource_urn, "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_insights_update_resource_signals_request( # pylint: disable=name-too-long + resource_urn: 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/resources/{resource_urn}/signals" + path_format_arguments = { + "resource_urn": _SERIALIZER.url("resource_urn", resource_urn, "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_consents_request( *, source: Optional[str] = None, **kwargs: Any ) -> HttpRequest: @@ -21341,6 +21444,90 @@ def build_inference_create_async_invoke_request( return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) +def build_inference_create_speech_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, audio/mpeg, audio/wav, audio/mp3" + ) + + # Construct URL + _url = "/v1/audio/speech" + + # 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_inference_create_video_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/videos" + + # 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_inference_get_video_request(video_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v1/videos/{video_id}" + path_format_arguments = { + "video_id": _SERIALIZER.url("video_id", video_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_inference_get_video_content_request( # pylint: disable=name-too-long + video_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "video/mp4, application/json") + + # Construct URL + _url = "/v1/videos/{video_id}/content" + path_format_arguments = { + "video_id": _SERIALIZER.url("video_id", video_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_inference_create_batch_file_request( **kwargs: Any, ) -> HttpRequest: # pylint: disable=name-too-long @@ -206436,9 +206623,9 @@ def post_traces_search( included when at least one of its spans matches ``filter``. The time range must not exceed 7 days (\\ ``168h``\\ ). ``pagination.limit`` defaults to 100 (also used when ``limit`` is ``0``\\ ) and must be between 0 and 1000. Results are ordered by ``started`` descending unless - ``orderBy`` is set. - JSON field names are camelCase (\\ ``timeRange``\\ , ``orderBy``\\ , ``hasMore``\\ , - ``traceId``\\ ). Unknown request properties, invalid filters, and out-of-range values are + ``order_by`` is set. + JSON field names use snake_case (\\ ``time_range``\\ , ``order_by``\\ , ``has_more``\\ , + ``trace_id``\\ ). Unknown request properties, invalid filters, and out-of-range values are rejected with ``400``. Each request searches a single region; there is no multi-region search. Supported regions are ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ , ``lon1``\\ , ``mem1``\\ , @@ -206467,7 +206654,7 @@ def post_traces_search( # JSON input template you can fill out and use as your body input. body = { - "timeRange": { + "time_range": { "from": { "absolute": "str", # Optional. An absolute timestamp, either RFC3339 (with optional fractional seconds) or a Unix epoch integer as a @@ -206492,79 +206679,100 @@ def post_traces_search( } }, "filter": { - "expressions": [ - ... - ], - "field": { - "name": "str", # The field name. Without ``scope``"" , these - names (case-insensitive) resolve to built-in span columns: `traceId` - (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`), `parentSpanId` - (`parent.span.id`, `parent_span_id`), `startTime` (`start_time`, - `timestamp`), `endTime` (`end_time`), `durationNs` (`duration`, in - nanoseconds), `name` (`span.name`), `kind` (`span.kind`), `statusCode` - (`status.code`, `status_code`), `statusMessage` (`status.message`, - `status_message`), and `serviceName` (`service.name`, `service_name`). - Any other name is looked up as a span attribute, falling back to a - resource attribute. With `scope` set, `name` is always treated as an - attribute key. Attribute keys may contain only letters, digits, and `.`, - `_`, `-`, `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a - trace-level sort field instead; see the ``orderBy`` field description. - Required. - "scope": "str" # Optional. Restricts the lookup to one - attribute map (case-insensitive). ``resource`` (or - ``resource.attributes``"" ) reads resource attributes; ``attribute`` (or - ``attributes``"" , ``span.attributes``"" ) reads span attributes. Omit to - use the built-in column mapping described for ``name``. Ignored in traces - ``orderBy``. Known values are: "resource", "resource.attributes", - "attribute", "attributes", and "span.attributes". + "and": { + "expressions": [ + ... + ] + }, + "condition": { + "field": { + "name": "str", # The field name. Without ``scope``"" + , these names (case-insensitive) resolve to built-in span columns: + `trace_id`, `span_id`, `parent_span_id`, `start_time`, `end_time`, + `duration_ns`, `name` (`span.name`), `kind` (`span.kind`), + `status_code` (`status.code`, `status_code`), `status_message`, and + `service_name` (`service.name`). Any other name is looked up as a + span attribute, falling back to a resource attribute. With `scope` + set, `name` is always treated as an attribute key. Attribute keys may + contain only letters, digits, and `.`, `_`, `-`, `/`, `:`, `@`. In + traces ``order_by``"" , ``name`` must be a trace-level sort field + instead; see the ``order_by`` field description. Required. + "scope": "str" # Optional. Restricts the lookup to + one attribute map and is matched case-insensitively. + ``FIELD_SCOPE_RESOURCE`` reads resource attributes and accepts + ``resource`` or ``resource.attributes`` as aliases. + ``FIELD_SCOPE_ATTRIBUTES`` reads span attributes and accepts + ``attribute``"" , ``attributes``"" , or ``span.attributes`` as + aliases. Omit to use the built-in column mapping described for + ``name``. Ignored in traces ``order_by``. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", + "resource.attributes", "attribute", "attributes", and + "span.attributes". + }, + "operator": "str", # The comparison operator. Required. + Known values are: "FILTER_OPERATOR_EQ", "FILTER_OPERATOR_NEQ", + "FILTER_OPERATOR_IN", "FILTER_OPERATOR_EXISTS", "FILTER_OPERATOR_GTE", + and "FILTER_OPERATOR_LTE". + "value": { + "number_array_value": { + "values": [ + 0.0 # Required. + ] + }, + "number_value": 0.0, # Optional. A typed literal or + list value for a traces filter condition. Exactly one kind is set per + message. + "string_array_value": { + "values": [ + "str" # Required. + ] + }, + "string_value": "str" # Optional. A typed literal or + list value for a traces filter condition. Exactly one kind is set per + message. + } }, - "operator": "str", # Optional. The comparison operator for a - ``condition`` node. Matching is case-insensitive, and the symbol forms - ``=``"" , ``!=``"" , ``>``"" , ``>=``"" , ``<``"" , and ``<=`` are accepted - as aliases for ``eq``"" , ``neq``"" , ``gt``"" , ``gte``"" , ``lt``"" , and - ``lte``. ``exists`` matches spans where the field is present and non-empty - and ignores ``value``. ``in`` requires an array ``value`` with 1 to 100 - entries. ``neq`` on string fields also matches spans where the field is - absent. Known values are: "eq", "neq", "in", "exists", "gt", "gte", "lt", and - "lte". - "query": "str", # Optional. The search string for a ``text_search`` - node. Leading and trailing whitespace is trimmed; the trimmed string must be - non-empty. - "type": "condition", # Optional. Default value is "condition". The - node type. Matching is case-insensitive. Known values are: "condition", - "and", "or", "not", and "text_search". - "value": {} + "not": ..., + "or": { + "expressions": [ + ... + ] + }, + "text_search": { + "query": "str" # The search string. Leading and trailing + whitespace is trimmed, and the remaining string must not be empty. + Required. + } }, - "orderBy": [ + "order_by": [ { "field": { "name": "str", # The field name. Without ``scope``"" , these names (case-insensitive) resolve to built-in span columns: - `traceId` (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`), - `parentSpanId` (`parent.span.id`, `parent_span_id`), `startTime` - (`start_time`, `timestamp`), `endTime` (`end_time`), `durationNs` - (`duration`, in nanoseconds), `name` (`span.name`), `kind` - (`span.kind`), `statusCode` (`status.code`, `status_code`), - `statusMessage` (`status.message`, `status_message`), and - `serviceName` (`service.name`, `service_name`). Any other name is - looked up as a span attribute, falling back to a resource attribute. - With `scope` set, `name` is always treated as an attribute key. - Attribute keys may contain only letters, digits, and `.`, `_`, `-`, - `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a - trace-level sort field instead; see the ``orderBy`` field - description. Required. + `trace_id`, `span_id`, `parent_span_id`, `start_time`, `end_time`, + `duration_ns`, `name` (`span.name`), `kind` (`span.kind`), + `status_code` (`status.code`, `status_code`), `status_message`, and + `service_name` (`service.name`). Any other name is looked up as a + span attribute, falling back to a resource attribute. With `scope` + set, `name` is always treated as an attribute key. Attribute keys may + contain only letters, digits, and `.`, `_`, `-`, `/`, `:`, `@`. In + traces ``order_by``"" , ``name`` must be a trace-level sort field + instead; see the ``order_by`` field description. Required. "scope": "str" # Optional. Restricts the lookup to - one attribute map (case-insensitive). ``resource`` (or - ``resource.attributes``"" ) reads resource attributes; ``attribute`` - (or ``attributes``"" , ``span.attributes``"" ) reads span attributes. - Omit to use the built-in column mapping described for ``name``. - Ignored in traces ``orderBy``. Known values are: "resource", + one attribute map and is matched case-insensitively. + ``FIELD_SCOPE_RESOURCE`` reads resource attributes and accepts + ``resource`` or ``resource.attributes`` as aliases. + ``FIELD_SCOPE_ATTRIBUTES`` reads span attributes and accepts + ``attribute``"" , ``attributes``"" , or ``span.attributes`` as + aliases. Omit to use the built-in column mapping described for + ``name``. Ignored in traces ``order_by``. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", "resource.attributes", "attribute", "attributes", and "span.attributes". }, - "direction": "desc" # Optional. Default value is "desc". The - sort direction (case-insensitive). Defaults to ``desc``. Known values - are: "asc" and "desc". + "direction": "str" # Optional. The sort direction, matched + case-insensitively. Omit to use the server default. Known values are: + "asc" and "desc". } ], "pagination": { @@ -206578,17 +206786,17 @@ def post_traces_search( response == { "data": [ { - "traceId": "str", # The trace identifier. Required. - "durationNs": 0, # Optional. Wall-clock duration of the + "trace_id": "str", # The trace identifier. Required. + "duration_ns": 0, # Optional. Wall-clock duration of the trace in nanoseconds. - "errorCount": 0, # Optional. The number of spans in the + "error_count": 0, # Optional. The number of spans in the trace with an ``Error`` status code. Omitted when zero. - "serviceName": "str", # Optional. The service that emitted + "service_name": "str", # Optional. The service that emitted the root span. Omitted when the root span has no service.name resource attribute. - "spanCount": 0, # Optional. The number of spans in the + "span_count": 0, # Optional. The number of spans in the trace. - "spanNames": [ + "span_names": [ "str" # Optional. The distinct span names present in the trace. ], @@ -206600,7 +206808,7 @@ def post_traces_search( } ], "pagination": { - "hasMore": bool # Whether more results matched the query than were + "has_more": bool # Whether more results matched the query than were returned. Required. } } @@ -206636,9 +206844,9 @@ def post_traces_search( included when at least one of its spans matches ``filter``. The time range must not exceed 7 days (\\ ``168h``\\ ). ``pagination.limit`` defaults to 100 (also used when ``limit`` is ``0``\\ ) and must be between 0 and 1000. Results are ordered by ``started`` descending unless - ``orderBy`` is set. - JSON field names are camelCase (\\ ``timeRange``\\ , ``orderBy``\\ , ``hasMore``\\ , - ``traceId``\\ ). Unknown request properties, invalid filters, and out-of-range values are + ``order_by`` is set. + JSON field names use snake_case (\\ ``time_range``\\ , ``order_by``\\ , ``has_more``\\ , + ``trace_id``\\ ). Unknown request properties, invalid filters, and out-of-range values are rejected with ``400``. Each request searches a single region; there is no multi-region search. Supported regions are ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ , ``lon1``\\ , ``mem1``\\ , @@ -206669,17 +206877,17 @@ def post_traces_search( response == { "data": [ { - "traceId": "str", # The trace identifier. Required. - "durationNs": 0, # Optional. Wall-clock duration of the + "trace_id": "str", # The trace identifier. Required. + "duration_ns": 0, # Optional. Wall-clock duration of the trace in nanoseconds. - "errorCount": 0, # Optional. The number of spans in the + "error_count": 0, # Optional. The number of spans in the trace with an ``Error`` status code. Omitted when zero. - "serviceName": "str", # Optional. The service that emitted + "service_name": "str", # Optional. The service that emitted the root span. Omitted when the root span has no service.name resource attribute. - "spanCount": 0, # Optional. The number of spans in the + "span_count": 0, # Optional. The number of spans in the trace. - "spanNames": [ + "span_names": [ "str" # Optional. The distinct span names present in the trace. ], @@ -206691,7 +206899,7 @@ def post_traces_search( } ], "pagination": { - "hasMore": bool # Whether more results matched the query than were + "has_more": bool # Whether more results matched the query than were returned. Required. } } @@ -206722,9 +206930,9 @@ def post_traces_search( included when at least one of its spans matches ``filter``. The time range must not exceed 7 days (\\ ``168h``\\ ). ``pagination.limit`` defaults to 100 (also used when ``limit`` is ``0``\\ ) and must be between 0 and 1000. Results are ordered by ``started`` descending unless - ``orderBy`` is set. - JSON field names are camelCase (\\ ``timeRange``\\ , ``orderBy``\\ , ``hasMore``\\ , - ``traceId``\\ ). Unknown request properties, invalid filters, and out-of-range values are + ``order_by`` is set. + JSON field names use snake_case (\\ ``time_range``\\ , ``order_by``\\ , ``has_more``\\ , + ``trace_id``\\ ). Unknown request properties, invalid filters, and out-of-range values are rejected with ``400``. Each request searches a single region; there is no multi-region search. Supported regions are ``ams2``\\ , ``ams3``\\ , ``atl1``\\ , ``blr1``\\ , ``fra1``\\ , ``lon1``\\ , ``mem1``\\ , @@ -206750,7 +206958,7 @@ def post_traces_search( # JSON input template you can fill out and use as your body input. body = { - "timeRange": { + "time_range": { "from": { "absolute": "str", # Optional. An absolute timestamp, either RFC3339 (with optional fractional seconds) or a Unix epoch integer as a @@ -206775,79 +206983,100 @@ def post_traces_search( } }, "filter": { - "expressions": [ - ... - ], - "field": { - "name": "str", # The field name. Without ``scope``"" , these - names (case-insensitive) resolve to built-in span columns: `traceId` - (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`), `parentSpanId` - (`parent.span.id`, `parent_span_id`), `startTime` (`start_time`, - `timestamp`), `endTime` (`end_time`), `durationNs` (`duration`, in - nanoseconds), `name` (`span.name`), `kind` (`span.kind`), `statusCode` - (`status.code`, `status_code`), `statusMessage` (`status.message`, - `status_message`), and `serviceName` (`service.name`, `service_name`). - Any other name is looked up as a span attribute, falling back to a - resource attribute. With `scope` set, `name` is always treated as an - attribute key. Attribute keys may contain only letters, digits, and `.`, - `_`, `-`, `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a - trace-level sort field instead; see the ``orderBy`` field description. - Required. - "scope": "str" # Optional. Restricts the lookup to one - attribute map (case-insensitive). ``resource`` (or - ``resource.attributes``"" ) reads resource attributes; ``attribute`` (or - ``attributes``"" , ``span.attributes``"" ) reads span attributes. Omit to - use the built-in column mapping described for ``name``. Ignored in traces - ``orderBy``. Known values are: "resource", "resource.attributes", - "attribute", "attributes", and "span.attributes". + "and": { + "expressions": [ + ... + ] }, - "operator": "str", # Optional. The comparison operator for a - ``condition`` node. Matching is case-insensitive, and the symbol forms - ``=``"" , ``!=``"" , ``>``"" , ``>=``"" , ``<``"" , and ``<=`` are accepted - as aliases for ``eq``"" , ``neq``"" , ``gt``"" , ``gte``"" , ``lt``"" , and - ``lte``. ``exists`` matches spans where the field is present and non-empty - and ignores ``value``. ``in`` requires an array ``value`` with 1 to 100 - entries. ``neq`` on string fields also matches spans where the field is - absent. Known values are: "eq", "neq", "in", "exists", "gt", "gte", "lt", and - "lte". - "query": "str", # Optional. The search string for a ``text_search`` - node. Leading and trailing whitespace is trimmed; the trimmed string must be - non-empty. - "type": "condition", # Optional. Default value is "condition". The - node type. Matching is case-insensitive. Known values are: "condition", - "and", "or", "not", and "text_search". - "value": {} + "condition": { + "field": { + "name": "str", # The field name. Without ``scope``"" + , these names (case-insensitive) resolve to built-in span columns: + `trace_id`, `span_id`, `parent_span_id`, `start_time`, `end_time`, + `duration_ns`, `name` (`span.name`), `kind` (`span.kind`), + `status_code` (`status.code`, `status_code`), `status_message`, and + `service_name` (`service.name`). Any other name is looked up as a + span attribute, falling back to a resource attribute. With `scope` + set, `name` is always treated as an attribute key. Attribute keys may + contain only letters, digits, and `.`, `_`, `-`, `/`, `:`, `@`. In + traces ``order_by``"" , ``name`` must be a trace-level sort field + instead; see the ``order_by`` field description. Required. + "scope": "str" # Optional. Restricts the lookup to + one attribute map and is matched case-insensitively. + ``FIELD_SCOPE_RESOURCE`` reads resource attributes and accepts + ``resource`` or ``resource.attributes`` as aliases. + ``FIELD_SCOPE_ATTRIBUTES`` reads span attributes and accepts + ``attribute``"" , ``attributes``"" , or ``span.attributes`` as + aliases. Omit to use the built-in column mapping described for + ``name``. Ignored in traces ``order_by``. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", + "resource.attributes", "attribute", "attributes", and + "span.attributes". + }, + "operator": "str", # The comparison operator. Required. + Known values are: "FILTER_OPERATOR_EQ", "FILTER_OPERATOR_NEQ", + "FILTER_OPERATOR_IN", "FILTER_OPERATOR_EXISTS", "FILTER_OPERATOR_GTE", + and "FILTER_OPERATOR_LTE". + "value": { + "number_array_value": { + "values": [ + 0.0 # Required. + ] + }, + "number_value": 0.0, # Optional. A typed literal or + list value for a traces filter condition. Exactly one kind is set per + message. + "string_array_value": { + "values": [ + "str" # Required. + ] + }, + "string_value": "str" # Optional. A typed literal or + list value for a traces filter condition. Exactly one kind is set per + message. + } + }, + "not": ..., + "or": { + "expressions": [ + ... + ] + }, + "text_search": { + "query": "str" # The search string. Leading and trailing + whitespace is trimmed, and the remaining string must not be empty. + Required. + } }, - "orderBy": [ + "order_by": [ { "field": { "name": "str", # The field name. Without ``scope``"" , these names (case-insensitive) resolve to built-in span columns: - `traceId` (`trace.id`, `trace_id`), `spanId` (`span.id`, `span_id`), - `parentSpanId` (`parent.span.id`, `parent_span_id`), `startTime` - (`start_time`, `timestamp`), `endTime` (`end_time`), `durationNs` - (`duration`, in nanoseconds), `name` (`span.name`), `kind` - (`span.kind`), `statusCode` (`status.code`, `status_code`), - `statusMessage` (`status.message`, `status_message`), and - `serviceName` (`service.name`, `service_name`). Any other name is - looked up as a span attribute, falling back to a resource attribute. - With `scope` set, `name` is always treated as an attribute key. - Attribute keys may contain only letters, digits, and `.`, `_`, `-`, - `/`, `:`, `@`. In traces ``orderBy``"" , ``name`` must be a - trace-level sort field instead; see the ``orderBy`` field - description. Required. + `trace_id`, `span_id`, `parent_span_id`, `start_time`, `end_time`, + `duration_ns`, `name` (`span.name`), `kind` (`span.kind`), + `status_code` (`status.code`, `status_code`), `status_message`, and + `service_name` (`service.name`). Any other name is looked up as a + span attribute, falling back to a resource attribute. With `scope` + set, `name` is always treated as an attribute key. Attribute keys may + contain only letters, digits, and `.`, `_`, `-`, `/`, `:`, `@`. In + traces ``order_by``"" , ``name`` must be a trace-level sort field + instead; see the ``order_by`` field description. Required. "scope": "str" # Optional. Restricts the lookup to - one attribute map (case-insensitive). ``resource`` (or - ``resource.attributes``"" ) reads resource attributes; ``attribute`` - (or ``attributes``"" , ``span.attributes``"" ) reads span attributes. - Omit to use the built-in column mapping described for ``name``. - Ignored in traces ``orderBy``. Known values are: "resource", + one attribute map and is matched case-insensitively. + ``FIELD_SCOPE_RESOURCE`` reads resource attributes and accepts + ``resource`` or ``resource.attributes`` as aliases. + ``FIELD_SCOPE_ATTRIBUTES`` reads span attributes and accepts + ``attribute``"" , ``attributes``"" , or ``span.attributes`` as + aliases. Omit to use the built-in column mapping described for + ``name``. Ignored in traces ``order_by``. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", "resource.attributes", "attribute", "attributes", and "span.attributes". }, - "direction": "desc" # Optional. Default value is "desc". The - sort direction (case-insensitive). Defaults to ``desc``. Known values - are: "asc" and "desc". + "direction": "str" # Optional. The sort direction, matched + case-insensitively. Omit to use the server default. Known values are: + "asc" and "desc". } ], "pagination": { @@ -206861,17 +207090,17 @@ def post_traces_search( response == { "data": [ { - "traceId": "str", # The trace identifier. Required. - "durationNs": 0, # Optional. Wall-clock duration of the + "trace_id": "str", # The trace identifier. Required. + "duration_ns": 0, # Optional. Wall-clock duration of the trace in nanoseconds. - "errorCount": 0, # Optional. The number of spans in the + "error_count": 0, # Optional. The number of spans in the trace with an ``Error`` status code. Omitted when zero. - "serviceName": "str", # Optional. The service that emitted + "service_name": "str", # Optional. The service that emitted the root span. Omitted when the root span has no service.name resource attribute. - "spanCount": 0, # Optional. The number of spans in the + "span_count": 0, # Optional. The number of spans in the trace. - "spanNames": [ + "span_names": [ "str" # Optional. The distinct span names present in the trace. ], @@ -206883,7 +207112,7 @@ def post_traces_search( } ], "pagination": { - "hasMore": bool # Whether more results matched the query than were + "has_more": bool # Whether more results matched the query than were returned. Required. } } @@ -207088,8 +207317,9 @@ def get_trace( with ``id`` and ``message``. ``403`` is also returned for accounts that are in a trial or not in good standing. If the regional traces backend cannot be reached, the response is ``502`` with a ``text/plain`` body. - JSON field names are camelCase (\\ ``traceId``\\ , ``spanId``\\ , ``startTime``\\ , - ``endTime``\\ , ``durationNs``\\ , ``serviceName``\\ , ``statusCode``\\ , ``parentSpanId``\\ ). + JSON field names use snake_case (\\ ``trace_id``\\ , ``span_id``\\ , ``start_time``\\ , + ``end_time``\\ , ``duration_ns``\\ , ``service_name``\\ , ``status_code``\\ , + ``parent_span_id``\\ ). :param region: The datacenter region slug for the query. Required. :type region: str @@ -207117,37 +207347,37 @@ def get_trace( response == { "spans": [ { - "spanId": "str", # The span identifier. Required. - "traceId": "str", # The trace this span belongs to. + "span_id": "str", # The span identifier. Required. + "trace_id": "str", # The trace this span belongs to. Required. "attributes": { "str": "str" # Optional. Span attributes. Omitted when empty. }, - "durationNs": 0, # Optional. Span duration in nanoseconds. - "endTime": "2020-02-20 00:00:00", # Optional. The span end + "duration_ns": 0, # Optional. Span duration in nanoseconds. + "end_time": "2020-02-20 00:00:00", # Optional. The span end time. "kind": "str", # Optional. The OpenTelemetry span kind as a string, for example ``Server``"" , ``Client``"" , or ``Internal``. "name": "str", # Optional. The span name, typically the operation being performed. - "parentSpanId": "str", # Optional. The parent span + "parent_span_id": "str", # Optional. The parent span identifier. Omitted for the root span. "resource": { "str": "str" # Optional. Resource attributes associated with the span. }, - "serviceName": "str", # Optional. The service that emitted + "service_name": "str", # Optional. The service that emitted the span. Omitted when the span has no service.name resource attribute. - "startTime": "2020-02-20 00:00:00", # Optional. The span + "start_time": "2020-02-20 00:00:00", # Optional. The span start time. - "statusCode": "str", # Optional. The OpenTelemetry span + "status_code": "str", # Optional. The OpenTelemetry span status code as a string: ``Unset``"" , ``Ok``"" , or ``Error``. - "statusMessage": "str" # Optional. The status description. + "status_message": "str" # Optional. The status description. Omitted when empty. } ], - "traceId": "str", # Optional. The trace identifier. + "trace_id": "str", # Optional. The trace identifier. "truncated": bool # Optional. True when the trace has more spans than were returned in this response. Omitted when false. } @@ -207324,9 +207554,9 @@ def post_spans_search( ``/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. + 1 and 1000. Results are ordered by ``start_time`` descending by default. Cursor-based + pagination is not yet supported; ``pagination.has_more`` indicates whether additional spans + matched beyond the returned page. :param region: The datacenter region slug for the query. Required. :type region: str @@ -207344,7 +207574,7 @@ def post_spans_search( # JSON input template you can fill out and use as your body input. body = { - "timeRange": { + "time_range": { "from": { "absolute": "str", # Optional. An absolute timestamp. Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds, @@ -207365,46 +207595,88 @@ def post_spans_search( } }, "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". + "and": { + "expressions": [ + ... + ] }, - "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": {} + "condition": { + "field": { + "name": "str", # The field name. Well-known span + fields include ``trace_id``"" , ``span_id``"" , ``parent_span_id``"" + , ``start_time``"" , ``end_time``"" , ``duration_ns``"" , ``name``"" + , ``service_name``"" , ``kind``"" , ``status_code``"" , and + ``status_message``. Any other value is treated as a span or resource + attribute key. Required. + "scope": "str" # Optional. Optional attribute scope, + matched case-insensitively. Use ``FIELD_SCOPE_RESOURCE`` to match a + resource attribute or ``FIELD_SCOPE_ATTRIBUTES`` to match a span + attribute. The aliases ``resource`` and ``resource.attributes`` are + accepted for resource attributes; ``attribute``"" , ``attributes``"" + , and ``span.attributes`` are accepted for span attributes. Omit for + well-known fields or to search both attribute maps. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", + "resource.attributes", "attribute", "attributes", and + "span.attributes". + }, + "operator": "str", # The comparison operator. Required. + Known values are: "FILTER_OPERATOR_EQ", "FILTER_OPERATOR_NEQ", + "FILTER_OPERATOR_IN", "FILTER_OPERATOR_EXISTS", "FILTER_OPERATOR_GTE", + and "FILTER_OPERATOR_LTE". + "value": { + "number_array_value": { + "values": [ + 0.0 # Required. + ] + }, + "number_value": 0.0, # Optional. A typed literal or + list value for a spans filter condition. Exactly one kind is set per + message. + "string_array_value": { + "values": [ + "str" # Required. + ] + }, + "string_value": "str" # Optional. A typed literal or + list value for a spans filter condition. Exactly one kind is set per + message. + } + }, + "not": ..., + "or": { + "expressions": [ + ... + ] + }, + "text_search": { + "query": "str" # The search string. Leading and trailing + whitespace is trimmed, and the remaining string must not be empty. + Required. + } }, - "orderBy": [ + "order_by": [ { "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 + fields include ``trace_id``"" , ``span_id``"" , ``parent_span_id``"" + , ``start_time``"" , ``end_time``"" , ``duration_ns``"" , ``name``"" + , ``service_name``"" , ``kind``"" , ``status_code``"" , and + ``status_message``. 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". + "scope": "str" # Optional. Optional attribute scope, + matched case-insensitively. Use ``FIELD_SCOPE_RESOURCE`` to match a + resource attribute or ``FIELD_SCOPE_ATTRIBUTES`` to match a span + attribute. The aliases ``resource`` and ``resource.attributes`` are + accepted for resource attributes; ``attribute``"" , ``attributes``"" + , and ``span.attributes`` are accepted for span attributes. Omit for + well-known fields or to search both attribute maps. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", + "resource.attributes", "attribute", "attributes", and + "span.attributes". }, - "direction": "str" # Optional. The sort direction. Defaults - to ``desc`` when omitted. Known values are: "asc" and "desc". + "direction": "str" # Optional. The sort direction, matched + case-insensitively. Omit to use the server default. Known values are: + "asc" and "desc". } ], "pagination": { @@ -207420,13 +207692,13 @@ def post_spans_search( "attributes": { "str": "str" # Optional. Span attributes. }, - "durationNs": 0, # Optional. The span duration in + "duration_ns": 0, # Optional. The span duration in nanoseconds. - "endTime": "2020-02-20 00:00:00", # Optional. The span end + "end_time": "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 + "parent_span_id": "str", # Optional. The parent span identifier. Omitted for root spans. "region": "str", # Optional. The datacenter region slug the span was queried from. @@ -207434,20 +207706,20 @@ def post_spans_search( "str": "str" # Optional. Resource attributes associated with the span. }, - "serviceName": "str", # Optional. The name of the service + "service_name": "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 + "span_id": "str", # Optional. The span identifier. + "start_time": "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 + "status_code": "str", # Optional. The span status code. + "status_message": "str", # Optional. The span status + message. Omitted when empty. + "trace_id": "str" # Optional. The trace identifier the span belongs to. } ], "pagination": { - "hasMore": bool # Optional. Whether more spans matched than were + "has_more": bool # Optional. Whether more spans matched than were returned in this page. Cursor-based continuation is not yet supported. } } @@ -207480,9 +207752,9 @@ def post_spans_search( ``/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. + 1 and 1000. Results are ordered by ``start_time`` descending by default. Cursor-based + pagination is not yet supported; ``pagination.has_more`` indicates whether additional spans + matched beyond the returned page. :param region: The datacenter region slug for the query. Required. :type region: str @@ -207505,13 +207777,13 @@ def post_spans_search( "attributes": { "str": "str" # Optional. Span attributes. }, - "durationNs": 0, # Optional. The span duration in + "duration_ns": 0, # Optional. The span duration in nanoseconds. - "endTime": "2020-02-20 00:00:00", # Optional. The span end + "end_time": "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 + "parent_span_id": "str", # Optional. The parent span identifier. Omitted for root spans. "region": "str", # Optional. The datacenter region slug the span was queried from. @@ -207519,20 +207791,20 @@ def post_spans_search( "str": "str" # Optional. Resource attributes associated with the span. }, - "serviceName": "str", # Optional. The name of the service + "service_name": "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 + "span_id": "str", # Optional. The span identifier. + "start_time": "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 + "status_code": "str", # Optional. The span status code. + "status_message": "str", # Optional. The span status + message. Omitted when empty. + "trace_id": "str" # Optional. The trace identifier the span belongs to. } ], "pagination": { - "hasMore": bool # Optional. Whether more spans matched than were + "has_more": bool # Optional. Whether more spans matched than were returned in this page. Cursor-based continuation is not yet supported. } } @@ -207560,9 +207832,9 @@ def post_spans_search( ``/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. + 1 and 1000. Results are ordered by ``start_time`` descending by default. Cursor-based + pagination is not yet supported; ``pagination.has_more`` indicates whether additional spans + matched beyond the returned page. :param region: The datacenter region slug for the query. Required. :type region: str @@ -207577,7 +207849,7 @@ def post_spans_search( # JSON input template you can fill out and use as your body input. body = { - "timeRange": { + "time_range": { "from": { "absolute": "str", # Optional. An absolute timestamp. Accepts an RFC3339/RFC3339Nano string or a Unix timestamp (seconds, @@ -207598,46 +207870,88 @@ def post_spans_search( } }, "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". + "and": { + "expressions": [ + ... + ] }, - "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": {} + "condition": { + "field": { + "name": "str", # The field name. Well-known span + fields include ``trace_id``"" , ``span_id``"" , ``parent_span_id``"" + , ``start_time``"" , ``end_time``"" , ``duration_ns``"" , ``name``"" + , ``service_name``"" , ``kind``"" , ``status_code``"" , and + ``status_message``. Any other value is treated as a span or resource + attribute key. Required. + "scope": "str" # Optional. Optional attribute scope, + matched case-insensitively. Use ``FIELD_SCOPE_RESOURCE`` to match a + resource attribute or ``FIELD_SCOPE_ATTRIBUTES`` to match a span + attribute. The aliases ``resource`` and ``resource.attributes`` are + accepted for resource attributes; ``attribute``"" , ``attributes``"" + , and ``span.attributes`` are accepted for span attributes. Omit for + well-known fields or to search both attribute maps. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", + "resource.attributes", "attribute", "attributes", and + "span.attributes". + }, + "operator": "str", # The comparison operator. Required. + Known values are: "FILTER_OPERATOR_EQ", "FILTER_OPERATOR_NEQ", + "FILTER_OPERATOR_IN", "FILTER_OPERATOR_EXISTS", "FILTER_OPERATOR_GTE", + and "FILTER_OPERATOR_LTE". + "value": { + "number_array_value": { + "values": [ + 0.0 # Required. + ] + }, + "number_value": 0.0, # Optional. A typed literal or + list value for a spans filter condition. Exactly one kind is set per + message. + "string_array_value": { + "values": [ + "str" # Required. + ] + }, + "string_value": "str" # Optional. A typed literal or + list value for a spans filter condition. Exactly one kind is set per + message. + } + }, + "not": ..., + "or": { + "expressions": [ + ... + ] + }, + "text_search": { + "query": "str" # The search string. Leading and trailing + whitespace is trimmed, and the remaining string must not be empty. + Required. + } }, - "orderBy": [ + "order_by": [ { "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 + fields include ``trace_id``"" , ``span_id``"" , ``parent_span_id``"" + , ``start_time``"" , ``end_time``"" , ``duration_ns``"" , ``name``"" + , ``service_name``"" , ``kind``"" , ``status_code``"" , and + ``status_message``. 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". + "scope": "str" # Optional. Optional attribute scope, + matched case-insensitively. Use ``FIELD_SCOPE_RESOURCE`` to match a + resource attribute or ``FIELD_SCOPE_ATTRIBUTES`` to match a span + attribute. The aliases ``resource`` and ``resource.attributes`` are + accepted for resource attributes; ``attribute``"" , ``attributes``"" + , and ``span.attributes`` are accepted for span attributes. Omit for + well-known fields or to search both attribute maps. Known values are: + "FIELD_SCOPE_RESOURCE", "FIELD_SCOPE_ATTRIBUTES", "resource", + "resource.attributes", "attribute", "attributes", and + "span.attributes". }, - "direction": "str" # Optional. The sort direction. Defaults - to ``desc`` when omitted. Known values are: "asc" and "desc". + "direction": "str" # Optional. The sort direction, matched + case-insensitively. Omit to use the server default. Known values are: + "asc" and "desc". } ], "pagination": { @@ -207653,13 +207967,13 @@ def post_spans_search( "attributes": { "str": "str" # Optional. Span attributes. }, - "durationNs": 0, # Optional. The span duration in + "duration_ns": 0, # Optional. The span duration in nanoseconds. - "endTime": "2020-02-20 00:00:00", # Optional. The span end + "end_time": "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 + "parent_span_id": "str", # Optional. The parent span identifier. Omitted for root spans. "region": "str", # Optional. The datacenter region slug the span was queried from. @@ -207667,20 +207981,20 @@ def post_spans_search( "str": "str" # Optional. Resource attributes associated with the span. }, - "serviceName": "str", # Optional. The name of the service + "service_name": "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 + "span_id": "str", # Optional. The span identifier. + "start_time": "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 + "status_code": "str", # Optional. The span status code. + "status_message": "str", # Optional. The span status + message. Omitted when empty. + "trace_id": "str" # Optional. The trace identifier the span belongs to. } ], "pagination": { - "hasMore": bool # Optional. Whether more spans matched than were + "has_more": bool # Optional. Whether more spans matched than were returned in this page. Cursor-based continuation is not yet supported. } } @@ -207820,45 +208134,205 @@ def post_spans_search( return cast(JSON, deserialized) # type: ignore + @distributed_trace + def list_resources( + self, + *, + filter_product_types: Optional[List[str]] = None, + filter_regions: Optional[List[str]] = None, + pagination_page: int = 1, + pagination_per_page: int = 20, + pagination_sort: Optional[str] = None, + pagination_sort_direction: Optional[str] = None, + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """List Resource Signal Enablement. -class SignalsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + To list the resources in your account that have telemetry signal enablement + recorded, along with the current state of their metrics, logs, and traces + signals, send a GET request to ``/v2/insights/resources``. - Instead, you should access the following operations through - :class:`~pydo.GeneratedClient`'s - :attr:`signals` attribute. - """ + Results are paginated with ``pagination.page`` and ``pagination.per_page`` + (default ``20``\\ , maximum ``200``\\ ) and can be sorted with ``pagination.sort`` and + ``pagination.sort_direction``. Optionally filter by ``filter.product_types`` and + ``filter.regions``. - 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") + A signal is omitted from a resource when no explicit enablement has ever been + recorded for it. + + :keyword filter_product_types: Optional filter. When set, only resources of these product types + are returned. Repeat the parameter for multiple product types. Default value is None. + :paramtype filter_product_types: list[str] + :keyword filter_regions: Optional filter. When set, only resources in these regions are + returned. Repeat the parameter for multiple regions. Default value is None. + :paramtype filter_regions: list[str] + :keyword pagination_page: Which 'page' of paginated results to return. Default value is 1. + :paramtype pagination_page: int + :keyword pagination_per_page: Number of items returned per page. Default value is 20. + :paramtype pagination_per_page: int + :keyword pagination_sort: Field to sort by. Defaults to ``resource_urn``. Known values are: + "resource_urn" and "effective_at". Default value is None. + :paramtype pagination_sort: str + :keyword pagination_sort_direction: Sort direction. Defaults to ``asc``. Known values are: + "asc" and "desc". Default value is None. + :paramtype pagination_sort_direction: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "pagination": { + "page": 0, # Optional. The current page number. + "pages": 0, # Optional. The total number of pages. Omitted when + there are no results. + "per_page": 0, # Optional. The number of items per page. + "total": 0 # Optional. The total number of resources across all + pages. Omitted when there are no results. + }, + "resources": [ + { + "product_type": "str", # The product type of the resource, + for example ``droplet`` or ``kubernetes``. Required. + "resource_urn": "str", # The uniform resource name (URN) of + the resource. Required. + "logs": { + "effective_at": "2020-02-20 00:00:00", # Optional. + When this signal state last changed. + "enabled": bool # Optional. Whether the signal is + enabled for the resource. + }, + "metrics": { + "effective_at": "2020-02-20 00:00:00", # Optional. + When this signal state last changed. + "enabled": bool # Optional. Whether the signal is + enabled for the resource. + }, + "region": "str", # Optional. The region slug for + region-specific resources. Omitted when the resource has no region. + "traces": { + "effective_at": "2020-02-20 00:00:00", # Optional. + When this signal state last changed. + "enabled": bool # Optional. Whether the signal is + enabled for the resource. + } + } + ] + } + # response body for status code(s): 400 + 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_insights_list_resources_request( + filter_product_types=filter_product_types, + filter_regions=filter_regions, + pagination_page=pagination_page, + pagination_per_page=pagination_per_page, + pagination_sort=pagination_sort, + pagination_sort_direction=pagination_sort_direction, + 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]: + 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 cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore @distributed_trace - def list_consents(self, *, source: Optional[str] = None, **kwargs: Any) -> JSON: + def get_resource(self, resource_urn: str, **kwargs: Any) -> JSON: # pylint: disable=line-too-long - """List All Consent Records. + """Retrieve Resource Signal Enablement. - 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 source: per-environment records (\\ ``source: agent``\\ ) for Harness Runtime, and - the team-level record (\\ ``source: inference``\\ ) for Serverless Inference chat - completions. + To retrieve the current metrics, logs, and traces signal enablement for a + single resource, send a GET request to + ``/v2/insights/resources/{resource_urn}``. - Pass ``?source=agent`` or ``?source=inference`` to return only that source's - records. When filtered, the response also echoes the ``source``. + A ``404`` is returned when no signal enablement has been recorded for the + resource. - :keyword source: Filter consent records by source. ``agent`` returns per-environment records - (Harness Runtime); ``inference`` returns the team-level record for Serverless Inference chat - completions. When omitted, records for all sources are returned. Known values are: "agent" and - "inference". Default value is None. - :paramtype source: str + :param resource_urn: The uniform resource name (URN) of the resource, for example + ``do:droplet:12345``. Required. + :type resource_urn: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -207868,31 +208342,34 @@ def list_consents(self, *, source: Optional[str] = None, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == { - "consents": [ - { - "agent_id": "str", # The unique identifier of the - environment. For Harness Runtime, this is the Environment Config ID. - Empty for team-level records ("" ``source: inference``"" ), which are not - tied to an environment. Required. - "enabled": bool, # Whether signals collection is enabled for - this source. Required. - "id": 0, # The unique numeric identifier for the consent - record. Required. - "source": "str", # The source this consent applies to. - ``agent`` is per-environment consent for Harness Runtime; ``inference`` - is team-level consent for Serverless Inference chat completions. - Required. Known values are: "agent" and "inference". - "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. + "resource": { + "product_type": "str", # The product type of the resource, for + example ``droplet`` or ``kubernetes``. Required. + "resource_urn": "str", # The uniform resource name (URN) of the + resource. Required. + "logs": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "metrics": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "region": "str", # Optional. The region slug for region-specific + resources. Omitted when the resource has no region. + "traces": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. } - ], - "source": "str" # Optional. Echoes the ``source`` filter when the request - was filtered by source. Omitted when the list was not filtered. Known values are: - "agent" and "inference". + } } - # response body for status code(s): 400 + # response body for status code(s): 400, 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 @@ -207922,8 +208399,8 @@ def list_consents(self, *, source: Optional[str] = None, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_signals_list_consents_request( - source=source, + _request = build_insights_get_resource_request( + resource_urn=resource_urn, headers=_headers, params=_params, ) @@ -207938,7 +208415,7 @@ def list_consents(self, *, source: Optional[str] = None, **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200, 400]: + if response.status_code not in [200, 400, 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 @@ -207977,40 +208454,57 @@ def list_consents(self, *, source: Optional[str] = None, **kwargs: Any) -> 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_team_consent( + def update_resource_signals( self, + resource_urn: str, body: JSON, *, - source: str, content_type: str = "application/json", **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Update Team-Level Consent. + """Update Resource Signal Enablement. - To enable or disable signals collection for a source that is consented at - the team level, send a PUT request to ``/v1/consent?source=inference`` with - an ``enabled`` boolean in the request body. Currently the only team-level - source is ``inference``\\ , which covers Serverless Inference chat completions - made by your team. + To enable or disable telemetry signals for a resource, send a PUT request to + ``/v2/insights/resources/{resource_urn}/signals``. - To revoke consent, send the same request with ``enabled`` set to ``false``. - The ``source`` query parameter is required. Per-environment consent for Harness - Runtime environments is managed with ``PUT /v1/consent/{agent_id}`` instead. + This endpoint uses merge semantics. Set ``metrics``\\ , ``logs``\\ , or ``traces`` to + ``true`` or ``false`` to change that signal; omit a signal to leave it unchanged. + At least one signal must be set. + + ``region`` is only used when the resource has no existing enablement. On later + updates, omit it or send the stored value; changing the region is rejected + with a ``400``. + Requires both the ``insights:update`` and ``insights:create`` scopes. + + :param resource_urn: The uniform resource name (URN) of the resource, for example + ``do:droplet:12345``. Required. + :type resource_urn: str :param body: Required. :type body: JSON - :keyword source: The consent source to update. Only team-level sources are accepted on this - endpoint; currently ``inference`` (Serverless Inference chat completions). Per-environment - consent (\\ ``agent``\\ ) is managed with ``PUT /v1/consent/{agent_id}`` instead. "inference" - Required. - :paramtype source: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -208023,31 +208517,47 @@ def update_team_consent( # JSON input template you can fill out and use as your body input. body = { - "enabled": bool # Whether to enable signals collection for this source. - Required. + "logs": bool, # Optional. Enable or disable the logs signal. Omit to leave + unchanged. + "metrics": bool, # Optional. Enable or disable the metrics signal. Omit to + leave unchanged. + "region": "str", # Optional. The region slug for region-specific resources. + Only used when the resource has no existing enablement. On later updates, omit it + or send the stored value; changing the region is rejected. + "traces": bool # Optional. Enable or disable the traces signal. Omit to + leave unchanged. } # response body for status code(s): 200 response == { - "consent": { - "agent_id": "str", # The unique identifier of the environment. For - Harness Runtime, this is the Environment Config ID. Empty for team-level - records ("" ``source: inference``"" ), which are not tied to an environment. - Required. - "enabled": bool, # Whether signals collection is enabled for this - source. Required. - "id": 0, # The unique numeric identifier for the consent record. - Required. - "source": "str", # The source this consent applies to. ``agent`` is - per-environment consent for Harness Runtime; ``inference`` is team-level - consent for Serverless Inference chat completions. Required. Known values - are: "agent" and "inference". - "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. + "resource": { + "product_type": "str", # The product type of the resource, for + example ``droplet`` or ``kubernetes``. Required. + "resource_urn": "str", # The uniform resource name (URN) of the + resource. Required. + "logs": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "metrics": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "region": "str", # Optional. The region slug for region-specific + resources. Omitted when the resource has no region. + "traces": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + } } } - # response body for status code(s): 400 + # response body for status code(s): 400, 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 @@ -208061,34 +208571,35 @@ def update_team_consent( """ @overload - def update_team_consent( + def update_resource_signals( self, + resource_urn: str, body: IO[bytes], *, - source: str, content_type: str = "application/json", **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Update Team-Level Consent. + """Update Resource Signal Enablement. - To enable or disable signals collection for a source that is consented at - the team level, send a PUT request to ``/v1/consent?source=inference`` with - an ``enabled`` boolean in the request body. Currently the only team-level - source is ``inference``\\ , which covers Serverless Inference chat completions - made by your team. + To enable or disable telemetry signals for a resource, send a PUT request to + ``/v2/insights/resources/{resource_urn}/signals``. - To revoke consent, send the same request with ``enabled`` set to ``false``. - The ``source`` query parameter is required. Per-environment consent for Harness - Runtime environments is managed with ``PUT /v1/consent/{agent_id}`` instead. + This endpoint uses merge semantics. Set ``metrics``\\ , ``logs``\\ , or ``traces`` to + ``true`` or ``false`` to change that signal; omit a signal to leave it unchanged. + At least one signal must be set. + + ``region`` is only used when the resource has no existing enablement. On later + updates, omit it or send the stored value; changing the region is rejected + with a ``400``. + + Requires both the ``insights:update`` and ``insights:create`` scopes. + :param resource_urn: The uniform resource name (URN) of the resource, for example + ``do:droplet:12345``. Required. + :type resource_urn: str :param body: Required. :type body: IO[bytes] - :keyword source: The consent source to update. Only team-level sources are accepted on this - endpoint; currently ``inference`` (Serverless Inference chat completions). Per-environment - consent (\\ ``agent``\\ ) is managed with ``PUT /v1/consent/{agent_id}`` instead. "inference" - Required. - :paramtype source: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -208101,25 +208612,34 @@ def update_team_consent( # response body for status code(s): 200 response == { - "consent": { - "agent_id": "str", # The unique identifier of the environment. For - Harness Runtime, this is the Environment Config ID. Empty for team-level - records ("" ``source: inference``"" ), which are not tied to an environment. - Required. - "enabled": bool, # Whether signals collection is enabled for this - source. Required. - "id": 0, # The unique numeric identifier for the consent record. - Required. - "source": "str", # The source this consent applies to. ``agent`` is - per-environment consent for Harness Runtime; ``inference`` is team-level - consent for Serverless Inference chat completions. Required. Known values - are: "agent" and "inference". - "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. + "resource": { + "product_type": "str", # The product type of the resource, for + example ``droplet`` or ``kubernetes``. Required. + "resource_urn": "str", # The uniform resource name (URN) of the + resource. Required. + "logs": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "metrics": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "region": "str", # Optional. The region slug for region-specific + resources. Omitted when the resource has no region. + "traces": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + } } } - # response body for status code(s): 400 + # response body for status code(s): 400, 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 @@ -208133,29 +208653,30 @@ def update_team_consent( """ @distributed_trace - def update_team_consent( - self, body: Union[JSON, IO[bytes]], *, source: str, **kwargs: Any + def update_resource_signals( + self, resource_urn: str, body: Union[JSON, IO[bytes]], **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Update Team-Level Consent. + """Update Resource Signal Enablement. - To enable or disable signals collection for a source that is consented at - the team level, send a PUT request to ``/v1/consent?source=inference`` with - an ``enabled`` boolean in the request body. Currently the only team-level - source is ``inference``\\ , which covers Serverless Inference chat completions - made by your team. + To enable or disable telemetry signals for a resource, send a PUT request to + ``/v2/insights/resources/{resource_urn}/signals``. - To revoke consent, send the same request with ``enabled`` set to ``false``. - The ``source`` query parameter is required. Per-environment consent for Harness - Runtime environments is managed with ``PUT /v1/consent/{agent_id}`` instead. + This endpoint uses merge semantics. Set ``metrics``\\ , ``logs``\\ , or ``traces`` to + ``true`` or ``false`` to change that signal; omit a signal to leave it unchanged. + At least one signal must be set. + + ``region`` is only used when the resource has no existing enablement. On later + updates, omit it or send the stored value; changing the region is rejected + with a ``400``. + + Requires both the ``insights:update`` and ``insights:create`` scopes. + :param resource_urn: The uniform resource name (URN) of the resource, for example + ``do:droplet:12345``. Required. + :type resource_urn: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword source: The consent source to update. Only team-level sources are accepted on this - endpoint; currently ``inference`` (Serverless Inference chat completions). Per-environment - consent (\\ ``agent``\\ ) is managed with ``PUT /v1/consent/{agent_id}`` instead. "inference" - Required. - :paramtype source: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -208165,31 +208686,47 @@ def update_team_consent( # JSON input template you can fill out and use as your body input. body = { - "enabled": bool # Whether to enable signals collection for this source. - Required. + "logs": bool, # Optional. Enable or disable the logs signal. Omit to leave + unchanged. + "metrics": bool, # Optional. Enable or disable the metrics signal. Omit to + leave unchanged. + "region": "str", # Optional. The region slug for region-specific resources. + Only used when the resource has no existing enablement. On later updates, omit it + or send the stored value; changing the region is rejected. + "traces": bool # Optional. Enable or disable the traces signal. Omit to + leave unchanged. } # response body for status code(s): 200 response == { - "consent": { - "agent_id": "str", # The unique identifier of the environment. For - Harness Runtime, this is the Environment Config ID. Empty for team-level - records ("" ``source: inference``"" ), which are not tied to an environment. - Required. - "enabled": bool, # Whether signals collection is enabled for this - source. Required. - "id": 0, # The unique numeric identifier for the consent record. - Required. - "source": "str", # The source this consent applies to. ``agent`` is - per-environment consent for Harness Runtime; ``inference`` is team-level - consent for Serverless Inference chat completions. Required. Known values - are: "agent" and "inference". - "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. + "resource": { + "product_type": "str", # The product type of the resource, for + example ``droplet`` or ``kubernetes``. Required. + "resource_urn": "str", # The uniform resource name (URN) of the + resource. Required. + "logs": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "metrics": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + }, + "region": "str", # Optional. The region slug for region-specific + resources. Omitted when the resource has no region. + "traces": { + "effective_at": "2020-02-20 00:00:00", # Optional. When this + signal state last changed. + "enabled": bool # Optional. Whether the signal is enabled + for the resource. + } } } - # response body for status code(s): 400 + # response body for status code(s): 400, 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 @@ -208230,8 +208767,8 @@ def update_team_consent( else: _json = body - _request = build_signals_update_team_consent_request( - source=source, + _request = build_insights_update_resource_signals_request( + resource_urn=resource_urn, content_type=content_type, json=_json, content=_content, @@ -208249,7 +208786,496 @@ def update_team_consent( response = pipeline_response.http_response - if response.status_code not in [200, 400]: + if response.status_code not in [200, 400, 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 == 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, *, source: Optional[str] = None, **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 source: per-environment records (\\ ``source: agent``\\ ) for Harness Runtime, and + the team-level record (\\ ``source: inference``\\ ) for Serverless Inference chat + completions. + + Pass ``?source=agent`` or ``?source=inference`` to return only that source's + records. When filtered, the response also echoes the ``source``. + + :keyword source: Filter consent records by source. ``agent`` returns per-environment records + (Harness Runtime); ``inference`` returns the team-level record for Serverless Inference chat + completions. When omitted, records for all sources are returned. Known values are: "agent" and + "inference". Default value is None. + :paramtype source: str + :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 + environment. For Harness Runtime, this is the Environment Config ID. + Empty for team-level records ("" ``source: inference``"" ), which are not + tied to an environment. Required. + "enabled": bool, # Whether signals collection is enabled for + this source. Required. + "id": 0, # The unique numeric identifier for the consent + record. Required. + "source": "str", # The source this consent applies to. + ``agent`` is per-environment consent for Harness Runtime; ``inference`` + is team-level consent for Serverless Inference chat completions. + Required. Known values are: "agent" and "inference". + "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. + } + ], + "source": "str" # Optional. Echoes the ``source`` filter when the request + was filtered by source. Omitted when the list was not filtered. Known values are: + "agent" and "inference". + } + # response body for status code(s): 400 + 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_consents_request( + source=source, + 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]: + 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 cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + def update_team_consent( + self, + body: JSON, + *, + source: str, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Update Team-Level Consent. + + To enable or disable signals collection for a source that is consented at + the team level, send a PUT request to ``/v1/consent?source=inference`` with + an ``enabled`` boolean in the request body. Currently the only team-level + source is ``inference``\\ , which covers Serverless Inference chat completions + made by your team. + + To revoke consent, send the same request with ``enabled`` set to ``false``. + The ``source`` query parameter is required. Per-environment consent for Harness + Runtime environments is managed with ``PUT /v1/consent/{agent_id}`` instead. + + :param body: Required. + :type body: JSON + :keyword source: The consent source to update. Only team-level sources are accepted on this + endpoint; currently ``inference`` (Serverless Inference chat completions). Per-environment + consent (\\ ``agent``\\ ) is managed with ``PUT /v1/consent/{agent_id}`` instead. "inference" + Required. + :paramtype source: str + :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 source. + Required. + } + + # response body for status code(s): 200 + response == { + "consent": { + "agent_id": "str", # The unique identifier of the environment. For + Harness Runtime, this is the Environment Config ID. Empty for team-level + records ("" ``source: inference``"" ), which are not tied to an environment. + Required. + "enabled": bool, # Whether signals collection is enabled for this + source. Required. + "id": 0, # The unique numeric identifier for the consent record. + Required. + "source": "str", # The source this consent applies to. ``agent`` is + per-environment consent for Harness Runtime; ``inference`` is team-level + consent for Serverless Inference chat completions. Required. Known values + are: "agent" and "inference". + "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): 400 + 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_team_consent( + self, + body: IO[bytes], + *, + source: str, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Update Team-Level Consent. + + To enable or disable signals collection for a source that is consented at + the team level, send a PUT request to ``/v1/consent?source=inference`` with + an ``enabled`` boolean in the request body. Currently the only team-level + source is ``inference``\\ , which covers Serverless Inference chat completions + made by your team. + + To revoke consent, send the same request with ``enabled`` set to ``false``. + The ``source`` query parameter is required. Per-environment consent for Harness + Runtime environments is managed with ``PUT /v1/consent/{agent_id}`` instead. + + :param body: Required. + :type body: IO[bytes] + :keyword source: The consent source to update. Only team-level sources are accepted on this + endpoint; currently ``inference`` (Serverless Inference chat completions). Per-environment + consent (\\ ``agent``\\ ) is managed with ``PUT /v1/consent/{agent_id}`` instead. "inference" + Required. + :paramtype source: str + :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 environment. For + Harness Runtime, this is the Environment Config ID. Empty for team-level + records ("" ``source: inference``"" ), which are not tied to an environment. + Required. + "enabled": bool, # Whether signals collection is enabled for this + source. Required. + "id": 0, # The unique numeric identifier for the consent record. + Required. + "source": "str", # The source this consent applies to. ``agent`` is + per-environment consent for Harness Runtime; ``inference`` is team-level + consent for Serverless Inference chat completions. Required. Known values + are: "agent" and "inference". + "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): 400 + 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_team_consent( + self, body: Union[JSON, IO[bytes]], *, source: str, **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Update Team-Level Consent. + + To enable or disable signals collection for a source that is consented at + the team level, send a PUT request to ``/v1/consent?source=inference`` with + an ``enabled`` boolean in the request body. Currently the only team-level + source is ``inference``\\ , which covers Serverless Inference chat completions + made by your team. + + To revoke consent, send the same request with ``enabled`` set to ``false``. + The ``source`` query parameter is required. Per-environment consent for Harness + Runtime environments is managed with ``PUT /v1/consent/{agent_id}`` instead. + + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword source: The consent source to update. Only team-level sources are accepted on this + endpoint; currently ``inference`` (Serverless Inference chat completions). Per-environment + consent (\\ ``agent``\\ ) is managed with ``PUT /v1/consent/{agent_id}`` instead. "inference" + Required. + :paramtype source: 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 source. + Required. + } + + # response body for status code(s): 200 + response == { + "consent": { + "agent_id": "str", # The unique identifier of the environment. For + Harness Runtime, this is the Environment Config ID. Empty for team-level + records ("" ``source: inference``"" ), which are not tied to an environment. + Required. + "enabled": bool, # Whether signals collection is enabled for this + source. Required. + "id": 0, # The unique numeric identifier for the consent record. + Required. + "source": "str", # The source this consent applies to. ``agent`` is + per-environment consent for Harness Runtime; ``inference`` is team-level + consent for Serverless Inference chat completions. Required. Known values + are: "agent" and "inference". + "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): 400 + 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_team_consent_request( + source=source, + 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]: 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 @@ -363044,6 +364070,655 @@ def create_async_invoke(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JS return cast(JSON, deserialized) # type: ignore + @overload + def create_speech( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> Union[JSON, Iterator[bytes]]: + # pylint: disable=line-too-long + """Generate speech from text. + + Convert text input to speech audio. The response may be raw audio bytes (\\ ``audio/mpeg``\\ , + ``audio/wav``\\ , and similar) or a JSON envelope with base64-encoded audio in + ``data[].b64_json``. + + :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 or Iterator[bytes] + :rtype: JSON or Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "input": "str", # The text to convert to speech. Required. + "model": "str", # The text-to-speech model to use. Required. + "instructions": "str", # Optional. Optional style or delivery instructions + for the synthesizer. + "response_format": "str", # Optional. The audio format to return. Supported + values include ``mp3`` and ``wav``. The API may return raw audio bytes or a JSON + envelope with base64-encoded audio. + "voice": "str" # Optional. The voice to use for synthesis. + } + + # response body for status code(s): 200 + response == { + "data": [ + { + "b64_json": "str" # Base64-encoded audio bytes. Required. + } + ], + "created": 0 # Optional. Unix timestamp (in seconds) of when the audio was + created. + } + """ + + @overload + def create_speech( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> Union[JSON, Iterator[bytes]]: + """Generate speech from text. + + Convert text input to speech audio. The response may be raw audio bytes (\\ ``audio/mpeg``\\ , + ``audio/wav``\\ , and similar) or a JSON envelope with base64-encoded audio in + ``data[].b64_json``. + + :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 or Iterator[bytes] + :rtype: JSON or Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "data": [ + { + "b64_json": "str" # Base64-encoded audio bytes. Required. + } + ], + "created": 0 # Optional. Unix timestamp (in seconds) of when the audio was + created. + } + """ + + @distributed_trace + def create_speech( + self, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> Union[JSON, Iterator[bytes]]: + # pylint: disable=line-too-long + """Generate speech from text. + + Convert text input to speech audio. The response may be raw audio bytes (\\ ``audio/mpeg``\\ , + ``audio/wav``\\ , and similar) or a JSON envelope with base64-encoded audio in + ``data[].b64_json``. + + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON object or Iterator[bytes] + :rtype: JSON or Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "input": "str", # The text to convert to speech. Required. + "model": "str", # The text-to-speech model to use. Required. + "instructions": "str", # Optional. Optional style or delivery instructions + for the synthesizer. + "response_format": "str", # Optional. The audio format to return. Supported + values include ``mp3`` and ``wav``. The API may return raw audio bytes or a JSON + envelope with base64-encoded audio. + "voice": "str" # Optional. The voice to use for synthesis. + } + + # response body for status code(s): 200 + response == { + "data": [ + { + "b64_json": "str" # Base64-encoded audio bytes. Required. + } + ], + "created": 0 # Optional. Unix timestamp (in seconds) of when the audio was + created. + } + """ + 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[Union[JSON, Iterator[bytes]]] = 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_inference_create_speech_request( + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = True + 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, 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 = {} + 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") + ) + + deserialized = response.iter_bytes() + + 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") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, cast(Union[JSON, Iterator[bytes]], deserialized), response_headers) # type: ignore + + return cast(Union[JSON, Iterator[bytes]], deserialized) # type: ignore + + @overload + def create_video( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Start a video generation job. + + Start an asynchronous video generation job from a text prompt. Poll ``GET + /v1/videos/{video_id}`` until the job reaches a terminal status, then download the MP4 with + ``GET /v1/videos/{video_id}/content`` or from ``output.url`` when present. + + :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 = { + "model": "str", # The video generation model to use. Required. + "prompt": "str", # A text description of the desired video. Required. + "fps": 0, # Optional. Frames per second for the generated video. + "size": "str" # Optional. The output resolution, for example ``1280x720``. + } + + # response body for status code(s): 200 + response == { + "id": "str", # The video generation job identifier. Required. + "status": "str", # Job status. Poll until the value is a terminal state such + as ``completed`` or ``failed``. Required. + "created_at": 0, # Optional. Unix timestamp (in seconds) of when the job was + created. + "error": { + "str": {} # Optional. Error details when status is ``failed``. + }, + "model": "str", # Optional. The model used for generation. + "object": "str", # Optional. Object type returned by the API. + "output": { + "url": "str" # Optional. Presigned URL for the generated MP4. + }, + "x_request_id": "str" # Optional. Request correlation identifier when + provided by the API. + } + """ + + @overload + def create_video( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Start a video generation job. + + Start an asynchronous video generation job from a text prompt. Poll ``GET + /v1/videos/{video_id}`` until the job reaches a terminal status, then download the MP4 with + ``GET /v1/videos/{video_id}/content`` or from ``output.url`` when present. + + :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 == { + "id": "str", # The video generation job identifier. Required. + "status": "str", # Job status. Poll until the value is a terminal state such + as ``completed`` or ``failed``. Required. + "created_at": 0, # Optional. Unix timestamp (in seconds) of when the job was + created. + "error": { + "str": {} # Optional. Error details when status is ``failed``. + }, + "model": "str", # Optional. The model used for generation. + "object": "str", # Optional. Object type returned by the API. + "output": { + "url": "str" # Optional. Presigned URL for the generated MP4. + }, + "x_request_id": "str" # Optional. Request correlation identifier when + provided by the API. + } + """ + + @distributed_trace + def create_video(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Start a video generation job. + + Start an asynchronous video generation job from a text prompt. Poll ``GET + /v1/videos/{video_id}`` until the job reaches a terminal status, then download the MP4 with + ``GET /v1/videos/{video_id}/content`` or from ``output.url`` when present. + + :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 = { + "model": "str", # The video generation model to use. Required. + "prompt": "str", # A text description of the desired video. Required. + "fps": 0, # Optional. Frames per second for the generated video. + "size": "str" # Optional. The output resolution, for example ``1280x720``. + } + + # response body for status code(s): 200 + response == { + "id": "str", # The video generation job identifier. Required. + "status": "str", # Job status. Poll until the value is a terminal state such + as ``completed`` or ``failed``. Required. + "created_at": 0, # Optional. Unix timestamp (in seconds) of when the job was + created. + "error": { + "str": {} # Optional. Error details when status is ``failed``. + }, + "model": "str", # Optional. The model used for generation. + "object": "str", # Optional. Object type returned by the API. + "output": { + "url": "str" # Optional. Presigned URL for the generated MP4. + }, + "x_request_id": "str" # Optional. Request correlation identifier when + provided by the API. + } + """ + 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_inference_create_video_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 [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_video(self, video_id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Retrieve a video generation job. + + Returns the current state of a video generation job. Poll until ``status`` reaches a terminal + value such as ``completed`` or ``failed``. + + :param video_id: The video generation job identifier. Required. + :type video_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "id": "str", # The video generation job identifier. Required. + "status": "str", # Job status. Poll until the value is a terminal state such + as ``completed`` or ``failed``. Required. + "created_at": 0, # Optional. Unix timestamp (in seconds) of when the job was + created. + "error": { + "str": {} # Optional. Error details when status is ``failed``. + }, + "model": "str", # Optional. The model used for generation. + "object": "str", # Optional. Object type returned by the API. + "output": { + "url": "str" # Optional. Presigned URL for the generated MP4. + }, + "x_request_id": "str" # Optional. Request correlation identifier when + provided by the API. + } + # 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_inference_get_video_request( + video_id=video_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_video_content( + self, video_id: str, **kwargs: Any + ) -> Union[Iterator[bytes], JSON]: + # pylint: disable=line-too-long + """Download generated video content. + + Downloads the generated MP4 for a completed video generation job. + + :param video_id: The video generation job identifier. Required. + :type video_id: str + :return: Iterator[bytes] or JSON object + :rtype: Iterator[bytes] or JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # 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[Union[Iterator[bytes], JSON]] = kwargs.pop("cls", None) + + _request = build_inference_get_video_content_request( + video_id=video_id, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = True + 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") + ) + + deserialized = response.iter_bytes() + + 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") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, cast(Union[Iterator[bytes], JSON], deserialized), response_headers) # type: ignore + + return cast(Union[Iterator[bytes], JSON], deserialized) # type: ignore + @overload def create_batch_file( self, body: JSON, *, content_type: str = "application/json", **kwargs: Any diff --git a/src/pydo/resources/aio/inference/__init__.py b/src/pydo/resources/aio/inference/__init__.py index 64010fce..89f6127d 100644 --- a/src/pydo/resources/aio/inference/__init__.py +++ b/src/pydo/resources/aio/inference/__init__.py @@ -8,6 +8,7 @@ from pydo.aio import Client from .async_invoke import AsyncInvoke +from .audio import Audio from .batches import Batches from .chat import Chat from .embeddings import Embeddings @@ -17,6 +18,7 @@ from .models import Models from .responses import Responses from .systemone import Systemone +from .videos import Videos class InferenceResources: @@ -24,6 +26,7 @@ class InferenceResources: def __init__(self, client: Client) -> None: self.async_invoke = AsyncInvoke(client) + self.audio = Audio(client) self.batches = Batches(client) self.chat = Chat(client) self.embeddings = Embeddings(client) @@ -33,6 +36,7 @@ def __init__(self, client: Client) -> None: self.models = Models(client) self.responses = Responses(client) self.systemone = Systemone(client) + self.videos = Videos(client) __all__ = ["InferenceResources"] diff --git a/src/pydo/resources/aio/inference/audio/__init__.py b/src/pydo/resources/aio/inference/audio/__init__.py new file mode 100644 index 00000000..681e3cc7 --- /dev/null +++ b/src/pydo/resources/aio/inference/audio/__init__.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) DigitalOcean. +# Licensed under the Apache-2.0 License. +# ------------------------------------ +# Generated by scripts/generate_inference_resources.py — do not edit. +from __future__ import annotations + + +from pydo.aio import Client +from .speech import Speech + + +class Audio: + """Inference path namespace (generated).""" + + def __init__(self, client: Client) -> None: + self.speech = Speech(client) + + +__all__ = ["Audio"] diff --git a/src/pydo/resources/aio/inference/audio/speech.py b/src/pydo/resources/aio/inference/audio/speech.py new file mode 100644 index 00000000..4fc07fad --- /dev/null +++ b/src/pydo/resources/aio/inference/audio/speech.py @@ -0,0 +1,33 @@ +# ------------------------------------ +# Copyright (c) DigitalOcean. +# Licensed under the Apache-2.0 License. +# ------------------------------------ +# Generated by scripts/generate_inference_resources.py — do not edit. +from __future__ import annotations + +from typing import Any + +from pydo.aio import Client +from pydo.custom_extensions import ( + _SDK_KWARGS, + _prepare_body, + _wrap, + _wrap_with_id_alias, +) + + +class Speech: + """Inference resource helper (generated).""" + + def __init__(self, client: Client) -> None: + self._client = client + + async def create(self, **kwargs: Any) -> Any: + """Delegates to ``client.inference.create_speech``.""" + body = {k: v for k, v in kwargs.items() if k not in _SDK_KWARGS} + sdk = {k: v for k, v in kwargs.items() if k in _SDK_KWARGS} + body = _prepare_body("create_speech", body) + return _wrap_with_id_alias( + await self._client.inference.create_speech(body, **sdk), + primary_id_field="speech_id", + ) diff --git a/src/pydo/resources/aio/inference/videos/__init__.py b/src/pydo/resources/aio/inference/videos/__init__.py new file mode 100644 index 00000000..231fe76f --- /dev/null +++ b/src/pydo/resources/aio/inference/videos/__init__.py @@ -0,0 +1,48 @@ +# ------------------------------------ +# Copyright (c) DigitalOcean. +# Licensed under the Apache-2.0 License. +# ------------------------------------ +# Generated by scripts/generate_inference_resources.py — do not edit. +from __future__ import annotations + + +from typing import Any + +from pydo.aio import Client +from pydo.custom_extensions import ( + _SDK_KWARGS, + _prepare_body, + _wrap, + _wrap_with_id_alias, +) +from .content import Content + + +class Videos: + """Inference resource helper (generated).""" + + def __init__(self, client: Client) -> None: + self._client = client + self.content = Content(client) + + async def create(self, **kwargs: Any) -> Any: + """Delegates to ``client.inference.create_video``.""" + body = {k: v for k, v in kwargs.items() if k not in _SDK_KWARGS} + sdk = {k: v for k, v in kwargs.items() if k in _SDK_KWARGS} + body = _prepare_body("create_video", body) + return _wrap_with_id_alias( + await self._client.inference.create_video(body, **sdk), + primary_id_field="video_id", + ) + + async def get(self, video_id: str, **kwargs: Any) -> Any: + """Delegates to ``client.inference.get_video``.""" + return _wrap_with_id_alias( + await self._client.inference.get_video(video_id=video_id, **kwargs), + primary_id_field="video_id", + ) + + retrieve = get + + +__all__ = ["Videos"] diff --git a/src/pydo/resources/aio/inference/videos/content.py b/src/pydo/resources/aio/inference/videos/content.py new file mode 100644 index 00000000..044a8b71 --- /dev/null +++ b/src/pydo/resources/aio/inference/videos/content.py @@ -0,0 +1,32 @@ +# ------------------------------------ +# Copyright (c) DigitalOcean. +# Licensed under the Apache-2.0 License. +# ------------------------------------ +# Generated by scripts/generate_inference_resources.py — do not edit. +from __future__ import annotations + +from typing import Any + +from pydo.aio import Client +from pydo.custom_extensions import ( + _SDK_KWARGS, + _prepare_body, + _wrap, + _wrap_with_id_alias, +) + + +class Content: + """Inference resource helper (generated).""" + + def __init__(self, client: Client) -> None: + self._client = client + + async def get(self, video_id: str, **kwargs: Any) -> Any: + """Delegates to ``client.inference.get_video_content``.""" + return _wrap_with_id_alias( + await self._client.inference.get_video_content(video_id=video_id, **kwargs), + primary_id_field="video_id", + ) + + retrieve = get diff --git a/src/pydo/resources/client_surface.py b/src/pydo/resources/client_surface.py index b4d72544..99a6aea4 100644 --- a/src/pydo/resources/client_surface.py +++ b/src/pydo/resources/client_surface.py @@ -18,6 +18,12 @@ def async_invoke(self) -> Any: return self._require_inference_resource_root().async_invoke + @property + def audio(self) -> Any: + """Nested serverless inference API under path segment ``audio``.""" + + return self._require_inference_resource_root().audio + @property def batches(self) -> Any: """Nested serverless inference API under path segment ``batches``.""" @@ -66,6 +72,12 @@ def systemone(self) -> Any: return self._require_inference_resource_root().systemone + @property + def videos(self) -> Any: + """Nested serverless inference API under path segment ``videos``.""" + + return self._require_inference_resource_root().videos + @property def audio(self) -> Any: """Audio namespace (TTS + generation via async-invoke).""" diff --git a/src/pydo/resources/inference/__init__.py b/src/pydo/resources/inference/__init__.py index fa4039a0..ec3e5489 100644 --- a/src/pydo/resources/inference/__init__.py +++ b/src/pydo/resources/inference/__init__.py @@ -8,6 +8,7 @@ from pydo import Client from .async_invoke import AsyncInvoke +from .audio import Audio from .batches import Batches from .chat import Chat from .embeddings import Embeddings @@ -17,6 +18,7 @@ from .models import Models from .responses import Responses from .systemone import Systemone +from .videos import Videos class InferenceResources: @@ -24,6 +26,7 @@ class InferenceResources: def __init__(self, client: Client) -> None: self.async_invoke = AsyncInvoke(client) + self.audio = Audio(client) self.batches = Batches(client) self.chat = Chat(client) self.embeddings = Embeddings(client) @@ -33,6 +36,7 @@ def __init__(self, client: Client) -> None: self.models = Models(client) self.responses = Responses(client) self.systemone = Systemone(client) + self.videos = Videos(client) __all__ = ["InferenceResources"] diff --git a/src/pydo/resources/inference/audio/__init__.py b/src/pydo/resources/inference/audio/__init__.py new file mode 100644 index 00000000..aaab2317 --- /dev/null +++ b/src/pydo/resources/inference/audio/__init__.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) DigitalOcean. +# Licensed under the Apache-2.0 License. +# ------------------------------------ +# Generated by scripts/generate_inference_resources.py — do not edit. +from __future__ import annotations + + +from pydo import Client +from .speech import Speech + + +class Audio: + """Inference path namespace (generated).""" + + def __init__(self, client: Client) -> None: + self.speech = Speech(client) + + +__all__ = ["Audio"] diff --git a/src/pydo/resources/inference/audio/speech.py b/src/pydo/resources/inference/audio/speech.py new file mode 100644 index 00000000..44b092dc --- /dev/null +++ b/src/pydo/resources/inference/audio/speech.py @@ -0,0 +1,33 @@ +# ------------------------------------ +# Copyright (c) DigitalOcean. +# Licensed under the Apache-2.0 License. +# ------------------------------------ +# Generated by scripts/generate_inference_resources.py — do not edit. +from __future__ import annotations + +from typing import Any + +from pydo import Client +from pydo.custom_extensions import ( + _SDK_KWARGS, + _prepare_body, + _wrap, + _wrap_with_id_alias, +) + + +class Speech: + """Inference resource helper (generated).""" + + def __init__(self, client: Client) -> None: + self._client = client + + def create(self, **kwargs: Any) -> Any: + """Delegates to ``client.inference.create_speech``.""" + body = {k: v for k, v in kwargs.items() if k not in _SDK_KWARGS} + sdk = {k: v for k, v in kwargs.items() if k in _SDK_KWARGS} + body = _prepare_body("create_speech", body) + return _wrap_with_id_alias( + self._client.inference.create_speech(body, **sdk), + primary_id_field="speech_id", + ) diff --git a/src/pydo/resources/inference/videos/__init__.py b/src/pydo/resources/inference/videos/__init__.py new file mode 100644 index 00000000..1d9987d0 --- /dev/null +++ b/src/pydo/resources/inference/videos/__init__.py @@ -0,0 +1,48 @@ +# ------------------------------------ +# Copyright (c) DigitalOcean. +# Licensed under the Apache-2.0 License. +# ------------------------------------ +# Generated by scripts/generate_inference_resources.py — do not edit. +from __future__ import annotations + + +from typing import Any + +from pydo import Client +from pydo.custom_extensions import ( + _SDK_KWARGS, + _prepare_body, + _wrap, + _wrap_with_id_alias, +) +from .content import Content + + +class Videos: + """Inference resource helper (generated).""" + + def __init__(self, client: Client) -> None: + self._client = client + self.content = Content(client) + + def create(self, **kwargs: Any) -> Any: + """Delegates to ``client.inference.create_video``.""" + body = {k: v for k, v in kwargs.items() if k not in _SDK_KWARGS} + sdk = {k: v for k, v in kwargs.items() if k in _SDK_KWARGS} + body = _prepare_body("create_video", body) + return _wrap_with_id_alias( + self._client.inference.create_video(body, **sdk), + primary_id_field="video_id", + ) + + def get(self, video_id: str, **kwargs: Any) -> Any: + """Delegates to ``client.inference.get_video``.""" + return _wrap_with_id_alias( + self._client.inference.get_video(video_id=video_id, **kwargs), + primary_id_field="video_id", + ) + + retrieve = get + + +__all__ = ["Videos"] diff --git a/src/pydo/resources/inference/videos/content.py b/src/pydo/resources/inference/videos/content.py new file mode 100644 index 00000000..8c87bd37 --- /dev/null +++ b/src/pydo/resources/inference/videos/content.py @@ -0,0 +1,32 @@ +# ------------------------------------ +# Copyright (c) DigitalOcean. +# Licensed under the Apache-2.0 License. +# ------------------------------------ +# Generated by scripts/generate_inference_resources.py — do not edit. +from __future__ import annotations + +from typing import Any + +from pydo import Client +from pydo.custom_extensions import ( + _SDK_KWARGS, + _prepare_body, + _wrap, + _wrap_with_id_alias, +) + + +class Content: + """Inference resource helper (generated).""" + + def __init__(self, client: Client) -> None: + self._client = client + + def get(self, video_id: str, **kwargs: Any) -> Any: + """Delegates to ``client.inference.get_video_content``.""" + return _wrap_with_id_alias( + self._client.inference.get_video_content(video_id=video_id, **kwargs), + primary_id_field="video_id", + ) + + retrieve = get diff --git a/src/pydo/resources/inference_surface.json b/src/pydo/resources/inference_surface.json index 5521521d..c44f4434 100644 --- a/src/pydo/resources/inference_surface.json +++ b/src/pydo/resources/inference_surface.json @@ -83,6 +83,54 @@ "create" ] }, + { + "op_method": "create_speech", + "path_segments": [ + "audio", + "speech" + ], + "path_params": [], + "facade_methods": [ + "create" + ] + }, + { + "op_method": "create_video", + "path_segments": [ + "videos" + ], + "path_params": [], + "facade_methods": [ + "create" + ] + }, + { + "op_method": "get_video", + "path_segments": [ + "videos" + ], + "path_params": [ + "video_id" + ], + "facade_methods": [ + "get", + "retrieve" + ] + }, + { + "op_method": "get_video_content", + "path_segments": [ + "videos", + "content" + ], + "path_params": [ + "video_id" + ], + "facade_methods": [ + "get", + "retrieve" + ] + }, { "op_method": "create_batch_file", "path_segments": [ diff --git a/src/pydo/types/__init__.py b/src/pydo/types/__init__.py index d98c4989..19bdcbc1 100644 --- a/src/pydo/types/__init__.py +++ b/src/pydo/types/__init__.py @@ -15,6 +15,8 @@ """ from pydo.types.async_invoke import AsyncInvokeResponse +from pydo.types.audio import SpeechAudioItem +from pydo.types.audio import SpeechResponse from pydo.types.batches import Batch from pydo.types.batches import BatchFileCreateResponse from pydo.types.batches import BatchResultsResponse @@ -45,9 +47,13 @@ from pydo.types.systemone import SystemoneAnswer from pydo.types.systemone import SystemoneResponse from pydo.types.systemone import SystemoneUsage +from pydo.types.videos import VideoGeneration +from pydo.types.videos import VideoGenerationOutput __all__ = [ "AsyncInvokeResponse", + "SpeechAudioItem", + "SpeechResponse", "Batch", "BatchFileCreateResponse", "BatchResultsResponse", @@ -78,4 +84,6 @@ "SystemoneAnswer", "SystemoneResponse", "SystemoneUsage", + "VideoGeneration", + "VideoGenerationOutput", ] diff --git a/src/pydo/types/audio/__init__.py b/src/pydo/types/audio/__init__.py new file mode 100644 index 00000000..fff17f99 --- /dev/null +++ b/src/pydo/types/audio/__init__.py @@ -0,0 +1,26 @@ +# ------------------------------------ +# Copyright (c) DigitalOcean. +# Licensed under the Apache-2.0 License. +# ------------------------------------ +# Generated by scripts/generate_inference_types.py — do not edit. +from __future__ import annotations + +from typing import Any, List, Optional + +from pydo.custom_extensions import DotDict + + +class SpeechAudioItem(DotDict): + """Typed response for ``speech_audio_item`` schema.""" + + b64_json: str # Base64-encoded audio bytes + + +class SpeechResponse(DotDict): + """Typed response for ``speech_response`` schema.""" + + created: int # Unix timestamp (in seconds) of when the audio was created + data: List[Any] # Generated audio items + + +__all__ = ["SpeechAudioItem", "SpeechResponse"] diff --git a/src/pydo/types/videos/__init__.py b/src/pydo/types/videos/__init__.py new file mode 100644 index 00000000..c59c1486 --- /dev/null +++ b/src/pydo/types/videos/__init__.py @@ -0,0 +1,34 @@ +# ------------------------------------ +# Copyright (c) DigitalOcean. +# Licensed under the Apache-2.0 License. +# ------------------------------------ +# Generated by scripts/generate_inference_types.py — do not edit. +from __future__ import annotations + +from typing import Any, Optional + +from pydo.custom_extensions import DotDict + + +class VideoGeneration(DotDict): + """Typed response for ``video_generation`` schema.""" + + id: str # The video generation job identifier + object: str # Object type returned by the API + created_at: int # Unix timestamp (in seconds) of when the job was created + model: str # The model used for generation + status: str + output: Optional[Any] + error: Optional[Any] # Error details when status is `failed` + x_request_id: Optional[ + str + ] # Request correlation identifier when provided by the API + + +class VideoGenerationOutput(DotDict): + """Typed response for ``video_generation_output`` schema.""" + + url: str # Presigned URL for the generated MP4 + + +__all__ = ["VideoGeneration", "VideoGenerationOutput"]