From e13a7b946f8ff15ee49551e3a104257aa1518533 Mon Sep 17 00:00:00 2001 From: API Engineering Date: Wed, 30 Sep 2026 14:50:42 +0000 Subject: [PATCH] [bot] Updated client based on openapi-abb92c4/clientgen --- DO_OPENAPI_COMMIT_SHA.txt | 2 +- src/pydo/_client.py | 38 +- src/pydo/aio/_client.py | 38 +- src/pydo/aio/operations/__init__.py | 18 +- src/pydo/aio/operations/_operations.py | 10814 ++++++++++--- src/pydo/operations/__init__.py | 18 +- src/pydo/operations/_operations.py | 19603 +++++++++++++++-------- 7 files changed, 21311 insertions(+), 9220 deletions(-) diff --git a/DO_OPENAPI_COMMIT_SHA.txt b/DO_OPENAPI_COMMIT_SHA.txt index 6193d54d..20c259fe 100644 --- a/DO_OPENAPI_COMMIT_SHA.txt +++ b/DO_OPENAPI_COMMIT_SHA.txt @@ -1 +1 @@ -b431341 +abb92c4 diff --git a/src/pydo/_client.py b/src/pydo/_client.py index f9655b5d..378251b8 100644 --- a/src/pydo/_client.py +++ b/src/pydo/_client.py @@ -16,6 +16,7 @@ from .operations import ( AccountOperations, ActionsOperations, + ActorLimitsOperations, AddonsOperations, AgentInferenceOperations, AppsOperations, @@ -42,10 +43,12 @@ InvoicesOperations, KubernetesOperations, LoadBalancersOperations, + McpServersOperations, MonitoringOperations, NfsOperations, OneClicksOperations, OrganizationsOperations, + OutputViewsOperations, PartnerAttachmentsOperations, PrepaymentConfigOperations, PrepaymentStatusOperations, @@ -88,16 +91,22 @@ class GeneratedClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """GeneratedClient. - :ivar tools: ToolsOperations operations - :vartype tools: pydo.operations.ToolsOperations - :ivar toolbelts: ToolbeltsOperations operations - :vartype toolbelts: pydo.operations.ToolbeltsOperations + :ivar actor_limits: ActorLimitsOperations operations + :vartype actor_limits: pydo.operations.ActorLimitsOperations :ivar connections: ConnectionsOperations operations :vartype connections: pydo.operations.ConnectionsOperations - :ivar users: UsersOperations operations - :vartype users: pydo.operations.UsersOperations + :ivar mcp_servers: McpServersOperations operations + :vartype mcp_servers: pydo.operations.McpServersOperations + :ivar output_views: OutputViewsOperations operations + :vartype output_views: pydo.operations.OutputViewsOperations :ivar sessions: SessionsOperations operations :vartype sessions: pydo.operations.SessionsOperations + :ivar toolbelts: ToolbeltsOperations operations + :vartype toolbelts: pydo.operations.ToolbeltsOperations + :ivar tools: ToolsOperations operations + :vartype tools: pydo.operations.ToolsOperations + :ivar users: UsersOperations operations + :vartype users: pydo.operations.UsersOperations :ivar one_clicks: OneClicksOperations operations :vartype one_clicks: pydo.operations.OneClicksOperations :ivar account: AccountOperations operations @@ -258,21 +267,30 @@ def __init__( self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.tools = ToolsOperations( + self.actor_limits = ActorLimitsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.toolbelts = ToolbeltsOperations( + self.connections = ConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.connections = ConnectionsOperations( + self.mcp_servers = McpServersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.users = UsersOperations( + self.output_views = OutputViewsOperations( self._client, self._config, self._serialize, self._deserialize ) self.sessions = SessionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.toolbelts = ToolbeltsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.tools = ToolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.users = UsersOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.one_clicks = OneClicksOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/src/pydo/aio/_client.py b/src/pydo/aio/_client.py index 6266ae39..61a44790 100644 --- a/src/pydo/aio/_client.py +++ b/src/pydo/aio/_client.py @@ -16,6 +16,7 @@ from .operations import ( AccountOperations, ActionsOperations, + ActorLimitsOperations, AddonsOperations, AgentInferenceOperations, AppsOperations, @@ -42,10 +43,12 @@ InvoicesOperations, KubernetesOperations, LoadBalancersOperations, + McpServersOperations, MonitoringOperations, NfsOperations, OneClicksOperations, OrganizationsOperations, + OutputViewsOperations, PartnerAttachmentsOperations, PrepaymentConfigOperations, PrepaymentStatusOperations, @@ -88,16 +91,22 @@ class GeneratedClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """GeneratedClient. - :ivar tools: ToolsOperations operations - :vartype tools: pydo.aio.operations.ToolsOperations - :ivar toolbelts: ToolbeltsOperations operations - :vartype toolbelts: pydo.aio.operations.ToolbeltsOperations + :ivar actor_limits: ActorLimitsOperations operations + :vartype actor_limits: pydo.aio.operations.ActorLimitsOperations :ivar connections: ConnectionsOperations operations :vartype connections: pydo.aio.operations.ConnectionsOperations - :ivar users: UsersOperations operations - :vartype users: pydo.aio.operations.UsersOperations + :ivar mcp_servers: McpServersOperations operations + :vartype mcp_servers: pydo.aio.operations.McpServersOperations + :ivar output_views: OutputViewsOperations operations + :vartype output_views: pydo.aio.operations.OutputViewsOperations :ivar sessions: SessionsOperations operations :vartype sessions: pydo.aio.operations.SessionsOperations + :ivar toolbelts: ToolbeltsOperations operations + :vartype toolbelts: pydo.aio.operations.ToolbeltsOperations + :ivar tools: ToolsOperations operations + :vartype tools: pydo.aio.operations.ToolsOperations + :ivar users: UsersOperations operations + :vartype users: pydo.aio.operations.UsersOperations :ivar one_clicks: OneClicksOperations operations :vartype one_clicks: pydo.aio.operations.OneClicksOperations :ivar account: AccountOperations operations @@ -258,21 +267,30 @@ def __init__( self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.tools = ToolsOperations( + self.actor_limits = ActorLimitsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.toolbelts = ToolbeltsOperations( + self.connections = ConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.connections = ConnectionsOperations( + self.mcp_servers = McpServersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.users = UsersOperations( + self.output_views = OutputViewsOperations( self._client, self._config, self._serialize, self._deserialize ) self.sessions = SessionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.toolbelts = ToolbeltsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.tools = ToolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.users = UsersOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.one_clicks = OneClicksOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/src/pydo/aio/operations/__init__.py b/src/pydo/aio/operations/__init__.py index 7d900119..58cfa4c4 100644 --- a/src/pydo/aio/operations/__init__.py +++ b/src/pydo/aio/operations/__init__.py @@ -4,11 +4,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import ToolsOperations -from ._operations import ToolbeltsOperations +from ._operations import ActorLimitsOperations from ._operations import ConnectionsOperations -from ._operations import UsersOperations +from ._operations import McpServersOperations +from ._operations import OutputViewsOperations from ._operations import SessionsOperations +from ._operations import ToolbeltsOperations +from ._operations import ToolsOperations +from ._operations import UsersOperations from ._operations import OneClicksOperations from ._operations import AccountOperations from ._operations import SshKeysOperations @@ -74,11 +77,14 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ToolsOperations", - "ToolbeltsOperations", + "ActorLimitsOperations", "ConnectionsOperations", - "UsersOperations", + "McpServersOperations", + "OutputViewsOperations", "SessionsOperations", + "ToolbeltsOperations", + "ToolsOperations", + "UsersOperations", "OneClicksOperations", "AccountOperations", "SshKeysOperations", diff --git a/src/pydo/aio/operations/_operations.py b/src/pydo/aio/operations/_operations.py index 7a1e65d3..ff2588f4 100644 --- a/src/pydo/aio/operations/_operations.py +++ b/src/pydo/aio/operations/_operations.py @@ -39,6 +39,9 @@ build_account_get_request, build_actions_get_request, build_actions_list_request, + build_actor_limits_delete_request, + build_actor_limits_get_request, + build_actor_limits_update_request, build_addons_create_request, build_addons_delete_request, build_addons_get_app_metadata_request, @@ -117,7 +120,6 @@ build_connections_delete_request, build_connections_get_request, build_connections_list_request, - build_connections_update_request, build_databases_add_connection_pool_request, build_databases_add_request, build_databases_add_user_request, @@ -471,6 +473,14 @@ build_load_balancers_remove_droplets_request, build_load_balancers_remove_forwarding_rules_request, build_load_balancers_update_request, + build_mcp_servers_create_request, + build_mcp_servers_delete_request, + build_mcp_servers_get_request, + build_mcp_servers_list_request, + build_mcp_servers_list_tools_request, + build_mcp_servers_patch_request, + build_mcp_servers_run_resync_request, + build_mcp_servers_update_tools_request, build_monitoring_create_alert_policy_request, build_monitoring_create_destination_request, build_monitoring_create_sink_request, @@ -559,6 +569,11 @@ build_one_clicks_list_request, build_organizations_create_team_request, build_organizations_list_teams_request, + build_output_views_create_request, + build_output_views_delete_request, + build_output_views_get_request, + build_output_views_list_request, + build_output_views_validate_request, build_partner_attachments_create_request, build_partner_attachments_create_service_key_request, build_partner_attachments_delete_request, @@ -646,6 +661,7 @@ build_sessions_create_request, build_sessions_delete_request, build_sessions_list_request, + build_sessions_list_search_request, build_sizes_list_request, build_snapshots_delete_request, build_snapshots_get_request, @@ -672,10 +688,17 @@ build_toolbelts_delete_request, build_toolbelts_delete_tools_request, build_toolbelts_get_request, + build_toolbelts_list_provider_tools_request, + build_toolbelts_list_providers_request, build_toolbelts_list_request, - build_tools_get_definition_request, + build_toolbelts_list_search_request, + build_tools_get_health_request, + build_tools_list_health_providers_request, + build_tools_list_health_request, build_tools_list_providers_request, build_tools_list_request, + build_tools_list_search_providers_request, + build_tools_list_search_request, build_tools_list_toolkits_request, build_uptime_create_alert_request, build_uptime_create_check_request, @@ -758,14 +781,14 @@ ] -class ToolsOperations: +class ActorLimitsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~pydo.aio.GeneratedClient`'s - :attr:`tools` attribute. + :attr:`actor_limits` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -778,25 +801,17 @@ def __init__(self, *args, **kwargs) -> None: ) @distributed_trace_async - async def list( - self, - *, - toolkit_id: Optional[str] = None, - page: int = 1, - per_page: int = 20, - **kwargs: Any - ) -> JSON: + async def get(self, actor_id: str, **kwargs: Any) -> JSON: # pylint: disable=line-too-long - """List Tools. + """Get an Actor's Limits. - Lists active Action Gateway tools visible to the authenticated team. + Returns the per-minute limits set for the actor and the limits in effect, each the lower of + your team's limit and the actor's override. Returns 404 when the actor has no sessions, + connections, or limit overrides. - :keyword toolkit_id: Filter tools by toolkit identifier. Default value is None. - :paramtype toolkit_id: str - :keyword page: Which 'page' of paginated results to return. Default value is 1. - :paramtype page: int - :keyword per_page: Number of items returned per page. Default value is 20. - :paramtype per_page: int + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -806,307 +821,39 @@ async def list( # response body for status code(s): 200 response == { - "definitions": [ - { - "annotations": { - "destructiveHint": bool, # Optional. - "idempotentHint": bool, # Optional. - "openWorldHint": bool, # Optional. - "readOnlyHint": bool, # Optional. - "title": "str" # Optional. - }, - "auth": { - "baseUrlResolution": { - "httpLookup": { - "baseUrlTemplate": "str", # - Optional. HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "caseInsensitive": bool, # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "extractField": "str", # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "matchField": "str", # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "matchValue": "str", # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "match_value_parameter": "str", # - Optional. HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "method": "str", # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "requiredScopes": [ - "str" # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access - token), selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When - both are empty, exactly one entry whose own "scopes" - array contains required_scopes must exist. Configuring - only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - ], - "trimTrailingSlash": bool, # - Optional. HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "url": "str" # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - } - }, - "credentialBinding": "str", # Optional. - "credentialRefSource": "str", # Optional. - "doManagedCredentialRef": "str", # Optional. - "injection": { - "location": "str", # Optional. - "name": "str", # Optional. - "scheme": "str" # Optional. - }, - "modes": [ - "str" # Optional. - ], - "provider": "str", # Optional. - "scopes": [ - "str" # Optional. - ] - }, - "classification": { - "dataClasses": [ - "str" # Optional. - ], - "operation": "str", # Optional. - "risk": "str" # Optional. - }, - "description": "str", # Optional. - "execution": { - "adapterVersion": "str", # Optional. - "configRef": "str", # Optional. - "http": { - "allowedHosts": [ - "str" # Optional. - ], - "baseUrl": "str", # Optional. - "method": "str", # Optional. - "path": "str", # Optional. - "requestEncoding": "str", # Optional. - "responseFormat": "str" # Optional. - }, - "mcp": { - "allowedHosts": [ - "str" # Optional. MCPExecution - describes how to invoke a tool that is fronted by a remote - MCP server (as opposed to a plain HTTP endpoint). endpoint is - the remote MCP server's URL, tool_name is the name the remote - server expects on tools/call (may differ from this tool's - registry name), transport selects the wire protocol - ("streamable_http" is the only kind implemented today), and - server_ref is an opaque label identifying the remote server - for logging/metrics/allowlisting. - ], - "endpoint": "str", # Optional. MCPExecution - describes how to invoke a tool that is fronted by a remote MCP - server (as opposed to a plain HTTP endpoint). endpoint is the - remote MCP server's URL, tool_name is the name the remote server - expects on tools/call (may differ from this tool's registry - name), transport selects the wire protocol ("streamable_http" is - the only kind implemented today), and server_ref is an opaque - label identifying the remote server for - logging/metrics/allowlisting. - "serverRef": "str", # Optional. MCPExecution - describes how to invoke a tool that is fronted by a remote MCP - server (as opposed to a plain HTTP endpoint). endpoint is the - remote MCP server's URL, tool_name is the name the remote server - expects on tools/call (may differ from this tool's registry - name), transport selects the wire protocol ("streamable_http" is - the only kind implemented today), and server_ref is an opaque - label identifying the remote server for - logging/metrics/allowlisting. - "toolName": "str", # Optional. MCPExecution - describes how to invoke a tool that is fronted by a remote MCP - server (as opposed to a plain HTTP endpoint). endpoint is the - remote MCP server's URL, tool_name is the name the remote server - expects on tools/call (may differ from this tool's registry - name), transport selects the wire protocol ("streamable_http" is - the only kind implemented today), and server_ref is an opaque - label identifying the remote server for - logging/metrics/allowlisting. - "transport": "str" # Optional. MCPExecution - describes how to invoke a tool that is fronted by a remote MCP - server (as opposed to a plain HTTP endpoint). endpoint is the - remote MCP server's URL, tool_name is the name the remote server - expects on tools/call (may differ from this tool's registry - name), transport selects the wire protocol ("streamable_http" is - the only kind implemented today), and server_ref is an opaque - label identifying the remote server for - logging/metrics/allowlisting. - }, - "type": "str" # Optional. - }, - "flipperName": "str", # Optional. - "hooks": { - "usage": { - "billable": bool, # Optional. When usage - metadata is present, false prevents billing. Omitting usage - metadata leaves consumers' legacy billing classification - unchanged. - "meters": [ - { - "quantitySource": "str", # - Optional. - "sku": "str", # Optional. - "unit": "str" # Optional. - } - ] - } - }, - "inputSchema": {}, # Optional. Any object. - "name": "str", # Optional. - "outputSchema": {}, # Optional. Any object. - "parallelizable": bool, # Optional. - "policy": { - "permission": "str" # Optional. - }, - "reliability": { - "maxOutputBytes": "str", # Optional. - "retry": { - "backoff": "str", # Optional. - "maxAttempts": 0, # Optional. - "retryOn": [ - "str" # Optional. - ] - }, - "timeoutMs": 0 # Optional. - }, - "schemaVersion": "str", # Optional. - "status": "str", # Optional. - "streamingSafe": bool, # Optional. - "tags": [ - "str" # Optional. - ], - "title": "str", # Optional. - "toolId": "str", # Optional. - "toolSlug": "str", # Optional. tool_slug is the - provider-qualified, stable tool identifier - ":code:``_:code:``". Pass this value back verbatim to - the toolbelt add/remove endpoints; clients should treat it as opaque. - "toolkitId": "str", # Optional. - "transform": { - "input": {}, # Optional. Any object. - "language": "str", # Optional. - "output": {} # Optional. Any object. - }, - "version": "str" # Optional. - } - ], - "pagination": { - "page": 0, # Required. - "per_page": 0, # Required. - "total": 0 # Required. - }, - "tools": [ + "configured_limits": [ { - "annotations": { - "destructiveHint": bool, # Optional. - "idempotentHint": bool, # Optional. - "openWorldHint": bool, # Optional. - "readOnlyHint": bool, # Optional. - "title": "str" # Optional. - }, - "description": "str", # Optional. - "inputSchema": {}, # Optional. Any object. - "name": "str", # Optional. - "outputSchema": {}, # Optional. Any object. - "parallelizable": bool, # Optional. - "streamingSafe": bool, # Optional. - "title": "str", # Optional. - "toolSlug": "str", # Optional. tool_slug is the - provider-qualified, stable tool identifier - ":code:``_:code:``". Pass this value back verbatim to - the toolbelt add/remove endpoints; clients should treat it as opaque - rather than reconstructing it from toolkit_id and name. - "toolkitId": "str", # Optional. - "version": "str" # Optional. + "category": "str", # The category the limit applies to. + Required. Known values are: + "LIMIT_CATEGORY_WEB_SEARCH_REQUESTS_PER_MINUTE", + "LIMIT_CATEGORY_WEB_FETCH_REQUESTS_PER_MINUTE", + "LIMIT_CATEGORY_NATIVE_TOOL_CALLS_REQUESTS_PER_MINUTE", and + "LIMIT_CATEGORY_NON_NATIVE_TOOL_CALLS_REQUESTS_PER_MINUTE". + "requests_per_minute": "str" # Calls allowed per minute. 0 + blocks every call in the category. Required. } ], - "version": "str" # Optional. + "effective_limits": { + "native_tool_calls_requests_per_minute": "str", # Optional. Calls + per minute to DigitalOcean tools. + "non_native_tool_calls_requests_per_minute": "str", # Optional. + Calls per minute to all other tools. + "web_fetch_requests_per_minute": "str", # Optional. Calls per minute + to the ``exa_web_fetch`` tool. + "web_search_requests_per_minute": "str" # Optional. Calls per minute + to the ``exa_web_search`` tool. + } + } + # 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]] = { @@ -1127,10 +874,8 @@ async def list( cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_tools_list_request( - toolkit_id=toolkit_id, - page=page, - per_page=per_page, + _request = build_actor_limits_get_request( + actor_id=actor_id, headers=_headers, params=_params, ) @@ -1145,56 +890,198 @@ async def list( response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = {} - 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.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.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 delete( + self, + actor_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Clear an Actor's Limits. + + Removes the actor's overrides for the listed categories, which then follow your team's limits + again. Clearing a category without an override succeeds. + + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON or 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 = { + "categories": [ + "str" # Required. Categories to clear, each at most once. Required. + ] + } + + # 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 delete( + self, + actor_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Clear an Actor's Limits. + + Removes the actor's overrides for the listed categories, which then follow your team's limits + again. Clearing a category without an override succeeds. + + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON or JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # 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 list_toolkits(self, **kwargs: Any) -> JSON: - """List Toolkits. + async def delete( + self, actor_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Clear an Actor's Limits. - Lists the toolkits that group Action Gateway tools. + Removes the actor's overrides for the listed categories, which then follow your team's limits + again. Clearing a category without an override succeeds. - :return: JSON object + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON or JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # JSON input template you can fill out and use as your body input. + body = { + "categories": [ + "str" # Required. Categories to clear, each at most once. Required. + ] + } + + # response body for status code(s): 400, 404 response == { - "toolkits": [ - { - "description": "str", # Optional. - "id": "str", # Optional. - "name": "str" # Optional. - } - ], - "version": "str" # Optional. + "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]] = { @@ -1210,16 +1097,31 @@ async def list_toolkits(self, **kwargs: Any) -> JSON: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[JSON] = kwargs.pop("cls", None) - - _request = build_tools_list_toolkits_request( - headers=_headers, - params=_params, + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) ) - _request.url = self._client.format_url(_request.url) + 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_actor_limits_delete_request( + actor_id=actor_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = ( @@ -1230,77 +1132,220 @@ async def list_toolkits(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = {} - 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.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.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 - @distributed_trace_async - async def list_providers(self, **kwargs: Any) -> JSON: - """List Tool Providers. + @overload + async def update( + self, + actor_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Set an Actor's Limits. - Lists Action Gateway providers and their connection requirements. + Sets per-minute limits for the listed categories and leaves the others unchanged. A limit may + not exceed your team's current limit for the category (400 otherwise), and 0 blocks every call + in the category. The actor does not need to exist yet. - :return: JSON object + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON or JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # JSON input template you can fill out and use as your body input. + body = { + "overrides": [ + { + "category": "str", # The category the limit applies to. + Required. Known values are: + "LIMIT_CATEGORY_WEB_SEARCH_REQUESTS_PER_MINUTE", + "LIMIT_CATEGORY_WEB_FETCH_REQUESTS_PER_MINUTE", + "LIMIT_CATEGORY_NATIVE_TOOL_CALLS_REQUESTS_PER_MINUTE", and + "LIMIT_CATEGORY_NON_NATIVE_TOOL_CALLS_REQUESTS_PER_MINUTE". + "requests_per_minute": "str" # Calls allowed per minute. 0 + blocks every call in the category. Required. + } + ] + } + + # response body for status code(s): 400, 404 response == { - "providers": [ + "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( + self, + actor_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Set an Actor's Limits. + + Sets per-minute limits for the listed categories and leaves the others unchanged. A limit may + not exceed your team's current limit for the category (400 otherwise), and 0 blocks every call + in the category. The actor does not need to exist yet. + + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON or JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # 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( + self, actor_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Set an Actor's Limits. + + Sets per-minute limits for the listed categories and leaves the others unchanged. A limit may + not exceed your team's current limit for the category (400 otherwise), and 0 blocks every call + in the category. The actor does not need to exist yet. + + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON or 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 = { + "overrides": [ { - "auth_type": "str", # Optional. - "connection_parameters": [ - { - "allowed_host_suffixes": [ - "str" # Optional. - ], - "allowed_values": [ - "str" # Optional. - ], - "description": "str", # Optional. - "input_kind": "str", # Optional. - "key": "str", # Optional. - "label": "str", # Optional. - "max_length": 0, # Optional. - "normalization": "str", # Optional. - "required": bool # Optional. - } - ], - "description": "str", # Optional. - "display_name": "str", # Optional. - "name": "str", # Optional. - "scopes": [ - "str" # Optional. - ] + "category": "str", # The category the limit applies to. + Required. Known values are: + "LIMIT_CATEGORY_WEB_SEARCH_REQUESTS_PER_MINUTE", + "LIMIT_CATEGORY_WEB_FETCH_REQUESTS_PER_MINUTE", + "LIMIT_CATEGORY_NATIVE_TOOL_CALLS_REQUESTS_PER_MINUTE", and + "LIMIT_CATEGORY_NON_NATIVE_TOOL_CALLS_REQUESTS_PER_MINUTE". + "requests_per_minute": "str" # Calls allowed per minute. 0 + blocks every call in the category. Required. } ] } + + # 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, @@ -1315,12 +1360,27 @@ async def list_providers(self, **kwargs: Any) -> JSON: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) 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) - _request = build_tools_list_providers_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_actor_limits_update_request( + actor_id=actor_id, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -1335,55 +1395,5976 @@ async def list_providers(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = {} - 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 == 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 cls: - return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + if response.content: + deserialized = response.json() + else: + deserialized = None - return cast(JSON, deserialized) # type: ignore + 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") + ) - @distributed_trace_async - async def get_definition( + 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 ConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.aio.GeneratedClient`'s + :attr:`connections` 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") + ) + + @overload + async def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a Connection. + + Connects one of your users, identified by ``user_id``\\ , to a provider so tools can act on + their + account. An OAuth connection starts pending, and authorization carries the URL to send the user + to; + read the connection until it is active or expired. A connection through a team API-key + credential is + active immediately. + + There is one connection per provider and ``user_id`` for each DigitalOcean user who creates + connections. Repeating the request returns the existing connection when its scopes cover the + request, reusing a pending connection's link, and restarts an expired or revoked connection + under + the same ID. Requesting scopes beyond an existing connection's, or a different credential, + returns + 400 until that connection is deleted. + + :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 = { + "provider": "str", # Required provider slug, from the provider list. + Required. + "user_id": "str", # Required. Your identifier for the user the connection + acts for: 1 to 64 characters from ``[A-Za-z0-9._-]``. A session whose + ``actor_id`` equals it uses this connection. Required. + "connection_parameters": {}, # Optional. Values for the provider's + ``connection_parameters``"" , validated against their specifications. + "credential": { + "digitalocean_oauth": {}, # Optional. Use DigitalOcean's shared + OAuth application. + "team_credential": { + "credential_id": "str" # Optional. Required. ID of an active + provider credential for the same provider that you can use. + } + }, + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional CIDR + ranges; when set, every address the host resolves to must + fall within one of them. + ], + "host": "str", # Optional. Host name or IP + address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to 65535. + } + ], + "vpc_uuid": "str" # Optional. UUID of a VPC owned by your + team. + } + }, + "scopes": [ + "str" # Optional. Optional OAuth scopes to request. Defaults to + every scope the provider offers; scopes outside that set are rejected. + Ignored for API-key credentials. + ] + } + + # response body for status code(s): 200 + response == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "connection": { + "api_key": {}, # Optional. Set for ``team_api_key`` connections. + "connection_parameters": {}, # Optional. Non-sensitive provider + configuration. + "created_at": "2020-02-20 00:00:00", # Optional. When the connection + was created. + "credential_id": "str", # Optional. Empty for + ``digitalocean_oauth``"" ; otherwise the ID of the team provider credential + the connection uses. + "credential_kind": "str", # Optional. ``digitalocean_oauth``"" , + ``private_oauth``"" , or ``team_api_key``. Known values are: + "digitalocean_oauth", "private_oauth", and "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. Deprecated: read + ``oauth.granted_at``. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional + CIDR ranges; when set, every address the host resolves to + must fall within one of them. + ], + "host": "str", # Optional. Host name + or IP address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to + 65535. + } + ], + "region": "str", # Optional. Region of the VPC. Set + by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID of a VPC owned by + your team. + } + }, + "oauth": { + "granted_at": "2020-02-20 00:00:00", # Optional. When the + user completed authorization. + "scopes": [ + "str" # Optional. Provider scopes granted, or + requested while pending. + ] + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for example ``jira``. + "provider_display_name": "str", # Optional. Human-readable provider + name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. When the connection + was revoked. + "scopes": [ + "str" # Optional. Deprecated: read ``oauth.scopes``. + Duplicated here so a reader of the pre-union shape keeps working; empty + for a kind with no OAuth grant. + ], + "status": "str", # Optional. pending, active, revoked, or expired. + Known values are: "pending", "active", "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. When the connection + was last modified. + "user_id": "str" # Optional. Your identifier for the user the + connection acts for. + } + } + # response body for status code(s): 400, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + async def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a Connection. + + Connects one of your users, identified by ``user_id``\\ , to a provider so tools can act on + their + account. An OAuth connection starts pending, and authorization carries the URL to send the user + to; + read the connection until it is active or expired. A connection through a team API-key + credential is + active immediately. + + There is one connection per provider and ``user_id`` for each DigitalOcean user who creates + connections. Repeating the request returns the existing connection when its scopes cover the + request, reusing a pending connection's link, and restarts an expired or revoked connection + under + the same ID. Requesting scopes beyond an existing connection's, or a different credential, + returns + 400 until that connection is deleted. + + :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 == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "connection": { + "api_key": {}, # Optional. Set for ``team_api_key`` connections. + "connection_parameters": {}, # Optional. Non-sensitive provider + configuration. + "created_at": "2020-02-20 00:00:00", # Optional. When the connection + was created. + "credential_id": "str", # Optional. Empty for + ``digitalocean_oauth``"" ; otherwise the ID of the team provider credential + the connection uses. + "credential_kind": "str", # Optional. ``digitalocean_oauth``"" , + ``private_oauth``"" , or ``team_api_key``. Known values are: + "digitalocean_oauth", "private_oauth", and "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. Deprecated: read + ``oauth.granted_at``. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional + CIDR ranges; when set, every address the host resolves to + must fall within one of them. + ], + "host": "str", # Optional. Host name + or IP address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to + 65535. + } + ], + "region": "str", # Optional. Region of the VPC. Set + by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID of a VPC owned by + your team. + } + }, + "oauth": { + "granted_at": "2020-02-20 00:00:00", # Optional. When the + user completed authorization. + "scopes": [ + "str" # Optional. Provider scopes granted, or + requested while pending. + ] + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for example ``jira``. + "provider_display_name": "str", # Optional. Human-readable provider + name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. When the connection + was revoked. + "scopes": [ + "str" # Optional. Deprecated: read ``oauth.scopes``. + Duplicated here so a reader of the pre-union shape keeps working; empty + for a kind with no OAuth grant. + ], + "status": "str", # Optional. pending, active, revoked, or expired. + Known values are: "pending", "active", "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. When the connection + was last modified. + "user_id": "str" # Optional. Your identifier for the user the + connection acts for. + } + } + # response body for status code(s): 400, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace_async + async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Create a Connection. + + Connects one of your users, identified by ``user_id``\\ , to a provider so tools can act on + their + account. An OAuth connection starts pending, and authorization carries the URL to send the user + to; + read the connection until it is active or expired. A connection through a team API-key + credential is + active immediately. + + There is one connection per provider and ``user_id`` for each DigitalOcean user who creates + connections. Repeating the request returns the existing connection when its scopes cover the + request, reusing a pending connection's link, and restarts an expired or revoked connection + under + the same ID. Requesting scopes beyond an existing connection's, or a different credential, + returns + 400 until that connection is deleted. + + :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 = { + "provider": "str", # Required provider slug, from the provider list. + Required. + "user_id": "str", # Required. Your identifier for the user the connection + acts for: 1 to 64 characters from ``[A-Za-z0-9._-]``. A session whose + ``actor_id`` equals it uses this connection. Required. + "connection_parameters": {}, # Optional. Values for the provider's + ``connection_parameters``"" , validated against their specifications. + "credential": { + "digitalocean_oauth": {}, # Optional. Use DigitalOcean's shared + OAuth application. + "team_credential": { + "credential_id": "str" # Optional. Required. ID of an active + provider credential for the same provider that you can use. + } + }, + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional CIDR + ranges; when set, every address the host resolves to must + fall within one of them. + ], + "host": "str", # Optional. Host name or IP + address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to 65535. + } + ], + "vpc_uuid": "str" # Optional. UUID of a VPC owned by your + team. + } + }, + "scopes": [ + "str" # Optional. Optional OAuth scopes to request. Defaults to + every scope the provider offers; scopes outside that set are rejected. + Ignored for API-key credentials. + ] + } + + # response body for status code(s): 200 + response == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "connection": { + "api_key": {}, # Optional. Set for ``team_api_key`` connections. + "connection_parameters": {}, # Optional. Non-sensitive provider + configuration. + "created_at": "2020-02-20 00:00:00", # Optional. When the connection + was created. + "credential_id": "str", # Optional. Empty for + ``digitalocean_oauth``"" ; otherwise the ID of the team provider credential + the connection uses. + "credential_kind": "str", # Optional. ``digitalocean_oauth``"" , + ``private_oauth``"" , or ``team_api_key``. Known values are: + "digitalocean_oauth", "private_oauth", and "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. Deprecated: read + ``oauth.granted_at``. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional + CIDR ranges; when set, every address the host resolves to + must fall within one of them. + ], + "host": "str", # Optional. Host name + or IP address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to + 65535. + } + ], + "region": "str", # Optional. Region of the VPC. Set + by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID of a VPC owned by + your team. + } + }, + "oauth": { + "granted_at": "2020-02-20 00:00:00", # Optional. When the + user completed authorization. + "scopes": [ + "str" # Optional. Provider scopes granted, or + requested while pending. + ] + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for example ``jira``. + "provider_display_name": "str", # Optional. Human-readable provider + name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. When the connection + was revoked. + "scopes": [ + "str" # Optional. Deprecated: read ``oauth.scopes``. + Duplicated here so a reader of the pre-union shape keeps working; empty + for a kind with no OAuth grant. + ], + "status": "str", # Optional. pending, active, revoked, or expired. + Known values are: "pending", "active", "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. When the connection + was last modified. + "user_id": "str" # Optional. Your identifier for the user the + connection acts for. + } + } + # response body for status code(s): 400, 409 + 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_connections_create_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, 400, 409]: + 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 == 409: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace_async + async def list( + self, + *, + provider: Optional[str] = None, + user_id: Optional[str] = None, + status: Optional[str] = None, + sort: Optional[str] = None, + sort_direction: Optional[str] = None, + page: int = 1, + per_page: int = 20, + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """List Connections. + + Returns the connections you can see, excluding revoked ones. Offset-paged with page and + ``per_page``\\ ; filter by provider, ``user_id``\\ , and status. + + :keyword provider: Optional provider slug, matched exactly. Default value is None. + :paramtype provider: str + :keyword user_id: Optional substring of ``user_id``. It must use the ``user_id`` alphabet, + ``[A-Za-z0-9._-]``. Default value is None. + :paramtype user_id: str + :keyword status: pending|active|revoked|expired. List results always omit revoked connections, + including when this filter is revoked. Known values are: "pending", "active", and "expired". + Default value is None. + :paramtype status: str + :keyword sort: ``created_at``\\ , provider, ``user_id``\\ , or status. Defaults to provider, + then ``user_id``. Known values are: "created_at", "provider", "user_id", and "status". Default + value is None. + :paramtype sort: str + :keyword sort_direction: asc (the default) or desc. Known values are: "asc" and "desc". Default + value is None. + :paramtype sort_direction: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "connections": [ + { + "api_key": {}, # Optional. Set for ``team_api_key`` + connections. + "connection_parameters": {}, # Optional. Non-sensitive + provider configuration. + "created_at": "2020-02-20 00:00:00", # Optional. When the + connection was created. + "credential_id": "str", # Optional. Empty for + ``digitalocean_oauth``"" ; otherwise the ID of the team provider + credential the connection uses. + "credential_kind": "str", # Optional. + ``digitalocean_oauth``"" , ``private_oauth``"" , or ``team_api_key``. + Known values are: "digitalocean_oauth", "private_oauth", and + "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. Deprecated: + read ``oauth.granted_at``. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. + Optional CIDR ranges; when set, every address the + host resolves to must fall within one of them. + ], + "host": "str", # Optional. + Host name or IP address. It must resolve only to private + addresses. + "port": 0 # Optional. Port, + 1 to 65535. + } + ], + "region": "str", # Optional. Region of the + VPC. Set by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID of a VPC + owned by your team. + } + }, + "oauth": { + "granted_at": "2020-02-20 00:00:00", # Optional. + When the user completed authorization. + "scopes": [ + "str" # Optional. Provider scopes granted, + or requested while pending. + ] + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of + the user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for example + ``jira``. + "provider_display_name": "str", # Optional. Human-readable + provider name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. When the + connection was revoked. + "scopes": [ + "str" # Optional. Deprecated: read ``oauth.scopes``. + Duplicated here so a reader of the pre-union shape keeps working; + empty for a kind with no OAuth grant. + ], + "status": "str", # Optional. pending, active, revoked, or + expired. Known values are: "pending", "active", "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. When the + connection was last modified. + "user_id": "str" # Optional. Your identifier for the user + the connection acts for. + } + ], + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. + } + } + # 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_connections_list_request( + provider=provider, + user_id=user_id, + status=status, + sort=sort, + sort_direction=sort_direction, + page=page, + per_page=per_page, + 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(self, id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Get a Connection. + + Returns the connection and, while it is pending, the authorization the user still has to + complete. Reading a pending connection picks up a completed authorization, and marks the + connection expired once its link has lapsed. Returns 404 for an unknown connection or one you + cannot see. + + :param id: Connection ID. Required. + :type id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "connection": { + "api_key": {}, # Optional. Set for ``team_api_key`` connections. + "connection_parameters": {}, # Optional. Non-sensitive provider + configuration. + "created_at": "2020-02-20 00:00:00", # Optional. When the connection + was created. + "credential_id": "str", # Optional. Empty for + ``digitalocean_oauth``"" ; otherwise the ID of the team provider credential + the connection uses. + "credential_kind": "str", # Optional. ``digitalocean_oauth``"" , + ``private_oauth``"" , or ``team_api_key``. Known values are: + "digitalocean_oauth", "private_oauth", and "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. Deprecated: read + ``oauth.granted_at``. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional + CIDR ranges; when set, every address the host resolves to + must fall within one of them. + ], + "host": "str", # Optional. Host name + or IP address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to + 65535. + } + ], + "region": "str", # Optional. Region of the VPC. Set + by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID of a VPC owned by + your team. + } + }, + "oauth": { + "granted_at": "2020-02-20 00:00:00", # Optional. When the + user completed authorization. + "scopes": [ + "str" # Optional. Provider scopes granted, or + requested while pending. + ] + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for example ``jira``. + "provider_display_name": "str", # Optional. Human-readable provider + name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. When the connection + was revoked. + "scopes": [ + "str" # Optional. Deprecated: read ``oauth.scopes``. + Duplicated here so a reader of the pre-union shape keeps working; empty + for a kind with no OAuth grant. + ], + "status": "str", # Optional. pending, active, revoked, or expired. + Known values are: "pending", "active", "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. When the connection + was last modified. + "user_id": "str" # Optional. Your identifier for the user the + connection acts for. + } + } + # 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_connections_get_request( + id=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 delete(self, id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Delete a Connection. + + Marks the connection revoked and returns it; for an OAuth connection, its stored tokens are + deleted first. Creating a connection for the same provider and ``user_id`` later reuses the + same ID. Only the user who created the connection can delete it; for anyone else it is 404. + + :param id: Connection ID. Required. + :type id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "connection": { + "api_key": {}, # Optional. Set for ``team_api_key`` connections. + "connection_parameters": {}, # Optional. Non-sensitive provider + configuration. + "created_at": "2020-02-20 00:00:00", # Optional. When the connection + was created. + "credential_id": "str", # Optional. Empty for + ``digitalocean_oauth``"" ; otherwise the ID of the team provider credential + the connection uses. + "credential_kind": "str", # Optional. ``digitalocean_oauth``"" , + ``private_oauth``"" , or ``team_api_key``. Known values are: + "digitalocean_oauth", "private_oauth", and "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. Deprecated: read + ``oauth.granted_at``. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional + CIDR ranges; when set, every address the host resolves to + must fall within one of them. + ], + "host": "str", # Optional. Host name + or IP address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to + 65535. + } + ], + "region": "str", # Optional. Region of the VPC. Set + by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID of a VPC owned by + your team. + } + }, + "oauth": { + "granted_at": "2020-02-20 00:00:00", # Optional. When the + user completed authorization. + "scopes": [ + "str" # Optional. Provider scopes granted, or + requested while pending. + ] + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for example ``jira``. + "provider_display_name": "str", # Optional. Human-readable provider + name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. When the connection + was revoked. + "scopes": [ + "str" # Optional. Deprecated: read ``oauth.scopes``. + Duplicated here so a reader of the pre-union shape keeps working; empty + for a kind with no OAuth grant. + ], + "status": "str", # Optional. pending, active, revoked, or expired. + Known values are: "pending", "active", "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. When the connection + was last modified. + "user_id": "str" # Optional. Your identifier for the user the + connection acts for. + } + } + # 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_connections_delete_request( + id=id, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + +class McpServersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.aio.GeneratedClient`'s + :attr:`mcp_servers` 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") + ) + + @overload + async def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Register an MCP Server. + + Registers a remote MCP server for your team, using the streamable HTTP transport. The server + starts with ``syncStatus`` pending and no tools: discover its tools with ``POST + .../mcp-servers/{server_ref}/resync``\\ , then choose which to enable with ``PUT + .../mcp-servers/{server_ref}/tools``. The endpoint must be HTTPS and resolve only to public IP + addresses. The number of servers per team is limited (10 by default); registering beyond it + returns 429. Returns 409 when ``serverRef`` is already in use. + + :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 = { + "endpoint": "str", # HTTPS URL of the server's MCP endpoint. Its host must + resolve only to public IP addresses. Required. Required. + "serverRef": "str", # Identifier for the server, unique within your team. + Must match ``^``"" [a-z]"" ```[a-z0-9-]``"" {0,63}$`. Required. + "api_key": "str", # Optional. For ``credentialRefSource`` secret: the key or + token itself. DigitalOcean stores it; it is write-only and no response returns + it. Set exactly one of ``credentialRef`` and ``api_key``. + "credentialRef": "str", # Optional. For ``credentialRefSource`` secret: a + reference to a secret your team stores with DigitalOcean. Must match ``^``"" + [A-Za-z0-9]"" ```[A-Za-z0-9:/_.-]``"" {0,254}$"" ``. Set exactly one of``"" + credentialRef"" ``and``"" api_key`. + "credentialRefSource": "none", # Optional. Default value is "none". How + requests to the server authenticate: none (the default), secret, or connection. + With secret, the value from ``credentialRef`` or ``api_key`` is sent in the + Authorization header, prefixed with "Bearer " unless it already contains a space. + Known values are: "none", "secret", and "connection". + "description": "str", # Optional. Optional description shown on the server's + catalog card. At most 1024 characters. + "oauth_authorization_ttl_seconds": "str", # Optional. How long, in seconds, + a user's authorization may be reused before they must consent again. Optional; 0 + means 30 days, and the maximum is 100 years. Authorizations are not refreshed + automatically, so this window, not the provider's token lifetime, decides how + often a user is sent back through consent. Set it no longer than the provider's + own token lifetime, so the prompt arrives before a tool call fails against an + expired token. + "oauth_authorize_url": "str", # Optional. Required for + ``credentialRefSource`` connection: the OAuth authorization endpoint. It must use + the endpoint's scheme and port, on the endpoint's host or another host under the + same registrable domain. + "oauth_client_id": "str", # Optional. Required for ``credentialRefSource`` + connection: the client ID of your team's OAuth client for the server. Each user + of the server then authorizes individually. + "oauth_client_secret": "str", # Optional. Required for + ``credentialRefSource`` connection. Write-only; no response returns it. + "oauth_scopes": [ + "str" # Optional. Required for ``credentialRefSource`` connection: + the scopes to request from each user, 1 to 64 of them. + ], + "oauth_token_url": "str", # Optional. Required for ``credentialRefSource`` + connection: the OAuth token endpoint, under the same rules as + ``oauth_authorize_url``. + "transport": "streamable_http" # Optional. Default value is + "streamable_http". Optional. ``streamable_http``"" , the default and only + accepted value. "streamable_http" + } + + # response body for status code(s): 200 + response == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # response body for status code(s): 400, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + async def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Register an MCP Server. + + Registers a remote MCP server for your team, using the streamable HTTP transport. The server + starts with ``syncStatus`` pending and no tools: discover its tools with ``POST + .../mcp-servers/{server_ref}/resync``\\ , then choose which to enable with ``PUT + .../mcp-servers/{server_ref}/tools``. The endpoint must be HTTPS and resolve only to public IP + addresses. The number of servers per team is limited (10 by default); registering beyond it + returns 429. Returns 409 when ``serverRef`` is already in use. + + :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 == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # response body for status code(s): 400, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace_async + async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Register an MCP Server. + + Registers a remote MCP server for your team, using the streamable HTTP transport. The server + starts with ``syncStatus`` pending and no tools: discover its tools with ``POST + .../mcp-servers/{server_ref}/resync``\\ , then choose which to enable with ``PUT + .../mcp-servers/{server_ref}/tools``. The endpoint must be HTTPS and resolve only to public IP + addresses. The number of servers per team is limited (10 by default); registering beyond it + returns 429. Returns 409 when ``serverRef`` is already in use. + + :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 = { + "endpoint": "str", # HTTPS URL of the server's MCP endpoint. Its host must + resolve only to public IP addresses. Required. Required. + "serverRef": "str", # Identifier for the server, unique within your team. + Must match ``^``"" [a-z]"" ```[a-z0-9-]``"" {0,63}$`. Required. + "api_key": "str", # Optional. For ``credentialRefSource`` secret: the key or + token itself. DigitalOcean stores it; it is write-only and no response returns + it. Set exactly one of ``credentialRef`` and ``api_key``. + "credentialRef": "str", # Optional. For ``credentialRefSource`` secret: a + reference to a secret your team stores with DigitalOcean. Must match ``^``"" + [A-Za-z0-9]"" ```[A-Za-z0-9:/_.-]``"" {0,254}$"" ``. Set exactly one of``"" + credentialRef"" ``and``"" api_key`. + "credentialRefSource": "none", # Optional. Default value is "none". How + requests to the server authenticate: none (the default), secret, or connection. + With secret, the value from ``credentialRef`` or ``api_key`` is sent in the + Authorization header, prefixed with "Bearer " unless it already contains a space. + Known values are: "none", "secret", and "connection". + "description": "str", # Optional. Optional description shown on the server's + catalog card. At most 1024 characters. + "oauth_authorization_ttl_seconds": "str", # Optional. How long, in seconds, + a user's authorization may be reused before they must consent again. Optional; 0 + means 30 days, and the maximum is 100 years. Authorizations are not refreshed + automatically, so this window, not the provider's token lifetime, decides how + often a user is sent back through consent. Set it no longer than the provider's + own token lifetime, so the prompt arrives before a tool call fails against an + expired token. + "oauth_authorize_url": "str", # Optional. Required for + ``credentialRefSource`` connection: the OAuth authorization endpoint. It must use + the endpoint's scheme and port, on the endpoint's host or another host under the + same registrable domain. + "oauth_client_id": "str", # Optional. Required for ``credentialRefSource`` + connection: the client ID of your team's OAuth client for the server. Each user + of the server then authorizes individually. + "oauth_client_secret": "str", # Optional. Required for + ``credentialRefSource`` connection. Write-only; no response returns it. + "oauth_scopes": [ + "str" # Optional. Required for ``credentialRefSource`` connection: + the scopes to request from each user, 1 to 64 of them. + ], + "oauth_token_url": "str", # Optional. Required for ``credentialRefSource`` + connection: the OAuth token endpoint, under the same rules as + ``oauth_authorize_url``. + "transport": "streamable_http" # Optional. Default value is + "streamable_http". Optional. ``streamable_http``"" , the default and only + accepted value. "streamable_http" + } + + # response body for status code(s): 200 + response == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # response body for status code(s): 400, 409 + 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_mcp_servers_create_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, 400, 409]: + 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 == 409: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace_async + async def list(self, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """List MCP Servers. + + Returns every MCP server your team has registered, sorted by ``serverRef``. + + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "mcpServers": [ + { + "createdAt": "str", # Optional. When the server was + registered, in RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference + supplied at registration when source=secret, or the team's OAuth + credential ID when source=connection. Empty when the server was + registered with an ``api_key``"" , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to + the server authenticate: none, secret (a key or token sent in the + Authorization header), or connection (each user's own OAuth + authorization). Known values are: "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, + shown on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last + succeeded, in RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How + long a user's authorization is reused before re-consent. Echoed so a team + can read the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth + authorization endpoint. Set only when ``credentialRefSource`` is + connection; the client secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each + user. Set only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique + within your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery + failed; empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest + discovery: pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known + values are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on + the server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last + modified, in RFC 3339 format. + } + ] + } + """ + 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_mcp_servers_list_request( + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace_async + async def get(self, server_ref: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Get an MCP Server. + + Returns one of your team's MCP servers, or 404 when your team has none with this ``serverRef``. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # 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_mcp_servers_get_request( + server_ref=server_ref, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + async def patch( + self, + server_ref: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Update an MCP Server. + + Changes the server's description, which is shown on its catalog card immediately. The endpoint + and credentials cannot be changed; to change them, delete the server and register it again. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 = { + "description": "str" # Optional. Replaces the stored description; empty + clears it. At most 1024 characters. + } + + # response body for status code(s): 200 + response == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # 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 patch( + self, + server_ref: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Update an MCP Server. + + Changes the server's description, which is shown on its catalog card immediately. The endpoint + and credentials cannot be changed; to change them, delete the server and register it again. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # 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 patch( + self, server_ref: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Update an MCP Server. + + Changes the server's description, which is shown on its catalog card immediately. The endpoint + and credentials cannot be changed; to change them, delete the server and register it again. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 = { + "description": "str" # Optional. Replaces the stored description; empty + clears it. At most 1024 characters. + } + + # response body for status code(s): 200 + response == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # 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_mcp_servers_patch_request( + server_ref=server_ref, + 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 + + @distributed_trace_async + async def delete(self, server_ref: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Delete an MCP Server. + + Disables all of the server's tools, removes them from your team's catalog, and deletes the + server. An ``api_key`` supplied at registration is deleted; a ``credentialRef`` you supplied is + left untouched. For a server registered with ``credentialRefSource`` connection, every user + connection made through its OAuth client is revoked. Returns the deleted server, or 404 when it + does not exist. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # 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_mcp_servers_delete_request( + server_ref=server_ref, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + async def run_resync( + self, + server_ref: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Discover an MCP Server's Tools. + + Connects to the server, lists its tools, and records them. Discovered tools are not callable + until + you enable them. + + When discovery finishes in time, returns 200 with the server and its tools; a discovery failure + is + reported in ``syncStatus`` and ``syncError`` rather than as an error. Otherwise returns 202 + with pending + set while discovery continues: poll ``GET .../mcp-servers/{server_ref}`` until ``lastSyncedAt`` + or + ``syncError`` changes (\\ ``syncStatus`` is not reset while discovery runs). + + For a server registered with ``credentialRefSource`` connection, ``user_id`` is required; if + that user + has not authorized the server yet, the response carries authorization with the URL to send them + to. + Resyncs are rate limited per team, and a team can run only a few discoveries at once; either + limit + returns 429. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 = { + "user_id": "str" # Optional. Required for a server registered with + ``credentialRefSource`` connection: discovery reaches the server as this user, + through their connection, because such a server has no team-wide credential. + Ignored otherwise. + } + + # response body for status code(s): 200, 202 + response == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + }, + "pending": bool, # Optional. True when discovery is still running (HTTP + 202). Poll the server to see the outcome. + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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 run_resync( + self, + server_ref: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Discover an MCP Server's Tools. + + Connects to the server, lists its tools, and records them. Discovered tools are not callable + until + you enable them. + + When discovery finishes in time, returns 200 with the server and its tools; a discovery failure + is + reported in ``syncStatus`` and ``syncError`` rather than as an error. Otherwise returns 202 + with pending + set while discovery continues: poll ``GET .../mcp-servers/{server_ref}`` until ``lastSyncedAt`` + or + ``syncError`` changes (\\ ``syncStatus`` is not reset while discovery runs). + + For a server registered with ``credentialRefSource`` connection, ``user_id`` is required; if + that user + has not authorized the server yet, the response carries authorization with the URL to send them + to. + Resyncs are rate limited per team, and a team can run only a few discoveries at once; either + limit + returns 429. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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, 202 + response == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + }, + "pending": bool, # Optional. True when discovery is still running (HTTP + 202). Poll the server to see the outcome. + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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 run_resync( + self, server_ref: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Discover an MCP Server's Tools. + + Connects to the server, lists its tools, and records them. Discovered tools are not callable + until + you enable them. + + When discovery finishes in time, returns 200 with the server and its tools; a discovery failure + is + reported in ``syncStatus`` and ``syncError`` rather than as an error. Otherwise returns 202 + with pending + set while discovery continues: poll ``GET .../mcp-servers/{server_ref}`` until ``lastSyncedAt`` + or + ``syncError`` changes (\\ ``syncStatus`` is not reset while discovery runs). + + For a server registered with ``credentialRefSource`` connection, ``user_id`` is required; if + that user + has not authorized the server yet, the response carries authorization with the URL to send them + to. + Resyncs are rate limited per team, and a team can run only a few discoveries at once; either + limit + returns 429. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 = { + "user_id": "str" # Optional. Required for a server registered with + ``credentialRefSource`` connection: discovery reaches the server as this user, + through their connection, because such a server has no team-wide credential. + Ignored otherwise. + } + + # response body for status code(s): 200, 202 + response == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + }, + "pending": bool, # Optional. True when discovery is still running (HTTP + 202). Poll the server to see the outcome. + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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_mcp_servers_run_resync_request( + server_ref=server_ref, + 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, 202, 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 == 202: + 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 + + @distributed_trace_async + async def list_tools(self, server_ref: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """List an MCP Server's Tools. + + Returns every tool discovered on the server, sorted by name, with whether each is enabled. + Tools that have since disappeared from the server stay listed. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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_mcp_servers_list_tools_request( + server_ref=server_ref, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + async def update_tools( + self, + server_ref: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Set Which of an MCP Server's Tools Are Enabled. + + ``enabledToolSlugs`` is the complete set to enable; every other tool of the server is disabled. + An + enabled tool is added to your team's catalog at its latest discovered version, and a disabled + one is + removed from it. Repeating the same set changes nothing. + + Before changing anything, each tool being enabled, re-enabled, or moved to a newer discovered + version is verified against the live server: it must still be listed there, with the same input + schema as when it was discovered. If any check fails or the server cannot be reached, the + request + fails with 400 and nothing changes; resync and try again. An unknown tool slug is also rejected + with + + + #. A request that needs verification counts against the resync rate limit (429). Returns the + server's full tool list. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 = { + "enabledToolSlugs": [ + "str" # The complete set of tool slugs ("" ``_``"" + ) to enable; every other tool of the server is disabled. Empty disables every + tool. Required. + ], + "user_id": "str" # Optional. Required for a server registered with + ``credentialRefSource`` connection when a tool needs verification against the + live server, which can only be reached as a user who has authorized it. Ignored + otherwise. + } + + # response body for status code(s): 200 + response == { + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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_tools( + self, + server_ref: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Set Which of an MCP Server's Tools Are Enabled. + + ``enabledToolSlugs`` is the complete set to enable; every other tool of the server is disabled. + An + enabled tool is added to your team's catalog at its latest discovered version, and a disabled + one is + removed from it. Repeating the same set changes nothing. + + Before changing anything, each tool being enabled, re-enabled, or moved to a newer discovered + version is verified against the live server: it must still be listed there, with the same input + schema as when it was discovered. If any check fails or the server cannot be reached, the + request + fails with 400 and nothing changes; resync and try again. An unknown tool slug is also rejected + with + + + #. A request that needs verification counts against the resync rate limit (429). Returns the + server's full tool list. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 == { + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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_tools( + self, server_ref: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Set Which of an MCP Server's Tools Are Enabled. + + ``enabledToolSlugs`` is the complete set to enable; every other tool of the server is disabled. + An + enabled tool is added to your team's catalog at its latest discovered version, and a disabled + one is + removed from it. Repeating the same set changes nothing. + + Before changing anything, each tool being enabled, re-enabled, or moved to a newer discovered + version is verified against the live server: it must still be listed there, with the same input + schema as when it was discovered. If any check fails or the server cannot be reached, the + request + fails with 400 and nothing changes; resync and try again. An unknown tool slug is also rejected + with + + + #. A request that needs verification counts against the resync rate limit (429). Returns the + server's full tool list. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 = { + "enabledToolSlugs": [ + "str" # The complete set of tool slugs ("" ``_``"" + ) to enable; every other tool of the server is disabled. Empty disables every + tool. Required. + ], + "user_id": "str" # Optional. Required for a server registered with + ``credentialRefSource`` connection when a tool needs verification against the + live server, which can only be reached as a user who has authorized it. Ignored + otherwise. + } + + # response body for status code(s): 200 + response == { + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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_mcp_servers_update_tools_request( + server_ref=server_ref, + 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 OutputViewsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.aio.GeneratedClient`'s + :attr:`output_views` 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") + ) + + @overload + async def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create an Output View. + + An output view is a named projection of one tool version's output: tool calls that use it + return only the listed fields, and its ``output_schema`` describes the result. The view is + bound to the tool version your catalog currently releases. Returns 409 when your team already + has a view with this name on the tool version, and 429 when your team already has the maximum + of 20 views on it. + + :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 = { + "fields": [ + "str" # Output paths to keep, 1 to 64 of them. Each is a dotted path + of up to 8 segments made of ``[A-Za-z0-9_-]``"" , and must be declared by the + tool's output schema; arrays are traversed element-wise. Paths may not repeat + or be a prefix of one another. The tool version must declare an object output + schema. Required. + ], + "name": "str", # View name. Must match ``^``"" [a-z]"" ```[a-z0-9_-]``"" + {0,63}$` and be unique per tool version within your team. Required. + "description": "str", # Optional. Optional description. At most 512 bytes. + "tool": "str", # Optional. Exactly one of tool or ``tool_id`` selects the + tool version. tool is a provider-qualified slug, optionally pinned as + ``@``. You can bind only the released version your catalog + exposes: an unpinned slug resolves it and the response echoes it as version; a + pin must equal it, and a ``tool_id`` (the opaque identity from tool search) must + be that version. Any other version returns 404. + "tool_id": "str" # Optional. Opaque ID of the tool version; see tool. + } + + # response body for status code(s): 200 + response == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # response body for status code(s): 400, 404, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + async def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create an Output View. + + An output view is a named projection of one tool version's output: tool calls that use it + return only the listed fields, and its ``output_schema`` describes the result. The view is + bound to the tool version your catalog currently releases. Returns 409 when your team already + has a view with this name on the tool version, and 429 when your team already has the maximum + of 20 views on it. + + :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 == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # response body for status code(s): 400, 404, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace_async + async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Create an Output View. + + An output view is a named projection of one tool version's output: tool calls that use it + return only the listed fields, and its ``output_schema`` describes the result. The view is + bound to the tool version your catalog currently releases. Returns 409 when your team already + has a view with this name on the tool version, and 429 when your team already has the maximum + of 20 views on it. + + :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 = { + "fields": [ + "str" # Output paths to keep, 1 to 64 of them. Each is a dotted path + of up to 8 segments made of ``[A-Za-z0-9_-]``"" , and must be declared by the + tool's output schema; arrays are traversed element-wise. Paths may not repeat + or be a prefix of one another. The tool version must declare an object output + schema. Required. + ], + "name": "str", # View name. Must match ``^``"" [a-z]"" ```[a-z0-9_-]``"" + {0,63}$` and be unique per tool version within your team. Required. + "description": "str", # Optional. Optional description. At most 512 bytes. + "tool": "str", # Optional. Exactly one of tool or ``tool_id`` selects the + tool version. tool is a provider-qualified slug, optionally pinned as + ``@``. You can bind only the released version your catalog + exposes: an unpinned slug resolves it and the response echoes it as version; a + pin must equal it, and a ``tool_id`` (the opaque identity from tool search) must + be that version. Any other version returns 404. + "tool_id": "str" # Optional. Opaque ID of the tool version; see tool. + } + + # response body for status code(s): 200 + response == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # response body for status code(s): 400, 404, 409 + 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_output_views_create_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, 400, 404, 409]: + 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 response.status_code == 409: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace_async + async def list( + self, + *, + tool: Optional[str] = None, + tool_id: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """List Output Views. + + Returns the output views your team can use: views DigitalOcean publishes to every team, plus + your team's own. Cursor-paged with ``page_size`` and ``page_token``\\ ; no total is reported. + + :keyword tool: At most one of tool or ``tool_id``\\ , as on create. With one set, the list is + the published views plus your team's own on that tool version. With neither, it is every live + view your team owns plus every published view on a tool version your catalog exposes, across + tools. Default value is None. + :paramtype tool: str + :keyword tool_id: Opaque ID of the tool version; see tool. Default value is None. + :paramtype tool_id: str + :keyword page_size: Page size, 1 to 100. Defaults to 20 when omitted or 0; other values are + rejected with 400. Default value is 20. + :paramtype page_size: int + :keyword page_token: ``next_page_token`` from the previous response. Valid only with the same + tool selection; otherwise the request is rejected with 400. Default value is None. + :paramtype page_token: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "next_page_token": "str", # Optional. Empty on the last page. + "tool": "str", # Optional. Tool slug of that version. Empty when the request + named no tool. + "tool_id": "str", # Optional. The tool version the views are bound to, + echoed so an unpinned request learns which version it resolved. Empty when the + request named no tool. + "version": "str", # Optional. Version of that tool, for example ``v3``. + Empty when the request named no tool. + "views": [ + { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When + the resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set + once the resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When + the resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a + projection keeps; arrays are traversed element-wise. Empty for a + transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` + or ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool + version among its owner's views. + "output_schema": {}, # Optional. The JSON Schema every + result of this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's + views, and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, + for example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the + exact tool version the view is bound to; tool and version are its + readable coordinates. + "version": "str", # Optional. The tool version, for example + ``v3``. + "view_id": "str" # Optional. Output view ID, for example + ``ov_`` followed by 32 hex digits. Empty on a preview. + } + ] + } + # 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_output_views_list_request( + tool=tool, + tool_id=tool_id, + page_size=page_size, + page_token=page_token, + 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 validate( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Preview an Output View. + + Validates a projection exactly as create does and returns the view it would produce, including + ``output_schema``\\ , without storing anything. name and description are optional here; name + uniqueness and the per-tool-version limit are not checked. + + :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 = { + "fields": [ + "str" # Output paths to keep; as on create. Required. + ], + "description": "str", # Optional. Optional description, validated as on + create when present. + "name": "str", # Optional. Optional view name, validated as on create when + present. + "tool": "str", # Optional. Tool slug, optionally pinned; as on create. + "tool_id": "str" # Optional. Opaque ID of the tool version; as on create. + } + + # response body for status code(s): 200 + response == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # 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 validate( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Preview an Output View. + + Validates a projection exactly as create does and returns the view it would produce, including + ``output_schema``\\ , without storing anything. name and description are optional here; name + uniqueness and the per-tool-version limit are not checked. + + :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 == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # 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 validate(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Preview an Output View. + + Validates a projection exactly as create does and returns the view it would produce, including + ``output_schema``\\ , without storing anything. name and description are optional here; name + uniqueness and the per-tool-version limit are not checked. + + :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 = { + "fields": [ + "str" # Output paths to keep; as on create. Required. + ], + "description": "str", # Optional. Optional description, validated as on + create when present. + "name": "str", # Optional. Optional view name, validated as on create when + present. + "tool": "str", # Optional. Tool slug, optionally pinned; as on create. + "tool_id": "str" # Optional. Opaque ID of the tool version; as on create. + } + + # response body for status code(s): 200 + response == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # 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_output_views_validate_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, 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 + + @distributed_trace_async + async def get(self, view_id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Get an Output View. + + Returns one of your team's views, or a published view on a tool version your catalog exposes. + Returns 404 when the view does not exist, was deleted, or belongs to another team. + + :param view_id: Output view ID. Required. + :type view_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # 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_output_views_get_request( + view_id=view_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 delete(self, view_id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Delete an Output View. + + Deletes one of your team's views and returns it with audit.deleted_at set; it can no longer be + used. Published views cannot be deleted. Returns 404 when the view does not exist, is already + deleted, or is not your team's. + + :param view_id: Output view ID. Required. + :type view_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # 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_output_views_delete_request( + view_id=view_id, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + +class SessionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.aio.GeneratedClient`'s + :attr:`sessions` 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") + ) + + @overload + async def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a Session. + + Creates a session owned by your team, with a new session URN, and returns the MCP URL an agent + connects to. tools selects the tools and toolbelts the session exposes, and policy decides + which calls run, need approval, or are refused. + + :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 = { + "name": "str", # Required human-readable session name. Required. + "actorId": "str", # Optional. Optional actor binding: the user whose + connections the session's tool calls use, matched against connection ``user_id``. + When set it must use the same alphabet as a connection's ``user_id``"" , + ``[A-Za-z0-9._-]``"" , at most 64 characters; anything else is rejected with 400. + "config": {}, # Optional. Optional session options. config.preloadTools may + contain concrete tool names (optionally version-pinned) and version-pinned + toolbelt references. config.customInstructions is a string of at most 1000 + characters. config.outputViews maps up to 100 tool slugs to the name of an output + view to apply to that tool's results. + "insights": { + "logs": bool, # Optional. Whether the session's customer logs are + sent to Insights. + "metrics": bool, # Optional. Accepted and stored for parity with the + Insights schema. + "traces": bool # Optional. Whether the session's customer traces are + sent to Insights. + }, + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by your team, in a + region that supports sessions. + }, + "policy": { + "defaultAction": "str", # Optional. Action for calls no rule + matches. Empty means ask; otherwise this must be allow, ask, or deny. Known + values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. Required: allow, ask, + or deny. Known values are: "allow", "ask", and "deny". + "match": { + "str": "str" # Optional. Optional argument + conditions, keyed by argument name; the rule applies only to + calls whose arguments match. + }, + "tool": "str" # Optional. Required. A tool slug, + optionally ``@``"" , or a toolbelt as + ``toolbelt:@``. When the session selects tools, the + rule must name one of them. + } + ] + }, + "tools": [ + "str" # Optional. Omitted enables every tool. An explicit empty + array enables no tools. Direct tools may be ```` or + ``@``"" , using provider-qualified tool slugs, and a pinned + version must be the released one; toolbelt references must be version-pinned + as ``toolbelt:@``. + ] + } + + # response body for status code(s): 200 + response == { + "mcpUrl": "str", # Optional. URL of the session's MCP endpoint, for the + agent to connect to. + "session": { + "actorId": "str", # Optional. Empty when the session is not bound to + an actor. + "agentName": "str", # Optional. Name of the agent that started the + session. Empty for sessions created through this API. + "agentUrn": "str", # Optional. URN of the agent that started the + session. Empty for sessions created through this API. + "config": {}, # Optional. Session options as supplied at creation. + Omitted when none were supplied. + "createdAt": "2020-02-20 00:00:00", # Optional. When the session was + created. + "insights": { + "logs": bool, # Optional. Whether the session's customer + logs are sent to Insights. + "metrics": bool, # Optional. Accepted and stored for parity + with the Insights schema. + "traces": bool # Optional. Whether the session's customer + traces are sent to Insights. + }, + "name": "str", # Optional. The required human-readable session name. + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by your + team, in a region that supports sessions. + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the session, when recorded. + "policy": { + "defaultAction": "str", # Optional. Action for calls no rule + matches. Empty means ask; otherwise this must be allow, ask, or deny. + Known values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. Required: + allow, ask, or deny. Known values are: "allow", "ask", and + "deny". + "match": { + "str": "str" # Optional. Optional + argument conditions, keyed by argument name; the rule applies + only to calls whose arguments match. + }, + "tool": "str" # Optional. Required. A tool + slug, optionally ``@``"" , or a toolbelt as + ``toolbelt:@``. When the session selects tools, + the rule must name one of them. + } + ] + }, + "sessionUrn": "str", # Optional. Session URN, for example + ``do:managed_agent_session:``. + "tools": { + "references": [ + { + "kind": "str", # Optional. Whether name is a + tool or a toolbelt. Known values are: + "SESSION_TOOL_REFERENCE_KIND_TOOL" and + "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". + "name": "str", # Optional. Tool slug or + toolbelt name. + "version": "str" # Optional. Pinned version. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. When the session was + last modified. + }, + "tools": [ + "str" # Optional. Canonical, version-pinned selected tool + references. Empty when the session exposes every tool. + ] + } + # 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 + async def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a Session. + + Creates a session owned by your team, with a new session URN, and returns the MCP URL an agent + connects to. tools selects the tools and toolbelts the session exposes, and policy decides + which calls run, need approval, or are refused. + + :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 == { + "mcpUrl": "str", # Optional. URL of the session's MCP endpoint, for the + agent to connect to. + "session": { + "actorId": "str", # Optional. Empty when the session is not bound to + an actor. + "agentName": "str", # Optional. Name of the agent that started the + session. Empty for sessions created through this API. + "agentUrn": "str", # Optional. URN of the agent that started the + session. Empty for sessions created through this API. + "config": {}, # Optional. Session options as supplied at creation. + Omitted when none were supplied. + "createdAt": "2020-02-20 00:00:00", # Optional. When the session was + created. + "insights": { + "logs": bool, # Optional. Whether the session's customer + logs are sent to Insights. + "metrics": bool, # Optional. Accepted and stored for parity + with the Insights schema. + "traces": bool # Optional. Whether the session's customer + traces are sent to Insights. + }, + "name": "str", # Optional. The required human-readable session name. + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by your + team, in a region that supports sessions. + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the session, when recorded. + "policy": { + "defaultAction": "str", # Optional. Action for calls no rule + matches. Empty means ask; otherwise this must be allow, ask, or deny. + Known values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. Required: + allow, ask, or deny. Known values are: "allow", "ask", and + "deny". + "match": { + "str": "str" # Optional. Optional + argument conditions, keyed by argument name; the rule applies + only to calls whose arguments match. + }, + "tool": "str" # Optional. Required. A tool + slug, optionally ``@``"" , or a toolbelt as + ``toolbelt:@``. When the session selects tools, + the rule must name one of them. + } + ] + }, + "sessionUrn": "str", # Optional. Session URN, for example + ``do:managed_agent_session:``. + "tools": { + "references": [ + { + "kind": "str", # Optional. Whether name is a + tool or a toolbelt. Known values are: + "SESSION_TOOL_REFERENCE_KIND_TOOL" and + "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". + "name": "str", # Optional. Tool slug or + toolbelt name. + "version": "str" # Optional. Pinned version. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. When the session was + last modified. + }, + "tools": [ + "str" # Optional. Canonical, version-pinned selected tool + references. Empty when the session exposes every tool. + ] + } + # 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_async + async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Create a Session. + + Creates a session owned by your team, with a new session URN, and returns the MCP URL an agent + connects to. tools selects the tools and toolbelts the session exposes, and policy decides + which calls run, need approval, or are refused. + + :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 = { + "name": "str", # Required human-readable session name. Required. + "actorId": "str", # Optional. Optional actor binding: the user whose + connections the session's tool calls use, matched against connection ``user_id``. + When set it must use the same alphabet as a connection's ``user_id``"" , + ``[A-Za-z0-9._-]``"" , at most 64 characters; anything else is rejected with 400. + "config": {}, # Optional. Optional session options. config.preloadTools may + contain concrete tool names (optionally version-pinned) and version-pinned + toolbelt references. config.customInstructions is a string of at most 1000 + characters. config.outputViews maps up to 100 tool slugs to the name of an output + view to apply to that tool's results. + "insights": { + "logs": bool, # Optional. Whether the session's customer logs are + sent to Insights. + "metrics": bool, # Optional. Accepted and stored for parity with the + Insights schema. + "traces": bool # Optional. Whether the session's customer traces are + sent to Insights. + }, + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by your team, in a + region that supports sessions. + }, + "policy": { + "defaultAction": "str", # Optional. Action for calls no rule + matches. Empty means ask; otherwise this must be allow, ask, or deny. Known + values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. Required: allow, ask, + or deny. Known values are: "allow", "ask", and "deny". + "match": { + "str": "str" # Optional. Optional argument + conditions, keyed by argument name; the rule applies only to + calls whose arguments match. + }, + "tool": "str" # Optional. Required. A tool slug, + optionally ``@``"" , or a toolbelt as + ``toolbelt:@``. When the session selects tools, the + rule must name one of them. + } + ] + }, + "tools": [ + "str" # Optional. Omitted enables every tool. An explicit empty + array enables no tools. Direct tools may be ```` or + ``@``"" , using provider-qualified tool slugs, and a pinned + version must be the released one; toolbelt references must be version-pinned + as ``toolbelt:@``. + ] + } + + # response body for status code(s): 200 + response == { + "mcpUrl": "str", # Optional. URL of the session's MCP endpoint, for the + agent to connect to. + "session": { + "actorId": "str", # Optional. Empty when the session is not bound to + an actor. + "agentName": "str", # Optional. Name of the agent that started the + session. Empty for sessions created through this API. + "agentUrn": "str", # Optional. URN of the agent that started the + session. Empty for sessions created through this API. + "config": {}, # Optional. Session options as supplied at creation. + Omitted when none were supplied. + "createdAt": "2020-02-20 00:00:00", # Optional. When the session was + created. + "insights": { + "logs": bool, # Optional. Whether the session's customer + logs are sent to Insights. + "metrics": bool, # Optional. Accepted and stored for parity + with the Insights schema. + "traces": bool # Optional. Whether the session's customer + traces are sent to Insights. + }, + "name": "str", # Optional. The required human-readable session name. + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by your + team, in a region that supports sessions. + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the session, when recorded. + "policy": { + "defaultAction": "str", # Optional. Action for calls no rule + matches. Empty means ask; otherwise this must be allow, ask, or deny. + Known values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. Required: + allow, ask, or deny. Known values are: "allow", "ask", and + "deny". + "match": { + "str": "str" # Optional. Optional + argument conditions, keyed by argument name; the rule applies + only to calls whose arguments match. + }, + "tool": "str" # Optional. Required. A tool + slug, optionally ``@``"" , or a toolbelt as + ``toolbelt:@``. When the session selects tools, + the rule must name one of them. + } + ] + }, + "sessionUrn": "str", # Optional. Session URN, for example + ``do:managed_agent_session:``. + "tools": { + "references": [ + { + "kind": "str", # Optional. Whether name is a + tool or a toolbelt. Known values are: + "SESSION_TOOL_REFERENCE_KIND_TOOL" and + "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". + "name": "str", # Optional. Tool slug or + toolbelt name. + "version": "str" # Optional. Pinned version. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. When the session was + last modified. + }, + "tools": [ + "str" # Optional. Canonical, version-pinned selected tool + references. Empty when the session exposes every tool. + ] + } + # 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_sessions_create_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, 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 list( self, - name: str, *, - version: Optional[str] = None, - toolkit_id: Optional[str] = None, + end_user_id: Optional[str] = None, + page: int = 1, + per_page: int = 20, + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """List Sessions. + + Returns the sessions you can see, newest first. Offset-paged with page and ``per_page``\\ ; + ``end_user_id`` filters to one actor. + + :keyword end_user_id: Optional ``actor_id``\\ , matched exactly. Default value is None. + :paramtype end_user_id: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int + :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. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. + }, + "sessions": [ + { + "actorId": "str", # Optional. Empty when the session is not + bound to an actor. + "agentName": "str", # Optional. Name of the agent that + started the session. Empty for sessions created through this API. + "agentUrn": "str", # Optional. URN of the agent that started + the session. Empty for sessions created through this API. + "config": {}, # Optional. Session options as supplied at + creation. Omitted when none were supplied. + "createdAt": "2020-02-20 00:00:00", # Optional. When the + session was created. + "insights": { + "logs": bool, # Optional. Whether the session's + customer logs are sent to Insights. + "metrics": bool, # Optional. Accepted and stored for + parity with the Insights schema. + "traces": bool # Optional. Whether the session's + customer traces are sent to Insights. + }, + "name": "str", # Optional. The required human-readable + session name. + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by + your team, in a region that supports sessions. + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of + the user who created the session, when recorded. + "policy": { + "defaultAction": "str", # Optional. Action for calls + no rule matches. Empty means ask; otherwise this must be allow, ask, + or deny. Known values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. + Required: allow, ask, or deny. Known values are: "allow", + "ask", and "deny". + "match": { + "str": "str" # Optional. + Optional argument conditions, keyed by argument name; the + rule applies only to calls whose arguments match. + }, + "tool": "str" # Optional. Required. + A tool slug, optionally ``@``"" , or a + toolbelt as ``toolbelt:@``. When the session + selects tools, the rule must name one of them. + } + ] + }, + "sessionUrn": "str", # Optional. Session URN, for example + ``do:managed_agent_session:``. + "tools": { + "references": [ + { + "kind": "str", # Optional. Whether + name is a tool or a toolbelt. Known values are: + "SESSION_TOOL_REFERENCE_KIND_TOOL" and + "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". + "name": "str", # Optional. Tool slug + or toolbelt name. + "version": "str" # Optional. Pinned + version. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + session was last modified. + } + ] + } + """ + 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_sessions_list_request( + end_user_id=end_user_id, + page=page, + per_page=per_page, + 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 list_search( + self, + *, + query: Optional[str] = None, + end_user_id: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Retrieve a Tool Definition. + """Search Sessions. + + Returns the sessions you can see whose name, ``actor_id``\\ , ``session_urn``\\ , or + ``agentName`` contains query, case-insensitively, ranked across the whole result set. + Cursor-paged with ``page_size`` and ``page_token``\\ ; no total is reported. + + :keyword query: Matched case-insensitively as a substring of name, ``actor_id``\\ , + ``session_urn``\\ , or ``agentName``. Empty matches every session you can see. Results are + ordered by match quality (an exact name, ``session_urn``\\ , or ``actor_id`` match, then a + prefix, then a substring), then by name, across the whole result set, so a client must not + re-sort a page to rank it. Default value is None. + :paramtype query: str + :keyword end_user_id: ``end_user_id``\\ , when set, is an exact filter on ``actor_id`` (the + same filter as on the session list) and combines with query as AND. Default value is None. + :paramtype end_user_id: str + :keyword page_size: Page size, 1 to 100. Defaults to 20 when omitted or 0; other values are + rejected with 400. Default value is 20. + :paramtype page_size: int + :keyword page_token: ``next_page_token`` from the previous response. Valid only with the same + query and ``end_user_id``\\ ; otherwise the request is rejected with 400. Default value is + None. + :paramtype page_token: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "next_page_token": "str", # Optional. Token for the next page; empty on the + last page. + "sessions": [ + { + "actorId": "str", # Optional. Empty when the session is not + bound to an actor. + "agentName": "str", # Optional. Name of the agent that + started the session. Empty for sessions created through this API. + "agentUrn": "str", # Optional. URN of the agent that started + the session. Empty for sessions created through this API. + "config": {}, # Optional. Session options as supplied at + creation. Omitted when none were supplied. + "createdAt": "2020-02-20 00:00:00", # Optional. When the + session was created. + "insights": { + "logs": bool, # Optional. Whether the session's + customer logs are sent to Insights. + "metrics": bool, # Optional. Accepted and stored for + parity with the Insights schema. + "traces": bool # Optional. Whether the session's + customer traces are sent to Insights. + }, + "name": "str", # Optional. The required human-readable + session name. + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by + your team, in a region that supports sessions. + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of + the user who created the session, when recorded. + "policy": { + "defaultAction": "str", # Optional. Action for calls + no rule matches. Empty means ask; otherwise this must be allow, ask, + or deny. Known values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. + Required: allow, ask, or deny. Known values are: "allow", + "ask", and "deny". + "match": { + "str": "str" # Optional. + Optional argument conditions, keyed by argument name; the + rule applies only to calls whose arguments match. + }, + "tool": "str" # Optional. Required. + A tool slug, optionally ``@``"" , or a + toolbelt as ``toolbelt:@``. When the session + selects tools, the rule must name one of them. + } + ] + }, + "sessionUrn": "str", # Optional. Session URN, for example + ``do:managed_agent_session:``. + "tools": { + "references": [ + { + "kind": "str", # Optional. Whether + name is a tool or a toolbelt. Known values are: + "SESSION_TOOL_REFERENCE_KIND_TOOL" and + "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". + "name": "str", # Optional. Tool slug + or toolbelt name. + "version": "str" # Optional. Pinned + version. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + session was last modified. + } + ] + } + # 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_sessions_list_search_request( + query=query, + end_user_id=end_user_id, + page_size=page_size, + page_token=page_token, + 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 delete(self, session_urn: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Delete a Session. + + Deletes the session and its policy. Succeeds without deleting anything when the session does + not exist or you cannot delete it, so repeating a delete also succeeds. A malformed + ``session_urn`` is rejected with 400. + + :param session_urn: URN of the session, for example ``do:managed_agent_session:``. + Required. + :type session_urn: str + :return: JSON or JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # 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_sessions_delete_request( + session_urn=session_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 + + +class ToolbeltsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.aio.GeneratedClient`'s + :attr:`toolbelts` 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") + ) + + @overload + async def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a Toolbelt. - Retrieves the executable definition for an active Action Gateway tool. + A toolbelt is a named set of tools, each pinned to a version, that your team can attach to + sessions as ``toolbelt:@``. The first version is 1 unless version is set. + Returns 409 if an active toolbelt with the same name exists. The name of a deleted toolbelt can + be reused; its versions start again from the initial version. - :param name: The provider-qualified tool name. Required. - :type name: str - :keyword version: The tool version. Omit to retrieve the current version. Default value is - None. - :paramtype version: str - :keyword toolkit_id: The toolkit identifier used to disambiguate a bare tool name. Default - value is None. - :paramtype toolkit_id: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "name": "str", # Toolbelt name, unique among your team's active toolbelts. + Must match ``^``"" [a-z]"" ```[a-z0-9_-]``"" {0,63}$"" ``;``"" search` is + reserved. Required. + "description": "str", # Optional. Optional description. At most 255 bytes. + "display_name": "str", # Optional. Optional human-readable label, separate + from name. At most 128 bytes. + "tools": [ + "str" # Optional. Optional initial members, as catalog tool slugs + ("" ``_``"" ). Each may be pinned as + ``@``"" ; a pin must equal the tool's current released + version, and an unpinned tool is pinned to that version. Every tool must be + an active catalog tool. Duplicates are merged; at most 500 tools. Empty + creates a toolbelt with no tools. + ], + "version": "1" # Optional. Default value is "1". Optional initial version + number, a positive integer such as ``1``. Defaults to 1. + } + + # response body for status code(s): 200 + response == { + "toolbelt": { + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. + "tools": [ + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. + ], + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. + } + } + # response body for status code(s): 400, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + async def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a Toolbelt. + + A toolbelt is a named set of tools, each pinned to a version, that your team can attach to + sessions as ``toolbelt:@``. The first version is 1 unless version is set. + Returns 409 if an active toolbelt with the same name exists. The name of a deleted toolbelt can + be reused; its versions start again from the initial version. + + :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 == { + "toolbelt": { + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. + "tools": [ + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. + ], + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. + } + } + # response body for status code(s): 400, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace_async + async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Create a Toolbelt. + + A toolbelt is a named set of tools, each pinned to a version, that your team can attach to + sessions as ``toolbelt:@``. The first version is 1 unless version is set. + Returns 409 if an active toolbelt with the same name exists. The name of a deleted toolbelt can + be reused; its versions start again from the initial version. + + :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: @@ -1391,251 +7372,54 @@ async def get_definition( Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "name": "str", # Toolbelt name, unique among your team's active toolbelts. + Must match ``^``"" [a-z]"" ```[a-z0-9_-]``"" {0,63}$"" ``;``"" search` is + reserved. Required. + "description": "str", # Optional. Optional description. At most 255 bytes. + "display_name": "str", # Optional. Optional human-readable label, separate + from name. At most 128 bytes. + "tools": [ + "str" # Optional. Optional initial members, as catalog tool slugs + ("" ``_``"" ). Each may be pinned as + ``@``"" ; a pin must equal the tool's current released + version, and an unpinned tool is pinned to that version. Every tool must be + an active catalog tool. Duplicates are merged; at most 500 tools. Empty + creates a toolbelt with no tools. + ], + "version": "1" # Optional. Default value is "1". Optional initial version + number, a positive integer such as ``1``. Defaults to 1. + } + # response body for status code(s): 200 response == { - "annotations": { - "destructiveHint": bool, # Optional. - "idempotentHint": bool, # Optional. - "openWorldHint": bool, # Optional. - "readOnlyHint": bool, # Optional. - "title": "str" # Optional. - }, - "auth": { - "baseUrlResolution": { - "httpLookup": { - "baseUrlTemplate": "str", # Optional. HTTPLookupSpec - resolves a base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON array, - extracting extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and match_value are - both set, they select the entry. When both are empty, exactly one - entry whose own "scopes" array contains required_scopes must exist. - Configuring only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - "caseInsensitive": bool, # Optional. HTTPLookupSpec - resolves a base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON array, - extracting extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and match_value are - both set, they select the entry. When both are empty, exactly one - entry whose own "scopes" array contains required_scopes must exist. - Configuring only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - "extractField": "str", # Optional. HTTPLookupSpec - resolves a base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON array, - extracting extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and match_value are - both set, they select the entry. When both are empty, exactly one - entry whose own "scopes" array contains required_scopes must exist. - Configuring only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - "matchField": "str", # Optional. HTTPLookupSpec - resolves a base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON array, - extracting extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and match_value are - both set, they select the entry. When both are empty, exactly one - entry whose own "scopes" array contains required_scopes must exist. - Configuring only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - "matchValue": "str", # Optional. HTTPLookupSpec - resolves a base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON array, - extracting extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and match_value are - both set, they select the entry. When both are empty, exactly one - entry whose own "scopes" array contains required_scopes must exist. - Configuring only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - "match_value_parameter": "str", # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting extract_field from - that entry, and substituting it for "{value}" in base_url_template. - When match_field and match_value are both set, they select the entry. - When both are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one match field - is invalid. Resolution fails fast on zero or multiple compatible - entries. - "method": "str", # Optional. HTTPLookupSpec resolves - a base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON array, - extracting extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and match_value are - both set, they select the entry. When both are empty, exactly one - entry whose own "scopes" array contains required_scopes must exist. - Configuring only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - "requiredScopes": [ - "str" # Optional. HTTPLookupSpec resolves a - base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON - array, extracting extract_field from that entry, and substituting - it for "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both are - empty, exactly one entry whose own "scopes" array contains - required_scopes must exist. Configuring only one match field is - invalid. Resolution fails fast on zero or multiple compatible - entries. - ], - "trimTrailingSlash": bool, # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting extract_field from - that entry, and substituting it for "{value}" in base_url_template. - When match_field and match_value are both set, they select the entry. - When both are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one match field - is invalid. Resolution fails fast on zero or multiple compatible - entries. - "url": "str" # Optional. HTTPLookupSpec resolves a - base_url by calling url (bearer-authenticated with the just-exchanged - access token), selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for "{value}" in - base_url_template. When match_field and match_value are both set, - they select the entry. When both are empty, exactly one entry whose - own "scopes" array contains required_scopes must exist. Configuring - only one match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - } - }, - "credentialBinding": "str", # Optional. - "credentialRefSource": "str", # Optional. - "doManagedCredentialRef": "str", # Optional. - "injection": { - "location": "str", # Optional. - "name": "str", # Optional. - "scheme": "str" # Optional. - }, - "modes": [ - "str" # Optional. - ], - "provider": "str", # Optional. - "scopes": [ - "str" # Optional. - ] - }, - "classification": { - "dataClasses": [ - "str" # Optional. + "toolbelt": { + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. + "tools": [ + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "operation": "str", # Optional. - "risk": "str" # Optional. - }, - "description": "str", # Optional. - "execution": { - "adapterVersion": "str", # Optional. - "configRef": "str", # Optional. - "http": { - "allowedHosts": [ - "str" # Optional. - ], - "baseUrl": "str", # Optional. - "method": "str", # Optional. - "path": "str", # Optional. - "requestEncoding": "str", # Optional. - "responseFormat": "str" # Optional. - }, - "mcp": { - "allowedHosts": [ - "str" # Optional. MCPExecution describes how to - invoke a tool that is fronted by a remote MCP server (as opposed to a - plain HTTP endpoint). endpoint is the remote MCP server's URL, - tool_name is the name the remote server expects on tools/call (may - differ from this tool's registry name), transport selects the wire - protocol ("streamable_http" is the only kind implemented today), and - server_ref is an opaque label identifying the remote server for - logging/metrics/allowlisting. - ], - "endpoint": "str", # Optional. MCPExecution describes how to - invoke a tool that is fronted by a remote MCP server (as opposed to a - plain HTTP endpoint). endpoint is the remote MCP server's URL, tool_name - is the name the remote server expects on tools/call (may differ from this - tool's registry name), transport selects the wire protocol - ("streamable_http" is the only kind implemented today), and server_ref is - an opaque label identifying the remote server for - logging/metrics/allowlisting. - "serverRef": "str", # Optional. MCPExecution describes how - to invoke a tool that is fronted by a remote MCP server (as opposed to a - plain HTTP endpoint). endpoint is the remote MCP server's URL, tool_name - is the name the remote server expects on tools/call (may differ from this - tool's registry name), transport selects the wire protocol - ("streamable_http" is the only kind implemented today), and server_ref is - an opaque label identifying the remote server for - logging/metrics/allowlisting. - "toolName": "str", # Optional. MCPExecution describes how to - invoke a tool that is fronted by a remote MCP server (as opposed to a - plain HTTP endpoint). endpoint is the remote MCP server's URL, tool_name - is the name the remote server expects on tools/call (may differ from this - tool's registry name), transport selects the wire protocol - ("streamable_http" is the only kind implemented today), and server_ref is - an opaque label identifying the remote server for - logging/metrics/allowlisting. - "transport": "str" # Optional. MCPExecution describes how to - invoke a tool that is fronted by a remote MCP server (as opposed to a - plain HTTP endpoint). endpoint is the remote MCP server's URL, tool_name - is the name the remote server expects on tools/call (may differ from this - tool's registry name), transport selects the wire protocol - ("streamable_http" is the only kind implemented today), and server_ref is - an opaque label identifying the remote server for - logging/metrics/allowlisting. - }, - "type": "str" # Optional. - }, - "flipperName": "str", # Optional. - "hooks": { - "usage": { - "billable": bool, # Optional. When usage metadata is - present, false prevents billing. Omitting usage metadata leaves - consumers' legacy billing classification unchanged. - "meters": [ - { - "quantitySource": "str", # Optional. - "sku": "str", # Optional. - "unit": "str" # Optional. - } - ] - } - }, - "inputSchema": {}, # Optional. Any object. - "name": "str", # Optional. - "outputSchema": {}, # Optional. Any object. - "parallelizable": bool, # Optional. - "policy": { - "permission": "str" # Optional. - }, - "reliability": { - "maxOutputBytes": "str", # Optional. - "retry": { - "backoff": "str", # Optional. - "maxAttempts": 0, # Optional. - "retryOn": [ - "str" # Optional. - ] - }, - "timeoutMs": 0 # Optional. - }, - "schemaVersion": "str", # Optional. - "status": "str", # Optional. - "streamingSafe": bool, # Optional. - "tags": [ - "str" # Optional. - ], - "title": "str", # Optional. - "toolId": "str", # Optional. - "toolSlug": "str", # Optional. tool_slug is the provider-qualified, stable - tool identifier ":code:``_:code:``". Pass this value back - verbatim to the toolbelt add/remove endpoints; clients should treat it as opaque. - "toolkitId": "str", # Optional. - "transform": { - "input": {}, # Optional. Any object. - "language": "str", # Optional. - "output": {} # Optional. Any object. - }, - "version": "str" # Optional. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. + } } - # response body for status code(s): 404 + # response body for status code(s): 400, 409 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 @@ -1660,15 +7444,26 @@ async def get_definition( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) 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) - _request = build_tools_get_definition_request( - name=name, - version=version, - toolkit_id=toolkit_id, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_toolbelts_create_request( + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -1683,7 +7478,7 @@ async def get_definition( response = pipeline_response.http_response - if response.status_code not in [200, 404]: + if response.status_code not in [200, 400, 409]: 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 @@ -1706,7 +7501,23 @@ async def get_definition( else: deserialized = None - if response.status_code == 404: + 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 == 409: response_headers["ratelimit-limit"] = self._deserialize( "int", response.headers.get("ratelimit-limit") ) @@ -1727,26 +7538,6 @@ async def get_definition( return cast(JSON, deserialized) # type: ignore - -class ToolbeltsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~pydo.aio.GeneratedClient`'s - :attr:`toolbelts` 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( self, @@ -1756,16 +7547,19 @@ async def list( per_page: int = 20, **kwargs: Any ) -> JSON: + # pylint: disable=line-too-long """List Toolbelts. - Lists the latest version of each toolbelt owned by the authenticated team. + Returns your team's toolbelts, one entry per name describing its latest version, sorted by + name. Offset-paged with page and ``per_page``\\ ; pagination reports the total. - :keyword status: Filter toolbelts by status. Known values are: "active", "deprecated", and - "all". Default value is "active". + :keyword status: active (default), deprecated, or all. Case-insensitive. Known values are: + "active", "deprecated", and "all". Default value is "active". :paramtype status: str - :keyword page: Which 'page' of paginated results to return. Default value is 1. + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. :paramtype page: int - :keyword per_page: Number of items returned per page. Default value is 20. + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. :paramtype per_page: int :return: JSON object :rtype: JSON @@ -1777,25 +7571,45 @@ async def list( # response body for status code(s): 200 response == { "pagination": { - "page": 0, # Required. - "per_page": 0, # Required. - "total": 0 # Required. + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. }, "toolbelts": [ { - "latest_version": "str", # Required. - "name": "str", # Required. - "reference_latest": "str", # Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. - "updated_at": "2020-02-20 00:00:00", # Required. - "version_count": 0, # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "description": "str", # Optional. Description of the latest + version. + "display_name": "str", # Optional. Human-readable label of + the latest version. + "latest_version": "str", # Optional. Latest version number, + as a string. + "name": "str", # Optional. Toolbelt name. + "reference_latest": "str", # Optional. The toolbelt name, + which refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the + toolbelt is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of members in the latest + version. + "updated_at": "2020-02-20 00:00:00", # Optional. When the + latest version was last modified, in RFC 3339 format. + "version_count": 0 # Optional. Number of versions recorded + under this name, including versions from before the toolbelt was deleted + and the name reused. } ] } + # 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, @@ -1833,163 +7647,79 @@ async def list( response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = {} - response_headers["ratelimit-limit"] = self._deserialize( - "int", response.headers.get("ratelimit-limit") - ) - response_headers["ratelimit-remaining"] = self._deserialize( - "int", response.headers.get("ratelimit-remaining") - ) - response_headers["ratelimit-reset"] = self._deserialize( - "int", response.headers.get("ratelimit-reset") - ) - - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore - - return cast(JSON, deserialized) # type: ignore - - @overload - async def create( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> JSON: - # pylint: disable=line-too-long - """Create a Toolbelt. - - Creates a versioned collection of provider-qualified Action Gateway tool names. - - :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 = { - "name": "str", # Required. - "tools": [ - "str" # Required. - ], - "description": "str", # Optional. - "display_name": "str", # Optional. - "version": "1" # Optional. Default value is "1". - } - - # response body for status code(s): 200 - response == { - "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. - "tools": [ - "str" # Required. - ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. - } - } - # response body for status code(s): 400, 409 - response == { - "id": "str", # A short identifier corresponding to the HTTP status code - returned. For example, the ID for a response returning a 404 status code would - be "not_found.". Required. - "message": "str", # A message providing additional information about the - error, including details to help resolve it when possible. Required. - "request_id": "str" # Optional. Optionally, some endpoints may include a - request ID that should be provided when reporting bugs or opening support - tickets to help identify the issue. - } - """ - - @overload - async def create( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> JSON: - # pylint: disable=line-too-long - """Create a Toolbelt. - - Creates a versioned collection of provider-qualified Action Gateway tool names. - - :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: + 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") + ) - Example: - .. code-block:: python + if response.content: + deserialized = response.json() + else: + deserialized = None - # response body for status code(s): 200 - response == { - "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. - "tools": [ - "str" # Required. - ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. - } - } - # response body for status code(s): 400, 409 - 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. - } - """ + 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 create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + async def list_search( + self, + *, + query: Optional[str] = None, + status: str = "active", + page_size: int = 20, + page_token: Optional[str] = None, + **kwargs: Any + ) -> JSON: # pylint: disable=line-too-long - """Create a Toolbelt. + """Search Toolbelts. - Creates a versioned collection of provider-qualified Action Gateway tool names. + Returns your team's toolbelts whose name, display name, or description contains query, + case-insensitively, sorted by name. Cursor-paged with ``page_size`` and ``page_token``\\ ; no + total is reported. - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :keyword query: Matched case-insensitively as a substring of name, ``display_name``\\ , or + description. Empty matches every toolbelt of your team. Default value is None. + :paramtype query: str + :keyword status: active (default), deprecated, or all. Case-insensitive. Known values are: + "active", "deprecated", and "all". Default value is "active". + :paramtype status: str + :keyword page_size: Page size, 1 to 100. Defaults to 20 when omitted or 0; other values are + rejected with 400. Default value is 20. + :paramtype page_size: int + :keyword page_token: ``next_page_token`` from the previous response. Valid only with the same + query and status; otherwise the request is rejected with 400. Default value is None. + :paramtype page_token: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -1997,39 +7727,34 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - body = { - "name": "str", # Required. - "tools": [ - "str" # Required. - ], - "description": "str", # Optional. - "display_name": "str", # Optional. - "version": "1" # Optional. Default value is "1". - } - # response body for status code(s): 200 response == { - "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. - "tools": [ - "str" # Required. - ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. - } + "next_page_token": "str", # Optional. Token for the next page; empty on the + last page. + "toolbelts": [ + { + "description": "str", # Optional. Description of the latest + version. + "display_name": "str", # Optional. Human-readable label of + the latest version. + "latest_version": "str", # Optional. Latest version number, + as a string. + "name": "str", # Optional. Toolbelt name. + "reference_latest": "str", # Optional. The toolbelt name, + which refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the + toolbelt is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of members in the latest + version. + "updated_at": "2020-02-20 00:00:00", # Optional. When the + latest version was last modified, in RFC 3339 format. + "version_count": 0 # Optional. Number of versions recorded + under this name, including versions from before the toolbelt was deleted + and the name reused. + } + ] } - # response body for status code(s): 400, 409 + # 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 @@ -2054,26 +7779,16 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = 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_toolbelts_create_request( - content_type=content_type, - json=_json, - content=_content, + _request = build_toolbelts_list_search_request( + query=query, + status=status, + page_size=page_size, + page_token=page_token, headers=_headers, params=_params, ) @@ -2088,7 +7803,7 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200, 400, 409]: + 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 @@ -2127,22 +7842,6 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: else: deserialized = None - if response.status_code == 409: - 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 @@ -2150,18 +7849,38 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: @distributed_trace_async async def get( - self, name: str, *, version: Optional[str] = None, **kwargs: Any + self, + name: str, + *, + version: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, + search: Optional[str] = None, + **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Retrieve a Toolbelt. + """Get a Toolbelt. - Retrieves the latest active version or a specified immutable version of a toolbelt. + Returns the latest version of the named toolbelt, or the version requested, with catalog + metadata for one page of its members in ``tool_details``. A deleted toolbelt returns 404 unless + a version is requested. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name. Required. :type name: str - :keyword version: An immutable numeric toolbelt version. Omit to retrieve the latest active - version. Default value is None. + :keyword version: Version number to read. Empty returns the latest version. Default value is + None. :paramtype version: str + :keyword page_size: Page size for ``tool_details`` only; toolbelt.tools always lists every + member. Defaults to 20; values above 100 are capped at 100. Default value is 20. + :paramtype page_size: int + :keyword page_token: ``next_page_token`` from the previous response, to continue + ``tool_details``. Treat it as opaque, and send it only with the same toolbelt, version, and + search. Default value is None. + :paramtype page_token: str + :keyword search: Restricts ``tool_details`` to members whose tool slug, name, title, + description, provider, or category contains this value, case-insensitively. It does not filter + toolbelt.tools. This is a substring match, not a filter expression. Default value is None. + :paramtype search: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -2171,26 +7890,53 @@ async def get( # response body for status code(s): 200 response == { + "next_page_token": "str", # Optional. Token for the next page of + ``tool_details``"" ; empty on the last page. + "tool_details": [ + { + "category": "str", # Optional. Best-effort catalog metadata + and is empty for a large share of the catalog. Do not rely on it being + present. + "description": "str", # Optional. What the tool does. + "name": "str", # Optional. The unqualified tool name, + without the provider prefix. + "provider": "str", # Optional. The ID of the provider that + offers the tool, broken out so a client never has to split ``tool_slug``. + "title": "str", # Optional. Human-readable tool title. + "tool_slug": "str", # Optional. The provider-qualified, + stable tool identifier ("" ``_``"" ). Treat it as opaque + and pass it back verbatim. + "version": 0 # Optional. The version this toolbelt version + pins for the member, matching the ``@`` suffix in the + corresponding toolbelt.tools entry. + } + ], "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. "tools": [ - "str" # Required. + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } - # response body for status code(s): 404 + # 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 @@ -2223,6 +7969,9 @@ async def get( _request = build_toolbelts_get_request( name=name, version=version, + page_size=page_size, + page_token=page_token, + search=search, headers=_headers, params=_params, ) @@ -2237,7 +7986,7 @@ async def get( response = pipeline_response.http_response - if response.status_code not in [200, 404]: + 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 @@ -2260,6 +8009,22 @@ async def get( 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") @@ -2286,9 +8051,12 @@ async def delete(self, name: str, **kwargs: Any) -> JSON: # pylint: disable=line-too-long """Delete a Toolbelt. - Deprecates the latest active version of a toolbelt. + Marks the toolbelt deleted and returns its latest version with status deprecated. Its versions + stay readable by explicit version until the name is reused. The name is free to reuse + immediately; a new toolbelt with it starts a fresh version history. Returns 404 when the + toolbelt does not exist or is already deleted. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name. Required. :type name: str :return: JSON object :rtype: JSON @@ -2300,22 +8068,28 @@ async def delete(self, name: str, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == { "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. "tools": [ - "str" # Required. + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } # response body for status code(s): 404 @@ -2408,27 +8182,37 @@ async def delete(self, name: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore - @overload - async def add_tools( + @distributed_trace_async + async def list_providers( self, name: str, - body: JSON, *, - content_type: str = "application/json", + version: Optional[str] = None, + page: int = 1, + per_page: int = 20, + search: Optional[str] = None, **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Add Tools to a Toolbelt. + """List the Providers in a Toolbelt. - Adds provider-qualified tool names and creates a new immutable toolbelt version. + Returns the distinct providers of the toolbelt's members, each with its member count, sorted by + provider ID. List one provider's members with ``GET + .../toolbelts/{name}/providers/{provider}/tools``. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name. Required. :type name: 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 + :keyword version: Version number to read. Empty reads the latest version. Default value is + None. + :paramtype version: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int + :keyword search: Restricts providers whose ID, name, or description contains this value, + case-insensitively. Default value is None. + :paramtype search: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -2436,32 +8220,59 @@ async def add_tools( Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - body = { - "tools": [ - "str" # Required. - ] - } - # response body for status code(s): 200 response == { + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. + }, + "providers": [ + { + "categories": [ + "str" # Optional. The distinct tool categories among + this toolbelt's members for the provider (sorted). Empty for + ``_legacy`` or when no member has a category. + ], + "created_at": "2020-02-20 00:00:00", # Optional. When the + provider was added to the catalog. Unset for ``_legacy``. + "description": "str", # Optional. Provider description. + Empty for ``_legacy``. + "id": "str", # Optional. Equals provider; present so the + entry has the same shape as a toolkit. + "name": "str", # Optional. The provider's display name. + Empty for ``_legacy``. + "provider": "str", # Optional. The provider ID. Members + recorded without a provider are grouped under ``_legacy``"" , which is + also accepted in the provider path. + "tool_count": 0 # Optional. How many toolbelt members belong + to this provider. + } + ], "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. "tools": [ - "str" # Required. + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } # response body for status code(s): 400, 404 @@ -2476,28 +8287,138 @@ async def add_tools( 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 {}) - @overload - async def add_tools( + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_toolbelts_list_providers_request( + name=name, + version=version, + page=page, + per_page=per_page, + search=search, + 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 + + @distributed_trace_async + async def list_provider_tools( self, name: str, - body: IO[bytes], + provider: str, *, - content_type: str = "application/json", + version: Optional[str] = None, + page: int = 1, + per_page: int = 20, + search: Optional[str] = None, **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Add Tools to a Toolbelt. + """List a Toolbelt's Tools from One Provider. - Adds provider-qualified tool names and creates a new immutable toolbelt version. + Returns a page of catalog metadata for the toolbelt's members from the named provider, sorted + by tool slug. An unknown provider returns an empty page. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name. Required. :type name: 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 + :param provider: A provider ID from the toolbelt's provider list, or ``_legacy`` for members + recorded without a provider. Matched exactly. Required. + :type provider: str + :keyword version: Version number to read. Empty reads the latest version. Default value is + None. + :paramtype version: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int + :keyword search: Restricts tools whose slug, name, title, description, provider, or category + contains this value, case-insensitively, within the provider only. Default value is None. + :paramtype search: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -2507,86 +8428,32 @@ async def add_tools( # response body for status code(s): 200 response == { - "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. - "tools": [ - "str" # Required. - ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. - } - } - # 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 add_tools( - self, name: str, body: Union[JSON, IO[bytes]], **kwargs: Any - ) -> JSON: - # pylint: disable=line-too-long - """Add Tools to a Toolbelt. - - Adds provider-qualified tool names and creates a new immutable toolbelt version. - - :param name: The natural key identifying the toolbelt. Required. - :type name: 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 = { + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. + }, "tools": [ - "str" # Required. + { + "category": "str", # Optional. Best-effort catalog metadata + and is empty for a large share of the catalog. Do not rely on it being + present. + "description": "str", # Optional. What the tool does. + "name": "str", # Optional. The unqualified tool name, + without the provider prefix. + "provider": "str", # Optional. The ID of the provider that + offers the tool, broken out so a client never has to split ``tool_slug``. + "title": "str", # Optional. Human-readable tool title. + "tool_slug": "str", # Optional. The provider-qualified, + stable tool identifier ("" ``_``"" ). Treat it as opaque + and pass it back verbatim. + "version": 0 # Optional. The version this toolbelt version + pins for the member, matching the ``@`` suffix in the + corresponding toolbelt.tools entry. + } ] } - - # response body for status code(s): 200 - response == { - "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. - "tools": [ - "str" # Required. - ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. - } - } # response body for status code(s): 400, 404 response == { "id": "str", # A short identifier corresponding to the HTTP status code @@ -2612,27 +8479,18 @@ async def add_tools( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = 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_toolbelts_add_tools_request( + _request = build_toolbelts_list_provider_tools_request( name=name, - content_type=content_type, - json=_json, - content=_content, + provider=provider, + version=version, + page=page, + per_page=per_page, + search=search, headers=_headers, params=_params, ) @@ -2708,7 +8566,7 @@ async def add_tools( return cast(JSON, deserialized) # type: ignore @overload - async def delete_tools( + async def add_tools( self, name: str, body: JSON, @@ -2717,11 +8575,16 @@ async def delete_tools( **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Remove Tools from a Toolbelt. + """Add Tools to a Toolbelt. - Removes tool names and creates a new immutable toolbelt version. + Adds the listed tools and returns the toolbelt. When membership changes, this creates a new + version that keeps the display name and description. Tools already in the toolbelt are left as + they are, so a request that adds nothing new returns the current version unchanged. Returns 400 + when a tool is not an active catalog tool, when a pin differs from the tool's current released + version or from the version the toolbelt already holds, or when the toolbelt would exceed 500 + tools. Returns 404 for an unknown or deleted toolbelt. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name, from the path. Required. :type name: str :param body: Required. :type body: JSON @@ -2738,29 +8601,38 @@ async def delete_tools( # JSON input template you can fill out and use as your body input. body = { "tools": [ - "str" # Required. + "str" # Tool slugs ("" ``_``"" ) to add or remove, + each optionally pinned as ``@``. At least one is + required. When adding, a pin must equal the tool's current released version. + Required. ] } # response body for status code(s): 200 response == { "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. "tools": [ - "str" # Required. + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } # response body for status code(s): 400, 404 @@ -2777,7 +8649,7 @@ async def delete_tools( """ @overload - async def delete_tools( + async def add_tools( self, name: str, body: IO[bytes], @@ -2786,11 +8658,16 @@ async def delete_tools( **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Remove Tools from a Toolbelt. + """Add Tools to a Toolbelt. - Removes tool names and creates a new immutable toolbelt version. + Adds the listed tools and returns the toolbelt. When membership changes, this creates a new + version that keeps the display name and description. Tools already in the toolbelt are left as + they are, so a request that adds nothing new returns the current version unchanged. Returns 400 + when a tool is not an active catalog tool, when a pin differs from the tool's current released + version or from the version the toolbelt already holds, or when the toolbelt would exceed 500 + tools. Returns 404 for an unknown or deleted toolbelt. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name, from the path. Required. :type name: str :param body: Required. :type body: IO[bytes] @@ -2807,22 +8684,28 @@ async def delete_tools( # response body for status code(s): 200 response == { "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. "tools": [ - "str" # Required. + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } # response body for status code(s): 400, 404 @@ -2839,15 +8722,20 @@ async def delete_tools( """ @distributed_trace_async - async def delete_tools( + async def add_tools( self, name: str, body: Union[JSON, IO[bytes]], **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Remove Tools from a Toolbelt. + """Add Tools to a Toolbelt. - Removes tool names and creates a new immutable toolbelt version. + Adds the listed tools and returns the toolbelt. When membership changes, this creates a new + version that keeps the display name and description. Tools already in the toolbelt are left as + they are, so a request that adds nothing new returns the current version unchanged. Returns 400 + when a tool is not an active catalog tool, when a pin differs from the tool's current released + version or from the version the toolbelt already holds, or when the toolbelt would exceed 500 + tools. Returns 404 for an unknown or deleted toolbelt. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name, from the path. Required. :type name: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] @@ -2861,29 +8749,38 @@ async def delete_tools( # JSON input template you can fill out and use as your body input. body = { "tools": [ - "str" # Required. + "str" # Tool slugs ("" ``_``"" ) to add or remove, + each optionally pinned as ``@``. At least one is + required. When adding, a pin must equal the tool's current released version. + Required. ] } # response body for status code(s): 200 response == { "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. "tools": [ - "str" # Required. + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } # response body for status code(s): 400, 404 @@ -2927,7 +8824,7 @@ async def delete_tools( else: _json = body - _request = build_toolbelts_delete_tools_request( + _request = build_toolbelts_add_tools_request( name=name, content_type=content_type, json=_json, @@ -3006,166 +8903,26 @@ async def delete_tools( return cast(JSON, deserialized) # type: ignore - -class ConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~pydo.aio.GeneratedClient`'s - :attr:`connections` 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( + @overload + async def delete_tools( self, + name: str, + body: JSON, *, - provider: Optional[str] = None, - user_id: Optional[str] = None, - status: Optional[str] = None, - sort: Optional[str] = None, - sort_direction: Optional[str] = None, - page: int = 1, - per_page: int = 20, + content_type: str = "application/json", **kwargs: Any - ) -> JSON: - """List Connections. - - Lists OAuth connections owned by the authenticated team. - - :keyword provider: Filter by provider name. Default value is None. - :paramtype provider: str - :keyword user_id: Filter by end-user identifier. Default value is None. - :paramtype user_id: str - :keyword status: Filter by connection status. Default value is None. - :paramtype status: str - :keyword sort: Field used to sort results. Default value is None. - :paramtype sort: str - :keyword sort_direction: Sort direction. Default value is None. - :paramtype sort_direction: str - :keyword page: Which 'page' of paginated results to return. Default value is 1. - :paramtype page: int - :keyword per_page: Number of items returned per page. Default value is 20. - :paramtype per_page: int - :return: JSON object - :rtype: JSON - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "connections": [ - { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. - "granted_at": "2020-02-20 00:00:00", # Optional. - "id": "str", # Optional. - "provider": "str", # Optional. - "provider_display_name": "str", # Optional. - "revoked_at": "2020-02-20 00:00:00", # Optional. - "scopes": [ - "str" # Optional. - ], - "status": "str", # Optional. - "updated_at": "2020-02-20 00:00:00", # Optional. - "user_id": "str" # Optional. - } - ], - "pagination": { - "page": 0, # Required. - "per_page": 0, # Required. - "total": 0 # Required. - } - } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - 401: cast( - Type[HttpResponseError], - lambda response: ClientAuthenticationError(response=response), - ), - 429: HttpResponseError, - 500: HttpResponseError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[JSON] = kwargs.pop("cls", None) - - _request = build_connections_list_request( - provider=provider, - user_id=user_id, - status=status, - sort=sort, - sort_direction=sort_direction, - page=page, - per_page=per_page, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = ( - await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["ratelimit-limit"] = self._deserialize( - "int", response.headers.get("ratelimit-limit") - ) - response_headers["ratelimit-remaining"] = self._deserialize( - "int", response.headers.get("ratelimit-remaining") - ) - response_headers["ratelimit-reset"] = self._deserialize( - "int", response.headers.get("ratelimit-reset") - ) - - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore - - return cast(JSON, deserialized) # type: ignore - - @overload - async def create( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Create a Connection. + """Remove Tools from a Toolbelt. - Creates or begins authorization for an OAuth connection to an Action Gateway provider. + Removes the listed tools and returns the toolbelt. When membership changes, this creates a new + version that keeps the display name and description. Tools that are not members are ignored, + and removing every tool is allowed; deleting the toolbelt itself is a separate DELETE. Returns + 400 when a pin differs from the version the toolbelt holds, and 404 for an unknown or deleted + toolbelt. + :param name: Toolbelt name, from the path. Required. + :type name: str :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -3180,91 +8937,42 @@ async def create( # JSON input template you can fill out and use as your body input. body = { - "connection_parameters": {}, # Optional. Any object. - "provider": "str", # Optional. - "scopes": [ - "str" # Optional. - ], - "user_id": "str" # Optional. + "tools": [ + "str" # Tool slugs ("" ``_``"" ) to add or remove, + each optionally pinned as ``@``. At least one is + required. When adding, a pin must equal the tool's current released version. + Required. + ] } # response body for status code(s): 200 response == { - "authorization": { - "connect_url": "str", # Optional. ConnectionAuthorization is present - only while a connection is pending. The UI sends the user to connect_url and - polls GetConnection until the connection becomes active or expires. The - Secrets Manager poll URL is never exposed. - "expires_at": "2020-02-20 00:00:00", # Optional. - ConnectionAuthorization is present only while a connection is pending. The UI - sends the user to connect_url and polls GetConnection until the connection - becomes active or expires. The Secrets Manager poll URL is never exposed. - "status": "str", # Optional. ConnectionAuthorization is present only - while a connection is pending. The UI sends the user to connect_url and polls - GetConnection until the connection becomes active or expires. The Secrets - Manager poll URL is never exposed. - "verification_code": "str" # Optional. ConnectionAuthorization is - present only while a connection is pending. The UI sends the user to - connect_url and polls GetConnection until the connection becomes active or - expires. The Secrets Manager poll URL is never exposed. - }, - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. + "toolbelt": { + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. + "tools": [ + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } - # response body for status code(s): 400, 409 + # 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 @@ -3278,14 +8986,25 @@ async def create( """ @overload - async def create( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + async def delete_tools( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Create a Connection. + """Remove Tools from a Toolbelt. - Creates or begins authorization for an OAuth connection to an Action Gateway provider. + Removes the listed tools and returns the toolbelt. When membership changes, this creates a new + version that keeps the display name and description. Tools that are not members are ignored, + and removing every tool is allowed; deleting the toolbelt itself is a separate DELETE. Returns + 400 when a pin differs from the version the toolbelt holds, and 404 for an unknown or deleted + toolbelt. + :param name: Toolbelt name, from the path. Required. + :type name: str :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -3300,81 +9019,32 @@ async def create( # response body for status code(s): 200 response == { - "authorization": { - "connect_url": "str", # Optional. ConnectionAuthorization is present - only while a connection is pending. The UI sends the user to connect_url and - polls GetConnection until the connection becomes active or expires. The - Secrets Manager poll URL is never exposed. - "expires_at": "2020-02-20 00:00:00", # Optional. - ConnectionAuthorization is present only while a connection is pending. The UI - sends the user to connect_url and polls GetConnection until the connection - becomes active or expires. The Secrets Manager poll URL is never exposed. - "status": "str", # Optional. ConnectionAuthorization is present only - while a connection is pending. The UI sends the user to connect_url and polls - GetConnection until the connection becomes active or expires. The Secrets - Manager poll URL is never exposed. - "verification_code": "str" # Optional. ConnectionAuthorization is - present only while a connection is pending. The UI sends the user to - connect_url and polls GetConnection until the connection becomes active or - expires. The Secrets Manager poll URL is never exposed. - }, - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. + "toolbelt": { + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. + "tools": [ + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } - # response body for status code(s): 400, 409 + # 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 @@ -3388,12 +9058,20 @@ async def create( """ @distributed_trace_async - async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + async def delete_tools( + self, name: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: # pylint: disable=line-too-long - """Create a Connection. + """Remove Tools from a Toolbelt. - Creates or begins authorization for an OAuth connection to an Action Gateway provider. + Removes the listed tools and returns the toolbelt. When membership changes, this creates a new + version that keeps the display name and description. Tools that are not members are ignored, + and removing every tool is allowed; deleting the toolbelt itself is a separate DELETE. Returns + 400 when a pin differs from the version the toolbelt holds, and 404 for an unknown or deleted + toolbelt. + :param name: Toolbelt name, from the path. Required. + :type name: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] :return: JSON object @@ -3405,91 +9083,42 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: # JSON input template you can fill out and use as your body input. body = { - "connection_parameters": {}, # Optional. Any object. - "provider": "str", # Optional. - "scopes": [ - "str" # Optional. - ], - "user_id": "str" # Optional. + "tools": [ + "str" # Tool slugs ("" ``_``"" ) to add or remove, + each optionally pinned as ``@``. At least one is + required. When adding, a pin must equal the tool's current released version. + Required. + ] } # response body for status code(s): 200 response == { - "authorization": { - "connect_url": "str", # Optional. ConnectionAuthorization is present - only while a connection is pending. The UI sends the user to connect_url and - polls GetConnection until the connection becomes active or expires. The - Secrets Manager poll URL is never exposed. - "expires_at": "2020-02-20 00:00:00", # Optional. - ConnectionAuthorization is present only while a connection is pending. The UI - sends the user to connect_url and polls GetConnection until the connection - becomes active or expires. The Secrets Manager poll URL is never exposed. - "status": "str", # Optional. ConnectionAuthorization is present only - while a connection is pending. The UI sends the user to connect_url and polls - GetConnection until the connection becomes active or expires. The Secrets - Manager poll URL is never exposed. - "verification_code": "str" # Optional. ConnectionAuthorization is - present only while a connection is pending. The UI sends the user to - connect_url and polls GetConnection until the connection becomes active or - expires. The Secrets Manager poll URL is never exposed. - }, - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. + "toolbelt": { + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. + "tools": [ + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } - # response body for status code(s): 400, 409 + # 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 @@ -3530,7 +9159,8 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: else: _json = body - _request = build_connections_create_request( + _request = build_toolbelts_delete_tools_request( + name=name, content_type=content_type, json=_json, content=_content, @@ -3548,7 +9178,7 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200, 400, 409]: + 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 @@ -3587,7 +9217,7 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: else: deserialized = None - if response.status_code == 409: + if response.status_code == 404: response_headers["ratelimit-limit"] = self._deserialize( "int", response.headers.get("ratelimit-limit") ) @@ -3608,15 +9238,51 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore + +class ToolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.aio.GeneratedClient`'s + :attr:`tools` 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 get(self, id: str, **kwargs: Any) -> JSON: + async def list( + self, + *, + toolkit_id: Optional[str] = None, + page: int = 1, + per_page: int = 100, + **kwargs: Any + ) -> JSON: # pylint: disable=line-too-long - """Retrieve a Connection. + """List Tools. - Retrieves an OAuth connection owned by the authenticated team. + Returns one page of the tools your team can use: released catalog tools plus the enabled tools + of your team's MCP servers. definitions[i] describes tools[i]. Offset-paged with page and + ``per_page``\\ ; an unknown ``toolkitId`` returns an empty page. - :param id: The connection UUID. Required. - :type id: str + :keyword toolkit_id: Restricts the page to one provider. It accepts the provider ID the catalog + returns, including the ``serverRef`` of one of your team's MCP servers. Default value is None. + :paramtype toolkit_id: str + :keyword page: 1-based page index; values below 1 are treated as 1. A page past the end returns + an empty tools list with the real total. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 100 when omitted or 0; values above 100 are capped at + 100. Default value is 100. + :paramtype per_page: int :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -3626,90 +9292,102 @@ async def get(self, id: str, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == { - "authorization": { - "connect_url": "str", # Optional. ConnectionAuthorization is present - only while a connection is pending. The UI sends the user to connect_url and - polls GetConnection until the connection becomes active or expires. The - Secrets Manager poll URL is never exposed. - "expires_at": "2020-02-20 00:00:00", # Optional. - ConnectionAuthorization is present only while a connection is pending. The UI - sends the user to connect_url and polls GetConnection until the connection - becomes active or expires. The Secrets Manager poll URL is never exposed. - "status": "str", # Optional. ConnectionAuthorization is present only - while a connection is pending. The UI sends the user to connect_url and polls - GetConnection until the connection becomes active or expires. The Secrets - Manager poll URL is never exposed. - "verification_code": "str" # Optional. ConnectionAuthorization is - present only while a connection is pending. The UI sends the user to - connect_url and polls GetConnection until the connection becomes active or - expires. The Secrets Manager poll URL is never exposed. + "definitions": [ + { + "annotations": { + "destructiveHint": bool, # Optional. The tool may + perform destructive updates. + "idempotentHint": bool, # Optional. Repeating a call + with the same arguments has no additional effect. + "openWorldHint": bool, # Optional. The tool + interacts with external systems beyond the provider's own data. + "readOnlyHint": bool, # Optional. The tool does not + modify anything. + "title": "str" # Optional. Human-readable tool + title. + }, + "auth": { + "modes": [ + "str" # Optional. Lists how the tool + authenticates: oauth (a user connection), ``user_token`` (a key + your team supplies), ``shared_key`` (a key DigitalOcean + supplies), or none. + ], + "provider": "str", # Optional. The provider slug a + connection is created for. Empty when the tool needs no provider + account. + "scopes": [ + "str" # Optional. The provider permissions + the tool requests. + ] + }, + "description": "str", # Optional. What the tool does. + "inputSchema": {}, # Optional. The JSON Schema the tool's + arguments must satisfy. + "name": "str", # Optional. The tool name without the + provider prefix. + "outputSchema": {}, # Optional. The JSON Schema of the + tool's result, when declared. + "providerKind": "str", # Optional. Classifies the provider: + native, ``managed_api``"" , ``customer_mcp``"" , sandbox, or ``byo_mcp`` + (one of your team's MCP servers). + "title": "str", # Optional. Human-readable tool title. + "toolId": "str", # Optional. The opaque identity of this + released tool version. + "toolSlug": "str", # Optional. The provider-qualified tool + identifier ``_``. Treat it as opaque and pass it back + verbatim. + "toolkitId": "str", # Optional. The ID of the provider that + offers the tool. For a tool from one of your team's MCP servers it is + that server's ``serverRef``. + "version": "str" # Optional. The released version, for + example ``v3``. + } + ], + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. }, - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - } - } - # 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. + "tools": [ + { + "annotations": { + "destructiveHint": bool, # Optional. The tool may + perform destructive updates. + "idempotentHint": bool, # Optional. Repeating a call + with the same arguments has no additional effect. + "openWorldHint": bool, # Optional. The tool + interacts with external systems beyond the provider's own data. + "readOnlyHint": bool, # Optional. The tool does not + modify anything. + "title": "str" # Optional. Human-readable tool + title. + }, + "description": "str", # Optional. What the tool does. + "inputSchema": {}, # Optional. JSON Schema the tool's + arguments must satisfy. + "name": "str", # Optional. Tool name, without the provider + prefix. + "outputSchema": {}, # Optional. JSON Schema of the tool's + result, when declared. + "parallelizable": bool, # Optional. Catalog hint that calls + to the tool may run in parallel. + "streamingSafe": bool, # Optional. Catalog hint that the + tool's result can be streamed. + "title": "str", # Optional. Human-readable tool title. + "toolSlug": "str", # Optional. The provider-qualified, + stable tool identifier ``_``. Pass this value back + verbatim to the toolbelt add/remove endpoints; clients should treat it as + opaque rather than reconstructing it from ``toolkitId`` and name. + "toolkitId": "str", # Optional. ID of the provider that + offers the tool. For a tool from one of your team's MCP servers it is + that server's ``serverRef``. + "version": "str" # Optional. Released version, for example + ``v3``. + } + ], + "version": "str" # Optional. Catalog version identifier, for example ``v1``. } """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -3730,8 +9408,10 @@ async def get(self, id: str, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_connections_get_request( - id=id, + _request = build_tools_list_request( + toolkit_id=toolkit_id, + page=page, + per_page=per_page, headers=_headers, params=_params, ) @@ -3746,176 +9426,71 @@ async def get(self, id: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200, 404]: + 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 = {} - 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") - ) + 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.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( - self, - id: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> JSON: - # pylint: disable=line-too-long - """Update Connection Parameters. - - Updates non-sensitive connection parameters for an OAuth connection. - - :param id: The connection UUID. Required. - :type id: str - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: JSON object - :rtype: JSON - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "connection_parameters": {}, # Optional. Any object. - "id": "str" # Optional. - } - - # response body for status code(s): 200 - response == { - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - } - } - # 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( + @distributed_trace_async + async def list_health( self, - id: str, - body: IO[bytes], *, - content_type: str = "application/json", + provider: Optional[str] = None, + window: str = "HEALTH_WINDOW_TWENTY_FOUR_HOURS", + page: int = 1, + per_page: int = 20, **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Update Connection Parameters. + """List Tool Health. - Updates non-sensitive connection parameters for an OAuth connection. + Returns availability and latency for each catalog tool over the requested window, sorted by + provider and then tool slug. A tool with no calls in the window is listed with ``data_status`` + ``HEALTH_DATA_STATUS_NO_DATA``. Metrics are aggregated across all customers; request volumes + are not reported. Tools of your team's MCP servers are not included. Offset-paged with page and + ``per_page``. - :param id: The connection UUID. Required. - :type id: str - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str + :keyword provider: Optional provider ID, matched exactly, to return only that provider's tools. + Default value is None. + :paramtype provider: str + :keyword window: Window to aggregate over. Defaults to twenty-four hours. + + + * ``HEALTH_WINDOW_UNSPECIFIED``\\ : Twenty-four hours. + * ``HEALTH_WINDOW_ONE_HOUR``\\ : One hour; history points are 10 minutes. + * ``HEALTH_WINDOW_TWENTY_FOUR_HOURS``\\ : Twenty-four hours; history points are 1 hour. + * ``HEALTH_WINDOW_SEVEN_DAYS``\\ : Seven days; history points are 6 hours. + * ``HEALTH_WINDOW_THIRTY_DAYS``\\ : Thirty days; history points are 24 hours. Known values + are: "HEALTH_WINDOW_ONE_HOUR", "HEALTH_WINDOW_TWENTY_FOUR_HOURS", "HEALTH_WINDOW_SEVEN_DAYS", + and "HEALTH_WINDOW_THIRTY_DAYS". Default value is "HEALTH_WINDOW_TWENTY_FOUR_HOURS". + :paramtype window: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -3925,63 +9500,47 @@ async def update( # response body for status code(s): 200 response == { - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - } + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. + }, + "snapshot": { + "measured_at": "2020-02-20 00:00:00", # Optional. When the metrics + were computed. They are recomputed at most every five minutes. + "stale": bool, # Optional. True when the latest recomputation failed + and earlier metrics, up to 30 minutes old, are returned instead. + "window": "str" # Optional. Length of the window the metrics cover, + ending at ``measured_at``. + }, + "tools": [ + { + "health": { + "data_status": "str", # Optional. + ``HEALTH_DATA_STATUS_AVAILABLE`` when the window has calls to + measure; ``HEALTH_DATA_STATUS_NO_DATA`` when it has none, in which + case the metrics are null. Do not treat no data as healthy. Known + values are: "HEALTH_DATA_STATUS_AVAILABLE" and + "HEALTH_DATA_STATUS_NO_DATA". + "latency_p50_ms": 0.0, # Optional. Median duration + of successful calls, in milliseconds. Durations above 40960 ms are + reported as 40960. + "latency_p95_ms": 0.0, # Optional. 95th-percentile + duration of successful calls, in milliseconds. Durations above 40960 + ms are reported as 40960. + "uptime_percentage": 0.0 # Optional. Percentage of + calls that did not fail because of the provider (an upstream error, + timeout, rate limit, or unavailability). Calls that failed for other + reasons are not counted. + }, + "provider": "str", # Optional. ID of the provider that + offers the tool. + "tool_slug": "str" # Optional. Catalog tool slug. + } + ] } - # response body for status code(s): 400, 404 + # 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 @@ -3993,20 +9552,123 @@ async def update( 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_tools_list_health_request( + provider=provider, + window=window, + page=page, + per_page=per_page, + 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 update( - self, id: str, body: Union[JSON, IO[bytes]], **kwargs: Any + async def list_health_providers( + self, + *, + provider: Optional[str] = None, + window: str = "HEALTH_WINDOW_TWENTY_FOUR_HOURS", + page: int = 1, + per_page: int = 20, + **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Update Connection Parameters. + """List Provider Health. - Updates non-sensitive connection parameters for an OAuth connection. + Returns availability and latency for each catalog provider over the requested window, sorted by + provider ID. Metrics are aggregated across all customers; request volumes are not reported. + Tools of your team's MCP servers are not included. Offset-paged with page and ``per_page``. - :param id: The connection UUID. Required. - :type id: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :keyword provider: Optional provider ID, matched exactly, to return only that provider. Default + value is None. + :paramtype provider: str + :keyword window: Window to aggregate over. Defaults to twenty-four hours. + + + * ``HEALTH_WINDOW_UNSPECIFIED``\\ : Twenty-four hours. + * ``HEALTH_WINDOW_ONE_HOUR``\\ : One hour; history points are 10 minutes. + * ``HEALTH_WINDOW_TWENTY_FOUR_HOURS``\\ : Twenty-four hours; history points are 1 hour. + * ``HEALTH_WINDOW_SEVEN_DAYS``\\ : Seven days; history points are 6 hours. + * ``HEALTH_WINDOW_THIRTY_DAYS``\\ : Thirty days; history points are 24 hours. Known values + are: "HEALTH_WINDOW_ONE_HOUR", "HEALTH_WINDOW_TWENTY_FOUR_HOURS", "HEALTH_WINDOW_SEVEN_DAYS", + and "HEALTH_WINDOW_THIRTY_DAYS". Default value is "HEALTH_WINDOW_TWENTY_FOUR_HOURS". + :paramtype window: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -4014,71 +9676,47 @@ async def update( Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - body = { - "connection_parameters": {}, # Optional. Any object. - "id": "str" # Optional. - } - # response body for status code(s): 200 response == { - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. + }, + "providers": [ + { + "health": { + "data_status": "str", # Optional. + ``HEALTH_DATA_STATUS_AVAILABLE`` when the window has calls to + measure; ``HEALTH_DATA_STATUS_NO_DATA`` when it has none, in which + case the metrics are null. Do not treat no data as healthy. Known + values are: "HEALTH_DATA_STATUS_AVAILABLE" and + "HEALTH_DATA_STATUS_NO_DATA". + "latency_p50_ms": 0.0, # Optional. Median duration + of successful calls, in milliseconds. Durations above 40960 ms are + reported as 40960. + "latency_p95_ms": 0.0, # Optional. 95th-percentile + duration of successful calls, in milliseconds. Durations above 40960 + ms are reported as 40960. + "uptime_percentage": 0.0 # Optional. Percentage of + calls that did not fail because of the provider (an upstream error, + timeout, rate limit, or unavailability). Calls that failed for other + reasons are not counted. + }, + "provider": "str" # Optional. Provider ID. + } + ], + "snapshot": { + "measured_at": "2020-02-20 00:00:00", # Optional. When the metrics + were computed. They are recomputed at most every five minutes. + "stale": bool, # Optional. True when the latest recomputation failed + and earlier metrics, up to 30 minutes old, are returned instead. + "window": "str" # Optional. Length of the window the metrics cover, + ending at ``measured_at``. } } - # response body for status code(s): 400, 404 + # 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 @@ -4103,27 +9741,16 @@ async def update( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = 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_connections_update_request( - id=id, - content_type=content_type, - json=_json, - content=_content, + _request = build_tools_list_health_providers_request( + provider=provider, + window=window, + page=page, + per_page=per_page, headers=_headers, params=_params, ) @@ -4138,7 +9765,7 @@ async def update( response = pipeline_response.http_response - if response.status_code not in [200, 400, 404]: + 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 @@ -4177,36 +9804,43 @@ async def update( 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 delete(self, id: str, **kwargs: Any) -> JSON: + async def get_health( + self, + tool_slug: str, + *, + window: str = "HEALTH_WINDOW_TWENTY_FOUR_HOURS", + include_history: bool = False, + **kwargs: Any + ) -> JSON: # pylint: disable=line-too-long - """Delete a Connection. + """Get Tool Health. - Revokes and deletes an OAuth connection owned by the authenticated team. + Returns availability and latency for one catalog tool over the requested window, optionally + with a history series. Metrics are aggregated across all customers; request volumes are not + reported. Returns 404 when ``tool_slug`` is not a catalog tool. - :param id: The connection UUID. Required. - :type id: str + :param tool_slug: Catalog tool slug, for example ``exa_search``. Required. Required. + :type tool_slug: str + :keyword window: Window to aggregate over. Defaults to twenty-four hours. + + + * ``HEALTH_WINDOW_UNSPECIFIED``\\ : Twenty-four hours. + * ``HEALTH_WINDOW_ONE_HOUR``\\ : One hour; history points are 10 minutes. + * ``HEALTH_WINDOW_TWENTY_FOUR_HOURS``\\ : Twenty-four hours; history points are 1 hour. + * ``HEALTH_WINDOW_SEVEN_DAYS``\\ : Seven days; history points are 6 hours. + * ``HEALTH_WINDOW_THIRTY_DAYS``\\ : Thirty days; history points are 24 hours. Known values + are: "HEALTH_WINDOW_ONE_HOUR", "HEALTH_WINDOW_TWENTY_FOUR_HOURS", "HEALTH_WINDOW_SEVEN_DAYS", + and "HEALTH_WINDOW_THIRTY_DAYS". Default value is "HEALTH_WINDOW_TWENTY_FOUR_HOURS". + :paramtype window: str + :keyword include_history: Additionally returns the window split into resolution-aligned points + (the history field below). Default value is False. + :paramtype include_history: bool :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -4216,63 +9850,68 @@ async def delete(self, id: str, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == { - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. + "history": { + "points": [ + { + "bucket_start": "2020-02-20 00:00:00", # Optional. + Start of the slot. + "health": { + "data_status": "str", # Optional. + ``HEALTH_DATA_STATUS_AVAILABLE`` when the window has calls to + measure; ``HEALTH_DATA_STATUS_NO_DATA`` when it has none, in + which case the metrics are null. Do not treat no data as healthy. + Known values are: "HEALTH_DATA_STATUS_AVAILABLE" and + "HEALTH_DATA_STATUS_NO_DATA". + "latency_p50_ms": 0.0, # Optional. Median + duration of successful calls, in milliseconds. Durations above + 40960 ms are reported as 40960. + "latency_p95_ms": 0.0, # Optional. + 95th-percentile duration of successful calls, in milliseconds. + Durations above 40960 ms are reported as 40960. + "uptime_percentage": 0.0 # Optional. + Percentage of calls that did not fail because of the provider (an + upstream error, timeout, rate limit, or unavailability). Calls + that failed for other reasons are not counted. + } + } ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. + "resolution": "str", # Optional. Length of each point. + "stale": bool # Optional. Means the same as HealthSnapshot.stale, + for the history series. The series is refreshed independently, so a fresh + snapshot can accompany an older history and vice versa. + }, + "snapshot": { + "measured_at": "2020-02-20 00:00:00", # Optional. When the metrics + were computed. They are recomputed at most every five minutes. + "stale": bool, # Optional. True when the latest recomputation failed + and earlier metrics, up to 30 minutes old, are returned instead. + "window": "str" # Optional. Length of the window the metrics cover, + ending at ``measured_at``. + }, + "tool": { + "health": { + "data_status": "str", # Optional. + ``HEALTH_DATA_STATUS_AVAILABLE`` when the window has calls to measure; + ``HEALTH_DATA_STATUS_NO_DATA`` when it has none, in which case the + metrics are null. Do not treat no data as healthy. Known values are: + "HEALTH_DATA_STATUS_AVAILABLE" and "HEALTH_DATA_STATUS_NO_DATA". + "latency_p50_ms": 0.0, # Optional. Median duration of + successful calls, in milliseconds. Durations above 40960 ms are reported + as 40960. + "latency_p95_ms": 0.0, # Optional. 95th-percentile duration + of successful calls, in milliseconds. Durations above 40960 ms are + reported as 40960. + "uptime_percentage": 0.0 # Optional. Percentage of calls + that did not fail because of the provider (an upstream error, timeout, + rate limit, or unavailability). Calls that failed for other reasons are + not counted. + }, + "provider": "str", # Optional. ID of the provider that offers the + tool. + "tool_slug": "str" # Optional. Catalog tool slug. } } - # response body for status code(s): 404 + # 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 @@ -4302,8 +9941,10 @@ async def delete(self, id: str, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_connections_delete_request( - id=id, + _request = build_tools_get_health_request( + tool_slug=tool_slug, + window=window, + include_history=include_history, headers=_headers, params=_params, ) @@ -4318,7 +9959,7 @@ async def delete(self, id: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200, 404]: + 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 @@ -4341,6 +9982,22 @@ async def delete(self, id: str, **kwargs: Any) -> 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") @@ -4362,37 +10019,15 @@ async def delete(self, id: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore - -class UsersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~pydo.aio.GeneratedClient`'s - :attr:`users` 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(self, *, page: int = 1, per_page: int = 20, **kwargs: Any) -> JSON: - """List Action Gateway Users. + async def list_providers(self, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """List Providers. - Lists end-user identifiers derived from sessions and OAuth connections for the authenticated - team. + Returns the active catalog providers with at least one released tool, sorted by display name, + with the credential kinds each accepts and the parameters a connection or team credential + needs. Your team's MCP servers are listed separately under ``/v2/action-gateway/mcp-servers``. - :keyword page: Which 'page' of paginated results to return. Default value is 1. - :paramtype page: int - :keyword per_page: Number of items returned per page. Default value is 20. - :paramtype per_page: int :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -4402,13 +10037,103 @@ async def list(self, *, page: int = 1, per_page: int = 20, **kwargs: Any) -> JSO # response body for status code(s): 200 response == { - "pagination": { - "page": 0, # Required. - "per_page": 0, # Required. - "total": 0 # Required. - }, - "user_ids": [ - "str" # Optional. + "providers": [ + { + "auth_type": "str", # Optional. Deprecated: read + ``auth_types``"" , since a provider may accept more than one credential + kind. This is the first entry of ``auth_types`` other than ``none``"" , + or ``none`` when that is the only entry. + "auth_types": [ + "str" # Optional. Credential kinds the provider + accepts, sorted: none|oauth|"" ``shared_api_key``"" |unknown|"" + ``user_oauth_app``"" |"" ``user_token``. ``none`` means the provider + needs no credential. ``oauth`` means users can connect through + DigitalOcean's shared OAuth application. ``user_oauth_app`` means + users can connect through an OAuth client your team registers as a + provider credential; without ``oauth`` alongside it, that is the only + way to connect. ``shared_api_key`` means DigitalOcean supplies the + key. ``user_token`` means your team or its users supply a key or + token. ``unknown`` means the provider declares no kind this API + recognizes, including an OAuth provider whose shared application is + not available. It is never paired with another kind. + ], + "connection_parameters": [ + { + "allowed_host_suffixes": [ + "str" # Optional. For + ``https_origin`` inputs, the host suffixes the origin's host + must match. + ], + "allowed_values": [ + "str" # Optional. For enum inputs, + the accepted values. + ], + "description": "str", # Optional. Help text. + "input_kind": "str", # Optional. How the + value is entered: string, ``https_origin``"" , or enum. Known + values are: "string", "https_origin", and "enum". + "key": "str", # Optional. Key of the value + in ``connection_parameters`` or ``credential_parameters``. + "label": "str", # Optional. Display label. + "max_length": 0, # Optional. Maximum length + of the value. 0 means the default maximum of 4096. + "normalization": "str", # Optional. How the + value is normalized before it is validated and stored: trim, + lowercase, uppercase, or ``https_origin``. + "pattern": "str", # Optional. Optional RE2 + expression matched against the whole normalized value. + "required": bool # Optional. Whether the + value must be supplied. + } + ], + "credential_parameters": [ + { + "allowed_host_suffixes": [ + "str" # Optional. For + ``https_origin`` inputs, the host suffixes the origin's host + must match. + ], + "allowed_values": [ + "str" # Optional. For enum inputs, + the accepted values. + ], + "description": "str", # Optional. Help text. + "input_kind": "str", # Optional. How the + value is entered: string, ``https_origin``"" , or enum. Known + values are: "string", "https_origin", and "enum". + "key": "str", # Optional. Key of the value + in ``connection_parameters`` or ``credential_parameters``. + "label": "str", # Optional. Display label. + "max_length": 0, # Optional. Maximum length + of the value. 0 means the default maximum of 4096. + "normalization": "str", # Optional. How the + value is normalized before it is validated and stored: trim, + lowercase, uppercase, or ``https_origin``. + "pattern": "str", # Optional. Optional RE2 + expression matched against the whole normalized value. + "required": bool # Optional. Whether the + value must be supplied. + } + ], + "description": "str", # Optional. Provider description. + "display_name": "str", # Optional. Human-readable provider + name. + "name": "str", # Optional. Provider slug, used as provider + when creating a connection or a provider credential. + "oauth_client_setup_url": "str", # Optional. HTTPS page at + the provider where a team creates that OAuth client, such as its + developer console or setup guide. Empty unless ``auth_types`` contains + ``user_oauth_app`` and the provider declares one. + "oauth_redirect_url": "str", # Optional. Callback URL a team + must register with the provider when it creates its own OAuth client. It + is the same for every provider and cannot be changed per credential. + Empty unless ``auth_types`` contains ``user_oauth_app``. + "scopes": [ + "str" # Optional. The OAuth scopes a connection may + request; a connection that requests none gets all of them. Set only + when ``auth_types`` contains ``oauth`` or ``user_oauth_app``. + ] + } ] } """ @@ -4430,9 +10155,7 @@ async def list(self, *, page: int = 1, per_page: int = 20, **kwargs: Any) -> JSO cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_users_list_request( - page=page, - per_page=per_page, + _request = build_tools_list_providers_request( headers=_headers, params=_params, ) @@ -4475,14 +10198,32 @@ async def list(self, *, page: int = 1, per_page: int = 20, **kwargs: Any) -> JSO return cast(JSON, deserialized) # type: ignore @distributed_trace_async - async def get(self, user_id: str, **kwargs: Any) -> JSON: + async def list_search_providers( + self, + *, + query: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, + **kwargs: Any + ) -> JSON: # pylint: disable=line-too-long - """Retrieve an Action Gateway User. + """Search Providers. - Retrieves a derived end-user view containing its sessions and OAuth connections. + Returns the providers of ``GET /v2/action-gateway/tools/providers`` whose name, display name, + or description contains query, case-insensitively, sorted by name. Cursor-paged with + ``page_size`` and ``page_token``\\ ; no total is reported. - :param user_id: The end-user identifier. Required. - :type user_id: str + :keyword query: Matched case-insensitively as a substring of name, ``display_name``\\ , or + description. It does not match the titles of the tools a provider owns: "providers owning a + tool that matches" is a tool search grouped by the provider field of each result. Default value + is None. + :paramtype query: str + :keyword page_size: Page size, 1 to 100. Defaults to 20 when omitted or 0; other values are + rejected with 400. Default value is 20. + :paramtype page_size: int + :keyword page_token: ``next_page_token`` from the previous response. Valid only with the same + query; otherwise the request is rejected with 400. Default value is None. + :paramtype page_token: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -4492,56 +10233,108 @@ async def get(self, user_id: str, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == { - "user": { - "connections": [ - { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. - User is a derived, team-scoped view across sessions and OAuth - connections. - "granted_at": "2020-02-20 00:00:00", # Optional. - User is a derived, team-scoped view across sessions and OAuth - connections. - "id": "str", # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - "provider": "str", # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - "provider_display_name": "str", # Optional. User is - a derived, team-scoped view across sessions and OAuth connections. - "revoked_at": "2020-02-20 00:00:00", # Optional. - User is a derived, team-scoped view across sessions and OAuth - connections. - "scopes": [ - "str" # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - ], - "status": "str", # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - "updated_at": "2020-02-20 00:00:00", # Optional. - User is a derived, team-scoped view across sessions and OAuth - connections. - "user_id": "str" # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - } - ], - "sessions": [ - { - "created_at": "2020-02-20 00:00:00", # Optional. - User is a derived, team-scoped view across sessions and OAuth - connections. - "name": "str", # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - "session_urn": "str", # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - "updated_at": "2020-02-20 00:00:00" # Optional. User - is a derived, team-scoped view across sessions and OAuth connections. - } - ], - "user_id": "str" # Optional. User is a derived, team-scoped view - across sessions and OAuth connections. - } + "next_page_token": "str", # Optional. Token for the next page; empty on the + last page. + "providers": [ + { + "auth_type": "str", # Optional. Deprecated: read + ``auth_types``"" , since a provider may accept more than one credential + kind. This is the first entry of ``auth_types`` other than ``none``"" , + or ``none`` when that is the only entry. + "auth_types": [ + "str" # Optional. Credential kinds the provider + accepts, sorted: none|oauth|"" ``shared_api_key``"" |unknown|"" + ``user_oauth_app``"" |"" ``user_token``. ``none`` means the provider + needs no credential. ``oauth`` means users can connect through + DigitalOcean's shared OAuth application. ``user_oauth_app`` means + users can connect through an OAuth client your team registers as a + provider credential; without ``oauth`` alongside it, that is the only + way to connect. ``shared_api_key`` means DigitalOcean supplies the + key. ``user_token`` means your team or its users supply a key or + token. ``unknown`` means the provider declares no kind this API + recognizes, including an OAuth provider whose shared application is + not available. It is never paired with another kind. + ], + "connection_parameters": [ + { + "allowed_host_suffixes": [ + "str" # Optional. For + ``https_origin`` inputs, the host suffixes the origin's host + must match. + ], + "allowed_values": [ + "str" # Optional. For enum inputs, + the accepted values. + ], + "description": "str", # Optional. Help text. + "input_kind": "str", # Optional. How the + value is entered: string, ``https_origin``"" , or enum. Known + values are: "string", "https_origin", and "enum". + "key": "str", # Optional. Key of the value + in ``connection_parameters`` or ``credential_parameters``. + "label": "str", # Optional. Display label. + "max_length": 0, # Optional. Maximum length + of the value. 0 means the default maximum of 4096. + "normalization": "str", # Optional. How the + value is normalized before it is validated and stored: trim, + lowercase, uppercase, or ``https_origin``. + "pattern": "str", # Optional. Optional RE2 + expression matched against the whole normalized value. + "required": bool # Optional. Whether the + value must be supplied. + } + ], + "credential_parameters": [ + { + "allowed_host_suffixes": [ + "str" # Optional. For + ``https_origin`` inputs, the host suffixes the origin's host + must match. + ], + "allowed_values": [ + "str" # Optional. For enum inputs, + the accepted values. + ], + "description": "str", # Optional. Help text. + "input_kind": "str", # Optional. How the + value is entered: string, ``https_origin``"" , or enum. Known + values are: "string", "https_origin", and "enum". + "key": "str", # Optional. Key of the value + in ``connection_parameters`` or ``credential_parameters``. + "label": "str", # Optional. Display label. + "max_length": 0, # Optional. Maximum length + of the value. 0 means the default maximum of 4096. + "normalization": "str", # Optional. How the + value is normalized before it is validated and stored: trim, + lowercase, uppercase, or ``https_origin``. + "pattern": "str", # Optional. Optional RE2 + expression matched against the whole normalized value. + "required": bool # Optional. Whether the + value must be supplied. + } + ], + "description": "str", # Optional. Provider description. + "display_name": "str", # Optional. Human-readable provider + name. + "name": "str", # Optional. Provider slug, used as provider + when creating a connection or a provider credential. + "oauth_client_setup_url": "str", # Optional. HTTPS page at + the provider where a team creates that OAuth client, such as its + developer console or setup guide. Empty unless ``auth_types`` contains + ``user_oauth_app`` and the provider declares one. + "oauth_redirect_url": "str", # Optional. Callback URL a team + must register with the provider when it creates its own OAuth client. It + is the same for every provider and cannot be changed per credential. + Empty unless ``auth_types`` contains ``user_oauth_app``. + "scopes": [ + "str" # Optional. The OAuth scopes a connection may + request; a connection that requests none gets all of them. Set only + when ``auth_types`` contains ``oauth`` or ``user_oauth_app``. + ] + } + ] } - # response body for status code(s): 404 + # 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 @@ -4571,8 +10364,10 @@ async def get(self, user_id: str, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_users_get_request( - user_id=user_id, + _request = build_tools_list_search_providers_request( + query=query, + page_size=page_size, + page_token=page_token, headers=_headers, params=_params, ) @@ -4587,7 +10382,7 @@ async def get(self, user_id: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200, 404]: + 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 @@ -4610,7 +10405,7 @@ async def get(self, user_id: str, **kwargs: Any) -> JSON: else: deserialized = None - if response.status_code == 404: + if response.status_code == 400: response_headers["ratelimit-limit"] = self._deserialize( "int", response.headers.get("ratelimit-limit") ) @@ -4631,46 +10426,45 @@ async def get(self, user_id: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore - -class SessionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~pydo.aio.GeneratedClient`'s - :attr:`sessions` 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( + async def list_search( self, *, - end_user_id: Optional[str] = None, - page: int = 1, - per_page: int = 20, + query: Optional[str] = None, + provider: Optional[List[str]] = None, + toolbelt: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """List Action Gateway Sessions. + """Search Tools. - Lists Action Gateway sessions owned by the authenticated team. + Returns the tools your team can use that match query, optionally restricted to some providers + or to the members of one of your toolbelts. Results are ranked across the whole result set: + exact tool name matches first, then name or title prefixes, then name or title substrings, then + other matches. Cursor-paged with ``page_size`` and ``page_token``\\ ; no total is reported. - :keyword end_user_id: Filter sessions by actor identifier. Default value is None. - :paramtype end_user_id: str - :keyword page: Which 'page' of paginated results to return. Default value is 1. - :paramtype page: int - :keyword per_page: Number of items returned per page. Default value is 20. - :paramtype per_page: int + :keyword query: Matched case- and accent-insensitively as a substring of the tool's name, + title, description, category, provider ID, or tool slug. Empty matches every tool your team can + use. Default value is None. + :paramtype query: str + :keyword provider: Restricts results to these provider IDs, OR'd together. Repeat the parameter + to select several. An unknown ID matches nothing. Default value is None. + :paramtype provider: list[str] + :keyword toolbelt: Restricts results to the members of that toolbelt of your team at its latest + version, combined with query and provider as AND. Members are matched at the version the + toolbelt pins, which is the same set and the same versions ``GET + /v2/action-gateway/toolbelts/{name}`` reports. An unknown or deleted toolbelt returns 404 + rather than an empty page. Default value is None. + :paramtype toolbelt: str + :keyword page_size: Page size, 1 to 100. Defaults to 20 when omitted or 0; other values are + rejected with 400. Default value is 20. + :paramtype page_size: int + :keyword page_token: A ``next_page_token`` from the preceding response. It is pinned to the + query and filters that produced it: replaying one against a different search is rejected with + 400, not a silent restart from the top. Default value is None. + :paramtype page_token: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -4680,66 +10474,39 @@ async def list( # response body for status code(s): 200 response == { - "pagination": { - "page": 0, # Required. - "per_page": 0, # Required. - "total": 0 # Required. - }, - "sessions": [ + "next_page_token": "str", # Optional. Token for the next page; empty on the + last page. + "tools": [ { - "actorId": "str", # Optional. actor_id is empty when the - session is not bound to an actor. - "config": {}, # Optional. Preserved as an opaque object. - Gateway currently interprets config.preloadTools to add selected direct - tools to the session MCP. - "createdAt": "2020-02-20 00:00:00", # Optional. - "name": "str", # Optional. name is the required - human-readable session name. - "policy": { - "defaultAction": "ask", # Optional. Default value is - "ask". SessionPolicyAction is the disposition applied to a tool call. - Lowercase values are canonical so ProtoJSON matches the public REST - vocabulary; the prefixed aliases preserve compatibility for existing - protobuf clients. Known values are: "allow", "ask", and "deny". - "rules": [ - { - "action": "ask", # Optional. Default - value is "ask". SessionPolicyAction is the disposition - applied to a tool call. Lowercase values are canonical so - ProtoJSON matches the public REST vocabulary; the prefixed - aliases preserve compatibility for existing protobuf clients. - Known values are: "allow", "ask", and "deny". - "match": { - "str": "str" # Optional. - Dictionary of :code:``. - }, - "tool": "str" # Optional. - SessionPolicySpec is the Gateway-relevant subset of a - session's permission policy. Filesystem and network policy - remain enforced by the sandbox. - } - ] - }, - "sessionUrn": "str", # Optional. - "tools": { - "references": [ - { - "kind": "str", # Optional. Known - values are: "SESSION_TOOL_REFERENCE_KIND_TOOL" and - "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". - "name": "str", # Optional. Omitted - when the request omitted tools (all tools). A present - selection with no references represents tools: []. - "version": "str" # Optional. Omitted - when the request omitted tools (all tools). A present - selection with no references represents tools: []. - } - ] - }, - "updatedAt": "2020-02-20 00:00:00" # Optional. + "category": "str", # Optional. Best-effort catalog metadata + and is empty for a large share of the catalog. Do not rely on it being + present. + "description": "str", # Optional. What the tool does. + "name": "str", # Optional. The unqualified tool name, + without the provider prefix. + "provider": "str", # Optional. The owning toolkit ID, broken + out so a client never has to split ``tool_slug``. It is what a client + groups results by. + "title": "str", # Optional. Human-readable tool title. + "tool_slug": "str", # Optional. The provider-qualified, + stable tool identifier ("" ``_``"" ). Treat it as opaque + and pass it back verbatim. + "version": 0 # Optional. The released version number of the + tool, for example 3. } ] } + # 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, @@ -4759,10 +10526,12 @@ async def list( cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_sessions_list_request( - end_user_id=end_user_id, - page=page, - per_page=per_page, + _request = build_tools_list_search_request( + query=query, + provider=provider, + toolbelt=toolbelt, + page_size=page_size, + page_token=page_token, headers=_headers, params=_params, ) @@ -4777,185 +10546,74 @@ async def list( response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = {} - 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 + 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") + ) - @overload - async def create( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> JSON: - # pylint: disable=line-too-long - """Create an Action Gateway Session. + if response.content: + deserialized = response.json() + else: + deserialized = None - Creates a session with a tool selection, invocation policy, and optional direct-tool preload - configuration. + 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") + ) - :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: + if response.content: + deserialized = response.json() + else: + deserialized = None - Example: - .. code-block:: python + 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") + ) - # JSON input template you can fill out and use as your body input. - body = { - "actor_id": "str", # Required. - "name": "str", # Required. - "config": { - "preloadTools": [ - "str" # Optional. Concrete tools or pinned toolbelts to - expose directly beside the session meta-tools. - ] - }, - "policy": { - "defaultAction": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. Lowercase - values are canonical so ProtoJSON matches the public REST vocabulary; the - prefixed aliases preserve compatibility for existing protobuf clients. Known - values are: "allow", "ask", and "deny". - "rules": [ - { - "action": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. - Lowercase values are canonical so ProtoJSON matches the public REST - vocabulary; the prefixed aliases preserve compatibility for existing - protobuf clients. Known values are: "allow", "ask", and "deny". - "match": { - "str": "str" # Optional. Dictionary of - :code:``. - }, - "tool": "str" # Optional. Invocation policy. Omit to - use a default action of ask. - } - ] - }, - "tools": [ - "str" # Optional. Omitted enables every tool. An explicit empty - array enables no tools. Direct tools may be :code:`` or - @:code:``; toolbelt references must be version-pinned as - toolbelt::code:``@:code:``. - ] - } + if response.content: + deserialized = response.json() + else: + deserialized = None - # response body for status code(s): 200 - response == { - "mcpUrl": "str", # Public session-pinned MCP URL. Required. - "session": { - "actorId": "str", # Optional. actor_id is empty when the session is - not bound to an actor. - "config": {}, # Optional. Preserved as an opaque object. Gateway - currently interprets config.preloadTools to add selected direct tools to the - session MCP. - "createdAt": "2020-02-20 00:00:00", # Optional. A session and the - tool-permission policy bound to it. Required. - "name": "str", # Optional. name is the required human-readable - session name. - "policy": { - "defaultAction": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. Lowercase - values are canonical so ProtoJSON matches the public REST vocabulary; the - prefixed aliases preserve compatibility for existing protobuf clients. - Known values are: "allow", "ask", and "deny". - "rules": [ - { - "action": "ask", # Optional. Default value - is "ask". SessionPolicyAction is the disposition applied to a - tool call. Lowercase values are canonical so ProtoJSON matches - the public REST vocabulary; the prefixed aliases preserve - compatibility for existing protobuf clients. Known values are: - "allow", "ask", and "deny". - "match": { - "str": "str" # Optional. Dictionary - of :code:``. - }, - "tool": "str" # Optional. SessionPolicySpec - is the Gateway-relevant subset of a session's permission policy. - Filesystem and network policy remain enforced by the sandbox. - } - ] - }, - "sessionUrn": "str", # Optional. A session and the tool-permission - policy bound to it. Required. - "tools": { - "references": [ - { - "kind": "str", # Optional. Known values are: - "SESSION_TOOL_REFERENCE_KIND_TOOL" and - "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". - "name": "str", # Optional. Omitted when the - request omitted tools (all tools). A present selection with no - references represents tools: []. - "version": "str" # Optional. Omitted when - the request omitted tools (all tools). A present selection with - no references represents tools: []. - } - ] - }, - "updatedAt": "2020-02-20 00:00:00" # Optional. A session and the - tool-permission policy bound to it. Required. - }, - "tools": [ - "str" # Canonical, version-pinned selected tool references. - 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. - } - """ + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore - @overload - async def create( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> JSON: + return cast(JSON, deserialized) # type: ignore + + @distributed_trace_async + async def list_toolkits(self, **kwargs: Any) -> JSON: # pylint: disable=line-too-long - """Create an Action Gateway Session. + """List Toolkits. - Creates a session with a tool selection, invocation policy, and optional direct-tool preload - configuration. + Returns the providers (toolkits) whose tools your team can use: catalog providers with at least + one released tool, plus your team's registered MCP servers. - :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: @@ -4965,89 +10623,142 @@ async def create( # response body for status code(s): 200 response == { - "mcpUrl": "str", # Public session-pinned MCP URL. Required. - "session": { - "actorId": "str", # Optional. actor_id is empty when the session is - not bound to an actor. - "config": {}, # Optional. Preserved as an opaque object. Gateway - currently interprets config.preloadTools to add selected direct tools to the - session MCP. - "createdAt": "2020-02-20 00:00:00", # Optional. A session and the - tool-permission policy bound to it. Required. - "name": "str", # Optional. name is the required human-readable - session name. - "policy": { - "defaultAction": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. Lowercase - values are canonical so ProtoJSON matches the public REST vocabulary; the - prefixed aliases preserve compatibility for existing protobuf clients. - Known values are: "allow", "ask", and "deny". - "rules": [ - { - "action": "ask", # Optional. Default value - is "ask". SessionPolicyAction is the disposition applied to a - tool call. Lowercase values are canonical so ProtoJSON matches - the public REST vocabulary; the prefixed aliases preserve - compatibility for existing protobuf clients. Known values are: - "allow", "ask", and "deny". - "match": { - "str": "str" # Optional. Dictionary - of :code:``. - }, - "tool": "str" # Optional. SessionPolicySpec - is the Gateway-relevant subset of a session's permission policy. - Filesystem and network policy remain enforced by the sandbox. - } - ] - }, - "sessionUrn": "str", # Optional. A session and the tool-permission - policy bound to it. Required. - "tools": { - "references": [ - { - "kind": "str", # Optional. Known values are: - "SESSION_TOOL_REFERENCE_KIND_TOOL" and - "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". - "name": "str", # Optional. Omitted when the - request omitted tools (all tools). A present selection with no - references represents tools: []. - "version": "str" # Optional. Omitted when - the request omitted tools (all tools). A present selection with - no references represents tools: []. - } - ] - }, - "updatedAt": "2020-02-20 00:00:00" # Optional. A session and the - tool-permission policy bound to it. Required. - }, - "tools": [ - "str" # Canonical, version-pinned selected tool references. - 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. + "toolkits": [ + { + "categories": [ + "str" # Optional. Distinct categories of the + provider's released tools, sorted. + ], + "created_at": "2020-02-20 00:00:00", # Optional. When the + provider was added. + "description": "str", # Optional. Provider description. + "id": "str", # Optional. Provider ID. For one of your team's + MCP servers it is normally the server's ``serverRef``"" ; + ``provider_kind`` tells the two kinds apart. + "name": "str", # Optional. Human-readable provider name. + "provider_kind": "str" # Optional. Classifies the provider, + for example ``managed_api`` or ``byo_mcp`` (one of your team's MCP + servers). It is the same value as PublicToolDefinition.provider_kind for + the provider's tools. + } + ], + "version": "str" # Optional. Catalog version identifier, for example ``v1``. } """ + 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_tools_list_toolkits_request( + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + +class UsersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.aio.GeneratedClient`'s + :attr:`users` 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 create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + async def list( + self, + *, + user_id: Optional[str] = None, + sort: str = "created_at", + sort_direction: Optional[str] = None, + page: int = 1, + per_page: int = 20, + **kwargs: Any + ) -> JSON: # pylint: disable=line-too-long - """Create an Action Gateway Session. + """List Users. - Creates a session with a tool selection, invocation policy, and optional direct-tool preload - configuration. + Returns the user IDs known for your team: session ``actor_id`` values, the ``user_id`` of + connections that are not revoked, and actors with limit overrides. Only sessions and + connections you can see count. Offset-paged with page and ``per_page``. - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :keyword user_id: User ID prefix to return. An empty value returns all users. Default value is + None. + :paramtype user_id: str + :keyword sort: ``user_id``\\ |\\ ``created_at``\\ |\\ ``session_count``\\ |\\ + ``connection_count``. ``created_at`` is the earliest creation time among the user's sessions, + connections, and limit overrides. Defaults to ``created_at``. Known values are: "created_at", + "user_id", "session_count", and "connection_count". Default value is "created_at". + :paramtype sort: str + :keyword sort_direction: asc|desc. Defaults to desc. Known values are: "asc" and "desc". + Default value is None. + :paramtype sort_direction: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -5055,106 +10766,16 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - body = { - "actor_id": "str", # Required. - "name": "str", # Required. - "config": { - "preloadTools": [ - "str" # Optional. Concrete tools or pinned toolbelts to - expose directly beside the session meta-tools. - ] - }, - "policy": { - "defaultAction": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. Lowercase - values are canonical so ProtoJSON matches the public REST vocabulary; the - prefixed aliases preserve compatibility for existing protobuf clients. Known - values are: "allow", "ask", and "deny". - "rules": [ - { - "action": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. - Lowercase values are canonical so ProtoJSON matches the public REST - vocabulary; the prefixed aliases preserve compatibility for existing - protobuf clients. Known values are: "allow", "ask", and "deny". - "match": { - "str": "str" # Optional. Dictionary of - :code:``. - }, - "tool": "str" # Optional. Invocation policy. Omit to - use a default action of ask. - } - ] - }, - "tools": [ - "str" # Optional. Omitted enables every tool. An explicit empty - array enables no tools. Direct tools may be :code:`` or - @:code:``; toolbelt references must be version-pinned as - toolbelt::code:``@:code:``. - ] - } - # response body for status code(s): 200 response == { - "mcpUrl": "str", # Public session-pinned MCP URL. Required. - "session": { - "actorId": "str", # Optional. actor_id is empty when the session is - not bound to an actor. - "config": {}, # Optional. Preserved as an opaque object. Gateway - currently interprets config.preloadTools to add selected direct tools to the - session MCP. - "createdAt": "2020-02-20 00:00:00", # Optional. A session and the - tool-permission policy bound to it. Required. - "name": "str", # Optional. name is the required human-readable - session name. - "policy": { - "defaultAction": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. Lowercase - values are canonical so ProtoJSON matches the public REST vocabulary; the - prefixed aliases preserve compatibility for existing protobuf clients. - Known values are: "allow", "ask", and "deny". - "rules": [ - { - "action": "ask", # Optional. Default value - is "ask". SessionPolicyAction is the disposition applied to a - tool call. Lowercase values are canonical so ProtoJSON matches - the public REST vocabulary; the prefixed aliases preserve - compatibility for existing protobuf clients. Known values are: - "allow", "ask", and "deny". - "match": { - "str": "str" # Optional. Dictionary - of :code:``. - }, - "tool": "str" # Optional. SessionPolicySpec - is the Gateway-relevant subset of a session's permission policy. - Filesystem and network policy remain enforced by the sandbox. - } - ] - }, - "sessionUrn": "str", # Optional. A session and the tool-permission - policy bound to it. Required. - "tools": { - "references": [ - { - "kind": "str", # Optional. Known values are: - "SESSION_TOOL_REFERENCE_KIND_TOOL" and - "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". - "name": "str", # Optional. Omitted when the - request omitted tools (all tools). A present selection with no - references represents tools: []. - "version": "str" # Optional. Omitted when - the request omitted tools (all tools). A present selection with - no references represents tools: []. - } - ] - }, - "updatedAt": "2020-02-20 00:00:00" # Optional. A session and the - tool-permission policy bound to it. Required. + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. }, - "tools": [ - "str" # Canonical, version-pinned selected tool references. - Required. + "user_ids": [ + "str" # Optional. User IDs on this page. ] } # response body for status code(s): 400 @@ -5182,26 +10803,17 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = 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_sessions_create_request( - content_type=content_type, - json=_json, - content=_content, + _request = build_users_list_request( + user_id=user_id, + sort=sort, + sort_direction=sort_direction, + page=page, + per_page=per_page, headers=_headers, params=_params, ) @@ -5261,21 +10873,99 @@ async def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore @distributed_trace_async - async def delete(self, session_urn: str, **kwargs: Any) -> JSON: + async def get(self, user_id: str, **kwargs: Any) -> JSON: # pylint: disable=line-too-long - """Delete an Action Gateway Session. + """Get a User. - Deletes an Action Gateway session owned by the authenticated team. + Returns the sessions and non-revoked connections of one user ID. Returns 404 when the user has + none you can see and no limit overrides. - :param session_urn: The URL-encoded managed agents session URN. Required. - :type session_urn: str - :return: JSON or JSON object + :param user_id: User ID. Required. + :type user_id: str + :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python + # response body for status code(s): 200 + response == { + "user": { + "connections": [ + { + "connection_parameters": {}, # Optional. + Non-sensitive provider configuration. + "created_at": "2020-02-20 00:00:00", # Optional. + When the connection was created. + "credential_id": "str", # Optional. ID of the team + provider credential the connection uses; empty for DigitalOcean's + shared application. + "credential_kind": "str", # Optional. + ``digitalocean_oauth``"" , ``private_oauth``"" , or ``team_api_key``. + Known values are: "digitalocean_oauth", "private_oauth", and + "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. + When the user completed authorization. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # + Optional. Optional CIDR ranges; when set, every + address the host resolves to must fall within one + of them. + ], + "host": "str", # + Optional. Host name or IP address. It must resolve + only to private addresses. + "port": 0 # + Optional. Port, 1 to 65535. + } + ], + "region": "str", # Optional. Region + of the VPC. Set by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID + of a VPC owned by your team. + } + }, + "owning_user_id": "str", # Optional. DigitalOcean + user ID of the user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for + example ``jira``. + "provider_display_name": "str", # Optional. + Human-readable provider name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. + When the connection was revoked. + "scopes": [ + "str" # Optional. Provider scopes granted, + or requested while pending. + ], + "status": "str", # Optional. pending, active, + revoked, or expired. Known values are: "pending", "active", + "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. + When the connection was last modified. + "user_id": "str" # Optional. Your identifier for the + user the connection acts for. + } + ], + "sessions": [ + { + "created_at": "2020-02-20 00:00:00", # Optional. + When the session was created. + "name": "str", # Optional. Session name. + "session_urn": "str", # Optional. Session URN. + "updated_at": "2020-02-20 00:00:00" # Optional. When + the session was last modified. + } + ], + "user_id": "str" # Optional. The user ID: a session ``actor_id`` or + a connection ``user_id``. + } + } # response body for status code(s): 404 response == { "id": "str", # A short identifier corresponding to the HTTP status code @@ -5306,8 +10996,8 @@ async def delete(self, session_urn: str, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_sessions_delete_request( - session_urn=session_urn, + _request = build_users_get_request( + user_id=user_id, headers=_headers, params=_params, ) diff --git a/src/pydo/operations/__init__.py b/src/pydo/operations/__init__.py index 7d900119..58cfa4c4 100644 --- a/src/pydo/operations/__init__.py +++ b/src/pydo/operations/__init__.py @@ -4,11 +4,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import ToolsOperations -from ._operations import ToolbeltsOperations +from ._operations import ActorLimitsOperations from ._operations import ConnectionsOperations -from ._operations import UsersOperations +from ._operations import McpServersOperations +from ._operations import OutputViewsOperations from ._operations import SessionsOperations +from ._operations import ToolbeltsOperations +from ._operations import ToolsOperations +from ._operations import UsersOperations from ._operations import OneClicksOperations from ._operations import AccountOperations from ._operations import SshKeysOperations @@ -74,11 +77,14 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ToolsOperations", - "ToolbeltsOperations", + "ActorLimitsOperations", "ConnectionsOperations", - "UsersOperations", + "McpServersOperations", + "OutputViewsOperations", "SessionsOperations", + "ToolbeltsOperations", + "ToolsOperations", + "UsersOperations", "OneClicksOperations", "AccountOperations", "SshKeysOperations", diff --git a/src/pydo/operations/_operations.py b/src/pydo/operations/_operations.py index 2e22412f..4f9dff1e 100644 --- a/src/pydo/operations/_operations.py +++ b/src/pydo/operations/_operations.py @@ -51,103 +51,114 @@ _SERIALIZER.client_side_validation = False -def build_tools_list_request( - *, - toolkit_id: Optional[str] = None, - page: int = 1, - per_page: int = 20, - **kwargs: Any, -) -> HttpRequest: +def build_actor_limits_get_request(actor_id: str, **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/action-gateway/tools" + _url = "/v2/action-gateway/actors/{actor_id}/limits" + path_format_arguments = { + "actor_id": _SERIALIZER.url( + "actor_id", actor_id, "str", pattern=r"^[A-Za-z0-9._-]{1,64}$" + ), + } - # Construct parameters - if toolkit_id is not None: - _params["toolkit_id"] = _SERIALIZER.query("toolkit_id", toolkit_id, "str") - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_tools_list_toolkits_request(**kwargs: Any) -> HttpRequest: +def build_actor_limits_delete_request(actor_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/tools/toolkits" + _url = "/v2/action-gateway/actors/{actor_id}/limits:clear" + path_format_arguments = { + "actor_id": _SERIALIZER.url( + "actor_id", actor_id, "str", pattern=r"^[A-Za-z0-9._-]{1,64}$" + ), + } + + _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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_tools_list_providers_request(**kwargs: Any) -> HttpRequest: +def build_actor_limits_update_request(actor_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/tools/providers" + _url = "/v2/action-gateway/actors/{actor_id}/limits:set" + path_format_arguments = { + "actor_id": _SERIALIZER.url( + "actor_id", actor_id, "str", pattern=r"^[A-Za-z0-9._-]{1,64}$" + ), + } + + _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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_tools_get_definition_request( - name: str, - *, - version: Optional[str] = None, - toolkit_id: Optional[str] = None, - **kwargs: Any, -) -> HttpRequest: +def build_connections_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/tools/{name}/definition" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if version is not None: - _params["version"] = _SERIALIZER.query("version", version, "str") - if toolkit_id is not None: - _params["toolkit_id"] = _SERIALIZER.query("toolkit_id", toolkit_id, "str") + _url = "/v2/action-gateway/connections" # 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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_toolbelts_list_request( - *, status: str = "active", page: int = 1, per_page: int = 20, **kwargs: Any +def build_connections_list_request( + *, + provider: Optional[str] = None, + user_id: Optional[str] = None, + status: Optional[str] = None, + sort: Optional[str] = None, + sort_direction: Optional[str] = None, + page: int = 1, + per_page: int = 20, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -155,16 +166,26 @@ def build_toolbelts_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/toolbelts" + _url = "/v2/action-gateway/connections" # Construct parameters + if provider is not None: + _params["provider"] = _SERIALIZER.query("provider", provider, "str") + if user_id is not None: + _params["user_id"] = _SERIALIZER.query("user_id", user_id, "str") if status is not None: _params["status"] = _SERIALIZER.query("status", status, "str") + if sort is not None: + _params["sort"] = _SERIALIZER.query("sort", sort, "str") + if sort_direction is not None: + _params["sort_direction"] = _SERIALIZER.query( + "sort_direction", sort_direction, "str" + ) if page is not None: _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) if per_page is not None: _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 + "per_page", per_page, "int", maximum=100, minimum=1 ) # Construct headers @@ -175,70 +196,34 @@ def build_toolbelts_list_request( ) -def build_toolbelts_create_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 = "/v2/action-gateway/toolbelts" - - # 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_toolbelts_get_request( - name: str, *, version: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_connections_get_request(id: str, **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/action-gateway/toolbelts/{name}" + _url = "/v2/action-gateway/connections/{id}" path_format_arguments = { - "name": _SERIALIZER.url( - "name", name, "str", pattern=r"^[a-z][a-z0-9_-]{0,63}$" - ), + "id": _SERIALIZER.url("id", id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if version is not None: - _params["version"] = _SERIALIZER.query( - "version", version, "str", pattern=r"^[0-9]+$" - ) - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_toolbelts_delete_request(name: str, **kwargs: Any) -> HttpRequest: +def build_connections_delete_request(id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/toolbelts/{name}" + _url = "/v2/action-gateway/connections/{id}" path_format_arguments = { - "name": _SERIALIZER.url( - "name", name, "str", pattern=r"^[a-z][a-z0-9_-]{0,63}$" - ), + "id": _SERIALIZER.url("id", id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -249,7 +234,7 @@ def build_toolbelts_delete_request(name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_toolbelts_add_tools_request(name: str, **kwargs: Any) -> HttpRequest: +def build_mcp_servers_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -258,14 +243,7 @@ def build_toolbelts_add_tools_request(name: str, **kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/toolbelts/{name}/tools/add" - path_format_arguments = { - "name": _SERIALIZER.url( - "name", name, "str", pattern=r"^[a-z][a-z0-9_-]{0,63}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/action-gateway/mcp-servers" # Construct headers if content_type is not None: @@ -277,82 +255,40 @@ def build_toolbelts_add_tools_request(name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_toolbelts_delete_tools_request(name: str, **kwargs: Any) -> HttpRequest: +def build_mcp_servers_list_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 = "/v2/action-gateway/toolbelts/{name}/tools/remove" - path_format_arguments = { - "name": _SERIALIZER.url( - "name", name, "str", pattern=r"^[a-z][a-z0-9_-]{0,63}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/action-gateway/mcp-servers" # 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) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_connections_list_request( - *, - provider: Optional[str] = None, - user_id: Optional[str] = None, - status: Optional[str] = None, - sort: Optional[str] = None, - sort_direction: Optional[str] = None, - page: int = 1, - per_page: int = 20, - **kwargs: Any, -) -> HttpRequest: +def build_mcp_servers_get_request(server_ref: str, **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/action-gateway/connections" + _url = "/v2/action-gateway/mcp-servers/{server_ref}" + path_format_arguments = { + "server_ref": _SERIALIZER.url("server_ref", server_ref, "str"), + } - # Construct parameters - if provider is not None: - _params["provider"] = _SERIALIZER.query("provider", provider, "str") - if user_id is not None: - _params["user_id"] = _SERIALIZER.query("user_id", user_id, "str") - if status is not None: - _params["status"] = _SERIALIZER.query("status", status, "str") - if sort is not None: - _params["sort"] = _SERIALIZER.query("sort", sort, "str") - if sort_direction is not None: - _params["sort_direction"] = _SERIALIZER.query( - "sort_direction", sort_direction, "str" - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_connections_create_request(**kwargs: Any) -> HttpRequest: +def build_mcp_servers_patch_request(server_ref: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -361,7 +297,12 @@ def build_connections_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/connections" + _url = "/v2/action-gateway/mcp-servers/{server_ref}" + path_format_arguments = { + "server_ref": _SERIALIZER.url("server_ref", server_ref, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -370,18 +311,18 @@ def build_connections_create_request(**kwargs: Any) -> HttpRequest: ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) -def build_connections_get_request(id: str, **kwargs: Any) -> HttpRequest: +def build_mcp_servers_delete_request(server_ref: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/connections/{id}" + _url = "/v2/action-gateway/mcp-servers/{server_ref}" path_format_arguments = { - "id": _SERIALIZER.url("id", id, "str"), + "server_ref": _SERIALIZER.url("server_ref", server_ref, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -389,10 +330,10 @@ def build_connections_get_request(id: str, **kwargs: Any) -> HttpRequest: # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_connections_update_request(id: str, **kwargs: Any) -> HttpRequest: +def build_mcp_servers_run_resync_request(server_ref: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -401,9 +342,9 @@ def build_connections_update_request(id: str, **kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/connections/{id}" + _url = "/v2/action-gateway/mcp-servers/{server_ref}/resync" path_format_arguments = { - "id": _SERIALIZER.url("id", id, "str"), + "server_ref": _SERIALIZER.url("server_ref", server_ref, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -415,18 +356,18 @@ def build_connections_update_request(id: str, **kwargs: Any) -> HttpRequest: ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_connections_delete_request(id: str, **kwargs: Any) -> HttpRequest: +def build_mcp_servers_list_tools_request(server_ref: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/connections/{id}" + _url = "/v2/action-gateway/mcp-servers/{server_ref}/tools" path_format_arguments = { - "id": _SERIALIZER.url("id", id, "str"), + "server_ref": _SERIALIZER.url("server_ref", server_ref, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -434,60 +375,64 @@ def build_connections_delete_request(id: str, **kwargs: Any) -> HttpRequest: # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_users_list_request( - *, page: int = 1, per_page: int = 20, **kwargs: Any +def build_mcp_servers_update_tools_request( + server_ref: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/users" - - # Construct parameters - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) + _url = "/v2/action-gateway/mcp-servers/{server_ref}/tools" + path_format_arguments = { + "server_ref": _SERIALIZER.url("server_ref", server_ref, "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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_users_get_request(user_id: str, **kwargs: Any) -> HttpRequest: +def build_output_views_create_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 = "/v2/action-gateway/users/{user_id}" - path_format_arguments = { - "user_id": _SERIALIZER.url("user_id", user_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/action-gateway/output-views" # 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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_sessions_list_request( +def build_output_views_list_request( *, - end_user_id: Optional[str] = None, - page: int = 1, - per_page: int = 20, + tool: Optional[str] = None, + tool_id: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -496,17 +441,19 @@ def build_sessions_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/sessions" + _url = "/v2/action-gateway/output-views" # Construct parameters - if end_user_id is not None: - _params["end_user_id"] = _SERIALIZER.query("end_user_id", end_user_id, "str") - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 + if tool is not None: + _params["tool"] = _SERIALIZER.query("tool", tool, "str") + if tool_id is not None: + _params["tool_id"] = _SERIALIZER.query("tool_id", tool_id, "str") + if page_size is not None: + _params["page_size"] = _SERIALIZER.query( + "page_size", page_size, "int", maximum=100, minimum=1 ) + if page_token is not None: + _params["page_token"] = _SERIALIZER.query("page_token", page_token, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -516,7 +463,7 @@ def build_sessions_list_request( ) -def build_sessions_create_request(**kwargs: Any) -> HttpRequest: +def build_output_views_validate_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -525,7 +472,7 @@ def build_sessions_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/sessions" + _url = "/v2/action-gateway/output-views/preview" # Construct headers if content_type is not None: @@ -537,15 +484,15 @@ def build_sessions_create_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_sessions_delete_request(session_urn: str, **kwargs: Any) -> HttpRequest: +def build_output_views_get_request(view_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/action-gateway/sessions/{session_urn}" + _url = "/v2/action-gateway/output-views/{view_id}" path_format_arguments = { - "session_urn": _SERIALIZER.url("session_urn", session_urn, "str"), + "view_id": _SERIALIZER.url("view_id", view_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -553,35 +500,29 @@ def build_sessions_delete_request(session_urn: str, **kwargs: Any) -> HttpReques # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_one_clicks_list_request( - *, type: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_output_views_delete_request(view_id: str, **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/1-clicks" + _url = "/v2/action-gateway/output-views/{view_id}" + path_format_arguments = { + "view_id": _SERIALIZER.url("view_id", view_id, "str"), + } - # Construct parameters - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "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, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_one_clicks_install_kubernetes_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_sessions_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -590,7 +531,7 @@ def build_one_clicks_install_kubernetes_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/1-clicks/kubernetes" + _url = "/v2/action-gateway/sessions" # Construct headers if content_type is not None: @@ -602,22 +543,12 @@ def build_one_clicks_install_kubernetes_request( return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_account_get_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/v2/account" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_ssh_keys_list_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_sessions_list_request( + *, + end_user_id: Optional[str] = None, + page: int = 1, + per_page: int = 20, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -625,15 +556,17 @@ def build_ssh_keys_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/account/keys" + _url = "/v2/action-gateway/sessions" # Construct parameters + if end_user_id is not None: + _params["end_user_id"] = _SERIALIZER.query("end_user_id", end_user_id, "str") + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) if per_page is not None: _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 + "per_page", per_page, "int", maximum=100, minimum=1 ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -643,38 +576,51 @@ def build_ssh_keys_list_request( ) -def build_ssh_keys_create_request(**kwargs: Any) -> HttpRequest: +def build_sessions_list_search_request( + *, + query: Optional[str] = None, + end_user_id: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/account/keys" + _url = "/v2/action-gateway/sessions/search" - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" + # Construct parameters + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if end_user_id is not None: + _params["end_user_id"] = _SERIALIZER.query("end_user_id", end_user_id, "str") + if page_size is not None: + _params["page_size"] = _SERIALIZER.query( + "page_size", page_size, "int", maximum=100, minimum=1 ) + if page_token is not None: + _params["page_token"] = _SERIALIZER.query("page_token", page_token, "str") + + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_ssh_keys_get_request(ssh_key_identifier: JSON, **kwargs: Any) -> HttpRequest: +def build_sessions_delete_request(session_urn: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/account/keys/{ssh_key_identifier}" + _url = "/v2/action-gateway/sessions/{session_urn}" path_format_arguments = { - "ssh_key_identifier": _SERIALIZER.url( - "ssh_key_identifier", ssh_key_identifier, "object" - ), + "session_urn": _SERIALIZER.url("session_urn", session_urn, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -682,12 +628,10 @@ def build_ssh_keys_get_request(ssh_key_identifier: JSON, **kwargs: Any) -> HttpR # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_ssh_keys_update_request( - ssh_key_identifier: JSON, **kwargs: Any -) -> HttpRequest: +def build_toolbelts_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -696,14 +640,7 @@ def build_ssh_keys_update_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/account/keys/{ssh_key_identifier}" - path_format_arguments = { - "ssh_key_identifier": _SERIALIZER.url( - "ssh_key_identifier", ssh_key_identifier, "object" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/action-gateway/toolbelts" # Construct headers if content_type is not None: @@ -712,34 +649,45 @@ def build_ssh_keys_update_request( ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_ssh_keys_delete_request( - ssh_key_identifier: JSON, **kwargs: Any +def build_toolbelts_list_request( + *, status: str = "active", page: int = 1, per_page: int = 20, **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/account/keys/{ssh_key_identifier}" - path_format_arguments = { - "ssh_key_identifier": _SERIALIZER.url( - "ssh_key_identifier", ssh_key_identifier, "object" - ), - } + _url = "/v2/action-gateway/toolbelts" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if status is not None: + _params["status"] = _SERIALIZER.query("status", status, "str") + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=100, minimum=1 + ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_actions_list_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_toolbelts_list_search_request( + *, + query: Optional[str] = None, + status: str = "active", + page_size: int = 20, + page_token: Optional[str] = None, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -747,15 +695,19 @@ def build_actions_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/actions" + _url = "/v2/action-gateway/toolbelts/search" # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if status is not None: + _params["status"] = _SERIALIZER.query("status", status, "str") + if page_size is not None: + _params["page_size"] = _SERIALIZER.query( + "page_size", page_size, "int", maximum=100, minimum=1 ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if page_token is not None: + _params["page_token"] = _SERIALIZER.query("page_token", page_token, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -765,132 +717,168 @@ def build_actions_list_request( ) -def build_actions_get_request(action_id: int, **kwargs: Any) -> HttpRequest: +def build_toolbelts_get_request( + name: str, + *, + version: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, + search: 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/actions/{action_id}" + _url = "/v2/action-gateway/toolbelts/{name}" path_format_arguments = { - "action_id": _SERIALIZER.url("action_id", action_id, "int", minimum=1), + "name": _SERIALIZER.url( + "name", name, "str", pattern=r"^[a-z][a-z0-9_-]{0,63}$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if version is not None: + _params["version"] = _SERIALIZER.query( + "version", version, "str", pattern=r"^[0-9]+$" + ) + if page_size is not None: + _params["page_size"] = _SERIALIZER.query( + "page_size", page_size, "int", maximum=100, minimum=1 + ) + if page_token is not None: + _params["page_token"] = _SERIALIZER.query("page_token", page_token, "str") + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_addons_get_app_request(**kwargs: Any) -> HttpRequest: +def build_toolbelts_delete_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/add-ons/apps" + _url = "/v2/action-gateway/toolbelts/{name}" + path_format_arguments = { + "name": _SERIALIZER.url( + "name", name, "str", pattern=r"^[a-z][a-z0-9_-]{0,63}$" + ), + } + + _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) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_addons_get_app_metadata_request(app_slug: str, **kwargs: Any) -> HttpRequest: +def build_toolbelts_list_providers_request( + name: str, + *, + version: Optional[str] = None, + page: int = 1, + per_page: int = 20, + search: 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/add-ons/apps/{app_slug}/metadata" + _url = "/v2/action-gateway/toolbelts/{name}/providers" path_format_arguments = { - "app_slug": _SERIALIZER.url("app_slug", app_slug, "str"), + "name": _SERIALIZER.url( + "name", name, "str", pattern=r"^[a-z][a-z0-9_-]{0,63}$" + ), } _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_addons_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/v2/add-ons/saas" + # Construct parameters + if version is not None: + _params["version"] = _SERIALIZER.query( + "version", version, "str", pattern=r"^[0-9]+$" + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=100, minimum=1 + ) + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_addons_create_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) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/v2/add-ons/saas" - - # 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_addons_get_request(resource_uuid: str, **kwargs: Any) -> HttpRequest: +def build_toolbelts_list_provider_tools_request( # pylint: disable=name-too-long + name: str, + provider: str, + *, + version: Optional[str] = None, + page: int = 1, + per_page: int = 20, + search: 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/add-ons/saas/{resource_uuid}" + _url = "/v2/action-gateway/toolbelts/{name}/providers/{provider}/tools" path_format_arguments = { - "resource_uuid": _SERIALIZER.url("resource_uuid", resource_uuid, "str"), + "name": _SERIALIZER.url( + "name", name, "str", pattern=r"^[a-z][a-z0-9_-]{0,63}$" + ), + "provider": _SERIALIZER.url("provider", provider, "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_addons_delete_request(resource_uuid: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/v2/add-ons/saas/{resource_uuid}" - path_format_arguments = { - "resource_uuid": _SERIALIZER.url("resource_uuid", resource_uuid, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if version is not None: + _params["version"] = _SERIALIZER.query( + "version", version, "str", pattern=r"^[0-9]+$" + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=100, minimum=1 + ) + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_addons_patch_request(resource_uuid: str, **kwargs: Any) -> HttpRequest: +def build_toolbelts_add_tools_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -899,9 +887,11 @@ def build_addons_patch_request(resource_uuid: str, **kwargs: Any) -> HttpRequest accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/add-ons/saas/{resource_uuid}" + _url = "/v2/action-gateway/toolbelts/{name}/tools/add" path_format_arguments = { - "resource_uuid": _SERIALIZER.url("resource_uuid", resource_uuid, "str"), + "name": _SERIALIZER.url( + "name", name, "str", pattern=r"^[a-z][a-z0-9_-]{0,63}$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -913,10 +903,10 @@ def build_addons_patch_request(resource_uuid: str, **kwargs: Any) -> HttpRequest ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_addons_patch_plan_request(resource_uuid: str, **kwargs: Any) -> HttpRequest: +def build_toolbelts_delete_tools_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -925,9 +915,11 @@ def build_addons_patch_plan_request(resource_uuid: str, **kwargs: Any) -> HttpRe accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/add-ons/saas/{resource_uuid}/plan" + _url = "/v2/action-gateway/toolbelts/{name}/tools/remove" path_format_arguments = { - "resource_uuid": _SERIALIZER.url("resource_uuid", resource_uuid, "str"), + "name": _SERIALIZER.url( + "name", name, "str", pattern=r"^[a-z][a-z0-9_-]{0,63}$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -939,14 +931,14 @@ def build_addons_patch_plan_request(resource_uuid: str, **kwargs: Any) -> HttpRe ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_apps_list_request( +def build_tools_list_request( *, + toolkit_id: Optional[str] = None, page: int = 1, - per_page: int = 20, - with_projects: Optional[bool] = None, + per_page: int = 100, **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -955,18 +947,16 @@ def build_apps_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps" + _url = "/v2/action-gateway/tools" # Construct parameters + if toolkit_id is not None: + _params["toolkit_id"] = _SERIALIZER.query("toolkit_id", toolkit_id, "str") if page is not None: _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) if per_page is not None: _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if with_projects is not None: - _params["with_projects"] = _SERIALIZER.query( - "with_projects", with_projects, "bool" + "per_page", per_page, "int", maximum=100, minimum=1 ) # Construct headers @@ -977,48 +967,84 @@ def build_apps_list_request( ) -def build_apps_create_request(**kwargs: Any) -> HttpRequest: +def build_tools_list_health_request( + *, + provider: Optional[str] = None, + window: str = "HEALTH_WINDOW_TWENTY_FOUR_HOURS", + page: int = 1, + per_page: int = 20, + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps" + _url = "/v2/action-gateway/tools/health" - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" + # Construct parameters + if provider is not None: + _params["provider"] = _SERIALIZER.query("provider", provider, "str") + if window is not None: + _params["window"] = _SERIALIZER.query("window", window, "str") + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=100, minimum=1 ) + + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_apps_delete_request(id: str, **kwargs: Any) -> HttpRequest: +def build_tools_list_health_providers_request( # pylint: disable=name-too-long + *, + provider: Optional[str] = None, + window: str = "HEALTH_WINDOW_TWENTY_FOUR_HOURS", + page: int = 1, + per_page: int = 20, + **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/apps/{id}" - path_format_arguments = { - "id": _SERIALIZER.url("id", id, "str"), - } + _url = "/v2/action-gateway/tools/health/providers" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if provider is not None: + _params["provider"] = _SERIALIZER.query("provider", provider, "str") + if window is not None: + _params["window"] = _SERIALIZER.query("window", window, "str") + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=100, minimum=1 + ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_apps_get_request( - id: str, *, name: Optional[str] = None, **kwargs: Any +def build_tools_get_health_request( + tool_slug: str, + *, + window: str = "HEALTH_WINDOW_TWENTY_FOUR_HOURS", + include_history: bool = False, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1026,16 +1052,20 @@ def build_apps_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{id}" + _url = "/v2/action-gateway/tools/health/tools/{tool_slug}" path_format_arguments = { - "id": _SERIALIZER.url("id", id, "str"), + "tool_slug": _SERIALIZER.url("tool_slug", tool_slug, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if name is not None: - _params["name"] = _SERIALIZER.query("name", name, "str") + if window is not None: + _params["window"] = _SERIALIZER.query("window", window, "str") + if include_history is not None: + _params["include_history"] = _SERIALIZER.query( + "include_history", include_history, "bool" + ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1045,65 +1075,60 @@ def build_apps_get_request( ) -def build_apps_update_request(id: str, **kwargs: Any) -> HttpRequest: +def build_tools_list_providers_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 = "/v2/apps/{id}" - path_format_arguments = { - "id": _SERIALIZER.url("id", id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/action-gateway/tools/providers" # 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) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_apps_restart_request(app_id: str, **kwargs: Any) -> HttpRequest: +def build_tools_list_search_providers_request( # pylint: disable=name-too-long + *, + query: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/restart" - path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - } + _url = "/v2/action-gateway/tools/providers/search" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if page_size is not None: + _params["page_size"] = _SERIALIZER.query( + "page_size", page_size, "int", maximum=100, minimum=1 + ) + if page_token is not None: + _params["page_token"] = _SERIALIZER.query("page_token", page_token, "str") # 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) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_apps_get_logs_active_deployment_request( # pylint: disable=name-too-long - app_id: str, - component_name: str, +def build_tools_list_search_request( *, - follow: Optional[bool] = None, - type: str = "UNSPECIFIED", - pod_connection_timeout: Optional[str] = None, + query: Optional[str] = None, + provider: Optional[List[str]] = None, + toolbelt: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1112,22 +1137,24 @@ def build_apps_get_logs_active_deployment_request( # pylint: disable=name-too-l accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/components/{component_name}/logs" - path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "component_name": _SERIALIZER.url("component_name", component_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/action-gateway/tools/search" # Construct parameters - if follow is not None: - _params["follow"] = _SERIALIZER.query("follow", follow, "bool") - _params["type"] = _SERIALIZER.query("type", type, "str") - if pod_connection_timeout is not None: - _params["pod_connection_timeout"] = _SERIALIZER.query( - "pod_connection_timeout", pod_connection_timeout, "str" + if query is not None: + _params["query"] = _SERIALIZER.query("query", query, "str") + if provider is not None: + _params["provider"] = [ + _SERIALIZER.query("provider", q, "str") if q is not None else "" + for q in provider + ] + if toolbelt is not None: + _params["toolbelt"] = _SERIALIZER.query("toolbelt", toolbelt, "str") + if page_size is not None: + _params["page_size"] = _SERIALIZER.query( + "page_size", page_size, "int", maximum=100, minimum=1 ) + if page_token is not None: + _params["page_token"] = _SERIALIZER.query("page_token", page_token, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1137,11 +1164,27 @@ def build_apps_get_logs_active_deployment_request( # pylint: disable=name-too-l ) -def build_apps_get_exec_active_deployment_request( # pylint: disable=name-too-long - app_id: str, - component_name: str, +def build_tools_list_toolkits_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/action-gateway/tools/toolkits" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_users_list_request( *, - instance_name: Optional[str] = None, + user_id: Optional[str] = None, + sort: str = "created_at", + sort_direction: Optional[str] = None, + page: int = 1, + per_page: int = 20, **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1150,18 +1193,22 @@ def build_apps_get_exec_active_deployment_request( # pylint: disable=name-too-l accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/components/{component_name}/exec" - path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "component_name": _SERIALIZER.url("component_name", component_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/action-gateway/users" # Construct parameters - if instance_name is not None: - _params["instance_name"] = _SERIALIZER.query( - "instance_name", instance_name, "str" + if user_id is not None: + _params["user_id"] = _SERIALIZER.query("user_id", user_id, "str") + if sort is not None: + _params["sort"] = _SERIALIZER.query("sort", sort, "str") + if sort_direction is not None: + _params["sort_direction"] = _SERIALIZER.query( + "sort_direction", sort_direction, "str" + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=100, minimum=1 ) # Construct headers @@ -1172,15 +1219,15 @@ def build_apps_get_exec_active_deployment_request( # pylint: disable=name-too-l ) -def build_apps_get_instances_request(app_id: str, **kwargs: Any) -> HttpRequest: +def build_users_get_request(user_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/instances" + _url = "/v2/action-gateway/users/{user_id}" path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "user_id": _SERIALIZER.url("user_id", user_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1191,13 +1238,8 @@ def build_apps_get_instances_request(app_id: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_apps_list_deployments_request( - app_id: str, - *, - page: int = 1, - per_page: int = 20, - deployment_types: Optional[List[str]] = None, - **kwargs: Any, +def build_one_clicks_list_request( + *, type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1205,24 +1247,75 @@ def build_apps_list_deployments_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/deployments" - path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - } + _url = "/v2/1-clicks" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) + + +def build_one_clicks_install_kubernetes_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long + _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/1-clicks/kubernetes" + + # 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_account_get_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/account" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_ssh_keys_list_request( + *, per_page: int = 20, page: int = 1, **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/account/keys" # Construct parameters - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) if per_page is not None: _params["per_page"] = _SERIALIZER.query( "per_page", per_page, "int", maximum=200, minimum=1 ) - if deployment_types is not None: - _params["deployment_types"] = _SERIALIZER.query( - "deployment_types", deployment_types, "[str]" - ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1232,7 +1325,7 @@ def build_apps_list_deployments_request( ) -def build_apps_create_deployment_request(app_id: str, **kwargs: Any) -> HttpRequest: +def build_ssh_keys_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -1241,12 +1334,7 @@ def build_apps_create_deployment_request(app_id: str, **kwargs: Any) -> HttpRequ accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/deployments" - path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/account/keys" # Construct headers if content_type is not None: @@ -1258,18 +1346,17 @@ def build_apps_create_deployment_request(app_id: str, **kwargs: Any) -> HttpRequ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_apps_get_deployment_request( - app_id: str, deployment_id: str, **kwargs: Any -) -> HttpRequest: +def build_ssh_keys_get_request(ssh_key_identifier: JSON, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/deployments/{deployment_id}" + _url = "/v2/account/keys/{ssh_key_identifier}" path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "deployment_id": _SERIALIZER.url("deployment_id", deployment_id, "str"), + "ssh_key_identifier": _SERIALIZER.url( + "ssh_key_identifier", ssh_key_identifier, "object" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1280,80 +1367,61 @@ def build_apps_get_deployment_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_apps_cancel_deployment_request( - app_id: str, deployment_id: str, **kwargs: Any +def build_ssh_keys_update_request( + ssh_key_identifier: JSON, **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/apps/{app_id}/deployments/{deployment_id}/cancel" + _url = "/v2/account/keys/{ssh_key_identifier}" path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "deployment_id": _SERIALIZER.url("deployment_id", deployment_id, "str"), + "ssh_key_identifier": _SERIALIZER.url( + "ssh_key_identifier", ssh_key_identifier, "object" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_apps_get_logs_request( - app_id: str, - deployment_id: str, - component_name: str, - *, - follow: Optional[bool] = None, - type: str = "UNSPECIFIED", - pod_connection_timeout: Optional[str] = None, - **kwargs: Any, +def build_ssh_keys_delete_request( + ssh_key_identifier: JSON, **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/apps/{app_id}/deployments/{deployment_id}/components/{component_name}/logs" - ) + _url = "/v2/account/keys/{ssh_key_identifier}" path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "deployment_id": _SERIALIZER.url("deployment_id", deployment_id, "str"), - "component_name": _SERIALIZER.url("component_name", component_name, "str"), + "ssh_key_identifier": _SERIALIZER.url( + "ssh_key_identifier", ssh_key_identifier, "object" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if follow is not None: - _params["follow"] = _SERIALIZER.query("follow", follow, "bool") - _params["type"] = _SERIALIZER.query("type", type, "str") - if pod_connection_timeout is not None: - _params["pod_connection_timeout"] = _SERIALIZER.query( - "pod_connection_timeout", pod_connection_timeout, "str" - ) - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_apps_get_logs_aggregate_request( - app_id: str, - deployment_id: str, - *, - follow: Optional[bool] = None, - type: str = "UNSPECIFIED", - pod_connection_timeout: Optional[str] = None, - **kwargs: Any, +def build_actions_list_request( + *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1361,22 +1429,15 @@ def build_apps_get_logs_aggregate_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/deployments/{deployment_id}/logs" - path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "deployment_id": _SERIALIZER.url("deployment_id", deployment_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/actions" # Construct parameters - if follow is not None: - _params["follow"] = _SERIALIZER.query("follow", follow, "bool") - _params["type"] = _SERIALIZER.query("type", type, "str") - if pod_connection_timeout is not None: - _params["pod_connection_timeout"] = _SERIALIZER.query( - "pod_connection_timeout", pod_connection_timeout, "str" + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1386,255 +1447,188 @@ def build_apps_get_logs_aggregate_request( ) -def build_apps_get_exec_request( - app_id: str, - deployment_id: str, - component_name: str, - *, - instance_name: Optional[str] = None, - **kwargs: Any, -) -> HttpRequest: +def build_actions_get_request(action_id: int, **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/apps/{app_id}/deployments/{deployment_id}/components/{component_name}/exec" - ) + _url = "/v2/actions/{action_id}" path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "deployment_id": _SERIALIZER.url("deployment_id", deployment_id, "str"), - "component_name": _SERIALIZER.url("component_name", component_name, "str"), + "action_id": _SERIALIZER.url("action_id", action_id, "int", minimum=1), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if instance_name is not None: - _params["instance_name"] = _SERIALIZER.query( - "instance_name", instance_name, "str" - ) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_addons_get_app_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/add-ons/apps" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_apps_get_logs_active_deployment_aggregate_request( # pylint: disable=name-too-long - app_id: str, - *, - follow: Optional[bool] = None, - type: str = "UNSPECIFIED", - pod_connection_timeout: Optional[str] = None, - **kwargs: Any, -) -> HttpRequest: +def build_addons_get_app_metadata_request(app_slug: str, **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/apps/{app_id}/logs" + _url = "/v2/add-ons/apps/{app_slug}/metadata" path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "app_slug": _SERIALIZER.url("app_slug", app_slug, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if follow is not None: - _params["follow"] = _SERIALIZER.query("follow", follow, "bool") - _params["type"] = _SERIALIZER.query("type", type, "str") - if pod_connection_timeout is not None: - _params["pod_connection_timeout"] = _SERIALIZER.query( - "pod_connection_timeout", pod_connection_timeout, "str" - ) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_addons_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/add-ons/saas" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_addons_create_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 = "/v2/add-ons/saas" + # 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") -def build_apps_list_job_invocations_request( - app_id: str, - *, - job_names: Optional[List[str]] = None, - deployment_id: Optional[str] = None, - page: int = 1, - per_page: int = 20, - **kwargs: Any, -) -> HttpRequest: + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_addons_get_request(resource_uuid: str, **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/apps/{app_id}/job-invocations" + _url = "/v2/add-ons/saas/{resource_uuid}" path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "resource_uuid": _SERIALIZER.url("resource_uuid", resource_uuid, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if job_names is not None: - _params["job_names"] = _SERIALIZER.query("job_names", job_names, "[str]") - if deployment_id is not None: - _params["deployment_id"] = _SERIALIZER.query( - "deployment_id", deployment_id, "str" - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_apps_get_job_invocation_request( - app_id: str, - job_invocation_id: str, - *, - job_name: Optional[str] = None, - **kwargs: Any, -) -> HttpRequest: +def build_addons_delete_request(resource_uuid: str, **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/apps/{app_id}/job-invocations/{job_invocation_id}" + _url = "/v2/add-ons/saas/{resource_uuid}" path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "job_invocation_id": _SERIALIZER.url( - "job_invocation_id", job_invocation_id, "str" - ), + "resource_uuid": _SERIALIZER.url("resource_uuid", resource_uuid, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if job_name is not None: - _params["job_name"] = _SERIALIZER.query("job_name", job_name, "str") - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_apps_cancel_job_invocation_request( - app_id: str, - job_invocation_id: str, - *, - job_name: Optional[str] = None, - **kwargs: Any, -) -> HttpRequest: +def build_addons_patch_request(resource_uuid: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/job-invocations/{job_invocation_id}/cancel" + _url = "/v2/add-ons/saas/{resource_uuid}" path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "job_invocation_id": _SERIALIZER.url( - "job_invocation_id", job_invocation_id, "str" - ), + "resource_uuid": _SERIALIZER.url("resource_uuid", resource_uuid, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if job_name is not None: - _params["job_name"] = _SERIALIZER.query("job_name", job_name, "str") - # 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, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) -def build_apps_get_job_invocation_logs_request( # pylint: disable=name-too-long - app_id: str, - job_name: str, - job_invocation_id: str, - *, - type: str, - deployment_id: Optional[str] = None, - follow: Optional[bool] = None, - pod_connection_timeout: Optional[str] = None, - tail_lines: Optional[str] = None, - **kwargs: Any, -) -> HttpRequest: +def build_addons_patch_plan_request(resource_uuid: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/jobs/{job_name}/invocations/{job_invocation_id}/logs" + _url = "/v2/add-ons/saas/{resource_uuid}/plan" path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "job_name": _SERIALIZER.url("job_name", job_name, "str"), - "job_invocation_id": _SERIALIZER.url( - "job_invocation_id", job_invocation_id, "str" - ), + "resource_uuid": _SERIALIZER.url("resource_uuid", resource_uuid, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if deployment_id is not None: - _params["deployment_id"] = _SERIALIZER.query( - "deployment_id", deployment_id, "str" - ) - if follow is not None: - _params["follow"] = _SERIALIZER.query("follow", follow, "bool") - _params["type"] = _SERIALIZER.query("type", type, "str") - if pod_connection_timeout is not None: - _params["pod_connection_timeout"] = _SERIALIZER.query( - "pod_connection_timeout", pod_connection_timeout, "str" - ) - if tail_lines is not None: - _params["tail_lines"] = _SERIALIZER.query("tail_lines", tail_lines, "str") - # 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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) -def build_apps_list_events_request( - app_id: str, +def build_apps_list_request( *, page: int = 1, per_page: int = 20, - event_types: Optional[List[str]] = None, + with_projects: Optional[bool] = None, **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1643,12 +1637,7 @@ def build_apps_list_events_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/events" - path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/apps" # Construct parameters if page is not None: @@ -1657,8 +1646,10 @@ def build_apps_list_events_request( _params["per_page"] = _SERIALIZER.query( "per_page", per_page, "int", maximum=200, minimum=1 ) - if event_types is not None: - _params["event_types"] = _SERIALIZER.query("event_types", event_types, "[str]") + if with_projects is not None: + _params["with_projects"] = _SERIALIZER.query( + "with_projects", with_projects, "bool" + ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1668,40 +1659,36 @@ def build_apps_list_events_request( ) -def build_apps_get_event_request( - app_id: str, event_id: str, **kwargs: Any -) -> HttpRequest: +def build_apps_create_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 = "/v2/apps/{app_id}/events/{event_id}" - path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "event_id": _SERIALIZER.url("event_id", event_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/apps" # 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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_apps_cancel_event_request( - app_id: str, event_id: str, **kwargs: Any -) -> HttpRequest: +def build_apps_delete_request(id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/events/{event_id}/cancel" + _url = "/v2/apps/{id}" path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "event_id": _SERIALIZER.url("event_id", event_id, "str"), + "id": _SERIALIZER.url("id", id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1709,17 +1696,11 @@ def build_apps_cancel_event_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_apps_get_event_logs_request( - app_id: str, - event_id: str, - *, - follow: Optional[bool] = None, - type: str = "UNSPECIFIED", - pod_connection_timeout: Optional[str] = None, - **kwargs: Any, +def build_apps_get_request( + id: str, *, name: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1727,22 +1708,16 @@ def build_apps_get_event_logs_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/events/{event_id}/logs" + _url = "/v2/apps/{id}" path_format_arguments = { - "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "event_id": _SERIALIZER.url("event_id", event_id, "str"), + "id": _SERIALIZER.url("id", id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if follow is not None: - _params["follow"] = _SERIALIZER.query("follow", follow, "bool") - _params["type"] = _SERIALIZER.query("type", type, "str") - if pod_connection_timeout is not None: - _params["pod_connection_timeout"] = _SERIALIZER.query( - "pod_connection_timeout", pod_connection_timeout, "str" - ) + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1752,149 +1727,194 @@ def build_apps_get_event_logs_request( ) -def build_apps_list_instance_sizes_request(**kwargs: Any) -> HttpRequest: +def build_apps_update_request(id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/tiers/instance_sizes" + _url = "/v2/apps/{id}" + path_format_arguments = { + "id": _SERIALIZER.url("id", id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_apps_get_instance_size_request(slug: str, **kwargs: Any) -> HttpRequest: +def build_apps_restart_request(app_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/tiers/instance_sizes/{slug}" + _url = "/v2/apps/{app_id}/restart" path_format_arguments = { - "slug": _SERIALIZER.url("slug", slug, "str"), + "app_id": _SERIALIZER.url("app_id", app_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_apps_list_regions_request(**kwargs: Any) -> HttpRequest: +def build_apps_get_logs_active_deployment_request( # pylint: disable=name-too-long + app_id: str, + component_name: str, + *, + follow: Optional[bool] = None, + type: str = "UNSPECIFIED", + pod_connection_timeout: 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/apps/regions" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_apps_validate_app_spec_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _url = "/v2/apps/{app_id}/components/{component_name}/logs" + path_format_arguments = { + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "component_name": _SERIALIZER.url("component_name", component_name, "str"), + } - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) - accept = _headers.pop("Accept", "application/json") + _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct URL - _url = "/v2/apps/propose" + # Construct parameters + if follow is not None: + _params["follow"] = _SERIALIZER.query("follow", follow, "bool") + _params["type"] = _SERIALIZER.query("type", type, "str") + if pod_connection_timeout is not None: + _params["pod_connection_timeout"] = _SERIALIZER.query( + "pod_connection_timeout", pod_connection_timeout, "str" + ) # 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) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_apps_list_alerts_request(app_id: str, **kwargs: Any) -> HttpRequest: +def build_apps_get_exec_active_deployment_request( # pylint: disable=name-too-long + app_id: str, + component_name: str, + *, + instance_name: 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/apps/{app_id}/alerts" + _url = "/v2/apps/{app_id}/components/{component_name}/exec" path_format_arguments = { "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "component_name": _SERIALIZER.url("component_name", component_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if instance_name is not None: + _params["instance_name"] = _SERIALIZER.query( + "instance_name", instance_name, "str" + ) + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_apps_assign_alert_destinations_request( # pylint: disable=name-too-long - app_id: str, alert_id: str, **kwargs: Any -) -> HttpRequest: +def build_apps_get_instances_request(app_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/alerts/{alert_id}/destinations" + _url = "/v2/apps/{app_id}/instances" path_format_arguments = { "app_id": _SERIALIZER.url("app_id", app_id, "str"), - "alert_id": _SERIALIZER.url("alert_id", alert_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_apps_create_rollback_request(app_id: str, **kwargs: Any) -> HttpRequest: +def build_apps_list_deployments_request( + app_id: str, + *, + page: int = 1, + per_page: int = 20, + deployment_types: Optional[List[str]] = None, + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/rollback" + _url = "/v2/apps/{app_id}/deployments" path_format_arguments = { "app_id": _SERIALIZER.url("app_id", app_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" + # Construct parameters + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if deployment_types is not None: + _params["deployment_types"] = _SERIALIZER.query( + "deployment_types", deployment_types, "[str]" ) + + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_apps_validate_rollback_request(app_id: str, **kwargs: Any) -> HttpRequest: +def build_apps_create_deployment_request(app_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -1903,7 +1923,7 @@ def build_apps_validate_rollback_request(app_id: str, **kwargs: Any) -> HttpRequ accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/rollback/validate" + _url = "/v2/apps/{app_id}/deployments" path_format_arguments = { "app_id": _SERIALIZER.url("app_id", app_id, "str"), } @@ -1920,15 +1940,18 @@ def build_apps_validate_rollback_request(app_id: str, **kwargs: Any) -> HttpRequ return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_apps_commit_rollback_request(app_id: str, **kwargs: Any) -> HttpRequest: +def build_apps_get_deployment_request( + app_id: str, deployment_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/rollback/commit" + _url = "/v2/apps/{app_id}/deployments/{deployment_id}" path_format_arguments = { "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "deployment_id": _SERIALIZER.url("deployment_id", deployment_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1936,18 +1959,21 @@ def build_apps_commit_rollback_request(app_id: str, **kwargs: Any) -> HttpReques # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_apps_revert_rollback_request(app_id: str, **kwargs: Any) -> HttpRequest: +def build_apps_cancel_deployment_request( + app_id: str, deployment_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/rollback/revert" + _url = "/v2/apps/{app_id}/deployments/{deployment_id}/cancel" path_format_arguments = { "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "deployment_id": _SERIALIZER.url("deployment_id", deployment_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -1958,8 +1984,15 @@ def build_apps_revert_rollback_request(app_id: str, **kwargs: Any) -> HttpReques return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_apps_get_metrics_bandwidth_daily_request( # pylint: disable=name-too-long - app_id: str, *, date: Optional[datetime.datetime] = None, **kwargs: Any +def build_apps_get_logs_request( + app_id: str, + deployment_id: str, + component_name: str, + *, + follow: Optional[bool] = None, + type: str = "UNSPECIFIED", + pod_connection_timeout: Optional[str] = None, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -1967,16 +2000,25 @@ def build_apps_get_metrics_bandwidth_daily_request( # pylint: disable=name-too- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/apps/{app_id}/metrics/bandwidth_daily" + _url = ( + "/v2/apps/{app_id}/deployments/{deployment_id}/components/{component_name}/logs" + ) path_format_arguments = { "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "deployment_id": _SERIALIZER.url("deployment_id", deployment_id, "str"), + "component_name": _SERIALIZER.url("component_name", component_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if date is not None: - _params["date"] = _SERIALIZER.query("date", date, "iso-8601") + if follow is not None: + _params["follow"] = _SERIALIZER.query("follow", follow, "bool") + _params["type"] = _SERIALIZER.query("type", type, "str") + if pod_connection_timeout is not None: + _params["pod_connection_timeout"] = _SERIALIZER.query( + "pod_connection_timeout", pod_connection_timeout, "str" + ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -1986,50 +2028,53 @@ def build_apps_get_metrics_bandwidth_daily_request( # pylint: disable=name-too- ) -def build_apps_list_metrics_bandwidth_daily_request( +def build_apps_get_logs_aggregate_request( + app_id: str, + deployment_id: str, + *, + follow: Optional[bool] = None, + type: str = "UNSPECIFIED", + pod_connection_timeout: Optional[str] = None, **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long - _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/apps/metrics/bandwidth_daily" - - # 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_apps_get_health_request(app_id: str, **kwargs: Any) -> HttpRequest: +) -> 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/apps/{app_id}/health" + _url = "/v2/apps/{app_id}/deployments/{deployment_id}/logs" path_format_arguments = { "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "deployment_id": _SERIALIZER.url("deployment_id", deployment_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if follow is not None: + _params["follow"] = _SERIALIZER.query("follow", follow, "bool") + _params["type"] = _SERIALIZER.query("type", type, "str") + if pod_connection_timeout is not None: + _params["pod_connection_timeout"] = _SERIALIZER.query( + "pod_connection_timeout", pod_connection_timeout, "str" + ) + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_cdn_list_endpoints_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_apps_get_exec_request( + app_id: str, + deployment_id: str, + component_name: str, + *, + instance_name: Optional[str] = None, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2037,15 +2082,22 @@ def build_cdn_list_endpoints_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/cdn/endpoints" + _url = ( + "/v2/apps/{app_id}/deployments/{deployment_id}/components/{component_name}/exec" + ) + path_format_arguments = { + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "deployment_id": _SERIALIZER.url("deployment_id", deployment_id, "str"), + "component_name": _SERIALIZER.url("component_name", component_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 + if instance_name is not None: + _params["instance_name"] = _SERIALIZER.query( + "instance_name", instance_name, "str" ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2055,119 +2107,217 @@ def build_cdn_list_endpoints_request( ) -def build_cdn_create_endpoint_request(**kwargs: Any) -> HttpRequest: +def build_apps_get_logs_active_deployment_aggregate_request( # pylint: disable=name-too-long + app_id: str, + *, + follow: Optional[bool] = None, + type: str = "UNSPECIFIED", + pod_connection_timeout: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/cdn/endpoints" + _url = "/v2/apps/{app_id}/logs" + path_format_arguments = { + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + } - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if follow is not None: + _params["follow"] = _SERIALIZER.query("follow", follow, "bool") + _params["type"] = _SERIALIZER.query("type", type, "str") + if pod_connection_timeout is not None: + _params["pod_connection_timeout"] = _SERIALIZER.query( + "pod_connection_timeout", pod_connection_timeout, "str" ) + + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_cdn_get_endpoint_request(cdn_id: str, **kwargs: Any) -> HttpRequest: +def build_apps_list_job_invocations_request( + app_id: str, + *, + job_names: Optional[List[str]] = None, + deployment_id: Optional[str] = None, + page: int = 1, + per_page: int = 20, + **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/cdn/endpoints/{cdn_id}" + _url = "/v2/apps/{app_id}/job-invocations" path_format_arguments = { - "cdn_id": _SERIALIZER.url("cdn_id", cdn_id, "str"), + "app_id": _SERIALIZER.url("app_id", app_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if job_names is not None: + _params["job_names"] = _SERIALIZER.query("job_names", job_names, "[str]") + if deployment_id is not None: + _params["deployment_id"] = _SERIALIZER.query( + "deployment_id", deployment_id, "str" + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_cdn_update_endpoints_request(cdn_id: str, **kwargs: Any) -> HttpRequest: +def build_apps_get_job_invocation_request( + app_id: str, + job_invocation_id: str, + *, + job_name: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/cdn/endpoints/{cdn_id}" + _url = "/v2/apps/{app_id}/job-invocations/{job_invocation_id}" path_format_arguments = { - "cdn_id": _SERIALIZER.url("cdn_id", cdn_id, "str"), + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "job_invocation_id": _SERIALIZER.url( + "job_invocation_id", job_invocation_id, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if job_name is not None: + _params["job_name"] = _SERIALIZER.query("job_name", job_name, "str") + # 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) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_cdn_delete_endpoint_request(cdn_id: str, **kwargs: Any) -> HttpRequest: +def build_apps_cancel_job_invocation_request( + app_id: str, + job_invocation_id: str, + *, + job_name: 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/cdn/endpoints/{cdn_id}" + _url = "/v2/apps/{app_id}/job-invocations/{job_invocation_id}/cancel" path_format_arguments = { - "cdn_id": _SERIALIZER.url("cdn_id", cdn_id, "str"), + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "job_invocation_id": _SERIALIZER.url( + "job_invocation_id", job_invocation_id, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if job_name is not None: + _params["job_name"] = _SERIALIZER.query("job_name", job_name, "str") + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="POST", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_cdn_purge_cache_request(cdn_id: str, **kwargs: Any) -> HttpRequest: +def build_apps_get_job_invocation_logs_request( # pylint: disable=name-too-long + app_id: str, + job_name: str, + job_invocation_id: str, + *, + type: str, + deployment_id: Optional[str] = None, + follow: Optional[bool] = None, + pod_connection_timeout: Optional[str] = None, + tail_lines: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/cdn/endpoints/{cdn_id}/cache" + _url = "/v2/apps/{app_id}/jobs/{job_name}/invocations/{job_invocation_id}/logs" path_format_arguments = { - "cdn_id": _SERIALIZER.url("cdn_id", cdn_id, "str"), + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "job_name": _SERIALIZER.url("job_name", job_name, "str"), + "job_invocation_id": _SERIALIZER.url( + "job_invocation_id", job_invocation_id, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" + # Construct parameters + if deployment_id is not None: + _params["deployment_id"] = _SERIALIZER.query( + "deployment_id", deployment_id, "str" + ) + if follow is not None: + _params["follow"] = _SERIALIZER.query("follow", follow, "bool") + _params["type"] = _SERIALIZER.query("type", type, "str") + if pod_connection_timeout is not None: + _params["pod_connection_timeout"] = _SERIALIZER.query( + "pod_connection_timeout", pod_connection_timeout, "str" ) + if tail_lines is not None: + _params["tail_lines"] = _SERIALIZER.query("tail_lines", tail_lines, "str") + + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_certificates_list_request( - *, per_page: int = 20, page: int = 1, name: str = "", **kwargs: Any +def build_apps_list_events_request( + app_id: str, + *, + page: int = 1, + per_page: int = 20, + event_types: Optional[List[str]] = None, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2175,17 +2325,22 @@ def build_certificates_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/certificates" + _url = "/v2/apps/{app_id}/events" + path_format_arguments = { + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) if per_page is not None: _params["per_page"] = _SERIALIZER.query( "per_page", per_page, "int", maximum=200, minimum=1 ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if name is not None: - _params["name"] = _SERIALIZER.query("name", name, "str") + if event_types is not None: + _params["event_types"] = _SERIALIZER.query("event_types", event_types, "[str]") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2195,36 +2350,40 @@ def build_certificates_list_request( ) -def build_certificates_create_request(**kwargs: Any) -> HttpRequest: +def build_apps_get_event_request( + app_id: str, event_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/certificates" + _url = "/v2/apps/{app_id}/events/{event_id}" + path_format_arguments = { + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "event_id": _SERIALIZER.url("event_id", event_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_certificates_get_request(certificate_id: str, **kwargs: Any) -> HttpRequest: +def build_apps_cancel_event_request( + app_id: str, event_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/certificates/{certificate_id}" + _url = "/v2/apps/{app_id}/events/{event_id}/cancel" path_format_arguments = { - "certificate_id": _SERIALIZER.url("certificate_id", certificate_id, "str"), + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "event_id": _SERIALIZER.url("event_id", event_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2232,37 +2391,56 @@ def build_certificates_get_request(certificate_id: str, **kwargs: Any) -> HttpRe # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_certificates_delete_request( - certificate_id: str, **kwargs: Any +def build_apps_get_event_logs_request( + app_id: str, + event_id: str, + *, + follow: Optional[bool] = None, + type: str = "UNSPECIFIED", + pod_connection_timeout: 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/certificates/{certificate_id}" + _url = "/v2/apps/{app_id}/events/{event_id}/logs" path_format_arguments = { - "certificate_id": _SERIALIZER.url("certificate_id", certificate_id, "str"), + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "event_id": _SERIALIZER.url("event_id", event_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if follow is not None: + _params["follow"] = _SERIALIZER.query("follow", follow, "bool") + _params["type"] = _SERIALIZER.query("type", type, "str") + if pod_connection_timeout is not None: + _params["pod_connection_timeout"] = _SERIALIZER.query( + "pod_connection_timeout", pod_connection_timeout, "str" + ) + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_balance_get_request(**kwargs: Any) -> HttpRequest: +def build_apps_list_instance_sizes_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/customers/my/balance" + _url = "/v2/apps/tiers/instance_sizes" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2270,13 +2448,18 @@ def build_balance_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_prepayment_config_get_request(**kwargs: Any) -> HttpRequest: +def build_apps_get_instance_size_request(slug: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/customers/my/prepayment_config" + _url = "/v2/apps/tiers/instance_sizes/{slug}" + path_format_arguments = { + "slug": _SERIALIZER.url("slug", slug, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2284,13 +2467,13 @@ def build_prepayment_config_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_prepayment_status_get_request(**kwargs: Any) -> HttpRequest: +def build_apps_list_regions_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/customers/my/prepayment_status" + _url = "/v2/apps/regions" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2298,111 +2481,136 @@ def build_prepayment_status_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_billing_history_list_request(**kwargs: Any) -> HttpRequest: +def build_apps_validate_app_spec_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 = "/v2/customers/my/billing_history" + _url = "/v2/apps/propose" # 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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_invoices_list_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any -) -> HttpRequest: +def build_apps_list_alerts_request(app_id: str, **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/customers/my/invoices" + _url = "/v2/apps/{app_id}/alerts" + path_format_arguments = { + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + } - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_invoices_get_by_uuid_request( - invoice_uuid: str, *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_apps_assign_alert_destinations_request( # pylint: disable=name-too-long + app_id: str, alert_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/customers/my/invoices/{invoice_uuid}" + _url = "/v2/apps/{app_id}/alerts/{alert_id}/destinations" path_format_arguments = { - "invoice_uuid": _SERIALIZER.url("invoice_uuid", invoice_uuid, "str"), + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "alert_id": _SERIALIZER.url("alert_id", alert_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_apps_create_rollback_request(app_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/apps/{app_id}/rollback" + path_format_arguments = { + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_invoices_get_csv_by_uuid_request( - invoice_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_apps_validate_rollback_request(app_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop("Accept", "text/csv, application/json") + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/customers/my/invoices/{invoice_uuid}/csv" + _url = "/v2/apps/{app_id}/rollback/validate" path_format_arguments = { - "invoice_uuid": _SERIALIZER.url("invoice_uuid", invoice_uuid, "str"), + "app_id": _SERIALIZER.url("app_id", app_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_invoices_get_pdf_by_uuid_request( - invoice_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_apps_commit_rollback_request(app_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop("Accept", "application/pdf, application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/customers/my/invoices/{invoice_uuid}/pdf" + _url = "/v2/apps/{app_id}/rollback/commit" path_format_arguments = { - "invoice_uuid": _SERIALIZER.url("invoice_uuid", invoice_uuid, "str"), + "app_id": _SERIALIZER.url("app_id", app_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2410,20 +2618,18 @@ def build_invoices_get_pdf_by_uuid_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_invoices_get_summary_by_uuid_request( # pylint: disable=name-too-long - invoice_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_apps_revert_rollback_request(app_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/customers/my/invoices/{invoice_uuid}/summary" + _url = "/v2/apps/{app_id}/rollback/revert" path_format_arguments = { - "invoice_uuid": _SERIALIZER.url("invoice_uuid", invoice_uuid, "str"), + "app_id": _SERIALIZER.url("app_id", app_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2431,17 +2637,11 @@ def build_invoices_get_summary_by_uuid_request( # pylint: disable=name-too-long # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_billing_insights_list_request( - account_urn: str, - start_date: datetime.date, - end_date: datetime.date, - *, - per_page: int = 20, - page: int = 1, - **kwargs: Any, +def build_apps_get_metrics_bandwidth_daily_request( # pylint: disable=name-too-long + app_id: str, *, date: Optional[datetime.datetime] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2449,22 +2649,16 @@ def build_billing_insights_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/billing/{account_urn}/insights/{start_date}/{end_date}" + _url = "/v2/apps/{app_id}/metrics/bandwidth_daily" path_format_arguments = { - "account_urn": _SERIALIZER.url("account_urn", account_urn, "str"), - "start_date": _SERIALIZER.url("start_date", start_date, "date"), - "end_date": _SERIALIZER.url("end_date", end_date, "date"), + "app_id": _SERIALIZER.url("app_id", app_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if date is not None: + _params["date"] = _SERIALIZER.query("date", date, "iso-8601") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2474,34 +2668,66 @@ def build_billing_insights_list_request( ) -def build_databases_list_options_request(**kwargs: Any) -> HttpRequest: +def build_apps_list_metrics_bandwidth_daily_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long _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/databases/options" + _url = "/v2/apps/metrics/bandwidth_daily" # 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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_databases_list_clusters_request( - *, tag_name: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_apps_get_health_request(app_id: str, **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/databases" + _url = "/v2/apps/{app_id}/health" + path_format_arguments = { + "app_id": _SERIALIZER.url("app_id", app_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_cdn_list_endpoints_request( + *, per_page: int = 20, page: int = 1, **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/cdn/endpoints" # Construct parameters - if tag_name is not None: - _params["tag_name"] = _SERIALIZER.query("tag_name", tag_name, "str") + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2511,7 +2737,7 @@ def build_databases_list_clusters_request( ) -def build_databases_create_cluster_request(**kwargs: Any) -> HttpRequest: +def build_cdn_create_endpoint_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -2520,7 +2746,7 @@ def build_databases_create_cluster_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases" + _url = "/v2/cdn/endpoints" # Construct headers if content_type is not None: @@ -2532,19 +2758,15 @@ def build_databases_create_cluster_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_databases_get_cluster_request( - database_cluster_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_cdn_get_endpoint_request(cdn_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}" + _url = "/v2/cdn/endpoints/{cdn_id}" path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), + "cdn_id": _SERIALIZER.url("cdn_id", cdn_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2555,42 +2777,41 @@ def build_databases_get_cluster_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_destroy_cluster_request( - database_cluster_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_cdn_update_endpoints_request(cdn_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}" + _url = "/v2/cdn/endpoints/{cdn_id}" path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), + "cdn_id": _SERIALIZER.url("cdn_id", cdn_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_get_config_request( - database_cluster_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_cdn_delete_endpoint_request(cdn_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/config" + _url = "/v2/cdn/endpoints/{cdn_id}" path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), + "cdn_id": _SERIALIZER.url("cdn_id", cdn_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2598,12 +2819,10 @@ def build_databases_get_config_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_databases_patch_config_request( - database_cluster_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_cdn_purge_cache_request(cdn_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -2612,11 +2831,9 @@ def build_databases_patch_config_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/config" + _url = "/v2/cdn/endpoints/{cdn_id}/cache" path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), + "cdn_id": _SERIALIZER.url("cdn_id", cdn_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2628,58 +2845,39 @@ def build_databases_patch_config_request( ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) - - -def build_databases_get_ca_request( - database_cluster_uuid: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/ca" - path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "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) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_databases_get_migration_status_request( # pylint: disable=name-too-long - database_cluster_uuid: str, **kwargs: Any +def build_certificates_list_request( + *, per_page: int = 20, page: int = 1, name: str = "", **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/databases/{database_cluster_uuid}/online-migration" - path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), - } + _url = "/v2/certificates" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_databases_update_online_migration_request( # pylint: disable=name-too-long - database_cluster_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_certificates_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -2688,14 +2886,7 @@ def build_databases_update_online_migration_request( # pylint: disable=name-too accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/online-migration" - path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/certificates" # Construct headers if content_type is not None: @@ -2704,23 +2895,18 @@ def build_databases_update_online_migration_request( # pylint: disable=name-too ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_databases_delete_online_migration_request( # pylint: disable=name-too-long - database_cluster_uuid: str, migration_id: str, **kwargs: Any -) -> HttpRequest: +def build_certificates_get_request(certificate_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/online-migration/{migration_id}" + _url = "/v2/certificates/{certificate_id}" path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), - "migration_id": _SERIALIZER.url("migration_id", migration_id, "str"), + "certificate_id": _SERIALIZER.url("certificate_id", certificate_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2728,85 +2914,51 @@ def build_databases_delete_online_migration_request( # pylint: disable=name-too # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_update_region_request( - database_cluster_uuid: str, **kwargs: Any +def build_certificates_delete_request( + certificate_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/migrate" + _url = "/v2/certificates/{certificate_id}" path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), + "certificate_id": _SERIALIZER.url("certificate_id", certificate_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_databases_update_cluster_size_request( # pylint: disable=name-too-long - database_cluster_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_balance_get_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 = "/v2/databases/{database_cluster_uuid}/resize" - path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/customers/my/balance" # 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) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_list_firewall_rules_request( # pylint: disable=name-too-long - database_cluster_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_prepayment_config_get_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/firewall" - path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/customers/my/prepayment_config" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2814,52 +2966,27 @@ def build_databases_list_firewall_rules_request( # pylint: disable=name-too-lon return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_update_firewall_rules_request( # pylint: disable=name-too-long - database_cluster_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_prepayment_status_get_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 = "/v2/databases/{database_cluster_uuid}/firewall" - path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/customers/my/prepayment_status" # 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) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_get_do_settings_request( - database_cluster_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_billing_history_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/do_settings" - path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/customers/my/billing_history" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -2867,79 +2994,76 @@ def build_databases_get_do_settings_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_update_do_settings_request( # pylint: disable=name-too-long - database_cluster_uuid: str, **kwargs: Any +def build_invoices_list_request( + *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/do_settings" - path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), - } + _url = "/v2/customers/my/invoices" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # 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) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_databases_update_maintenance_window_request( # pylint: disable=name-too-long - database_cluster_uuid: str, **kwargs: Any +def build_invoices_get_by_uuid_request( + invoice_uuid: str, *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/maintenance" + _url = "/v2/customers/my/invoices/{invoice_uuid}" path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), + "invoice_uuid": _SERIALIZER.url("invoice_uuid", invoice_uuid, "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" + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_databases_install_update_request( - database_cluster_uuid: str, **kwargs: Any +def build_invoices_get_csv_by_uuid_request( + invoice_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop("Accept", "application/json") + accept = _headers.pop("Accept", "text/csv, application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/install_update" + _url = "/v2/customers/my/invoices/{invoice_uuid}/csv" path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), + "invoice_uuid": _SERIALIZER.url("invoice_uuid", invoice_uuid, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2947,22 +3071,20 @@ def build_databases_install_update_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_list_backups_request( - database_cluster_uuid: str, **kwargs: Any +def build_invoices_get_pdf_by_uuid_request( + invoice_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop("Accept", "application/json") + accept = _headers.pop("Accept", "application/pdf, application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/backups" + _url = "/v2/customers/my/invoices/{invoice_uuid}/pdf" path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), + "invoice_uuid": _SERIALIZER.url("invoice_uuid", invoice_uuid, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2973,19 +3095,17 @@ def build_databases_list_backups_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_list_replicas_request( - database_cluster_uuid: str, **kwargs: Any +def build_invoices_get_summary_by_uuid_request( # pylint: disable=name-too-long + invoice_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/replicas" + _url = "/v2/customers/my/invoices/{invoice_uuid}/summary" path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), + "invoice_uuid": _SERIALIZER.url("invoice_uuid", invoice_uuid, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -2996,52 +3116,53 @@ def build_databases_list_replicas_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_create_replica_request( - database_cluster_uuid: str, **kwargs: Any +def build_billing_insights_list_request( + account_urn: str, + start_date: datetime.date, + end_date: datetime.date, + *, + per_page: int = 20, + page: int = 1, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/replicas" + _url = "/v2/billing/{account_urn}/insights/{start_date}/{end_date}" path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), + "account_urn": _SERIALIZER.url("account_urn", account_urn, "str"), + "start_date": _SERIALIZER.url("start_date", start_date, "date"), + "end_date": _SERIALIZER.url("end_date", end_date, "date"), } _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" + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_databases_list_events_logs_request( - database_cluster_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_databases_list_options_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/events" - path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/databases/options" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -3049,44 +3170,63 @@ def build_databases_list_events_logs_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_get_replica_request( - database_cluster_uuid: str, replica_name: str, **kwargs: Any +def build_databases_list_clusters_request( + *, tag_name: 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/databases/{database_cluster_uuid}/replicas/{replica_name}" - path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), - "replica_name": _SERIALIZER.url("replica_name", replica_name, "str"), - } + _url = "/v2/databases" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if tag_name is not None: + _params["tag_name"] = _SERIALIZER.query("tag_name", tag_name, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_databases_destroy_replica_request( - database_cluster_uuid: str, replica_name: str, **kwargs: Any +def build_databases_create_cluster_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 = "/v2/databases" + + # 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_databases_get_cluster_request( + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/replicas/{replica_name}" + _url = "/v2/databases/{database_cluster_uuid}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "replica_name": _SERIALIZER.url("replica_name", replica_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3094,23 +3234,22 @@ def build_databases_destroy_replica_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_promote_replica_request( - database_cluster_uuid: str, replica_name: str, **kwargs: Any +def build_databases_destroy_cluster_request( + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/replicas/{replica_name}/promote" + _url = "/v2/databases/{database_cluster_uuid}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "replica_name": _SERIALIZER.url("replica_name", replica_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3118,10 +3257,10 @@ def build_databases_promote_replica_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_databases_list_users_request( +def build_databases_get_config_request( database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3129,7 +3268,7 @@ def build_databases_list_users_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/users" + _url = "/v2/databases/{database_cluster_uuid}/config" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3144,7 +3283,7 @@ def build_databases_list_users_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_add_user_request( +def build_databases_patch_config_request( database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3155,7 +3294,7 @@ def build_databases_add_user_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/users" + _url = "/v2/databases/{database_cluster_uuid}/config" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3171,23 +3310,22 @@ def build_databases_add_user_request( ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) -def build_databases_get_user_request( - database_cluster_uuid: str, username: str, **kwargs: Any +def build_databases_get_ca_request( + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/users/{username}" + _url = "/v2/databases/{database_cluster_uuid}/ca" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "username": _SERIALIZER.url("username", username, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3198,20 +3336,19 @@ def build_databases_get_user_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_delete_user_request( - database_cluster_uuid: str, username: str, **kwargs: Any +def build_databases_get_migration_status_request( # pylint: disable=name-too-long + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/users/{username}" + _url = "/v2/databases/{database_cluster_uuid}/online-migration" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "username": _SERIALIZER.url("username", username, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3219,11 +3356,11 @@ def build_databases_delete_user_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_update_user_request( - database_cluster_uuid: str, username: str, **kwargs: Any +def build_databases_update_online_migration_request( # pylint: disable=name-too-long + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3233,12 +3370,11 @@ def build_databases_update_user_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/users/{username}" + _url = "/v2/databases/{database_cluster_uuid}/online-migration" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "username": _SERIALIZER.url("username", username, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3253,46 +3389,42 @@ def build_databases_update_user_request( return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_reset_auth_request( - database_cluster_uuid: str, username: str, **kwargs: Any +def build_databases_delete_online_migration_request( # pylint: disable=name-too-long + database_cluster_uuid: str, migration_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/users/{username}/reset_auth" + _url = "/v2/databases/{database_cluster_uuid}/online-migration/{migration_id}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "username": _SERIALIZER.url("username", username, "str"), + "migration_id": _SERIALIZER.url("migration_id", migration_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_databases_list_request( +def build_databases_update_region_request( database_cluster_uuid: 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/databases/{database_cluster_uuid}/dbs" + _url = "/v2/databases/{database_cluster_uuid}/migrate" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3302,12 +3434,16 @@ def build_databases_list_request( _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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_add_request( +def build_databases_update_cluster_size_request( # pylint: disable=name-too-long database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3318,7 +3454,7 @@ def build_databases_add_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/dbs" + _url = "/v2/databases/{database_cluster_uuid}/resize" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3334,23 +3470,22 @@ def build_databases_add_request( ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_get_request( - database_cluster_uuid: str, database_name: str, **kwargs: Any +def build_databases_list_firewall_rules_request( # pylint: disable=name-too-long + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/dbs/{database_name}" + _url = "/v2/databases/{database_cluster_uuid}/firewall" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "database_name": _SERIALIZER.url("database_name", database_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3361,31 +3496,37 @@ def build_databases_get_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_delete_request( - database_cluster_uuid: str, database_name: str, **kwargs: Any +def build_databases_update_firewall_rules_request( # pylint: disable=name-too-long + database_cluster_uuid: 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/databases/{database_cluster_uuid}/dbs/{database_name}" + _url = "/v2/databases/{database_cluster_uuid}/firewall" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "database_name": _SERIALIZER.url("database_name", database_name, "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="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_list_connection_pools_request( # pylint: disable=name-too-long +def build_databases_get_do_settings_request( database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3393,7 +3534,7 @@ def build_databases_list_connection_pools_request( # pylint: disable=name-too-l accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/pools" + _url = "/v2/databases/{database_cluster_uuid}/do_settings" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3408,7 +3549,7 @@ def build_databases_list_connection_pools_request( # pylint: disable=name-too-l return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_add_connection_pool_request( # pylint: disable=name-too-long +def build_databases_update_do_settings_request( # pylint: disable=name-too-long database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3419,7 +3560,7 @@ def build_databases_add_connection_pool_request( # pylint: disable=name-too-lon accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/pools" + _url = "/v2/databases/{database_cluster_uuid}/do_settings" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3435,78 +3576,75 @@ def build_databases_add_connection_pool_request( # pylint: disable=name-too-lon ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_get_connection_pool_request( # pylint: disable=name-too-long - database_cluster_uuid: str, pool_name: str, **kwargs: Any +def build_databases_update_maintenance_window_request( # pylint: disable=name-too-long + database_cluster_uuid: 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/databases/{database_cluster_uuid}/pools/{pool_name}" + _url = "/v2/databases/{database_cluster_uuid}/maintenance" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "pool_name": _SERIALIZER.url("pool_name", pool_name, "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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_update_connection_pool_request( # pylint: disable=name-too-long - database_cluster_uuid: str, pool_name: str, **kwargs: Any +def build_databases_install_update_request( + database_cluster_uuid: 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/databases/{database_cluster_uuid}/pools/{pool_name}" + _url = "/v2/databases/{database_cluster_uuid}/install_update" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "pool_name": _SERIALIZER.url("pool_name", pool_name, "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_databases_delete_connection_pool_request( # pylint: disable=name-too-long - database_cluster_uuid: str, pool_name: str, **kwargs: Any +def build_databases_list_backups_request( + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/pools/{pool_name}" + _url = "/v2/databases/{database_cluster_uuid}/backups" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "pool_name": _SERIALIZER.url("pool_name", pool_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3514,10 +3652,10 @@ def build_databases_delete_connection_pool_request( # pylint: disable=name-too- # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_get_eviction_policy_request( # pylint: disable=name-too-long +def build_databases_list_replicas_request( database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3525,7 +3663,7 @@ def build_databases_get_eviction_policy_request( # pylint: disable=name-too-lon accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/eviction_policy" + _url = "/v2/databases/{database_cluster_uuid}/replicas" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3540,7 +3678,7 @@ def build_databases_get_eviction_policy_request( # pylint: disable=name-too-lon return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_update_eviction_policy_request( # pylint: disable=name-too-long +def build_databases_create_replica_request( database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3551,7 +3689,7 @@ def build_databases_update_eviction_policy_request( # pylint: disable=name-too- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/eviction_policy" + _url = "/v2/databases/{database_cluster_uuid}/replicas" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3567,10 +3705,10 @@ def build_databases_update_eviction_policy_request( # pylint: disable=name-too- ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_databases_get_sql_mode_request( +def build_databases_list_events_logs_request( database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3578,7 +3716,7 @@ def build_databases_get_sql_mode_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/sql_mode" + _url = "/v2/databases/{database_cluster_uuid}/events" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3593,79 +3731,68 @@ def build_databases_get_sql_mode_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_update_sql_mode_request( - database_cluster_uuid: str, **kwargs: Any +def build_databases_get_replica_request( + database_cluster_uuid: str, replica_name: 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/databases/{database_cluster_uuid}/sql_mode" + _url = "/v2/databases/{database_cluster_uuid}/replicas/{replica_name}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), + "replica_name": _SERIALIZER.url("replica_name", replica_name, "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) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_update_major_version_request( # pylint: disable=name-too-long - database_cluster_uuid: str, **kwargs: Any +def build_databases_destroy_replica_request( + database_cluster_uuid: str, replica_name: 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/databases/{database_cluster_uuid}/upgrade" + _url = "/v2/databases/{database_cluster_uuid}/replicas/{replica_name}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), + "replica_name": _SERIALIZER.url("replica_name", replica_name, "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) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_databases_get_autoscale_request( - database_cluster_uuid: str, **kwargs: Any +def build_databases_promote_replica_request( + database_cluster_uuid: str, replica_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/autoscale" + _url = "/v2/databases/{database_cluster_uuid}/replicas/{replica_name}/promote" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), + "replica_name": _SERIALIZER.url("replica_name", replica_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3673,21 +3800,18 @@ def build_databases_get_autoscale_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_update_autoscale_request( +def build_databases_list_users_request( database_cluster_uuid: 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/databases/{database_cluster_uuid}/autoscale" + _url = "/v2/databases/{database_cluster_uuid}/users" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3697,24 +3821,23 @@ def build_databases_update_autoscale_request( _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) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_list_kafka_topics_request( # pylint: disable=name-too-long +def build_databases_add_user_request( database_cluster_uuid: 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/databases/{database_cluster_uuid}/topics" + _url = "/v2/databases/{database_cluster_uuid}/users" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3724,55 +3847,53 @@ def build_databases_list_kafka_topics_request( # pylint: disable=name-too-long _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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_databases_create_kafka_topic_request( # pylint: disable=name-too-long - database_cluster_uuid: str, **kwargs: Any +def build_databases_get_user_request( + database_cluster_uuid: str, username: 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/databases/{database_cluster_uuid}/topics" + _url = "/v2/databases/{database_cluster_uuid}/users/{username}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), + "username": _SERIALIZER.url("username", username, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_get_kafka_topic_request( - database_cluster_uuid: str, topic_name: str, **kwargs: Any +def build_databases_delete_user_request( + database_cluster_uuid: str, username: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/topics/{topic_name}" + _url = "/v2/databases/{database_cluster_uuid}/users/{username}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "topic_name": _SERIALIZER.url("topic_name", topic_name, "str"), + "username": _SERIALIZER.url("username", username, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3780,11 +3901,11 @@ def build_databases_get_kafka_topic_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_databases_update_kafka_topic_request( # pylint: disable=name-too-long - database_cluster_uuid: str, topic_name: str, **kwargs: Any +def build_databases_update_user_request( + database_cluster_uuid: str, username: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3794,12 +3915,12 @@ def build_databases_update_kafka_topic_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/topics/{topic_name}" + _url = "/v2/databases/{database_cluster_uuid}/users/{username}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "topic_name": _SERIALIZER.url("topic_name", topic_name, "str"), + "username": _SERIALIZER.url("username", username, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3814,31 +3935,38 @@ def build_databases_update_kafka_topic_request( # pylint: disable=name-too-long return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_delete_kafka_topic_request( # pylint: disable=name-too-long - database_cluster_uuid: str, topic_name: str, **kwargs: Any +def build_databases_reset_auth_request( + database_cluster_uuid: str, username: 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/databases/{database_cluster_uuid}/topics/{topic_name}" + _url = "/v2/databases/{database_cluster_uuid}/users/{username}/reset_auth" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "topic_name": _SERIALIZER.url("topic_name", topic_name, "str"), + "username": _SERIALIZER.url("username", username, "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="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_databases_list_logsink_request( +def build_databases_list_request( database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3846,7 +3974,7 @@ def build_databases_list_logsink_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/logsink" + _url = "/v2/databases/{database_cluster_uuid}/dbs" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3861,7 +3989,7 @@ def build_databases_list_logsink_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_create_logsink_request( +def build_databases_add_request( database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3872,7 +4000,7 @@ def build_databases_create_logsink_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/logsink" + _url = "/v2/databases/{database_cluster_uuid}/dbs" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3891,20 +4019,20 @@ def build_databases_create_logsink_request( return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_databases_get_logsink_request( - database_cluster_uuid: str, logsink_id: str, **kwargs: Any +def build_databases_get_request( + database_cluster_uuid: str, database_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/logsink/{logsink_id}" + _url = "/v2/databases/{database_cluster_uuid}/dbs/{database_name}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "logsink_id": _SERIALIZER.url("logsink_id", logsink_id, "str"), + "database_name": _SERIALIZER.url("database_name", database_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -3915,62 +4043,31 @@ def build_databases_get_logsink_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_update_logsink_request( - database_cluster_uuid: str, logsink_id: str, **kwargs: Any +def build_databases_delete_request( + database_cluster_uuid: str, database_name: 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/databases/{database_cluster_uuid}/logsink/{logsink_id}" + _url = "/v2/databases/{database_cluster_uuid}/dbs/{database_name}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "logsink_id": _SERIALIZER.url("logsink_id", logsink_id, "str"), + "database_name": _SERIALIZER.url("database_name", database_name, "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) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_databases_delete_logsink_request( - database_cluster_uuid: str, logsink_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/logsink/{logsink_id}" - path_format_arguments = { - "database_cluster_uuid": _SERIALIZER.url( - "database_cluster_uuid", database_cluster_uuid, "str" - ), - "logsink_id": _SERIALIZER.url("logsink_id", logsink_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) - - -def build_databases_list_kafka_schemas_request( # pylint: disable=name-too-long +def build_databases_list_connection_pools_request( # pylint: disable=name-too-long database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3978,7 +4075,7 @@ def build_databases_list_kafka_schemas_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/schema-registry" + _url = "/v2/databases/{database_cluster_uuid}/pools" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -3993,7 +4090,7 @@ def build_databases_list_kafka_schemas_request( # pylint: disable=name-too-long return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_create_kafka_schema_request( # pylint: disable=name-too-long +def build_databases_add_connection_pool_request( # pylint: disable=name-too-long database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4004,7 +4101,7 @@ def build_databases_create_kafka_schema_request( # pylint: disable=name-too-lon accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/schema-registry" + _url = "/v2/databases/{database_cluster_uuid}/pools" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -4023,20 +4120,20 @@ def build_databases_create_kafka_schema_request( # pylint: disable=name-too-lon return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_databases_get_kafka_schema_request( - database_cluster_uuid: str, subject_name: str, **kwargs: Any +def build_databases_get_connection_pool_request( # pylint: disable=name-too-long + database_cluster_uuid: str, pool_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/schema-registry/{subject_name}" + _url = "/v2/databases/{database_cluster_uuid}/pools/{pool_name}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "subject_name": _SERIALIZER.url("subject_name", subject_name, "str"), + "pool_name": _SERIALIZER.url("pool_name", pool_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4047,45 +4144,51 @@ def build_databases_get_kafka_schema_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_delete_kafka_schema_request( # pylint: disable=name-too-long - database_cluster_uuid: str, subject_name: str, **kwargs: Any +def build_databases_update_connection_pool_request( # pylint: disable=name-too-long + database_cluster_uuid: str, pool_name: 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/databases/{database_cluster_uuid}/schema-registry/{subject_name}" + _url = "/v2/databases/{database_cluster_uuid}/pools/{pool_name}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "subject_name": _SERIALIZER.url("subject_name", subject_name, "str"), + "pool_name": _SERIALIZER.url("pool_name", pool_name, "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="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_get_kafka_schema_version_request( # pylint: disable=name-too-long - database_cluster_uuid: str, subject_name: str, version: str, **kwargs: Any +def build_databases_delete_connection_pool_request( # pylint: disable=name-too-long + database_cluster_uuid: str, pool_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/schema-registry/{subject_name}/versions/{version}" + _url = "/v2/databases/{database_cluster_uuid}/pools/{pool_name}" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "subject_name": _SERIALIZER.url("subject_name", subject_name, "str"), - "version": _SERIALIZER.url("version", version, "str"), + "pool_name": _SERIALIZER.url("pool_name", pool_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4093,10 +4196,10 @@ def build_databases_get_kafka_schema_version_request( # pylint: disable=name-to # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_databases_get_kafka_schema_config_request( # pylint: disable=name-too-long +def build_databases_get_eviction_policy_request( # pylint: disable=name-too-long database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4104,7 +4207,7 @@ def build_databases_get_kafka_schema_config_request( # pylint: disable=name-too accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/schema-registry/config" + _url = "/v2/databases/{database_cluster_uuid}/eviction_policy" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -4119,7 +4222,7 @@ def build_databases_get_kafka_schema_config_request( # pylint: disable=name-too return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_update_kafka_schema_config_request( # pylint: disable=name-too-long +def build_databases_update_eviction_policy_request( # pylint: disable=name-too-long database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4130,7 +4233,7 @@ def build_databases_update_kafka_schema_config_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/schema-registry/config" + _url = "/v2/databases/{database_cluster_uuid}/eviction_policy" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -4149,20 +4252,19 @@ def build_databases_update_kafka_schema_config_request( # pylint: disable=name- return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_get_kafka_schema_subject_config_request( # pylint: disable=name-too-long - database_cluster_uuid: str, subject_name: str, **kwargs: Any +def build_databases_get_sql_mode_request( + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/schema-registry/config/{subject_name}" + _url = "/v2/databases/{database_cluster_uuid}/sql_mode" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "subject_name": _SERIALIZER.url("subject_name", subject_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4173,8 +4275,8 @@ def build_databases_get_kafka_schema_subject_config_request( # pylint: disable= return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_update_kafka_schema_subject_config_request( # pylint: disable=name-too-long - database_cluster_uuid: str, subject_name: str, **kwargs: Any +def build_databases_update_sql_mode_request( + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4184,12 +4286,11 @@ def build_databases_update_kafka_schema_subject_config_request( # pylint: disab accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/schema-registry/config/{subject_name}" + _url = "/v2/databases/{database_cluster_uuid}/sql_mode" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "subject_name": _SERIALIZER.url("subject_name", subject_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4204,15 +4305,52 @@ def build_databases_update_kafka_schema_subject_config_request( # pylint: disab return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_get_cluster_metrics_credentials_request( # pylint: disable=name-too-long - **kwargs: Any, +def build_databases_update_major_version_request( # pylint: disable=name-too-long + database_cluster_uuid: 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/databases/{database_cluster_uuid}/upgrade" + path_format_arguments = { + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "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_databases_get_autoscale_request( + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/metrics/credentials" + _url = "/v2/databases/{database_cluster_uuid}/autoscale" + path_format_arguments = { + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4220,8 +4358,8 @@ def build_databases_get_cluster_metrics_credentials_request( # pylint: disable= return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_update_cluster_metrics_credentials_request( # pylint: disable=name-too-long - **kwargs: Any, +def build_databases_update_autoscale_request( + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4231,7 +4369,14 @@ def build_databases_update_cluster_metrics_credentials_request( # pylint: disab accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/metrics/credentials" + _url = "/v2/databases/{database_cluster_uuid}/autoscale" + path_format_arguments = { + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -4243,7 +4388,7 @@ def build_databases_update_cluster_metrics_credentials_request( # pylint: disab return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_databases_list_opeasearch_indexes_request( # pylint: disable=name-too-long +def build_databases_list_kafka_topics_request( # pylint: disable=name-too-long database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4251,7 +4396,7 @@ def build_databases_list_opeasearch_indexes_request( # pylint: disable=name-too accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/databases/{database_cluster_uuid}/indexes" + _url = "/v2/databases/{database_cluster_uuid}/topics" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" @@ -4266,43 +4411,50 @@ def build_databases_list_opeasearch_indexes_request( # pylint: disable=name-too return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_databases_delete_opensearch_index_request( # pylint: disable=name-too-long - database_cluster_uuid: str, index_name: str, **kwargs: Any +def build_databases_create_kafka_topic_request( # pylint: disable=name-too-long + database_cluster_uuid: 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/databases/{database_cluster_uuid}/indexes/{index_name}" + _url = "/v2/databases/{database_cluster_uuid}/topics" path_format_arguments = { "database_cluster_uuid": _SERIALIZER.url( "database_cluster_uuid", database_cluster_uuid, "str" ), - "index_name": _SERIALIZER.url("index_name", index_name, "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="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_get_request( - dedicated_inference_id: str, **kwargs: Any +def build_databases_get_kafka_topic_request( + database_cluster_uuid: str, topic_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/dedicated-inferences/{dedicated_inference_id}" + _url = "/v2/databases/{database_cluster_uuid}/topics/{topic_name}" path_format_arguments = { - "dedicated_inference_id": _SERIALIZER.url( - "dedicated_inference_id", dedicated_inference_id, "str" + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" ), + "topic_name": _SERIALIZER.url("topic_name", topic_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4313,8 +4465,8 @@ def build_dedicated_inferences_get_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_patch_request( - dedicated_inference_id: str, **kwargs: Any +def build_databases_update_kafka_topic_request( # pylint: disable=name-too-long + database_cluster_uuid: str, topic_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4324,11 +4476,12 @@ def build_dedicated_inferences_patch_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/dedicated-inferences/{dedicated_inference_id}" + _url = "/v2/databases/{database_cluster_uuid}/topics/{topic_name}" path_format_arguments = { - "dedicated_inference_id": _SERIALIZER.url( - "dedicated_inference_id", dedicated_inference_id, "str" + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" ), + "topic_name": _SERIALIZER.url("topic_name", topic_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4340,22 +4493,23 @@ def build_dedicated_inferences_patch_request( ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_delete_request( # pylint: disable=name-too-long - dedicated_inference_id: str, **kwargs: Any +def build_databases_delete_kafka_topic_request( # pylint: disable=name-too-long + database_cluster_uuid: str, topic_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/dedicated-inferences/{dedicated_inference_id}" + _url = "/v2/databases/{database_cluster_uuid}/topics/{topic_name}" path_format_arguments = { - "dedicated_inference_id": _SERIALIZER.url( - "dedicated_inference_id", dedicated_inference_id, "str" + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" ), + "topic_name": _SERIALIZER.url("topic_name", topic_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4366,38 +4520,32 @@ def build_dedicated_inferences_delete_request( # pylint: disable=name-too-long return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_list_request( - *, per_page: int = 20, page: int = 1, region: Optional[str] = None, **kwargs: Any +def build_databases_list_logsink_request( + database_cluster_uuid: str, **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/dedicated-inferences" + _url = "/v2/databases/{database_cluster_uuid}/logsink" + path_format_arguments = { + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + } - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if region is not None: - _params["region"] = _SERIALIZER.query("region", region, "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, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_create_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_databases_create_logsink_request( + database_cluster_uuid: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -4406,7 +4554,14 @@ def build_dedicated_inferences_create_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/dedicated-inferences" + _url = "/v2/databases/{database_cluster_uuid}/logsink" + path_format_arguments = { + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -4418,84 +4573,75 @@ def build_dedicated_inferences_create_request( return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_list_accelerators_request( # pylint: disable=name-too-long - dedicated_inference_id: str, - *, - per_page: int = 20, - page: int = 1, - slug: Optional[str] = None, - **kwargs: Any, +def build_databases_get_logsink_request( + database_cluster_uuid: str, logsink_id: str, **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/dedicated-inferences/{dedicated_inference_id}/accelerators" + _url = "/v2/databases/{database_cluster_uuid}/logsink/{logsink_id}" path_format_arguments = { - "dedicated_inference_id": _SERIALIZER.url( - "dedicated_inference_id", dedicated_inference_id, "str" + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" ), + "logsink_id": _SERIALIZER.url("logsink_id", logsink_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if slug is not None: - _params["slug"] = _SERIALIZER.query("slug", slug, "str") - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_get_accelerator_request( # pylint: disable=name-too-long - dedicated_inference_id: str, accelerator_id: str, **kwargs: Any +def build_databases_update_logsink_request( + database_cluster_uuid: str, logsink_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/dedicated-inferences/{dedicated_inference_id}/accelerators/{accelerator_id}" + _url = "/v2/databases/{database_cluster_uuid}/logsink/{logsink_id}" path_format_arguments = { - "dedicated_inference_id": _SERIALIZER.url( - "dedicated_inference_id", dedicated_inference_id, "str" + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" ), - "accelerator_id": _SERIALIZER.url("accelerator_id", accelerator_id, "str"), + "logsink_id": _SERIALIZER.url("logsink_id", logsink_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_get_ca_request( # pylint: disable=name-too-long - dedicated_inference_id: str, **kwargs: Any +def build_databases_delete_logsink_request( + database_cluster_uuid: str, logsink_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/dedicated-inferences/{dedicated_inference_id}/ca" + _url = "/v2/databases/{database_cluster_uuid}/logsink/{logsink_id}" path_format_arguments = { - "dedicated_inference_id": _SERIALIZER.url( - "dedicated_inference_id", dedicated_inference_id, "str" + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" ), + "logsink_id": _SERIALIZER.url("logsink_id", logsink_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4503,45 +4649,34 @@ def build_dedicated_inferences_get_ca_request( # pylint: disable=name-too-long # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_list_tokens_request( # pylint: disable=name-too-long - dedicated_inference_id: str, *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_databases_list_kafka_schemas_request( # pylint: disable=name-too-long + database_cluster_uuid: str, **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/dedicated-inferences/{dedicated_inference_id}/tokens" + _url = "/v2/databases/{database_cluster_uuid}/schema-registry" path_format_arguments = { - "dedicated_inference_id": _SERIALIZER.url( - "dedicated_inference_id", dedicated_inference_id, "str" + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" ), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_create_tokens_request( # pylint: disable=name-too-long - dedicated_inference_id: str, **kwargs: Any +def build_databases_create_kafka_schema_request( # pylint: disable=name-too-long + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4551,10 +4686,10 @@ def build_dedicated_inferences_create_tokens_request( # pylint: disable=name-to accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/dedicated-inferences/{dedicated_inference_id}/tokens" + _url = "/v2/databases/{database_cluster_uuid}/schema-registry" path_format_arguments = { - "dedicated_inference_id": _SERIALIZER.url( - "dedicated_inference_id", dedicated_inference_id, "str" + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" ), } @@ -4570,20 +4705,20 @@ def build_dedicated_inferences_create_tokens_request( # pylint: disable=name-to return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_delete_tokens_request( # pylint: disable=name-too-long - dedicated_inference_id: str, token_id: str, **kwargs: Any +def build_databases_get_kafka_schema_request( + database_cluster_uuid: str, subject_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/dedicated-inferences/{dedicated_inference_id}/tokens/{token_id}" + _url = "/v2/databases/{database_cluster_uuid}/schema-registry/{subject_name}" path_format_arguments = { - "dedicated_inference_id": _SERIALIZER.url( - "dedicated_inference_id", dedicated_inference_id, "str" + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" ), - "token_id": _SERIALIZER.url("token_id", token_id, "str"), + "subject_name": _SERIALIZER.url("subject_name", subject_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4591,34 +4726,51 @@ def build_dedicated_inferences_delete_tokens_request( # pylint: disable=name-to # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_list_sizes_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_databases_delete_kafka_schema_request( # pylint: disable=name-too-long + database_cluster_uuid: str, subject_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/dedicated-inferences/sizes" + _url = "/v2/databases/{database_cluster_uuid}/schema-registry/{subject_name}" + path_format_arguments = { + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + "subject_name": _SERIALIZER.url("subject_name", subject_name, "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) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_dedicated_inferences_get_gpu_model_config_request( # pylint: disable=name-too-long - **kwargs: Any, +def build_databases_get_kafka_schema_version_request( # pylint: disable=name-too-long + database_cluster_uuid: str, subject_name: str, version: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/dedicated-inferences/gpu-model-config" + _url = "/v2/databases/{database_cluster_uuid}/schema-registry/{subject_name}/versions/{version}" + path_format_arguments = { + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + "subject_name": _SERIALIZER.url("subject_name", subject_name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4626,34 +4778,32 @@ def build_dedicated_inferences_get_gpu_model_config_request( # pylint: disable= return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_domains_list_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_databases_get_kafka_schema_config_request( # pylint: disable=name-too-long + database_cluster_uuid: str, **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/domains" + _url = "/v2/databases/{database_cluster_uuid}/schema-registry/config" + path_format_arguments = { + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + } - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_domains_create_request(**kwargs: Any) -> HttpRequest: +def build_databases_update_kafka_schema_config_request( # pylint: disable=name-too-long + database_cluster_uuid: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -4662,7 +4812,14 @@ def build_domains_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/domains" + _url = "/v2/databases/{database_cluster_uuid}/schema-registry/config" + path_format_arguments = { + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -4671,18 +4828,23 @@ def build_domains_create_request(**kwargs: Any) -> HttpRequest: ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_domains_get_request(domain_name: str, **kwargs: Any) -> HttpRequest: +def build_databases_get_kafka_schema_subject_config_request( # pylint: disable=name-too-long + database_cluster_uuid: str, subject_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/domains/{domain_name}" + _url = "/v2/databases/{database_cluster_uuid}/schema-registry/config/{subject_name}" path_format_arguments = { - "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + "subject_name": _SERIALIZER.url("subject_name", subject_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4693,68 +4855,56 @@ def build_domains_get_request(domain_name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_domains_delete_request(domain_name: str, **kwargs: Any) -> HttpRequest: +def build_databases_update_kafka_schema_subject_config_request( # pylint: disable=name-too-long + database_cluster_uuid: str, subject_name: 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/domains/{domain_name}" + _url = "/v2/databases/{database_cluster_uuid}/schema-registry/config/{subject_name}" path_format_arguments = { - "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), + "subject_name": _SERIALIZER.url("subject_name", subject_name, "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="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_domains_list_records_request( - domain_name: str, - *, - name: Optional[str] = None, - type: Optional[str] = None, - per_page: int = 20, - page: int = 1, +def build_databases_get_cluster_metrics_credentials_request( # pylint: disable=name-too-long **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/domains/{domain_name}/records" - path_format_arguments = { - "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if name is not None: - _params["name"] = _SERIALIZER.query("name", name, "str") - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "str") - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + _url = "/v2/databases/metrics/credentials" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_domains_create_record_request(domain_name: str, **kwargs: Any) -> HttpRequest: +def build_databases_update_cluster_metrics_credentials_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -4763,12 +4913,7 @@ def build_domains_create_record_request(domain_name: str, **kwargs: Any) -> Http accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/domains/{domain_name}/records" - path_format_arguments = { - "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/databases/metrics/credentials" # Construct headers if content_type is not None: @@ -4777,23 +4922,22 @@ def build_domains_create_record_request(domain_name: str, **kwargs: Any) -> Http ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_domains_get_record_request( - domain_name: str, domain_record_id: int, **kwargs: Any +def build_databases_list_opeasearch_indexes_request( # pylint: disable=name-too-long + database_cluster_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/domains/{domain_name}/records/{domain_record_id}" + _url = "/v2/databases/{database_cluster_uuid}/indexes" path_format_arguments = { - "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), - "domain_record_id": _SERIALIZER.url( - "domain_record_id", domain_record_id, "int" - ), + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4804,39 +4948,55 @@ def build_domains_get_record_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_domains_patch_record_request( - domain_name: str, domain_record_id: int, **kwargs: Any +def build_databases_delete_opensearch_index_request( # pylint: disable=name-too-long + database_cluster_uuid: str, index_name: 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/domains/{domain_name}/records/{domain_record_id}" + _url = "/v2/databases/{database_cluster_uuid}/indexes/{index_name}" path_format_arguments = { - "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), - "domain_record_id": _SERIALIZER.url( - "domain_record_id", domain_record_id, "int" + "database_cluster_uuid": _SERIALIZER.url( + "database_cluster_uuid", database_cluster_uuid, "str" ), + "index_name": _SERIALIZER.url("index_name", index_name, "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="PATCH", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_domains_update_record_request( - domain_name: str, domain_record_id: int, **kwargs: Any +def build_dedicated_inferences_get_request( + dedicated_inference_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/dedicated-inferences/{dedicated_inference_id}" + path_format_arguments = { + "dedicated_inference_id": _SERIALIZER.url( + "dedicated_inference_id", dedicated_inference_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_dedicated_inferences_patch_request( + dedicated_inference_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4846,11 +5006,10 @@ def build_domains_update_record_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/domains/{domain_name}/records/{domain_record_id}" + _url = "/v2/dedicated-inferences/{dedicated_inference_id}" path_format_arguments = { - "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), - "domain_record_id": _SERIALIZER.url( - "domain_record_id", domain_record_id, "int" + "dedicated_inference_id": _SERIALIZER.url( + "dedicated_inference_id", dedicated_inference_id, "str" ), } @@ -4863,22 +5022,21 @@ def build_domains_update_record_request( ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) -def build_domains_delete_record_request( - domain_name: str, domain_record_id: int, **kwargs: Any +def build_dedicated_inferences_delete_request( # pylint: disable=name-too-long + dedicated_inference_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/domains/{domain_name}/records/{domain_record_id}" + _url = "/v2/dedicated-inferences/{dedicated_inference_id}" path_format_arguments = { - "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), - "domain_record_id": _SERIALIZER.url( - "domain_record_id", domain_record_id, "int" + "dedicated_inference_id": _SERIALIZER.url( + "dedicated_inference_id", dedicated_inference_id, "str" ), } @@ -4890,14 +5048,8 @@ def build_domains_delete_record_request( return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_droplets_list_request( - *, - per_page: int = 20, - page: int = 1, - tag_name: Optional[str] = None, - name: Optional[str] = None, - type: Optional[str] = None, - **kwargs: Any, +def build_dedicated_inferences_list_request( + *, per_page: int = 20, page: int = 1, region: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4905,7 +5057,7 @@ def build_droplets_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets" + _url = "/v2/dedicated-inferences" # Construct parameters if per_page is not None: @@ -4914,12 +5066,8 @@ def build_droplets_list_request( ) if page is not None: _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if tag_name is not None: - _params["tag_name"] = _SERIALIZER.query("tag_name", tag_name, "str") - if name is not None: - _params["name"] = _SERIALIZER.query("name", name, "str") - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "str") + if region is not None: + _params["region"] = _SERIALIZER.query("region", region, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -4929,7 +5077,9 @@ def build_droplets_list_request( ) -def build_droplets_create_request(**kwargs: Any) -> HttpRequest: +def build_dedicated_inferences_create_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -4938,7 +5088,7 @@ def build_droplets_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets" + _url = "/v2/dedicated-inferences" # Construct headers if content_type is not None: @@ -4950,8 +5100,13 @@ def build_droplets_create_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_droplets_destroy_by_tag_request( - *, tag_name: str, **kwargs: Any +def build_dedicated_inferences_list_accelerators_request( # pylint: disable=name-too-long + dedicated_inference_id: str, + *, + per_page: int = 20, + page: int = 1, + slug: Optional[str] = None, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -4959,28 +5114,47 @@ def build_droplets_destroy_by_tag_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets" + _url = "/v2/dedicated-inferences/{dedicated_inference_id}/accelerators" + path_format_arguments = { + "dedicated_inference_id": _SERIALIZER.url( + "dedicated_inference_id", dedicated_inference_id, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - _params["tag_name"] = _SERIALIZER.query("tag_name", tag_name, "str") + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if slug is not None: + _params["slug"] = _SERIALIZER.query("slug", slug, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest( - method="DELETE", url=_url, params=_params, headers=_headers, **kwargs + method="GET", url=_url, params=_params, headers=_headers, **kwargs ) -def build_droplets_get_request(droplet_id: int, **kwargs: Any) -> HttpRequest: +def build_dedicated_inferences_get_accelerator_request( # pylint: disable=name-too-long + dedicated_inference_id: str, accelerator_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/{droplet_id}" + _url = "/v2/dedicated-inferences/{dedicated_inference_id}/accelerators/{accelerator_id}" path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + "dedicated_inference_id": _SERIALIZER.url( + "dedicated_inference_id", dedicated_inference_id, "str" + ), + "accelerator_id": _SERIALIZER.url("accelerator_id", accelerator_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -4991,15 +5165,19 @@ def build_droplets_get_request(droplet_id: int, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_droplets_destroy_request(droplet_id: int, **kwargs: Any) -> HttpRequest: +def build_dedicated_inferences_get_ca_request( # pylint: disable=name-too-long + dedicated_inference_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/{droplet_id}" + _url = "/v2/dedicated-inferences/{dedicated_inference_id}/ca" path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + "dedicated_inference_id": _SERIALIZER.url( + "dedicated_inference_id", dedicated_inference_id, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5007,11 +5185,11 @@ def build_droplets_destroy_request(droplet_id: int, **kwargs: Any) -> HttpReques # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_droplets_list_backups_request( - droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_dedicated_inferences_list_tokens_request( # pylint: disable=name-too-long + dedicated_inference_id: str, *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5019,9 +5197,11 @@ def build_droplets_list_backups_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/{droplet_id}/backups" + _url = "/v2/dedicated-inferences/{dedicated_inference_id}/tokens" path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + "dedicated_inference_id": _SERIALIZER.url( + "dedicated_inference_id", dedicated_inference_id, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5042,63 +5222,69 @@ def build_droplets_list_backups_request( ) -def build_droplets_get_backup_policy_request( - droplet_id: int, **kwargs: Any +def build_dedicated_inferences_create_tokens_request( # pylint: disable=name-too-long + dedicated_inference_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/{droplet_id}/backups/policy" + _url = "/v2/dedicated-inferences/{dedicated_inference_id}/tokens" path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + "dedicated_inference_id": _SERIALIZER.url( + "dedicated_inference_id", dedicated_inference_id, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_droplets_list_backup_policies_request( # pylint: disable=name-too-long - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_dedicated_inferences_delete_tokens_request( # pylint: disable=name-too-long + dedicated_inference_id: str, token_id: str, **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/droplets/backups/policies" + _url = "/v2/dedicated-inferences/{dedicated_inference_id}/tokens/{token_id}" + path_format_arguments = { + "dedicated_inference_id": _SERIALIZER.url( + "dedicated_inference_id", dedicated_inference_id, "str" + ), + "token_id": _SERIALIZER.url("token_id", token_id, "str"), + } - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_droplets_list_supported_backup_policies_request( # pylint: disable=name-too-long +def build_dedicated_inferences_list_sizes_request( **kwargs: Any, -) -> HttpRequest: +) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/backups/supported_policies" + _url = "/v2/dedicated-inferences/sizes" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -5106,40 +5292,24 @@ def build_droplets_list_supported_backup_policies_request( # pylint: disable=na return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_droplets_list_snapshots_request( - droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_dedicated_inferences_get_gpu_model_config_request( # pylint: disable=name-too-long + **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/droplets/{droplet_id}/snapshots" - path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + _url = "/v2/dedicated-inferences/gpu-model-config" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_droplets_list_kernels_request( - droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_domains_list_request( + *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5147,12 +5317,7 @@ def build_droplets_list_kernels_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/{droplet_id}/kernels" - path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/domains" # Construct parameters if per_page is not None: @@ -5170,49 +5335,55 @@ def build_droplets_list_kernels_request( ) -def build_droplets_list_firewalls_request( - droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any -) -> HttpRequest: +def build_domains_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/{droplet_id}/firewalls" - path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/domains" - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_domains_get_request(domain_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/domains/{domain_name}" + path_format_arguments = { + "domain_name": _SERIALIZER.url("domain_name", domain_name, "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, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_droplets_list_neighbors_request( - droplet_id: int, **kwargs: Any -) -> HttpRequest: +def build_domains_delete_request(domain_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/{droplet_id}/neighbors" + _url = "/v2/domains/{domain_name}" path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5220,33 +5391,52 @@ def build_droplets_list_neighbors_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_droplets_list_associated_resources_request( # pylint: disable=name-too-long - droplet_id: int, **kwargs: Any +def build_domains_list_records_request( + domain_name: str, + *, + name: Optional[str] = None, + type: Optional[str] = None, + per_page: int = 20, + page: int = 1, + **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/droplets/{droplet_id}/destroy_with_associated_resources" + _url = "/v2/domains/{domain_name}/records" path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_droplets_destroy_with_associated_resources_selective_request( # pylint: disable=name-too-long - droplet_id: int, **kwargs: Any -) -> HttpRequest: +def build_domains_create_record_request(domain_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -5255,9 +5445,9 @@ def build_droplets_destroy_with_associated_resources_selective_request( # pylin accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/{droplet_id}/destroy_with_associated_resources/selective" + _url = "/v2/domains/{domain_name}/records" path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5269,91 +5459,127 @@ def build_droplets_destroy_with_associated_resources_selective_request( # pylin ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_droplets_destroy_with_associated_resources_dangerous_request( # pylint: disable=name-too-long - droplet_id: int, *, x_dangerous: bool, **kwargs: Any +def build_domains_get_record_request( + domain_name: str, domain_record_id: int, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/{droplet_id}/destroy_with_associated_resources/dangerous" + _url = "/v2/domains/{domain_name}/records/{domain_record_id}" path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), + "domain_record_id": _SERIALIZER.url( + "domain_record_id", domain_record_id, "int" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - _headers["X-Dangerous"] = _SERIALIZER.header("x_dangerous", x_dangerous, "bool") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_droplets_get_destroy_associated_resources_status_request( # pylint: disable=name-too-long - droplet_id: int, **kwargs: Any +def build_domains_patch_record_request( + domain_name: str, domain_record_id: int, **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/droplets/{droplet_id}/destroy_with_associated_resources/status" + _url = "/v2/domains/{domain_name}/records/{domain_record_id}" path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), + "domain_record_id": _SERIALIZER.url( + "domain_record_id", domain_record_id, "int" + ), } _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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) -def build_droplets_destroy_retry_with_associated_resources_request( # pylint: disable=name-too-long - droplet_id: int, **kwargs: Any +def build_domains_update_record_request( + domain_name: str, domain_record_id: int, **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/droplets/{droplet_id}/destroy_with_associated_resources/retry" + _url = "/v2/domains/{domain_name}/records/{domain_record_id}" path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), + "domain_record_id": _SERIALIZER.url( + "domain_record_id", domain_record_id, "int" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_droplets_list_neighbors_ids_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_domains_delete_record_request( + domain_name: str, domain_record_id: int, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/reports/droplet_neighbors_ids" + _url = "/v2/domains/{domain_name}/records/{domain_record_id}" + path_format_arguments = { + "domain_name": _SERIALIZER.url("domain_name", domain_name, "str"), + "domain_record_id": _SERIALIZER.url( + "domain_record_id", domain_record_id, "int" + ), + } + + _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) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_droplet_actions_list_request( - droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_droplets_list_request( + *, + per_page: int = 20, + page: int = 1, + tag_name: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5361,12 +5587,7 @@ def build_droplet_actions_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/{droplet_id}/actions" - path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/droplets" # Construct parameters if per_page is not None: @@ -5375,6 +5596,12 @@ def build_droplet_actions_list_request( ) if page is not None: _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if tag_name is not None: + _params["tag_name"] = _SERIALIZER.query("tag_name", tag_name, "str") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -5384,7 +5611,7 @@ def build_droplet_actions_list_request( ) -def build_droplet_actions_post_request(droplet_id: int, **kwargs: Any) -> HttpRequest: +def build_droplets_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -5393,12 +5620,7 @@ def build_droplet_actions_post_request(droplet_id: int, **kwargs: Any) -> HttpRe accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/{droplet_id}/actions" - path_format_arguments = { - "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/droplets" # Construct headers if content_type is not None: @@ -5410,48 +5632,37 @@ def build_droplet_actions_post_request(droplet_id: int, **kwargs: Any) -> HttpRe return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_droplet_actions_post_by_tag_request( # pylint: disable=name-too-long - *, tag_name: Optional[str] = None, **kwargs: Any +def build_droplets_destroy_by_tag_request( + *, tag_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/actions" + _url = "/v2/droplets" # Construct parameters - if tag_name is not None: - _params["tag_name"] = _SERIALIZER.query("tag_name", tag_name, "str") + _params["tag_name"] = _SERIALIZER.query("tag_name", tag_name, "str") # 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, params=_params, headers=_headers, **kwargs + method="DELETE", url=_url, params=_params, headers=_headers, **kwargs ) -def build_droplet_actions_get_request( - droplet_id: int, action_id: int, **kwargs: Any -) -> HttpRequest: +def build_droplets_get_request(droplet_id: int, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/{droplet_id}/actions/{action_id}" + _url = "/v2/droplets/{droplet_id}" path_format_arguments = { "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), - "action_id": _SERIALIZER.url("action_id", action_id, "int", minimum=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5462,8 +5673,27 @@ def build_droplet_actions_get_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_autoscalepools_list_request( - *, per_page: int = 20, page: int = 1, name: Optional[str] = None, **kwargs: Any +def build_droplets_destroy_request(droplet_id: int, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/droplets/{droplet_id}" + path_format_arguments = { + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + + +def build_droplets_list_backups_request( + droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5471,7 +5701,12 @@ def build_autoscalepools_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/autoscale" + _url = "/v2/droplets/{droplet_id}/backups" + path_format_arguments = { + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if per_page is not None: @@ -5480,8 +5715,6 @@ def build_autoscalepools_list_request( ) if page is not None: _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if name is not None: - _params["name"] = _SERIALIZER.query("name", name, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -5491,40 +5724,17 @@ def build_autoscalepools_list_request( ) -def build_autoscalepools_create_request(**kwargs: Any) -> HttpRequest: +def build_droplets_get_backup_policy_request( + droplet_id: int, **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/droplets/autoscale" - - # 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_autoscalepools_get_request( - autoscale_pool_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/v2/droplets/autoscale/{autoscale_pool_id}" + _url = "/v2/droplets/{droplet_id}/backups/policy" path_format_arguments = { - "autoscale_pool_id": _SERIALIZER.url( - "autoscale_pool_id", autoscale_pool_id, "str" - ), + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5535,85 +5745,51 @@ def build_autoscalepools_get_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_autoscalepools_update_request( - autoscale_pool_id: str, **kwargs: Any +def build_droplets_list_backup_policies_request( # pylint: disable=name-too-long + *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/autoscale/{autoscale_pool_id}" - path_format_arguments = { - "autoscale_pool_id": _SERIALIZER.url( - "autoscale_pool_id", autoscale_pool_id, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/droplets/backups/policies" - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 ) - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_autoscalepools_delete_request( - autoscale_pool_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/v2/droplets/autoscale/{autoscale_pool_id}" - path_format_arguments = { - "autoscale_pool_id": _SERIALIZER.url( - "autoscale_pool_id", autoscale_pool_id, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_autoscalepools_delete_dangerous_request( # pylint: disable=name-too-long - autoscale_pool_id: str, *, x_dangerous: bool, **kwargs: Any +def build_droplets_list_supported_backup_policies_request( # pylint: disable=name-too-long + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/autoscale/{autoscale_pool_id}/dangerous" - path_format_arguments = { - "autoscale_pool_id": _SERIALIZER.url( - "autoscale_pool_id", autoscale_pool_id, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/droplets/backups/supported_policies" # Construct headers - _headers["X-Dangerous"] = _SERIALIZER.header("x_dangerous", x_dangerous, "bool") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_autoscalepools_list_members_request( # pylint: disable=name-too-long - autoscale_pool_id: str, *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_droplets_list_snapshots_request( + droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5621,11 +5797,9 @@ def build_autoscalepools_list_members_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/autoscale/{autoscale_pool_id}/members" + _url = "/v2/droplets/{droplet_id}/snapshots" path_format_arguments = { - "autoscale_pool_id": _SERIALIZER.url( - "autoscale_pool_id", autoscale_pool_id, "str" - ), + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5646,8 +5820,8 @@ def build_autoscalepools_list_members_request( # pylint: disable=name-too-long ) -def build_autoscalepools_list_history_request( # pylint: disable=name-too-long - autoscale_pool_id: str, *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_droplets_list_kernels_request( + droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5655,11 +5829,9 @@ def build_autoscalepools_list_history_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/droplets/autoscale/{autoscale_pool_id}/history" + _url = "/v2/droplets/{droplet_id}/kernels" path_format_arguments = { - "autoscale_pool_id": _SERIALIZER.url( - "autoscale_pool_id", autoscale_pool_id, "str" - ), + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5680,8 +5852,8 @@ def build_autoscalepools_list_history_request( # pylint: disable=name-too-long ) -def build_firewalls_list_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_droplets_list_firewalls_request( + droplet_id: int, *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -5689,7 +5861,12 @@ def build_firewalls_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/firewalls" + _url = "/v2/droplets/{droplet_id}/firewalls" + path_format_arguments = { + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if per_page is not None: @@ -5707,36 +5884,38 @@ def build_firewalls_list_request( ) -def build_firewalls_create_request(**kwargs: Any) -> HttpRequest: +def build_droplets_list_neighbors_request( + droplet_id: int, **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/firewalls" + _url = "/v2/droplets/{droplet_id}/neighbors" + path_format_arguments = { + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_firewalls_get_request(firewall_id: str, **kwargs: Any) -> HttpRequest: +def build_droplets_list_associated_resources_request( # pylint: disable=name-too-long + droplet_id: int, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/firewalls/{firewall_id}" + _url = "/v2/droplets/{droplet_id}/destroy_with_associated_resources" path_format_arguments = { - "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5747,7 +5926,9 @@ def build_firewalls_get_request(firewall_id: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_firewalls_update_request(firewall_id: str, **kwargs: Any) -> HttpRequest: +def build_droplets_destroy_with_associated_resources_selective_request( # pylint: disable=name-too-long + droplet_id: int, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -5756,9 +5937,9 @@ def build_firewalls_update_request(firewall_id: str, **kwargs: Any) -> HttpReque accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/firewalls/{firewall_id}" + _url = "/v2/droplets/{droplet_id}/destroy_with_associated_resources/selective" path_format_arguments = { - "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5770,111 +5951,122 @@ def build_firewalls_update_request(firewall_id: str, **kwargs: Any) -> HttpReque ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_firewalls_delete_request(firewall_id: str, **kwargs: Any) -> HttpRequest: +def build_droplets_destroy_with_associated_resources_dangerous_request( # pylint: disable=name-too-long + droplet_id: int, *, x_dangerous: bool, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/firewalls/{firewall_id}" + _url = "/v2/droplets/{droplet_id}/destroy_with_associated_resources/dangerous" path_format_arguments = { - "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + _headers["X-Dangerous"] = _SERIALIZER.header("x_dangerous", x_dangerous, "bool") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_firewalls_assign_droplets_request( - firewall_id: str, **kwargs: Any +def build_droplets_get_destroy_associated_resources_status_request( # pylint: disable=name-too-long + droplet_id: int, **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/firewalls/{firewall_id}/droplets" + _url = "/v2/droplets/{droplet_id}/destroy_with_associated_resources/status" path_format_arguments = { - "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_firewalls_delete_droplets_request( - firewall_id: str, **kwargs: Any +def build_droplets_destroy_retry_with_associated_resources_request( # pylint: disable=name-too-long + droplet_id: int, **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/firewalls/{firewall_id}/droplets" + _url = "/v2/droplets/{droplet_id}/destroy_with_associated_resources/retry" path_format_arguments = { - "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), } _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="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_firewalls_add_tags_request(firewall_id: str, **kwargs: Any) -> HttpRequest: +def build_droplets_list_neighbors_ids_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long _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/firewalls/{firewall_id}/tags" + _url = "/v2/reports/droplet_neighbors_ids" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_droplet_actions_list_request( + droplet_id: int, *, per_page: int = 20, page: int = 1, **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/droplets/{droplet_id}/actions" path_format_arguments = { - "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), } _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" + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_firewalls_delete_tags_request(firewall_id: str, **kwargs: Any) -> HttpRequest: +def build_droplet_actions_post_request(droplet_id: int, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -5883,9 +6075,9 @@ def build_firewalls_delete_tags_request(firewall_id: str, **kwargs: Any) -> Http accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/firewalls/{firewall_id}/tags" + _url = "/v2/droplets/{droplet_id}/actions" path_format_arguments = { - "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5897,11 +6089,14 @@ def build_firewalls_delete_tags_request(firewall_id: str, **kwargs: Any) -> Http ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_firewalls_add_rules_request(firewall_id: str, **kwargs: Any) -> HttpRequest: +def build_droplet_actions_post_by_tag_request( # pylint: disable=name-too-long + *, tag_name: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop( "content_type", _headers.pop("Content-Type", None) @@ -5909,12 +6104,11 @@ def build_firewalls_add_rules_request(firewall_id: str, **kwargs: Any) -> HttpRe accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/firewalls/{firewall_id}/rules" - path_format_arguments = { - "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), - } + _url = "/v2/droplets/actions" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if tag_name is not None: + _params["tag_name"] = _SERIALIZER.query("tag_name", tag_name, "str") # Construct headers if content_type is not None: @@ -5923,52 +6117,63 @@ def build_firewalls_add_rules_request(firewall_id: str, **kwargs: Any) -> HttpRe ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="POST", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_firewalls_delete_rules_request( - firewall_id: str, **kwargs: Any +def build_droplet_actions_get_request( + droplet_id: int, action_id: int, **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/firewalls/{firewall_id}/rules" + _url = "/v2/droplets/{droplet_id}/actions/{action_id}" path_format_arguments = { - "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), + "droplet_id": _SERIALIZER.url("droplet_id", droplet_id, "int", minimum=1), + "action_id": _SERIALIZER.url("action_id", action_id, "int", minimum=1), } _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="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_functions_list_namespaces_request(**kwargs: Any) -> HttpRequest: +def build_autoscalepools_list_request( + *, per_page: int = 20, page: int = 1, name: 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/functions/namespaces" + _url = "/v2/droplets/autoscale" + + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_functions_create_namespace_request(**kwargs: Any) -> HttpRequest: +def build_autoscalepools_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -5977,7 +6182,7 @@ def build_functions_create_namespace_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/functions/namespaces" + _url = "/v2/droplets/autoscale" # Construct headers if content_type is not None: @@ -5989,17 +6194,19 @@ def build_functions_create_namespace_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_functions_get_namespace_request( - namespace_id: str, **kwargs: Any +def build_autoscalepools_get_request( + autoscale_pool_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/functions/namespaces/{namespace_id}" + _url = "/v2/droplets/autoscale/{autoscale_pool_id}" path_format_arguments = { - "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), + "autoscale_pool_id": _SERIALIZER.url( + "autoscale_pool_id", autoscale_pool_id, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6010,38 +6217,49 @@ def build_functions_get_namespace_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_functions_delete_namespace_request( - namespace_id: str, **kwargs: Any +def build_autoscalepools_update_request( + autoscale_pool_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/functions/namespaces/{namespace_id}" + _url = "/v2/droplets/autoscale/{autoscale_pool_id}" path_format_arguments = { - "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), + "autoscale_pool_id": _SERIALIZER.url( + "autoscale_pool_id", autoscale_pool_id, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_functions_list_triggers_request( - namespace_id: str, **kwargs: Any +def build_autoscalepools_delete_request( + autoscale_pool_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/functions/namespaces/{namespace_id}/triggers" + _url = "/v2/droplets/autoscale/{autoscale_pool_id}" path_format_arguments = { - "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), + "autoscale_pool_id": _SERIALIZER.url( + "autoscale_pool_id", autoscale_pool_id, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6049,162 +6267,169 @@ def build_functions_list_triggers_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_functions_create_trigger_request( - namespace_id: str, **kwargs: Any +def build_autoscalepools_delete_dangerous_request( # pylint: disable=name-too-long + autoscale_pool_id: str, *, x_dangerous: bool, **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/functions/namespaces/{namespace_id}/triggers" + _url = "/v2/droplets/autoscale/{autoscale_pool_id}/dangerous" path_format_arguments = { - "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), + "autoscale_pool_id": _SERIALIZER.url( + "autoscale_pool_id", autoscale_pool_id, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) + _headers["X-Dangerous"] = _SERIALIZER.header("x_dangerous", x_dangerous, "bool") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_functions_get_trigger_request( - namespace_id: str, trigger_name: str, **kwargs: Any +def build_autoscalepools_list_members_request( # pylint: disable=name-too-long + autoscale_pool_id: str, *, per_page: int = 20, page: int = 1, **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/functions/namespaces/{namespace_id}/triggers/{trigger_name}" + _url = "/v2/droplets/autoscale/{autoscale_pool_id}/members" path_format_arguments = { - "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), - "trigger_name": _SERIALIZER.url("trigger_name", trigger_name, "str"), + "autoscale_pool_id": _SERIALIZER.url( + "autoscale_pool_id", autoscale_pool_id, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_functions_update_trigger_request( - namespace_id: str, trigger_name: str, **kwargs: Any +def build_autoscalepools_list_history_request( # pylint: disable=name-too-long + autoscale_pool_id: str, *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/functions/namespaces/{namespace_id}/triggers/{trigger_name}" + _url = "/v2/droplets/autoscale/{autoscale_pool_id}/history" path_format_arguments = { - "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), - "trigger_name": _SERIALIZER.url("trigger_name", trigger_name, "str"), + "autoscale_pool_id": _SERIALIZER.url( + "autoscale_pool_id", autoscale_pool_id, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_functions_delete_trigger_request( - namespace_id: str, trigger_name: str, **kwargs: Any +def build_firewalls_list_request( + *, per_page: int = 20, page: int = 1, **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/functions/namespaces/{namespace_id}/triggers/{trigger_name}" - path_format_arguments = { - "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), - "trigger_name": _SERIALIZER.url("trigger_name", trigger_name, "str"), - } + _url = "/v2/firewalls" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_functions_access_key_list_request( - namespace_id: str, **kwargs: Any -) -> HttpRequest: +def build_firewalls_create_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 = "/v2/functions/namespaces/{namespace_id}/keys" - path_format_arguments = { - "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/firewalls" # 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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_functions_access_key_create_request( # pylint: disable=name-too-long - namespace_id: str, **kwargs: Any -) -> HttpRequest: +def build_firewalls_get_request(firewall_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/functions/namespaces/{namespace_id}/keys" + _url = "/v2/firewalls/{firewall_id}" path_format_arguments = { - "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), + "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_functions_access_key_update_request( # pylint: disable=name-too-long - namespace_id: str, key_id: str, **kwargs: Any -) -> HttpRequest: +def build_firewalls_update_request(firewall_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -6213,10 +6438,9 @@ def build_functions_access_key_update_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/functions/namespaces/{namespace_id}/keys/{key_id}" + _url = "/v2/firewalls/{firewall_id}" path_format_arguments = { - "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), - "key_id": _SERIALIZER.url("key_id", key_id, "str"), + "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6231,18 +6455,15 @@ def build_functions_access_key_update_request( # pylint: disable=name-too-long return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_functions_access_key_delete_request( # pylint: disable=name-too-long - namespace_id: str, key_id: str, **kwargs: Any -) -> HttpRequest: +def build_firewalls_delete_request(firewall_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/functions/namespaces/{namespace_id}/keys/{key_id}" + _url = "/v2/firewalls/{firewall_id}" path_format_arguments = { - "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), - "key_id": _SERIALIZER.url("key_id", key_id, "str"), + "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6253,47 +6474,10 @@ def build_functions_access_key_delete_request( # pylint: disable=name-too-long return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_images_list_request( - *, - type: Optional[str] = None, - private: Optional[bool] = None, - tag_name: Optional[str] = None, - per_page: int = 20, - page: int = 1, - **kwargs: Any, +def build_firewalls_assign_droplets_request( + firewall_id: str, **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/images" - - # Construct parameters - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "str") - if private is not None: - _params["private"] = _SERIALIZER.query("private", private, "bool") - if tag_name is not None: - _params["tag_name"] = _SERIALIZER.query("tag_name", tag_name, "str") - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) - - -def build_images_create_custom_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) @@ -6301,7 +6485,12 @@ def build_images_create_custom_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/images" + _url = "/v2/firewalls/{firewall_id}/droplets" + path_format_arguments = { + "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -6313,26 +6502,35 @@ def build_images_create_custom_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_images_get_request(image_id: JSON, **kwargs: Any) -> HttpRequest: +def build_firewalls_delete_droplets_request( + firewall_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/images/{image_id}" + _url = "/v2/firewalls/{firewall_id}/droplets" path_format_arguments = { - "image_id": _SERIALIZER.url("image_id", image_id, "object"), + "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_images_update_request(image_id: int, **kwargs: Any) -> HttpRequest: +def build_firewalls_add_tags_request(firewall_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -6341,9 +6539,9 @@ def build_images_update_request(image_id: int, **kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/images/{image_id}" + _url = "/v2/firewalls/{firewall_id}/tags" path_format_arguments = { - "image_id": _SERIALIZER.url("image_id", image_id, "int"), + "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6355,31 +6553,36 @@ def build_images_update_request(image_id: int, **kwargs: Any) -> HttpRequest: ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_images_delete_request(image_id: int, **kwargs: Any) -> HttpRequest: +def build_firewalls_delete_tags_request(firewall_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/images/{image_id}" + _url = "/v2/firewalls/{firewall_id}/tags" path_format_arguments = { - "image_id": _SERIALIZER.url("image_id", image_id, "int"), + "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_images_post_account_transfer_create_request( # pylint: disable=name-too-long - image_id: int, **kwargs: Any -) -> HttpRequest: +def build_firewalls_add_rules_request(firewall_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -6388,9 +6591,9 @@ def build_images_post_account_transfer_create_request( # pylint: disable=name-t accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/images/{image_id}/account_transfer" + _url = "/v2/firewalls/{firewall_id}/rules" path_format_arguments = { - "image_id": _SERIALIZER.url("image_id", image_id, "int"), + "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6405,8 +6608,8 @@ def build_images_post_account_transfer_create_request( # pylint: disable=name-t return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_images_post_account_transfer_accept_request( # pylint: disable=name-too-long - image_id: int, **kwargs: Any +def build_firewalls_delete_rules_request( + firewall_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -6416,9 +6619,9 @@ def build_images_post_account_transfer_accept_request( # pylint: disable=name-t accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/images/{image_id}/account_transfer/accept" + _url = "/v2/firewalls/{firewall_id}/rules" path_format_arguments = { - "image_id": _SERIALIZER.url("image_id", image_id, "int"), + "firewall_id": _SERIALIZER.url("firewall_id", firewall_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6430,40 +6633,24 @@ def build_images_post_account_transfer_accept_request( # pylint: disable=name-t ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_images_post_account_transfer_cancel_request( # pylint: disable=name-too-long - image_id: int, **kwargs: Any -) -> HttpRequest: +def build_functions_list_namespaces_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 = "/v2/images/{image_id}/account_transfer/cancel" - path_format_arguments = { - "image_id": _SERIALIZER.url("image_id", image_id, "int"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/functions/namespaces" # 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) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_images_post_account_transfer_decline_request( # pylint: disable=name-too-long - image_id: int, **kwargs: Any -) -> HttpRequest: +def build_functions_create_namespace_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -6472,12 +6659,7 @@ def build_images_post_account_transfer_decline_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/images/{image_id}/account_transfer/decline" - path_format_arguments = { - "image_id": _SERIALIZER.url("image_id", image_id, "int"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/functions/namespaces" # Construct headers if content_type is not None: @@ -6489,15 +6671,17 @@ def build_images_post_account_transfer_decline_request( # pylint: disable=name- return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_image_actions_list_request(image_id: int, **kwargs: Any) -> HttpRequest: +def build_functions_get_namespace_request( + namespace_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/images/{image_id}/actions" + _url = "/v2/functions/namespaces/{namespace_id}" path_format_arguments = { - "image_id": _SERIALIZER.url("image_id", image_id, "int"), + "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6508,44 +6692,38 @@ def build_image_actions_list_request(image_id: int, **kwargs: Any) -> HttpReques return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_image_actions_post_request(image_id: int, **kwargs: Any) -> HttpRequest: +def build_functions_delete_namespace_request( + namespace_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/images/{image_id}/actions" + _url = "/v2/functions/namespaces/{namespace_id}" path_format_arguments = { - "image_id": _SERIALIZER.url("image_id", image_id, "int"), + "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_image_actions_get_request( - image_id: int, action_id: int, **kwargs: Any +def build_functions_list_triggers_request( + namespace_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/images/{image_id}/actions/{action_id}" + _url = "/v2/functions/namespaces/{namespace_id}/triggers" path_format_arguments = { - "image_id": _SERIALIZER.url("image_id", image_id, "int"), - "action_id": _SERIALIZER.url("action_id", action_id, "int", minimum=1), + "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6556,35 +6734,10 @@ def build_image_actions_get_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_kubernetes_list_clusters_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_functions_create_trigger_request( + namespace_id: str, **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/kubernetes/clusters" - - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) - - -def build_kubernetes_create_cluster_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) @@ -6592,7 +6745,12 @@ def build_kubernetes_create_cluster_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters" + _url = "/v2/functions/namespaces/{namespace_id}/triggers" + path_format_arguments = { + "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -6604,15 +6762,18 @@ def build_kubernetes_create_cluster_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_kubernetes_get_cluster_request(cluster_id: str, **kwargs: Any) -> HttpRequest: +def build_functions_get_trigger_request( + namespace_id: str, trigger_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}" + _url = "/v2/functions/namespaces/{namespace_id}/triggers/{trigger_name}" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), + "trigger_name": _SERIALIZER.url("trigger_name", trigger_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6623,8 +6784,8 @@ def build_kubernetes_get_cluster_request(cluster_id: str, **kwargs: Any) -> Http return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_kubernetes_update_cluster_request( - cluster_id: str, **kwargs: Any +def build_functions_update_trigger_request( + namespace_id: str, trigger_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -6634,9 +6795,10 @@ def build_kubernetes_update_cluster_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}" + _url = "/v2/functions/namespaces/{namespace_id}/triggers/{trigger_name}" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), + "trigger_name": _SERIALIZER.url("trigger_name", trigger_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6651,17 +6813,18 @@ def build_kubernetes_update_cluster_request( return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_kubernetes_delete_cluster_request( - cluster_id: str, **kwargs: Any +def build_functions_delete_trigger_request( + namespace_id: str, trigger_name: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}" + _url = "/v2/functions/namespaces/{namespace_id}/triggers/{trigger_name}" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), + "trigger_name": _SERIALIZER.url("trigger_name", trigger_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6672,17 +6835,17 @@ def build_kubernetes_delete_cluster_request( return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_kubernetes_list_associated_resources_request( # pylint: disable=name-too-long - cluster_id: str, **kwargs: Any +def build_functions_access_key_list_request( + namespace_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}/destroy_with_associated_resources" + _url = "/v2/functions/namespaces/{namespace_id}/keys" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6693,8 +6856,8 @@ def build_kubernetes_list_associated_resources_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_kubernetes_destroy_associated_resources_selective_request( # pylint: disable=name-too-long - cluster_id: str, **kwargs: Any +def build_functions_access_key_create_request( # pylint: disable=name-too-long + namespace_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -6704,9 +6867,9 @@ def build_kubernetes_destroy_associated_resources_selective_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}/destroy_with_associated_resources/selective" + _url = "/v2/functions/namespaces/{namespace_id}/keys" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6718,68 +6881,68 @@ def build_kubernetes_destroy_associated_resources_selective_request( # pylint: ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_kubernetes_destroy_associated_resources_dangerous_request( # pylint: disable=name-too-long - cluster_id: str, **kwargs: Any +def build_functions_access_key_update_request( # pylint: disable=name-too-long + namespace_id: str, key_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}/destroy_with_associated_resources/dangerous" + _url = "/v2/functions/namespaces/{namespace_id}/keys/{key_id}" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), + "key_id": _SERIALIZER.url("key_id", key_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_kubernetes_get_kubeconfig_request( - cluster_id: str, - *, - expiry_seconds: int = 0, - type: Optional[str] = None, - **kwargs: Any, +def build_functions_access_key_delete_request( # pylint: disable=name-too-long + namespace_id: str, key_id: str, **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/kubernetes/clusters/{cluster_id}/kubeconfig" + _url = "/v2/functions/namespaces/{namespace_id}/keys/{key_id}" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "namespace_id": _SERIALIZER.url("namespace_id", namespace_id, "str"), + "key_id": _SERIALIZER.url("key_id", key_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if expiry_seconds is not None: - _params["expiry_seconds"] = _SERIALIZER.query( - "expiry_seconds", expiry_seconds, "int", minimum=0 - ) - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "str") - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_kubernetes_get_credentials_request( - cluster_id: str, *, expiry_seconds: int = 0, **kwargs: Any +def build_images_list_request( + *, + type: Optional[str] = None, + private: Optional[bool] = None, + tag_name: Optional[str] = None, + per_page: int = 20, + page: int = 1, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -6787,18 +6950,21 @@ def build_kubernetes_get_credentials_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}/credentials" - path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/images" # Construct parameters - if expiry_seconds is not None: - _params["expiry_seconds"] = _SERIALIZER.query( - "expiry_seconds", expiry_seconds, "int", minimum=0 + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + if private is not None: + _params["private"] = _SERIALIZER.query("private", private, "bool") + if tag_name is not None: + _params["tag_name"] = _SERIALIZER.query("tag_name", tag_name, "str") + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -6808,17 +6974,36 @@ def build_kubernetes_get_credentials_request( ) -def build_kubernetes_get_available_upgrades_request( # pylint: disable=name-too-long - cluster_id: str, **kwargs: Any -) -> HttpRequest: +def build_images_create_custom_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 = "/v2/kubernetes/clusters/{cluster_id}/upgrades" + _url = "/v2/images" + + # 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_images_get_request(image_id: JSON, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/images/{image_id}" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "image_id": _SERIALIZER.url("image_id", image_id, "object"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6829,9 +7014,7 @@ def build_kubernetes_get_available_upgrades_request( # pylint: disable=name-too return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_kubernetes_upgrade_cluster_request( - cluster_id: str, **kwargs: Any -) -> HttpRequest: +def build_images_update_request(image_id: int, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -6840,9 +7023,9 @@ def build_kubernetes_upgrade_cluster_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}/upgrade" + _url = "/v2/images/{image_id}" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "image_id": _SERIALIZER.url("image_id", image_id, "int"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6854,20 +7037,18 @@ def build_kubernetes_upgrade_cluster_request( ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_kubernetes_list_node_pools_request( - cluster_id: str, **kwargs: Any -) -> HttpRequest: +def build_images_delete_request(image_id: int, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}/node_pools" + _url = "/v2/images/{image_id}" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "image_id": _SERIALIZER.url("image_id", image_id, "int"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6875,11 +7056,11 @@ def build_kubernetes_list_node_pools_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_kubernetes_add_node_pool_request( - cluster_id: str, **kwargs: Any +def build_images_post_account_transfer_create_request( # pylint: disable=name-too-long + image_id: int, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -6889,9 +7070,9 @@ def build_kubernetes_add_node_pool_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}/node_pools" + _url = "/v2/images/{image_id}/account_transfer" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "image_id": _SERIALIZER.url("image_id", image_id, "int"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6906,30 +7087,36 @@ def build_kubernetes_add_node_pool_request( return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_kubernetes_get_node_pool_request( - cluster_id: str, node_pool_id: str, **kwargs: Any +def build_images_post_account_transfer_accept_request( # pylint: disable=name-too-long + image_id: int, **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/kubernetes/clusters/{cluster_id}/node_pools/{node_pool_id}" + _url = "/v2/images/{image_id}/account_transfer/accept" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), - "node_pool_id": _SERIALIZER.url("node_pool_id", node_pool_id, "str"), + "image_id": _SERIALIZER.url("image_id", image_id, "int"), } _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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_kubernetes_update_node_pool_request( # pylint: disable=name-too-long - cluster_id: str, node_pool_id: str, **kwargs: Any +def build_images_post_account_transfer_cancel_request( # pylint: disable=name-too-long + image_id: int, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -6939,10 +7126,9 @@ def build_kubernetes_update_node_pool_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}/node_pools/{node_pool_id}" + _url = "/v2/images/{image_id}/account_transfer/cancel" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), - "node_pool_id": _SERIALIZER.url("node_pool_id", node_pool_id, "str"), + "image_id": _SERIALIZER.url("image_id", image_id, "int"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6954,78 +7140,57 @@ def build_kubernetes_update_node_pool_request( # pylint: disable=name-too-long ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_kubernetes_delete_node_pool_request( # pylint: disable=name-too-long - cluster_id: str, node_pool_id: str, **kwargs: Any +def build_images_post_account_transfer_decline_request( # pylint: disable=name-too-long + image_id: int, **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/kubernetes/clusters/{cluster_id}/node_pools/{node_pool_id}" + _url = "/v2/images/{image_id}/account_transfer/decline" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), - "node_pool_id": _SERIALIZER.url("node_pool_id", node_pool_id, "str"), + "image_id": _SERIALIZER.url("image_id", image_id, "int"), } _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="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_kubernetes_delete_node_request( - cluster_id: str, - node_pool_id: str, - node_id: str, - *, - skip_drain: int = 0, - replace: int = 0, - **kwargs: Any, -) -> HttpRequest: +def build_image_actions_list_request(image_id: int, **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/kubernetes/clusters/{cluster_id}/node_pools/{node_pool_id}/nodes/{node_id}" - ) + _url = "/v2/images/{image_id}/actions" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), - "node_pool_id": _SERIALIZER.url("node_pool_id", node_pool_id, "str"), - "node_id": _SERIALIZER.url("node_id", node_id, "str"), + "image_id": _SERIALIZER.url("image_id", image_id, "int"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if skip_drain is not None: - _params["skip_drain"] = _SERIALIZER.query( - "skip_drain", skip_drain, "int", maximum=1, minimum=0 - ) - if replace is not None: - _params["replace"] = _SERIALIZER.query( - "replace", replace, "int", maximum=1, minimum=0 - ) - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_kubernetes_recycle_node_pool_request( # pylint: disable=name-too-long - cluster_id: str, node_pool_id: str, **kwargs: Any -) -> HttpRequest: +def build_image_actions_post_request(image_id: int, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -7034,10 +7199,9 @@ def build_kubernetes_recycle_node_pool_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}/node_pools/{node_pool_id}/recycle" + _url = "/v2/images/{image_id}/actions" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), - "node_pool_id": _SERIALIZER.url("node_pool_id", node_pool_id, "str"), + "image_id": _SERIALIZER.url("image_id", image_id, "int"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7052,17 +7216,18 @@ def build_kubernetes_recycle_node_pool_request( # pylint: disable=name-too-long return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_kubernetes_get_cluster_user_request( # pylint: disable=name-too-long - cluster_id: str, **kwargs: Any +def build_image_actions_get_request( + image_id: int, action_id: int, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}/user" + _url = "/v2/images/{image_id}/actions/{action_id}" path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "image_id": _SERIALIZER.url("image_id", image_id, "int"), + "action_id": _SERIALIZER.url("action_id", action_id, "int", minimum=1), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7073,23 +7238,34 @@ def build_kubernetes_get_cluster_user_request( # pylint: disable=name-too-long return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_kubernetes_list_options_request(**kwargs: Any) -> HttpRequest: +def build_kubernetes_list_clusters_request( + *, per_page: int = 20, page: int = 1, **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/kubernetes/options" + _url = "/v2/kubernetes/clusters" + + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_kubernetes_run_cluster_lint_request( # pylint: disable=name-too-long - cluster_id: str, **kwargs: Any -) -> HttpRequest: +def build_kubernetes_create_cluster_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -7098,12 +7274,7 @@ def build_kubernetes_run_cluster_lint_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/clusters/{cluster_id}/clusterlint" - path_format_arguments = { - "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/kubernetes/clusters" # Construct headers if content_type is not None: @@ -7115,35 +7286,28 @@ def build_kubernetes_run_cluster_lint_request( # pylint: disable=name-too-long return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_kubernetes_get_cluster_lint_results_request( # pylint: disable=name-too-long - cluster_id: str, *, run_id: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_kubernetes_get_cluster_request(cluster_id: str, **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/kubernetes/clusters/{cluster_id}/clusterlint" + _url = "/v2/kubernetes/clusters/{cluster_id}" path_format_arguments = { "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if run_id is not None: - _params["run_id"] = _SERIALIZER.query("run_id", run_id, "str") - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_kubernetes_add_registry_request(**kwargs: Any) -> HttpRequest: +def build_kubernetes_update_cluster_request( + cluster_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -7152,7 +7316,12 @@ def build_kubernetes_add_registry_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/registry" + _url = "/v2/kubernetes/clusters/{cluster_id}" + path_format_arguments = { + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -7161,54 +7330,54 @@ def build_kubernetes_add_registry_request(**kwargs: Any) -> HttpRequest: ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_kubernetes_remove_registry_request(**kwargs: Any) -> HttpRequest: +def build_kubernetes_delete_cluster_request( + cluster_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/registry" + _url = "/v2/kubernetes/clusters/{cluster_id}" + path_format_arguments = { + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_kubernetes_add_registries_request(**kwargs: Any) -> HttpRequest: +def build_kubernetes_list_associated_resources_request( # pylint: disable=name-too-long + cluster_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/registries" + _url = "/v2/kubernetes/clusters/{cluster_id}/destroy_with_associated_resources" + path_format_arguments = { + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_kubernetes_remove_registries_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_kubernetes_destroy_associated_resources_selective_request( # pylint: disable=name-too-long + cluster_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -7217,7 +7386,12 @@ def build_kubernetes_remove_registries_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/kubernetes/registries" + _url = "/v2/kubernetes/clusters/{cluster_id}/destroy_with_associated_resources/selective" + path_format_arguments = { + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -7229,57 +7403,65 @@ def build_kubernetes_remove_registries_request( return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_kubernetes_get_status_messages_request( # pylint: disable=name-too-long - cluster_id: str, *, since: Optional[datetime.datetime] = None, **kwargs: Any +def build_kubernetes_destroy_associated_resources_dangerous_request( # pylint: disable=name-too-long + cluster_id: str, **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/kubernetes/clusters/{cluster_id}/status_messages" + _url = "/v2/kubernetes/clusters/{cluster_id}/destroy_with_associated_resources/dangerous" path_format_arguments = { "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if since is not None: - _params["since"] = _SERIALIZER.query("since", since, "iso-8601") - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_load_balancers_create_request(**kwargs: Any) -> HttpRequest: +def build_kubernetes_get_kubeconfig_request( + cluster_id: str, + *, + expiry_seconds: int = 0, + type: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/load_balancers" + _url = "/v2/kubernetes/clusters/{cluster_id}/kubeconfig" + path_format_arguments = { + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + } - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if expiry_seconds is not None: + _params["expiry_seconds"] = _SERIALIZER.query( + "expiry_seconds", expiry_seconds, "int", minimum=0 ) + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_load_balancers_list_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_kubernetes_get_credentials_request( + cluster_id: str, *, expiry_seconds: int = 0, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7287,15 +7469,18 @@ def build_load_balancers_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/load_balancers" + _url = "/v2/kubernetes/clusters/{cluster_id}/credentials" + path_format_arguments = { + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 + if expiry_seconds is not None: + _params["expiry_seconds"] = _SERIALIZER.query( + "expiry_seconds", expiry_seconds, "int", minimum=0 ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -7305,15 +7490,17 @@ def build_load_balancers_list_request( ) -def build_load_balancers_get_request(lb_id: str, **kwargs: Any) -> HttpRequest: +def build_kubernetes_get_available_upgrades_request( # pylint: disable=name-too-long + cluster_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/load_balancers/{lb_id}" + _url = "/v2/kubernetes/clusters/{cluster_id}/upgrades" path_format_arguments = { - "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7324,7 +7511,9 @@ def build_load_balancers_get_request(lb_id: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_load_balancers_update_request(lb_id: str, **kwargs: Any) -> HttpRequest: +def build_kubernetes_upgrade_cluster_request( + cluster_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -7333,9 +7522,9 @@ def build_load_balancers_update_request(lb_id: str, **kwargs: Any) -> HttpReques accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/load_balancers/{lb_id}" + _url = "/v2/kubernetes/clusters/{cluster_id}/upgrade" path_format_arguments = { - "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7347,39 +7536,20 @@ def build_load_balancers_update_request(lb_id: str, **kwargs: Any) -> HttpReques ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_load_balancers_delete_request(lb_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/v2/load_balancers/{lb_id}" - path_format_arguments = { - "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_load_balancers_delete_cache_request( # pylint: disable=name-too-long - lb_id: str, **kwargs: Any +def build_kubernetes_list_node_pools_request( + cluster_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/load_balancers/{lb_id}/cache" + _url = "/v2/kubernetes/clusters/{cluster_id}/node_pools" path_format_arguments = { - "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7387,11 +7557,11 @@ def build_load_balancers_delete_cache_request( # pylint: disable=name-too-long # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_load_balancers_add_droplets_request( # pylint: disable=name-too-long - lb_id: str, **kwargs: Any +def build_kubernetes_add_node_pool_request( + cluster_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -7401,9 +7571,9 @@ def build_load_balancers_add_droplets_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/load_balancers/{lb_id}/droplets" + _url = "/v2/kubernetes/clusters/{cluster_id}/node_pools" path_format_arguments = { - "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7418,36 +7588,30 @@ def build_load_balancers_add_droplets_request( # pylint: disable=name-too-long return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_load_balancers_remove_droplets_request( # pylint: disable=name-too-long - lb_id: str, **kwargs: Any +def build_kubernetes_get_node_pool_request( + cluster_id: str, node_pool_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/load_balancers/{lb_id}/droplets" + _url = "/v2/kubernetes/clusters/{cluster_id}/node_pools/{node_pool_id}" path_format_arguments = { - "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "node_pool_id": _SERIALIZER.url("node_pool_id", node_pool_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_load_balancers_add_forwarding_rules_request( # pylint: disable=name-too-long - lb_id: str, **kwargs: Any +def build_kubernetes_update_node_pool_request( # pylint: disable=name-too-long + cluster_id: str, node_pool_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -7457,9 +7621,10 @@ def build_load_balancers_add_forwarding_rules_request( # pylint: disable=name-t accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/load_balancers/{lb_id}/forwarding_rules" + _url = "/v2/kubernetes/clusters/{cluster_id}/node_pools/{node_pool_id}" path_format_arguments = { - "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "node_pool_id": _SERIALIZER.url("node_pool_id", node_pool_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7471,39 +7636,39 @@ def build_load_balancers_add_forwarding_rules_request( # pylint: disable=name-t ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_load_balancers_remove_forwarding_rules_request( # pylint: disable=name-too-long - lb_id: str, **kwargs: Any +def build_kubernetes_delete_node_pool_request( # pylint: disable=name-too-long + cluster_id: str, node_pool_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/load_balancers/{lb_id}/forwarding_rules" + _url = "/v2/kubernetes/clusters/{cluster_id}/node_pools/{node_pool_id}" path_format_arguments = { - "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "node_pool_id": _SERIALIZER.url("node_pool_id", node_pool_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_monitoring_list_alert_policy_request( # pylint: disable=name-too-long - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_kubernetes_delete_node_request( + cluster_id: str, + node_pool_id: str, + node_id: str, + *, + skip_drain: int = 0, + replace: int = 0, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7511,27 +7676,38 @@ def build_monitoring_list_alert_policy_request( # pylint: disable=name-too-long accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/alerts" - + _url = ( + "/v2/kubernetes/clusters/{cluster_id}/node_pools/{node_pool_id}/nodes/{node_id}" + ) + path_format_arguments = { + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "node_pool_id": _SERIALIZER.url("node_pool_id", node_pool_id, "str"), + "node_id": _SERIALIZER.url("node_id", node_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 + if skip_drain is not None: + _params["skip_drain"] = _SERIALIZER.query( + "skip_drain", skip_drain, "int", maximum=1, minimum=0 + ) + if replace is not None: + _params["replace"] = _SERIALIZER.query( + "replace", replace, "int", maximum=1, minimum=0 ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs + method="DELETE", url=_url, params=_params, headers=_headers, **kwargs ) -def build_monitoring_create_alert_policy_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_kubernetes_recycle_node_pool_request( # pylint: disable=name-too-long + cluster_id: str, node_pool_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -7540,7 +7716,13 @@ def build_monitoring_create_alert_policy_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/alerts" + _url = "/v2/kubernetes/clusters/{cluster_id}/node_pools/{node_pool_id}/recycle" + path_format_arguments = { + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + "node_pool_id": _SERIALIZER.url("node_pool_id", node_pool_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -7552,17 +7734,17 @@ def build_monitoring_create_alert_policy_request( return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_alert_policy_request( # pylint: disable=name-too-long - alert_uuid: str, **kwargs: Any +def build_kubernetes_get_cluster_user_request( # pylint: disable=name-too-long + cluster_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/alerts/{alert_uuid}" + _url = "/v2/kubernetes/clusters/{cluster_id}/user" path_format_arguments = { - "alert_uuid": _SERIALIZER.url("alert_uuid", alert_uuid, "str"), + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -7573,57 +7755,50 @@ def build_monitoring_get_alert_policy_request( # pylint: disable=name-too-long return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_monitoring_update_alert_policy_request( # pylint: disable=name-too-long - alert_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_kubernetes_list_options_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 = "/v2/monitoring/alerts/{alert_uuid}" - path_format_arguments = { - "alert_uuid": _SERIALIZER.url("alert_uuid", alert_uuid, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/kubernetes/options" # 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) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_monitoring_delete_alert_policy_request( # pylint: disable=name-too-long - alert_uuid: str, **kwargs: Any +def build_kubernetes_run_cluster_lint_request( # pylint: disable=name-too-long + cluster_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/alerts/{alert_uuid}" + _url = "/v2/kubernetes/clusters/{cluster_id}/clusterlint" path_format_arguments = { - "alert_uuid": _SERIALIZER.url("alert_uuid", alert_uuid, "str"), + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_droplet_bandwidth_metrics_request( # pylint: disable=name-too-long - *, host_id: str, interface: str, direction: str, start: str, end: str, **kwargs: Any +def build_kubernetes_get_cluster_lint_results_request( # pylint: disable=name-too-long + cluster_id: str, *, run_id: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7631,14 +7806,16 @@ def build_monitoring_get_droplet_bandwidth_metrics_request( # pylint: disable=n accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet/bandwidth" + _url = "/v2/kubernetes/clusters/{cluster_id}/clusterlint" + path_format_arguments = { + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") - _params["interface"] = _SERIALIZER.query("interface", interface, "str") - _params["direction"] = _SERIALIZER.query("direction", direction, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "str") + if run_id is not None: + _params["run_id"] = _SERIALIZER.query("run_id", run_id, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -7648,104 +7825,94 @@ def build_monitoring_get_droplet_bandwidth_metrics_request( # pylint: disable=n ) -def build_monitoring_get_droplet_cpu_metrics_request( # pylint: disable=name-too-long - *, host_id: str, start: str, end: str, **kwargs: Any -) -> HttpRequest: +def build_kubernetes_add_registry_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet/cpu" - - # Construct parameters - _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "str") + _url = "/v2/kubernetes/registry" # 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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_droplet_filesystem_free_metrics_request( # pylint: disable=name-too-long - *, host_id: str, start: str, end: str, **kwargs: Any -) -> HttpRequest: +def build_kubernetes_remove_registry_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet/filesystem_free" - - # Construct parameters - _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "str") + _url = "/v2/kubernetes/registry" # 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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_droplet_filesystem_size_metrics_request( # pylint: disable=name-too-long - *, host_id: str, start: str, end: str, **kwargs: Any -) -> HttpRequest: +def build_kubernetes_add_registries_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet/filesystem_size" - - # Construct parameters - _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "str") + _url = "/v2/kubernetes/registries" # 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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_droplet_load1_metrics_request( # pylint: disable=name-too-long - *, host_id: str, start: str, end: str, **kwargs: Any -) -> HttpRequest: +def build_kubernetes_remove_registries_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet/load_1" - - # Construct parameters - _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "str") + _url = "/v2/kubernetes/registries" # 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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_droplet_load5_metrics_request( # pylint: disable=name-too-long - *, host_id: str, start: str, end: str, **kwargs: Any +def build_kubernetes_get_status_messages_request( # pylint: disable=name-too-long + cluster_id: str, *, since: Optional[datetime.datetime] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7753,12 +7920,16 @@ def build_monitoring_get_droplet_load5_metrics_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet/load_5" + _url = "/v2/kubernetes/clusters/{cluster_id}/status_messages" + path_format_arguments = { + "cluster_id": _SERIALIZER.url("cluster_id", cluster_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "str") + if since is not None: + _params["since"] = _SERIALIZER.query("since", since, "iso-8601") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -7768,32 +7939,29 @@ def build_monitoring_get_droplet_load5_metrics_request( # pylint: disable=name- ) -def build_monitoring_get_droplet_load15_metrics_request( # pylint: disable=name-too-long - *, host_id: str, start: str, end: str, **kwargs: Any -) -> HttpRequest: +def build_load_balancers_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet/load_15" - - # Construct parameters - _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "str") + _url = "/v2/load_balancers" # 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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_droplet_memory_cached_metrics_request( # pylint: disable=name-too-long - *, host_id: str, start: str, end: str, **kwargs: Any +def build_load_balancers_list_request( + *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -7801,12 +7969,15 @@ def build_monitoring_get_droplet_memory_cached_metrics_request( # pylint: disab accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet/memory_cached" + _url = "/v2/load_balancers" # Construct parameters - _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "str") + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -7816,227 +7987,205 @@ def build_monitoring_get_droplet_memory_cached_metrics_request( # pylint: disab ) -def build_monitoring_get_droplet_memory_free_metrics_request( # pylint: disable=name-too-long - *, host_id: str, start: str, end: str, **kwargs: Any -) -> HttpRequest: +def build_load_balancers_get_request(lb_id: str, **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/monitoring/metrics/droplet/memory_free" + _url = "/v2/load_balancers/{lb_id}" + path_format_arguments = { + "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + } - # Construct parameters - _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "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, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_droplet_memory_total_metrics_request( # pylint: disable=name-too-long - *, host_id: str, start: str, end: str, **kwargs: Any -) -> HttpRequest: +def build_load_balancers_update_request(lb_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet/memory_total" + _url = "/v2/load_balancers/{lb_id}" + path_format_arguments = { + "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + } - # Construct parameters - _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_droplet_memory_available_metrics_request( # pylint: disable=name-too-long - *, host_id: str, start: str, end: str, **kwargs: Any -) -> HttpRequest: +def build_load_balancers_delete_request(lb_id: str, **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/monitoring/metrics/droplet/memory_available" + _url = "/v2/load_balancers/{lb_id}" + path_format_arguments = { + "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + } - # Construct parameters - _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "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, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_app_memory_percentage_metrics_request( # pylint: disable=name-too-long - *, - app_id: str, - start: str, - end: str, - app_component: Optional[str] = None, - **kwargs: Any, +def build_load_balancers_delete_cache_request( # pylint: disable=name-too-long + lb_id: str, **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/monitoring/metrics/apps/memory_percentage" + _url = "/v2/load_balancers/{lb_id}/cache" + path_format_arguments = { + "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + } - # Construct parameters - _params["app_id"] = _SERIALIZER.query("app_id", app_id, "str") - if app_component is not None: - _params["app_component"] = _SERIALIZER.query( - "app_component", app_component, "str" - ) - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "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, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_app_cpu_percentage_metrics_request( # pylint: disable=name-too-long - *, - app_id: str, - start: str, - end: str, - app_component: Optional[str] = None, - **kwargs: Any, +def build_load_balancers_add_droplets_request( # pylint: disable=name-too-long + lb_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/apps/cpu_percentage" + _url = "/v2/load_balancers/{lb_id}/droplets" + path_format_arguments = { + "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + } - # Construct parameters - _params["app_id"] = _SERIALIZER.query("app_id", app_id, "str") - if app_component is not None: - _params["app_component"] = _SERIALIZER.query( - "app_component", app_component, "str" - ) - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_app_restart_count_metrics_yml_request( # pylint: disable=name-too-long - *, - app_id: str, - start: str, - end: str, - app_component: Optional[str] = None, - **kwargs: Any, +def build_load_balancers_remove_droplets_request( # pylint: disable=name-too-long + lb_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/apps/restart_count" + _url = "/v2/load_balancers/{lb_id}/droplets" + path_format_arguments = { + "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + } - # Construct parameters - _params["app_id"] = _SERIALIZER.query("app_id", app_id, "str") - if app_component is not None: - _params["app_component"] = _SERIALIZER.query( - "app_component", app_component, "str" - ) - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_lb_frontend_connections_current_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_load_balancers_add_forwarding_rules_request( # pylint: disable=name-too-long + lb_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_connections_current" + _url = "/v2/load_balancers/{lb_id}/forwarding_rules" + path_format_arguments = { + "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + } - # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_lb_frontend_connections_limit_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_load_balancers_remove_forwarding_rules_request( # pylint: disable=name-too-long + lb_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_connections_limit" + _url = "/v2/load_balancers/{lb_id}/forwarding_rules" + path_format_arguments = { + "lb_id": _SERIALIZER.url("lb_id", lb_id, "str"), + } - # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_lb_frontend_cpu_utilization_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_list_alert_policy_request( # pylint: disable=name-too-long + *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8044,12 +8193,15 @@ def build_monitoring_get_lb_frontend_cpu_utilization_request( # pylint: disable accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_cpu_utilization" + _url = "/v2/monitoring/alerts" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "str") + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -8059,104 +8211,101 @@ def build_monitoring_get_lb_frontend_cpu_utilization_request( # pylint: disable ) -def build_monitoring_get_lb_frontend_firewall_dropped_bytes_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any -) -> HttpRequest: +def build_monitoring_create_alert_policy_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_firewall_dropped_bytes" - - # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "str") + _url = "/v2/monitoring/alerts" # 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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_lb_frontend_firewall_dropped_packets_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_alert_policy_request( # pylint: disable=name-too-long + alert_uuid: str, **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/monitoring/metrics/load_balancer/frontend_firewall_dropped_packets" - - # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "str") + _url = "/v2/monitoring/alerts/{alert_uuid}" + path_format_arguments = { + "alert_uuid": _SERIALIZER.url("alert_uuid", alert_uuid, "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, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_lb_frontend_http_responses_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_update_alert_policy_request( # pylint: disable=name-too-long + alert_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_http_responses" + _url = "/v2/monitoring/alerts/{alert_uuid}" + path_format_arguments = { + "alert_uuid": _SERIALIZER.url("alert_uuid", alert_uuid, "str"), + } - # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_lb_frontend_http_requests_per_second_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_delete_alert_policy_request( # pylint: disable=name-too-long + alert_uuid: str, **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/monitoring/metrics/load_balancer/frontend_http_requests_per_second" + _url = "/v2/monitoring/alerts/{alert_uuid}" + path_format_arguments = { + "alert_uuid": _SERIALIZER.url("alert_uuid", alert_uuid, "str"), + } - # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "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, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_monitoring_get_lb_frontend_network_throughput_http_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_droplet_bandwidth_metrics_request( # pylint: disable=name-too-long + *, host_id: str, interface: str, direction: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8164,10 +8313,12 @@ def build_monitoring_get_lb_frontend_network_throughput_http_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_network_throughput_http" + _url = "/v2/monitoring/metrics/droplet/bandwidth" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") + _params["interface"] = _SERIALIZER.query("interface", interface, "str") + _params["direction"] = _SERIALIZER.query("direction", direction, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8179,8 +8330,8 @@ def build_monitoring_get_lb_frontend_network_throughput_http_request( # pylint: ) -def build_monitoring_get_lb_frontend_network_throughput_udp_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_droplet_cpu_metrics_request( # pylint: disable=name-too-long + *, host_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8188,10 +8339,10 @@ def build_monitoring_get_lb_frontend_network_throughput_udp_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_network_throughput_udp" + _url = "/v2/monitoring/metrics/droplet/cpu" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8203,8 +8354,8 @@ def build_monitoring_get_lb_frontend_network_throughput_udp_request( # pylint: ) -def build_monitoring_get_lb_frontend_network_throughput_tcp_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_droplet_filesystem_free_metrics_request( # pylint: disable=name-too-long + *, host_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8212,10 +8363,10 @@ def build_monitoring_get_lb_frontend_network_throughput_tcp_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_network_throughput_tcp" + _url = "/v2/monitoring/metrics/droplet/filesystem_free" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8227,8 +8378,8 @@ def build_monitoring_get_lb_frontend_network_throughput_tcp_request( # pylint: ) -def build_monitoring_get_lb_frontend_nlb_tcp_network_throughput_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_droplet_filesystem_size_metrics_request( # pylint: disable=name-too-long + *, host_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8236,10 +8387,10 @@ def build_monitoring_get_lb_frontend_nlb_tcp_network_throughput_request( # pyli accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_nlb_tcp_network_throughput" + _url = "/v2/monitoring/metrics/droplet/filesystem_size" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8251,8 +8402,8 @@ def build_monitoring_get_lb_frontend_nlb_tcp_network_throughput_request( # pyli ) -def build_monitoring_get_lb_frontend_nlb_udp_network_throughput_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_droplet_load1_metrics_request( # pylint: disable=name-too-long + *, host_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8260,10 +8411,10 @@ def build_monitoring_get_lb_frontend_nlb_udp_network_throughput_request( # pyli accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_nlb_udp_network_throughput" + _url = "/v2/monitoring/metrics/droplet/load_1" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8275,8 +8426,8 @@ def build_monitoring_get_lb_frontend_nlb_udp_network_throughput_request( # pyli ) -def build_monitoring_get_lb_frontend_tls_connections_current_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_droplet_load5_metrics_request( # pylint: disable=name-too-long + *, host_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8284,10 +8435,10 @@ def build_monitoring_get_lb_frontend_tls_connections_current_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_tls_connections_current" + _url = "/v2/monitoring/metrics/droplet/load_5" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8299,8 +8450,8 @@ def build_monitoring_get_lb_frontend_tls_connections_current_request( # pylint: ) -def build_monitoring_get_lb_frontend_tls_connections_limit_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_droplet_load15_metrics_request( # pylint: disable=name-too-long + *, host_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8308,10 +8459,10 @@ def build_monitoring_get_lb_frontend_tls_connections_limit_request( # pylint: d accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_tls_connections_limit" + _url = "/v2/monitoring/metrics/droplet/load_15" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8323,8 +8474,8 @@ def build_monitoring_get_lb_frontend_tls_connections_limit_request( # pylint: d ) -def build_monitoring_get_lb_frontend_tls_connections_exceeding_rate_limit_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_droplet_memory_cached_metrics_request( # pylint: disable=name-too-long + *, host_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8332,10 +8483,10 @@ def build_monitoring_get_lb_frontend_tls_connections_exceeding_rate_limit_reques accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/frontend_tls_connections_exceeding_rate_limit" + _url = "/v2/monitoring/metrics/droplet/memory_cached" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8347,8 +8498,8 @@ def build_monitoring_get_lb_frontend_tls_connections_exceeding_rate_limit_reques ) -def build_monitoring_get_lb_droplets_http_session_duration_avg_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_droplet_memory_free_metrics_request( # pylint: disable=name-too-long + *, host_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8356,10 +8507,10 @@ def build_monitoring_get_lb_droplets_http_session_duration_avg_request( # pylin accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/droplets_http_session_duration_avg" + _url = "/v2/monitoring/metrics/droplet/memory_free" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8371,8 +8522,8 @@ def build_monitoring_get_lb_droplets_http_session_duration_avg_request( # pylin ) -def build_monitoring_get_lb_droplets_http_session_duration50_p_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_droplet_memory_total_metrics_request( # pylint: disable=name-too-long + *, host_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8380,10 +8531,10 @@ def build_monitoring_get_lb_droplets_http_session_duration50_p_request( # pylin accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/droplets_http_session_duration_50p" + _url = "/v2/monitoring/metrics/droplet/memory_total" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8395,8 +8546,8 @@ def build_monitoring_get_lb_droplets_http_session_duration50_p_request( # pylin ) -def build_monitoring_get_lb_droplets_http_session_duration95_p_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_droplet_memory_available_metrics_request( # pylint: disable=name-too-long + *, host_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8404,10 +8555,10 @@ def build_monitoring_get_lb_droplets_http_session_duration95_p_request( # pylin accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/droplets_http_session_duration_95p" + _url = "/v2/monitoring/metrics/droplet/memory_available" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["host_id"] = _SERIALIZER.query("host_id", host_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8419,8 +8570,13 @@ def build_monitoring_get_lb_droplets_http_session_duration95_p_request( # pylin ) -def build_monitoring_get_lb_droplets_http_response_time_avg_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_app_memory_percentage_metrics_request( # pylint: disable=name-too-long + *, + app_id: str, + start: str, + end: str, + app_component: Optional[str] = None, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8428,10 +8584,14 @@ def build_monitoring_get_lb_droplets_http_response_time_avg_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/droplets_http_response_time_avg" + _url = "/v2/monitoring/metrics/apps/memory_percentage" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["app_id"] = _SERIALIZER.query("app_id", app_id, "str") + if app_component is not None: + _params["app_component"] = _SERIALIZER.query( + "app_component", app_component, "str" + ) _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8443,8 +8603,13 @@ def build_monitoring_get_lb_droplets_http_response_time_avg_request( # pylint: ) -def build_monitoring_get_lb_droplets_http_response_time50_p_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_app_cpu_percentage_metrics_request( # pylint: disable=name-too-long + *, + app_id: str, + start: str, + end: str, + app_component: Optional[str] = None, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8452,10 +8617,14 @@ def build_monitoring_get_lb_droplets_http_response_time50_p_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/droplets_http_response_time_50p" + _url = "/v2/monitoring/metrics/apps/cpu_percentage" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["app_id"] = _SERIALIZER.query("app_id", app_id, "str") + if app_component is not None: + _params["app_component"] = _SERIALIZER.query( + "app_component", app_component, "str" + ) _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8467,8 +8636,13 @@ def build_monitoring_get_lb_droplets_http_response_time50_p_request( # pylint: ) -def build_monitoring_get_lb_droplets_http_response_time95_p_request( # pylint: disable=name-too-long - *, lb_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_app_restart_count_metrics_yml_request( # pylint: disable=name-too-long + *, + app_id: str, + start: str, + end: str, + app_component: Optional[str] = None, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8476,10 +8650,14 @@ def build_monitoring_get_lb_droplets_http_response_time95_p_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/droplets_http_response_time_95p" + _url = "/v2/monitoring/metrics/apps/restart_count" # Construct parameters - _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["app_id"] = _SERIALIZER.query("app_id", app_id, "str") + if app_component is not None: + _params["app_component"] = _SERIALIZER.query( + "app_component", app_component, "str" + ) _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8491,7 +8669,7 @@ def build_monitoring_get_lb_droplets_http_response_time95_p_request( # pylint: ) -def build_monitoring_get_lb_droplets_http_response_time99_p_request( # pylint: disable=name-too-long +def build_monitoring_get_lb_frontend_connections_current_request( # pylint: disable=name-too-long *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -8500,7 +8678,7 @@ def build_monitoring_get_lb_droplets_http_response_time99_p_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/droplets_http_response_time_99p" + _url = "/v2/monitoring/metrics/load_balancer/frontend_connections_current" # Construct parameters _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") @@ -8515,7 +8693,7 @@ def build_monitoring_get_lb_droplets_http_response_time99_p_request( # pylint: ) -def build_monitoring_get_lb_droplets_queue_size_request( # pylint: disable=name-too-long +def build_monitoring_get_lb_frontend_connections_limit_request( # pylint: disable=name-too-long *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -8524,7 +8702,7 @@ def build_monitoring_get_lb_droplets_queue_size_request( # pylint: disable=name accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/droplets_queue_size" + _url = "/v2/monitoring/metrics/load_balancer/frontend_connections_limit" # Construct parameters _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") @@ -8539,7 +8717,7 @@ def build_monitoring_get_lb_droplets_queue_size_request( # pylint: disable=name ) -def build_monitoring_get_lb_droplets_http_responses_request( # pylint: disable=name-too-long +def build_monitoring_get_lb_frontend_cpu_utilization_request( # pylint: disable=name-too-long *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -8548,7 +8726,7 @@ def build_monitoring_get_lb_droplets_http_responses_request( # pylint: disable= accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/droplets_http_responses" + _url = "/v2/monitoring/metrics/load_balancer/frontend_cpu_utilization" # Construct parameters _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") @@ -8563,7 +8741,7 @@ def build_monitoring_get_lb_droplets_http_responses_request( # pylint: disable= ) -def build_monitoring_get_lb_droplets_connections_request( # pylint: disable=name-too-long +def build_monitoring_get_lb_frontend_firewall_dropped_bytes_request( # pylint: disable=name-too-long *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -8572,7 +8750,7 @@ def build_monitoring_get_lb_droplets_connections_request( # pylint: disable=nam accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/droplets_connections" + _url = "/v2/monitoring/metrics/load_balancer/frontend_firewall_dropped_bytes" # Construct parameters _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") @@ -8587,7 +8765,7 @@ def build_monitoring_get_lb_droplets_connections_request( # pylint: disable=nam ) -def build_monitoring_get_lb_droplets_health_checks_request( # pylint: disable=name-too-long +def build_monitoring_get_lb_frontend_firewall_dropped_packets_request( # pylint: disable=name-too-long *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -8596,7 +8774,7 @@ def build_monitoring_get_lb_droplets_health_checks_request( # pylint: disable=n accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/droplets_health_checks" + _url = "/v2/monitoring/metrics/load_balancer/frontend_firewall_dropped_packets" # Construct parameters _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") @@ -8611,7 +8789,7 @@ def build_monitoring_get_lb_droplets_health_checks_request( # pylint: disable=n ) -def build_monitoring_get_lb_droplets_downtime_request( # pylint: disable=name-too-long +def build_monitoring_get_lb_frontend_http_responses_request( # pylint: disable=name-too-long *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -8620,7 +8798,7 @@ def build_monitoring_get_lb_droplets_downtime_request( # pylint: disable=name-t accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/load_balancer/droplets_downtime" + _url = "/v2/monitoring/metrics/load_balancer/frontend_http_responses" # Construct parameters _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") @@ -8635,8 +8813,8 @@ def build_monitoring_get_lb_droplets_downtime_request( # pylint: disable=name-t ) -def build_monitoring_get_droplet_autoscale_current_instances_request( # pylint: disable=name-too-long - *, autoscale_pool_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_frontend_http_requests_per_second_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8644,12 +8822,10 @@ def build_monitoring_get_droplet_autoscale_current_instances_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet_autoscale/current_instances" + _url = "/v2/monitoring/metrics/load_balancer/frontend_http_requests_per_second" # Construct parameters - _params["autoscale_pool_id"] = _SERIALIZER.query( - "autoscale_pool_id", autoscale_pool_id, "str" - ) + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8661,8 +8837,8 @@ def build_monitoring_get_droplet_autoscale_current_instances_request( # pylint: ) -def build_monitoring_get_droplet_autoscale_target_instances_request( # pylint: disable=name-too-long - *, autoscale_pool_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_frontend_network_throughput_http_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8670,12 +8846,10 @@ def build_monitoring_get_droplet_autoscale_target_instances_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet_autoscale/target_instances" + _url = "/v2/monitoring/metrics/load_balancer/frontend_network_throughput_http" # Construct parameters - _params["autoscale_pool_id"] = _SERIALIZER.query( - "autoscale_pool_id", autoscale_pool_id, "str" - ) + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8687,8 +8861,8 @@ def build_monitoring_get_droplet_autoscale_target_instances_request( # pylint: ) -def build_monitoring_get_droplet_autoscale_current_cpu_utilization_yml_request( # pylint: disable=name-too-long - *, autoscale_pool_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_frontend_network_throughput_udp_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8696,12 +8870,10 @@ def build_monitoring_get_droplet_autoscale_current_cpu_utilization_yml_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet_autoscale/current_cpu_utilization" + _url = "/v2/monitoring/metrics/load_balancer/frontend_network_throughput_udp" # Construct parameters - _params["autoscale_pool_id"] = _SERIALIZER.query( - "autoscale_pool_id", autoscale_pool_id, "str" - ) + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8713,21 +8885,19 @@ def build_monitoring_get_droplet_autoscale_current_cpu_utilization_yml_request( ) -def build_monitoring_get_droplet_autoscale_target_cpu_utilization_request( # pylint: disable=name-too-long - *, autoscale_pool_id: str, start: str, end: str, **kwargs: Any -) -> HttpRequest: +def build_monitoring_get_lb_frontend_network_throughput_tcp_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **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/monitoring/metrics/droplet_autoscale/target_cpu_utilization" + _url = "/v2/monitoring/metrics/load_balancer/frontend_network_throughput_tcp" # Construct parameters - _params["autoscale_pool_id"] = _SERIALIZER.query( - "autoscale_pool_id", autoscale_pool_id, "str" - ) + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8739,8 +8909,8 @@ def build_monitoring_get_droplet_autoscale_target_cpu_utilization_request( # py ) -def build_monitoring_get_droplet_autoscale_current_memory_utilization_request( # pylint: disable=name-too-long - *, autoscale_pool_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_frontend_nlb_tcp_network_throughput_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8748,12 +8918,10 @@ def build_monitoring_get_droplet_autoscale_current_memory_utilization_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet_autoscale/current_memory_utilization" + _url = "/v2/monitoring/metrics/load_balancer/frontend_nlb_tcp_network_throughput" # Construct parameters - _params["autoscale_pool_id"] = _SERIALIZER.query( - "autoscale_pool_id", autoscale_pool_id, "str" - ) + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8765,8 +8933,8 @@ def build_monitoring_get_droplet_autoscale_current_memory_utilization_request( ) -def build_monitoring_get_droplet_autoscale_target_memory_utilization_request( # pylint: disable=name-too-long - *, autoscale_pool_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_frontend_nlb_udp_network_throughput_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8774,12 +8942,10 @@ def build_monitoring_get_droplet_autoscale_target_memory_utilization_request( # accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/droplet_autoscale/target_memory_utilization" + _url = "/v2/monitoring/metrics/load_balancer/frontend_nlb_udp_network_throughput" # Construct parameters - _params["autoscale_pool_id"] = _SERIALIZER.query( - "autoscale_pool_id", autoscale_pool_id, "str" - ) + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8791,8 +8957,8 @@ def build_monitoring_get_droplet_autoscale_target_memory_utilization_request( # ) -def build_monitoring_get_database_mysql_cpu_usage_request( # pylint: disable=name-too-long - *, db_id: str, aggregate: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_frontend_tls_connections_current_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8800,11 +8966,10 @@ def build_monitoring_get_database_mysql_cpu_usage_request( # pylint: disable=na accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/database/mysql/cpu_usage" + _url = "/v2/monitoring/metrics/load_balancer/frontend_tls_connections_current" # Construct parameters - _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") - _params["aggregate"] = _SERIALIZER.query("aggregate", aggregate, "str") + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8816,8 +8981,8 @@ def build_monitoring_get_database_mysql_cpu_usage_request( # pylint: disable=na ) -def build_monitoring_get_database_mysql_load_request( # pylint: disable=name-too-long - *, db_id: str, metric: str, aggregate: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_frontend_tls_connections_limit_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8825,12 +8990,10 @@ def build_monitoring_get_database_mysql_load_request( # pylint: disable=name-to accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/database/mysql/load" + _url = "/v2/monitoring/metrics/load_balancer/frontend_tls_connections_limit" # Construct parameters - _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") - _params["metric"] = _SERIALIZER.query("metric", metric, "str") - _params["aggregate"] = _SERIALIZER.query("aggregate", aggregate, "str") + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8842,8 +9005,8 @@ def build_monitoring_get_database_mysql_load_request( # pylint: disable=name-to ) -def build_monitoring_get_database_mysql_memory_usage_request( # pylint: disable=name-too-long - *, db_id: str, aggregate: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_frontend_tls_connections_exceeding_rate_limit_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8851,11 +9014,10 @@ def build_monitoring_get_database_mysql_memory_usage_request( # pylint: disable accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/database/mysql/memory_usage" + _url = "/v2/monitoring/metrics/load_balancer/frontend_tls_connections_exceeding_rate_limit" # Construct parameters - _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") - _params["aggregate"] = _SERIALIZER.query("aggregate", aggregate, "str") + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8867,8 +9029,8 @@ def build_monitoring_get_database_mysql_memory_usage_request( # pylint: disable ) -def build_monitoring_get_database_mysql_disk_usage_request( # pylint: disable=name-too-long - *, db_id: str, aggregate: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_droplets_http_session_duration_avg_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8876,11 +9038,10 @@ def build_monitoring_get_database_mysql_disk_usage_request( # pylint: disable=n accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/database/mysql/disk_usage" + _url = "/v2/monitoring/metrics/load_balancer/droplets_http_session_duration_avg" # Construct parameters - _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") - _params["aggregate"] = _SERIALIZER.query("aggregate", aggregate, "str") + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8892,8 +9053,8 @@ def build_monitoring_get_database_mysql_disk_usage_request( # pylint: disable=n ) -def build_monitoring_get_database_mysql_threads_connected_request( # pylint: disable=name-too-long - *, db_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_droplets_http_session_duration50_p_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8901,10 +9062,10 @@ def build_monitoring_get_database_mysql_threads_connected_request( # pylint: di accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/database/mysql/threads_connected" + _url = "/v2/monitoring/metrics/load_balancer/droplets_http_session_duration_50p" # Construct parameters - _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8916,8 +9077,8 @@ def build_monitoring_get_database_mysql_threads_connected_request( # pylint: di ) -def build_monitoring_get_database_mysql_threads_created_rate_request( # pylint: disable=name-too-long - *, db_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_droplets_http_session_duration95_p_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8925,10 +9086,10 @@ def build_monitoring_get_database_mysql_threads_created_rate_request( # pylint: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/database/mysql/threads_created_rate" + _url = "/v2/monitoring/metrics/load_balancer/droplets_http_session_duration_95p" # Construct parameters - _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8940,8 +9101,8 @@ def build_monitoring_get_database_mysql_threads_created_rate_request( # pylint: ) -def build_monitoring_get_database_mysql_threads_active_request( # pylint: disable=name-too-long - *, db_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_droplets_http_response_time_avg_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8949,10 +9110,10 @@ def build_monitoring_get_database_mysql_threads_active_request( # pylint: disab accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/database/mysql/threads_active" + _url = "/v2/monitoring/metrics/load_balancer/droplets_http_response_time_avg" # Construct parameters - _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8964,8 +9125,8 @@ def build_monitoring_get_database_mysql_threads_active_request( # pylint: disab ) -def build_monitoring_get_database_mysql_index_vs_sequential_reads_request( # pylint: disable=name-too-long - *, db_id: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_droplets_http_response_time50_p_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8973,10 +9134,10 @@ def build_monitoring_get_database_mysql_index_vs_sequential_reads_request( # py accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/database/mysql/index_vs_sequential_reads" + _url = "/v2/monitoring/metrics/load_balancer/droplets_http_response_time_50p" # Construct parameters - _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -8988,8 +9149,8 @@ def build_monitoring_get_database_mysql_index_vs_sequential_reads_request( # py ) -def build_monitoring_get_database_mysql_op_rates_request( # pylint: disable=name-too-long - *, db_id: str, metric: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_droplets_http_response_time95_p_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -8997,11 +9158,10 @@ def build_monitoring_get_database_mysql_op_rates_request( # pylint: disable=nam accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/database/mysql/op_rates" + _url = "/v2/monitoring/metrics/load_balancer/droplets_http_response_time_95p" # Construct parameters - _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") - _params["metric"] = _SERIALIZER.query("metric", metric, "str") + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -9013,8 +9173,8 @@ def build_monitoring_get_database_mysql_op_rates_request( # pylint: disable=nam ) -def build_monitoring_get_database_mysql_schema_throughput_request( # pylint: disable=name-too-long - *, db_id: str, schema: str, metric: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_droplets_http_response_time99_p_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -9022,12 +9182,10 @@ def build_monitoring_get_database_mysql_schema_throughput_request( # pylint: di accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/database/mysql/schema_throughput" + _url = "/v2/monitoring/metrics/load_balancer/droplets_http_response_time_99p" # Construct parameters - _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") - _params["schema"] = _SERIALIZER.query("schema", schema, "str") - _params["metric"] = _SERIALIZER.query("metric", metric, "str") + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -9039,8 +9197,8 @@ def build_monitoring_get_database_mysql_schema_throughput_request( # pylint: di ) -def build_monitoring_get_database_mysql_schema_latency_request( # pylint: disable=name-too-long - *, db_id: str, schema: str, metric: str, start: str, end: str, **kwargs: Any +def build_monitoring_get_lb_droplets_queue_size_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -9048,12 +9206,10 @@ def build_monitoring_get_database_mysql_schema_latency_request( # pylint: disab accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/metrics/database/mysql/schema_latency" + _url = "/v2/monitoring/metrics/load_balancer/droplets_queue_size" # Construct parameters - _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") - _params["schema"] = _SERIALIZER.query("schema", schema, "str") - _params["metric"] = _SERIALIZER.query("metric", metric, "str") + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") _params["start"] = _SERIALIZER.query("start", start, "str") _params["end"] = _SERIALIZER.query("end", end, "str") @@ -9065,144 +9221,156 @@ def build_monitoring_get_database_mysql_schema_latency_request( # pylint: disab ) -def build_monitoring_create_destination_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_monitoring_get_lb_droplets_http_responses_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/sinks/destinations" + _url = "/v2/monitoring/metrics/load_balancer/droplets_http_responses" + + # Construct parameters + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # 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) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_monitoring_list_destinations_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_monitoring_get_lb_droplets_connections_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **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/monitoring/sinks/destinations" + _url = "/v2/monitoring/metrics/load_balancer/droplets_connections" + + # Construct parameters + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_monitoring_get_destination_request( - destination_uuid: str, **kwargs: Any +def build_monitoring_get_lb_droplets_health_checks_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **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/monitoring/sinks/destinations/{destination_uuid}" - path_format_arguments = { - "destination_uuid": _SERIALIZER.url( - "destination_uuid", destination_uuid, "str" - ), - } + _url = "/v2/monitoring/metrics/load_balancer/droplets_health_checks" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_monitoring_update_destination_request( # pylint: disable=name-too-long - destination_uuid: str, **kwargs: Any +def build_monitoring_get_lb_droplets_downtime_request( # pylint: disable=name-too-long + *, lb_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/sinks/destinations/{destination_uuid}" - path_format_arguments = { - "destination_uuid": _SERIALIZER.url( - "destination_uuid", destination_uuid, "str" - ), - } + _url = "/v2/monitoring/metrics/load_balancer/droplets_downtime" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + _params["lb_id"] = _SERIALIZER.query("lb_id", lb_id, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # 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) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_monitoring_delete_destination_request( # pylint: disable=name-too-long - destination_uuid: str, **kwargs: Any +def build_monitoring_get_droplet_autoscale_current_instances_request( # pylint: disable=name-too-long + *, autoscale_pool_id: str, start: str, end: str, **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/monitoring/sinks/destinations/{destination_uuid}" - path_format_arguments = { - "destination_uuid": _SERIALIZER.url( - "destination_uuid", destination_uuid, "str" - ), - } + _url = "/v2/monitoring/metrics/droplet_autoscale/current_instances" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + _params["autoscale_pool_id"] = _SERIALIZER.query( + "autoscale_pool_id", autoscale_pool_id, "str" + ) + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_monitoring_create_sink_request(**kwargs: Any) -> HttpRequest: +def build_monitoring_get_droplet_autoscale_target_instances_request( # pylint: disable=name-too-long + *, autoscale_pool_id: str, start: str, end: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/sinks" + _url = "/v2/monitoring/metrics/droplet_autoscale/target_instances" - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) + # Construct parameters + _params["autoscale_pool_id"] = _SERIALIZER.query( + "autoscale_pool_id", autoscale_pool_id, "str" + ) + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") + + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_monitoring_list_sinks_request( - *, resource_id: Optional[str] = None, **kwargs: Any +def build_monitoring_get_droplet_autoscale_current_cpu_utilization_yml_request( # pylint: disable=name-too-long + *, autoscale_pool_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -9210,16 +9378,14 @@ def build_monitoring_list_sinks_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/monitoring/sinks" + _url = "/v2/monitoring/metrics/droplet_autoscale/current_cpu_utilization" # Construct parameters - if resource_id is not None: - _params["resource_id"] = _SERIALIZER.query( - "resource_id", - resource_id, - "str", - pattern=r"^do:(dbaas|domain|droplet|floatingip|loadbalancer|space|volume|kubernetes|vpc):.*", - ) + _params["autoscale_pool_id"] = _SERIALIZER.query( + "autoscale_pool_id", autoscale_pool_id, "str" + ) + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -9229,67 +9395,86 @@ def build_monitoring_list_sinks_request( ) -def build_monitoring_get_sink_request(sink_uuid: str, **kwargs: Any) -> HttpRequest: +def build_monitoring_get_droplet_autoscale_target_cpu_utilization_request( # pylint: disable=name-too-long + *, autoscale_pool_id: str, start: str, end: str, **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/monitoring/sinks/{sink_uuid}" - path_format_arguments = { - "sink_uuid": _SERIALIZER.url("sink_uuid", sink_uuid, "str"), - } + _url = "/v2/monitoring/metrics/droplet_autoscale/target_cpu_utilization" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + _params["autoscale_pool_id"] = _SERIALIZER.query( + "autoscale_pool_id", autoscale_pool_id, "str" + ) + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_monitoring_delete_sink_request(sink_uuid: str, **kwargs: Any) -> HttpRequest: +def build_monitoring_get_droplet_autoscale_current_memory_utilization_request( # pylint: disable=name-too-long + *, autoscale_pool_id: str, start: str, end: str, **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/monitoring/sinks/{sink_uuid}" - path_format_arguments = { - "sink_uuid": _SERIALIZER.url("sink_uuid", sink_uuid, "str"), - } + _url = "/v2/monitoring/metrics/droplet_autoscale/current_memory_utilization" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + _params["autoscale_pool_id"] = _SERIALIZER.query( + "autoscale_pool_id", autoscale_pool_id, "str" + ) + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_nfs_create_request(**kwargs: Any) -> HttpRequest: +def build_monitoring_get_droplet_autoscale_target_memory_utilization_request( # pylint: disable=name-too-long + *, autoscale_pool_id: str, start: str, end: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/nfs" + _url = "/v2/monitoring/metrics/droplet_autoscale/target_memory_utilization" + + # Construct parameters + _params["autoscale_pool_id"] = _SERIALIZER.query( + "autoscale_pool_id", autoscale_pool_id, "str" + ) + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # 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) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_nfs_list_request( - *, region: Optional[str] = None, **kwargs: Any +def build_monitoring_get_database_mysql_cpu_usage_request( # pylint: disable=name-too-long + *, db_id: str, aggregate: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -9297,11 +9482,13 @@ def build_nfs_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/nfs" + _url = "/v2/monitoring/metrics/database/mysql/cpu_usage" # Construct parameters - if region is not None: - _params["region"] = _SERIALIZER.query("region", region, "str") + _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["aggregate"] = _SERIALIZER.query("aggregate", aggregate, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -9311,8 +9498,8 @@ def build_nfs_list_request( ) -def build_nfs_get_request( - nfs_id: str, *, region: Optional[str] = None, **kwargs: Any +def build_monitoring_get_database_mysql_load_request( # pylint: disable=name-too-long + *, db_id: str, metric: str, aggregate: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -9320,16 +9507,14 @@ def build_nfs_get_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/nfs/{nfs_id}" - path_format_arguments = { - "nfs_id": _SERIALIZER.url("nfs_id", nfs_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/monitoring/metrics/database/mysql/load" # Construct parameters - if region is not None: - _params["region"] = _SERIALIZER.query("region", region, "str") + _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["metric"] = _SERIALIZER.query("metric", metric, "str") + _params["aggregate"] = _SERIALIZER.query("aggregate", aggregate, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -9339,8 +9524,8 @@ def build_nfs_get_request( ) -def build_nfs_delete_request( - nfs_id: str, *, region: Optional[str] = None, **kwargs: Any +def build_monitoring_get_database_mysql_memory_usage_request( # pylint: disable=name-too-long + *, db_id: str, aggregate: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -9348,53 +9533,49 @@ def build_nfs_delete_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/nfs/{nfs_id}" - path_format_arguments = { - "nfs_id": _SERIALIZER.url("nfs_id", nfs_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/monitoring/metrics/database/mysql/memory_usage" # Construct parameters - if region is not None: - _params["region"] = _SERIALIZER.query("region", region, "str") + _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["aggregate"] = _SERIALIZER.query("aggregate", aggregate, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest( - method="DELETE", url=_url, params=_params, headers=_headers, **kwargs + method="GET", url=_url, params=_params, headers=_headers, **kwargs ) -def build_nfs_create_action_request(nfs_id: str, **kwargs: Any) -> HttpRequest: +def build_monitoring_get_database_mysql_disk_usage_request( # pylint: disable=name-too-long + *, db_id: str, aggregate: str, start: str, end: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/nfs/{nfs_id}/actions" - path_format_arguments = { - "nfs_id": _SERIALIZER.url("nfs_id", nfs_id, "str"), - } + _url = "/v2/monitoring/metrics/database/mysql/disk_usage" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["aggregate"] = _SERIALIZER.query("aggregate", aggregate, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # 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) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_nfs_list_snapshot_request( - *, region: Optional[str] = None, share_id: Optional[str] = None, **kwargs: Any +def build_monitoring_get_database_mysql_threads_connected_request( # pylint: disable=name-too-long + *, db_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -9402,13 +9583,12 @@ def build_nfs_list_snapshot_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/nfs/snapshots" + _url = "/v2/monitoring/metrics/database/mysql/threads_connected" # Construct parameters - if region is not None: - _params["region"] = _SERIALIZER.query("region", region, "str") - if share_id is not None: - _params["share_id"] = _SERIALIZER.query("share_id", share_id, "str") + _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -9418,8 +9598,8 @@ def build_nfs_list_snapshot_request( ) -def build_nfs_get_snapshot_request( - nfs_snapshot_id: str, *, region: Optional[str] = None, **kwargs: Any +def build_monitoring_get_database_mysql_threads_created_rate_request( # pylint: disable=name-too-long + *, db_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -9427,16 +9607,12 @@ def build_nfs_get_snapshot_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/nfs/snapshots/{nfs_snapshot_id}" - path_format_arguments = { - "nfs_snapshot_id": _SERIALIZER.url("nfs_snapshot_id", nfs_snapshot_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/monitoring/metrics/database/mysql/threads_created_rate" # Construct parameters - if region is not None: - _params["region"] = _SERIALIZER.query("region", region, "str") + _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -9446,8 +9622,8 @@ def build_nfs_get_snapshot_request( ) -def build_nfs_delete_snapshot_request( - nfs_snapshot_id: str, *, region: Optional[str] = None, **kwargs: Any +def build_monitoring_get_database_mysql_threads_active_request( # pylint: disable=name-too-long + *, db_id: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -9455,53 +9631,47 @@ def build_nfs_delete_snapshot_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/nfs/snapshots/{nfs_snapshot_id}" - path_format_arguments = { - "nfs_snapshot_id": _SERIALIZER.url("nfs_snapshot_id", nfs_snapshot_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/monitoring/metrics/database/mysql/threads_active" # Construct parameters - if region is not None: - _params["region"] = _SERIALIZER.query("region", region, "str") + _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest( - method="DELETE", url=_url, params=_params, headers=_headers, **kwargs + method="GET", url=_url, params=_params, headers=_headers, **kwargs ) -def build_nfs_create_access_point_request(share_id: str, **kwargs: Any) -> HttpRequest: +def build_monitoring_get_database_mysql_index_vs_sequential_reads_request( # pylint: disable=name-too-long + *, db_id: str, start: str, end: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/nfs/shares/{share_id}/access_points" - path_format_arguments = { - "share_id": _SERIALIZER.url("share_id", share_id, "str"), - } + _url = "/v2/monitoring/metrics/database/mysql/index_vs_sequential_reads" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # 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) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_nfs_list_access_points_request( - share_id: str, *, status: Optional[str] = None, **kwargs: Any +def build_monitoring_get_database_mysql_op_rates_request( # pylint: disable=name-too-long + *, db_id: str, metric: str, start: str, end: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -9509,16 +9679,13 @@ def build_nfs_list_access_points_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/nfs/shares/{share_id}/access_points" - path_format_arguments = { - "share_id": _SERIALIZER.url("share_id", share_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/monitoring/metrics/database/mysql/op_rates" # Construct parameters - if status is not None: - _params["status"] = _SERIALIZER.query("status", status, "str") + _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["metric"] = _SERIALIZER.query("metric", metric, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -9528,49 +9695,61 @@ def build_nfs_list_access_points_request( ) -def build_nfs_get_access_point_request( - access_point_id: str, **kwargs: Any +def build_monitoring_get_database_mysql_schema_throughput_request( # pylint: disable=name-too-long + *, db_id: str, schema: str, metric: str, start: str, end: str, **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/nfs/access_points/{access_point_id}" - path_format_arguments = { - "access_point_id": _SERIALIZER.url("access_point_id", access_point_id, "str"), - } + _url = "/v2/monitoring/metrics/database/mysql/schema_throughput" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["schema"] = _SERIALIZER.query("schema", schema, "str") + _params["metric"] = _SERIALIZER.query("metric", metric, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_nfs_delete_access_point_request( - access_point_id: str, **kwargs: Any +def build_monitoring_get_database_mysql_schema_latency_request( # pylint: disable=name-too-long + *, db_id: str, schema: str, metric: str, start: str, end: str, **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/nfs/access_points/{access_point_id}" - path_format_arguments = { - "access_point_id": _SERIALIZER.url("access_point_id", access_point_id, "str"), - } + _url = "/v2/monitoring/metrics/database/mysql/schema_latency" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + _params["db_id"] = _SERIALIZER.query("db_id", db_id, "str") + _params["schema"] = _SERIALIZER.query("schema", schema, "str") + _params["metric"] = _SERIALIZER.query("metric", metric, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_organizations_create_team_request(**kwargs: Any) -> HttpRequest: +def build_monitoring_create_destination_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -9579,7 +9758,7 @@ def build_organizations_create_team_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/organizations/team" + _url = "/v2/monitoring/sinks/destinations" # Construct headers if content_type is not None: @@ -9591,13 +9770,15 @@ def build_organizations_create_team_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_organizations_list_teams_request(**kwargs: Any) -> HttpRequest: +def build_monitoring_list_destinations_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/organizations/teams" + _url = "/v2/monitoring/sinks/destinations" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -9605,34 +9786,32 @@ def build_organizations_list_teams_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_partner_attachments_list_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_monitoring_get_destination_request( + destination_uuid: str, **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/partner_network_connect/attachments" + _url = "/v2/monitoring/sinks/destinations/{destination_uuid}" + path_format_arguments = { + "destination_uuid": _SERIALIZER.url( + "destination_uuid", destination_uuid, "str" + ), + } - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_partner_attachments_create_request(**kwargs: Any) -> HttpRequest: +def build_monitoring_update_destination_request( # pylint: disable=name-too-long + destination_uuid: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -9641,7 +9820,14 @@ def build_partner_attachments_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/partner_network_connect/attachments" + _url = "/v2/monitoring/sinks/destinations/{destination_uuid}" + path_format_arguments = { + "destination_uuid": _SERIALIZER.url( + "destination_uuid", destination_uuid, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -9653,15 +9839,19 @@ def build_partner_attachments_create_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_partner_attachments_get_request(pa_id: str, **kwargs: Any) -> HttpRequest: +def build_monitoring_delete_destination_request( # pylint: disable=name-too-long + destination_uuid: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/partner_network_connect/attachments/{pa_id}" + _url = "/v2/monitoring/sinks/destinations/{destination_uuid}" path_format_arguments = { - "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), + "destination_uuid": _SERIALIZER.url( + "destination_uuid", destination_uuid, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -9669,10 +9859,10 @@ def build_partner_attachments_get_request(pa_id: str, **kwargs: Any) -> HttpRequ # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_partner_attachments_patch_request(pa_id: str, **kwargs: Any) -> HttpRequest: +def build_monitoring_create_sink_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -9681,12 +9871,7 @@ def build_partner_attachments_patch_request(pa_id: str, **kwargs: Any) -> HttpRe accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/partner_network_connect/attachments/{pa_id}" - path_format_arguments = { - "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/monitoring/sinks" # Construct headers if content_type is not None: @@ -9695,39 +9880,46 @@ def build_partner_attachments_patch_request(pa_id: str, **kwargs: Any) -> HttpRe ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_partner_attachments_delete_request(pa_id: str, **kwargs: Any) -> HttpRequest: +def build_monitoring_list_sinks_request( + *, resource_id: 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/partner_network_connect/attachments/{pa_id}" - path_format_arguments = { - "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), - } + _url = "/v2/monitoring/sinks" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if resource_id is not None: + _params["resource_id"] = _SERIALIZER.query( + "resource_id", + resource_id, + "str", + pattern=r"^do:(dbaas|domain|droplet|floatingip|loadbalancer|space|volume|kubernetes|vpc):.*", + ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_partner_attachments_get_bgp_auth_key_request( # pylint: disable=name-too-long - pa_id: str, **kwargs: Any -) -> HttpRequest: +def build_monitoring_get_sink_request(sink_uuid: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/partner_network_connect/attachments/{pa_id}/bgp_auth_key" + _url = "/v2/monitoring/sinks/{sink_uuid}" path_format_arguments = { - "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), + "sink_uuid": _SERIALIZER.url("sink_uuid", sink_uuid, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -9738,82 +9930,99 @@ def build_partner_attachments_get_bgp_auth_key_request( # pylint: disable=name- return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_partner_attachments_list_remote_routes_request( # pylint: disable=name-too-long - pa_id: str, *, per_page: int = 20, page: int = 1, **kwargs: Any -) -> HttpRequest: +def build_monitoring_delete_sink_request(sink_uuid: str, **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/partner_network_connect/attachments/{pa_id}/remote_routes" + _url = "/v2/monitoring/sinks/{sink_uuid}" path_format_arguments = { - "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), + "sink_uuid": _SERIALIZER.url("sink_uuid", sink_uuid, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + + +def build_nfs_create_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 = "/v2/nfs" -def build_partner_attachments_get_service_key_request( # pylint: disable=name-too-long - pa_id: str, **kwargs: Any + # 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_nfs_list_request( + *, region: 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/partner_network_connect/attachments/{pa_id}/service_key" - path_format_arguments = { - "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), - } + _url = "/v2/nfs" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if region is not None: + _params["region"] = _SERIALIZER.query("region", region, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_partner_attachments_create_service_key_request( # pylint: disable=name-too-long - pa_id: str, **kwargs: Any +def build_nfs_get_request( + nfs_id: str, *, region: 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/partner_network_connect/attachments/{pa_id}/service_key" + _url = "/v2/nfs/{nfs_id}" path_format_arguments = { - "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), + "nfs_id": _SERIALIZER.url("nfs_id", nfs_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if region is not None: + _params["region"] = _SERIALIZER.query("region", region, "str") + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_projects_list_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_nfs_delete_request( + nfs_id: str, *, region: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -9821,25 +10030,26 @@ def build_projects_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/projects" + _url = "/v2/nfs/{nfs_id}" + path_format_arguments = { + "nfs_id": _SERIALIZER.url("nfs_id", nfs_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if region is not None: + _params["region"] = _SERIALIZER.query("region", region, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs + method="DELETE", url=_url, params=_params, headers=_headers, **kwargs ) -def build_projects_create_request(**kwargs: Any) -> HttpRequest: +def build_nfs_create_action_request(nfs_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -9848,7 +10058,12 @@ def build_projects_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/projects" + _url = "/v2/nfs/{nfs_id}/actions" + path_format_arguments = { + "nfs_id": _SERIALIZER.url("nfs_id", nfs_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -9860,82 +10075,88 @@ def build_projects_create_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_projects_get_default_request(**kwargs: Any) -> HttpRequest: +def build_nfs_list_snapshot_request( + *, region: Optional[str] = None, share_id: 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/projects/default" + _url = "/v2/nfs/snapshots" + + # Construct parameters + if region is not None: + _params["region"] = _SERIALIZER.query("region", region, "str") + if share_id is not None: + _params["share_id"] = _SERIALIZER.query("share_id", share_id, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_projects_update_default_request(**kwargs: Any) -> HttpRequest: +def build_nfs_get_snapshot_request( + nfs_snapshot_id: str, *, region: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/projects/default" - - # 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_projects_patch_default_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _url = "/v2/nfs/snapshots/{nfs_snapshot_id}" + path_format_arguments = { + "nfs_snapshot_id": _SERIALIZER.url("nfs_snapshot_id", nfs_snapshot_id, "str"), + } - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) - accept = _headers.pop("Accept", "application/json") + _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct URL - _url = "/v2/projects/default" + # Construct parameters + if region is not None: + _params["region"] = _SERIALIZER.query("region", region, "str") # 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="PATCH", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_projects_get_request(project_id: str, **kwargs: Any) -> HttpRequest: +def build_nfs_delete_snapshot_request( + nfs_snapshot_id: str, *, region: 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/projects/{project_id}" + _url = "/v2/nfs/snapshots/{nfs_snapshot_id}" path_format_arguments = { - "project_id": _SERIALIZER.url("project_id", project_id, "str"), + "nfs_snapshot_id": _SERIALIZER.url("nfs_snapshot_id", nfs_snapshot_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if region is not None: + _params["region"] = _SERIALIZER.query("region", region, "str") + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="DELETE", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_projects_update_request(project_id: str, **kwargs: Any) -> HttpRequest: +def build_nfs_create_access_point_request(share_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -9944,9 +10165,9 @@ def build_projects_update_request(project_id: str, **kwargs: Any) -> HttpRequest accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/projects/{project_id}" + _url = "/v2/nfs/shares/{share_id}/access_points" path_format_arguments = { - "project_id": _SERIALIZER.url("project_id", project_id, "str"), + "share_id": _SERIALIZER.url("share_id", share_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -9958,44 +10179,48 @@ def build_projects_update_request(project_id: str, **kwargs: Any) -> HttpRequest ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_projects_patch_request(project_id: str, **kwargs: Any) -> HttpRequest: +def build_nfs_list_access_points_request( + share_id: str, *, status: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/projects/{project_id}" + _url = "/v2/nfs/shares/{share_id}/access_points" path_format_arguments = { - "project_id": _SERIALIZER.url("project_id", project_id, "str"), + "share_id": _SERIALIZER.url("share_id", share_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if status is not None: + _params["status"] = _SERIALIZER.query("status", status, "str") + # 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="PATCH", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_projects_delete_request(project_id: str, **kwargs: Any) -> HttpRequest: +def build_nfs_get_access_point_request( + access_point_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/projects/{project_id}" + _url = "/v2/nfs/access_points/{access_point_id}" path_format_arguments = { - "project_id": _SERIALIZER.url("project_id", project_id, "str"), + "access_point_id": _SERIALIZER.url("access_point_id", access_point_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -10003,44 +10228,31 @@ def build_projects_delete_request(project_id: str, **kwargs: Any) -> HttpRequest # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_projects_list_resources_request( - project_id: str, *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_nfs_delete_access_point_request( + access_point_id: str, **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/projects/{project_id}/resources" + _url = "/v2/nfs/access_points/{access_point_id}" path_format_arguments = { - "project_id": _SERIALIZER.url("project_id", project_id, "str"), + "access_point_id": _SERIALIZER.url("access_point_id", access_point_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_projects_assign_resources_request( - project_id: str, **kwargs: Any -) -> HttpRequest: +def build_organizations_create_team_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -10049,12 +10261,7 @@ def build_projects_assign_resources_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/projects/{project_id}/resources" - path_format_arguments = { - "project_id": _SERIALIZER.url("project_id", project_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/organizations/team" # Construct headers if content_type is not None: @@ -10066,15 +10273,13 @@ def build_projects_assign_resources_request( return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_projects_list_resources_default_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_organizations_list_teams_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/projects/default/resources" + _url = "/v2/organizations/teams" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -10082,30 +10287,7 @@ def build_projects_list_resources_default_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_projects_assign_resources_default_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long - _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/projects/default/resources" - - # 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_regions_list_request( +def build_partner_attachments_list_request( *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -10114,7 +10296,7 @@ def build_regions_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/regions" + _url = "/v2/partner_network_connect/attachments" # Construct parameters if per_page is not None: @@ -10132,21 +10314,7 @@ def build_regions_list_request( ) -def build_registries_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/v2/registries" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_registries_create_request(**kwargs: Any) -> HttpRequest: +def build_partner_attachments_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -10155,7 +10323,7 @@ def build_registries_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries" + _url = "/v2/partner_network_connect/attachments" # Construct headers if content_type is not None: @@ -10167,15 +10335,15 @@ def build_registries_create_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_registries_get_request(registry_name: str, **kwargs: Any) -> HttpRequest: +def build_partner_attachments_get_request(pa_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}" + _url = "/v2/partner_network_connect/attachments/{pa_id}" path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -10186,36 +10354,41 @@ def build_registries_get_request(registry_name: str, **kwargs: Any) -> HttpReque return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_registries_delete_request(registry_name: str, **kwargs: Any) -> HttpRequest: +def build_partner_attachments_patch_request(pa_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}" + _url = "/v2/partner_network_connect/attachments/{pa_id}" path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) -def build_registries_get_docker_credentials_request( # pylint: disable=name-too-long - registry_name: str, **kwargs: Any -) -> HttpRequest: +def build_partner_attachments_delete_request(pa_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}/docker-credentials" + _url = "/v2/partner_network_connect/attachments/{pa_id}" path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -10223,18 +10396,23 @@ def build_registries_get_docker_credentials_request( # pylint: disable=name-too # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_registries_get_subscription_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_partner_attachments_get_bgp_auth_key_request( # pylint: disable=name-too-long + pa_id: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/subscription" + _url = "/v2/partner_network_connect/attachments/{pa_id}/bgp_auth_key" + path_format_arguments = { + "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -10242,54 +10420,49 @@ def build_registries_get_subscription_request( return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_registries_update_subscription_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_partner_attachments_list_remote_routes_request( # pylint: disable=name-too-long + pa_id: str, *, per_page: int = 20, page: int = 1, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/subscription" - - # 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_registries_get_options_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _url = "/v2/partner_network_connect/attachments/{pa_id}/remote_routes" + path_format_arguments = { + "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), + } - accept = _headers.pop("Accept", "application/json") + _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct URL - _url = "/v2/registries/options" + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_registries_get_garbage_collection_request( # pylint: disable=name-too-long - registry_name: str, **kwargs: Any +def build_partner_attachments_get_service_key_request( # pylint: disable=name-too-long + pa_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}/garbage-collection" + _url = "/v2/partner_network_connect/attachments/{pa_id}/service_key" path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -10300,17 +10473,17 @@ def build_registries_get_garbage_collection_request( # pylint: disable=name-too return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_registries_run_garbage_collection_request( # pylint: disable=name-too-long - registry_name: str, **kwargs: Any +def build_partner_attachments_create_service_key_request( # pylint: disable=name-too-long + pa_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}/garbage-collection" + _url = "/v2/partner_network_connect/attachments/{pa_id}/service_key" path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "pa_id": _SERIALIZER.url("pa_id", pa_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -10321,8 +10494,8 @@ def build_registries_run_garbage_collection_request( # pylint: disable=name-too return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_registries_list_garbage_collections_request( # pylint: disable=name-too-long - registry_name: str, *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_projects_list_request( + *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -10330,12 +10503,7 @@ def build_registries_list_garbage_collections_request( # pylint: disable=name-t accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}/garbage-collections" - path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/projects" # Construct parameters if per_page is not None: @@ -10353,9 +10521,7 @@ def build_registries_list_garbage_collections_request( # pylint: disable=name-t ) -def build_registries_update_garbage_collection_request( # pylint: disable=name-too-long - registry_name: str, garbage_collection_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_projects_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -10364,15 +10530,42 @@ def build_registries_update_garbage_collection_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}/garbage-collection/{garbage_collection_uuid}" - path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), - "garbage_collection_uuid": _SERIALIZER.url( - "garbage_collection_uuid", garbage_collection_uuid, "str" - ), - } + _url = "/v2/projects" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_projects_get_default_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/projects/default" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_projects_update_default_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 = "/v2/projects/default" # Construct headers if content_type is not None: @@ -10384,118 +10577,107 @@ def build_registries_update_garbage_collection_request( # pylint: disable=name- return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_registries_list_repositories_v2_request( # pylint: disable=name-too-long - registry_name: str, - *, - per_page: int = 20, - page: int = 1, - page_token: Optional[str] = None, - **kwargs: Any, -) -> HttpRequest: +def build_projects_patch_default_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}/repositoriesV2" + _url = "/v2/projects/default" + + # 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="PATCH", url=_url, headers=_headers, **kwargs) + + +def build_projects_get_request(project_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/projects/{project_id}" path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "project_id": _SERIALIZER.url("project_id", project_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if page_token is not None: - _params["page_token"] = _SERIALIZER.query("page_token", page_token, "str") - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_registries_delete_repository_request( # pylint: disable=name-too-long - registry_name: str, repository_name: str, **kwargs: Any -) -> HttpRequest: +def build_projects_update_request(project_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}/repositories/{repository_name}" + _url = "/v2/projects/{project_id}" path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), - "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), + "project_id": _SERIALIZER.url("project_id", project_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_registries_list_repository_tags_request( # pylint: disable=name-too-long - registry_name: str, - repository_name: str, - *, - per_page: int = 20, - page: int = 1, - **kwargs: Any, -) -> HttpRequest: +def build_projects_patch_request(project_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}/repositories/{repository_name}/tags" + _url = "/v2/projects/{project_id}" path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), - "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), + "project_id": _SERIALIZER.url("project_id", project_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - # 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="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) -def build_registries_delete_repository_tag_request( # pylint: disable=name-too-long - registry_name: str, repository_name: str, repository_tag: str, **kwargs: Any -) -> HttpRequest: +def build_projects_delete_request(project_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}/repositories/{repository_name}/tags/{repository_tag}" + _url = "/v2/projects/{project_id}" path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), - "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), - "repository_tag": _SERIALIZER.url("repository_tag", repository_tag, "str"), + "project_id": _SERIALIZER.url("project_id", project_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -10506,13 +10688,8 @@ def build_registries_delete_repository_tag_request( # pylint: disable=name-too- return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_registries_list_repository_manifests_request( # pylint: disable=name-too-long - registry_name: str, - repository_name: str, - *, - per_page: int = 20, - page: int = 1, - **kwargs: Any, +def build_projects_list_resources_request( + project_id: str, *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -10520,10 +10697,9 @@ def build_registries_list_repository_manifests_request( # pylint: disable=name- accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}/repositories/{repository_name}/digests" + _url = "/v2/projects/{project_id}/resources" path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), - "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), + "project_id": _SERIALIZER.url("project_id", project_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -10544,31 +10720,54 @@ def build_registries_list_repository_manifests_request( # pylint: disable=name- ) -def build_registries_delete_repository_manifest_request( # pylint: disable=name-too-long - registry_name: str, repository_name: str, manifest_digest: str, **kwargs: Any +def build_projects_assign_resources_request( + project_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/{registry_name}/repositories/{repository_name}/digests/{manifest_digest}" + _url = "/v2/projects/{project_id}/resources" path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), - "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), - "manifest_digest": _SERIALIZER.url("manifest_digest", manifest_digest, "str"), + "project_id": _SERIALIZER.url("project_id", project_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_registries_validate_name_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) +def build_projects_list_resources_default_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/projects/default/resources" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_projects_assign_resources_default_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( "content_type", _headers.pop("Content-Type", None) @@ -10576,7 +10775,7 @@ def build_registries_validate_name_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registries/validate-name" + _url = "/v2/projects/default/resources" # Construct headers if content_type is not None: @@ -10588,13 +10787,40 @@ def build_registries_validate_name_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_registry_get_request(**kwargs: Any) -> HttpRequest: +def build_regions_list_request( + *, per_page: int = 20, page: int = 1, **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/registry" + _url = "/v2/regions" + + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) + + +def build_registries_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/registries" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -10602,7 +10828,7 @@ def build_registry_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_registry_create_request(**kwargs: Any) -> HttpRequest: +def build_registries_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -10611,7 +10837,7 @@ def build_registry_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry" + _url = "/v2/registries" # Construct headers if content_type is not None: @@ -10623,13 +10849,37 @@ def build_registry_create_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_registry_delete_request(**kwargs: Any) -> HttpRequest: +def build_registries_get_request(registry_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry" + _url = "/v2/registries/{registry_name}" + path_format_arguments = { + "registry_name": _SERIALIZER.url("registry_name", registry_name, "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_registries_delete_request(registry_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/registries/{registry_name}" + path_format_arguments = { + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -10637,13 +10887,20 @@ def build_registry_delete_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_registry_get_subscription_request(**kwargs: Any) -> HttpRequest: +def build_registries_get_docker_credentials_request( # pylint: disable=name-too-long + registry_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry/subscription" + _url = "/v2/registries/{registry_name}/docker-credentials" + path_format_arguments = { + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -10651,7 +10908,23 @@ def build_registry_get_subscription_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_registry_update_subscription_request( +def build_registries_get_subscription_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/registries/subscription" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_registries_update_subscription_request( **kwargs: Any, ) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -10662,7 +10935,7 @@ def build_registry_update_subscription_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry/subscription" + _url = "/v2/registries/subscription" # Construct headers if content_type is not None: @@ -10674,55 +10947,63 @@ def build_registry_update_subscription_request( return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_registry_get_docker_credentials_request( # pylint: disable=name-too-long - *, expiry_seconds: int = 0, read_write: bool = False, **kwargs: Any +def build_registries_get_options_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/registries/options" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_registries_get_garbage_collection_request( # pylint: disable=name-too-long + registry_name: str, **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/registry/docker-credentials" + _url = "/v2/registries/{registry_name}/garbage-collection" + path_format_arguments = { + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + } - # Construct parameters - if expiry_seconds is not None: - _params["expiry_seconds"] = _SERIALIZER.query( - "expiry_seconds", expiry_seconds, "int", minimum=0 - ) - if read_write is not None: - _params["read_write"] = _SERIALIZER.query("read_write", read_write, "bool") + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_registry_validate_name_request(**kwargs: Any) -> HttpRequest: +def build_registries_run_garbage_collection_request( # pylint: disable=name-too-long + registry_name: 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/registry/validate-name" + _url = "/v2/registries/{registry_name}/garbage-collection" + path_format_arguments = { + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_registry_list_repositories_request( +def build_registries_list_garbage_collections_request( # pylint: disable=name-too-long registry_name: str, *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -10731,7 +11012,7 @@ def build_registry_list_repositories_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry/{registry_name}/repositories" + _url = "/v2/registries/{registry_name}/garbage-collections" path_format_arguments = { "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), } @@ -10754,7 +11035,38 @@ def build_registry_list_repositories_request( ) -def build_registry_list_repositories_v2_request( # pylint: disable=name-too-long +def build_registries_update_garbage_collection_request( # pylint: disable=name-too-long + registry_name: str, garbage_collection_uuid: 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/registries/{registry_name}/garbage-collection/{garbage_collection_uuid}" + path_format_arguments = { + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "garbage_collection_uuid": _SERIALIZER.url( + "garbage_collection_uuid", garbage_collection_uuid, "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_registries_list_repositories_v2_request( # pylint: disable=name-too-long registry_name: str, *, per_page: int = 20, @@ -10768,7 +11080,7 @@ def build_registry_list_repositories_v2_request( # pylint: disable=name-too-lon accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry/{registry_name}/repositoriesV2" + _url = "/v2/registries/{registry_name}/repositoriesV2" path_format_arguments = { "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), } @@ -10793,7 +11105,29 @@ def build_registry_list_repositories_v2_request( # pylint: disable=name-too-lon ) -def build_registry_list_repository_tags_request( # pylint: disable=name-too-long +def build_registries_delete_repository_request( # pylint: disable=name-too-long + registry_name: str, repository_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/registries/{registry_name}/repositories/{repository_name}" + path_format_arguments = { + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + + +def build_registries_list_repository_tags_request( # pylint: disable=name-too-long registry_name: str, repository_name: str, *, @@ -10807,7 +11141,7 @@ def build_registry_list_repository_tags_request( # pylint: disable=name-too-lon accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry/{registry_name}/repositories/{repository_name}/tags" + _url = "/v2/registries/{registry_name}/repositories/{repository_name}/tags" path_format_arguments = { "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), @@ -10831,7 +11165,7 @@ def build_registry_list_repository_tags_request( # pylint: disable=name-too-lon ) -def build_registry_delete_repository_tag_request( # pylint: disable=name-too-long +def build_registries_delete_repository_tag_request( # pylint: disable=name-too-long registry_name: str, repository_name: str, repository_tag: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -10839,7 +11173,7 @@ def build_registry_delete_repository_tag_request( # pylint: disable=name-too-lo accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry/{registry_name}/repositories/{repository_name}/tags/{repository_tag}" + _url = "/v2/registries/{registry_name}/repositories/{repository_name}/tags/{repository_tag}" path_format_arguments = { "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), @@ -10854,7 +11188,7 @@ def build_registry_delete_repository_tag_request( # pylint: disable=name-too-lo return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_registry_list_repository_manifests_request( # pylint: disable=name-too-long +def build_registries_list_repository_manifests_request( # pylint: disable=name-too-long registry_name: str, repository_name: str, *, @@ -10868,7 +11202,7 @@ def build_registry_list_repository_manifests_request( # pylint: disable=name-to accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry/{registry_name}/repositories/{repository_name}/digests" + _url = "/v2/registries/{registry_name}/repositories/{repository_name}/digests" path_format_arguments = { "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), @@ -10892,7 +11226,7 @@ def build_registry_list_repository_manifests_request( # pylint: disable=name-to ) -def build_registry_delete_repository_manifest_request( # pylint: disable=name-too-long +def build_registries_delete_repository_manifest_request( # pylint: disable=name-too-long registry_name: str, repository_name: str, manifest_digest: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -10900,7 +11234,7 @@ def build_registry_delete_repository_manifest_request( # pylint: disable=name-t accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry/{registry_name}/repositories/{repository_name}/digests/{manifest_digest}" + _url = "/v2/registries/{registry_name}/repositories/{repository_name}/digests/{manifest_digest}" path_format_arguments = { "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), @@ -10915,9 +11249,7 @@ def build_registry_delete_repository_manifest_request( # pylint: disable=name-t return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_registry_run_garbage_collection_request( # pylint: disable=name-too-long - registry_name: str, **kwargs: Any -) -> HttpRequest: +def build_registries_validate_name_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -10926,12 +11258,7 @@ def build_registry_run_garbage_collection_request( # pylint: disable=name-too-l accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry/{registry_name}/garbage-collection" - path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/registries/validate-name" # Construct headers if content_type is not None: @@ -10943,20 +11270,13 @@ def build_registry_run_garbage_collection_request( # pylint: disable=name-too-l return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_registry_get_garbage_collection_request( # pylint: disable=name-too-long - registry_name: str, **kwargs: Any -) -> HttpRequest: +def build_registry_get_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry/{registry_name}/garbage-collection" - path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/registry" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -10964,85 +11284,80 @@ def build_registry_get_garbage_collection_request( # pylint: disable=name-too-l return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_registry_list_garbage_collections_request( # pylint: disable=name-too-long - registry_name: str, *, per_page: int = 20, page: int = 1, **kwargs: Any -) -> HttpRequest: +def build_registry_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/registry/{registry_name}/garbage-collections" - path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/registry" - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_registry_delete_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/registry" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_registry_update_garbage_collection_request( # pylint: disable=name-too-long - registry_name: str, garbage_collection_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_registry_get_subscription_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 = "/v2/registry/{registry_name}/garbage-collection/{garbage_collection_uuid}" - path_format_arguments = { - "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), - "garbage_collection_uuid": _SERIALIZER.url( - "garbage_collection_uuid", garbage_collection_uuid, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/registry/subscription" # 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) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_registry_get_options_request(**kwargs: Any) -> HttpRequest: +def build_registry_update_subscription_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long _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/registry/options" + _url = "/v2/registry/subscription" # 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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_reserved_ips_list_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_registry_get_docker_credentials_request( # pylint: disable=name-too-long + *, expiry_seconds: int = 0, read_write: bool = False, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -11050,15 +11365,15 @@ def build_reserved_ips_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/reserved_ips" + _url = "/v2/registry/docker-credentials" # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 + if expiry_seconds is not None: + _params["expiry_seconds"] = _SERIALIZER.query( + "expiry_seconds", expiry_seconds, "int", minimum=0 ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if read_write is not None: + _params["read_write"] = _SERIALIZER.query("read_write", read_write, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -11068,7 +11383,7 @@ def build_reserved_ips_list_request( ) -def build_reserved_ips_create_request(**kwargs: Any) -> HttpRequest: +def build_registry_validate_name_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -11077,7 +11392,7 @@ def build_reserved_ips_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/reserved_ips" + _url = "/v2/registry/validate-name" # Construct headers if content_type is not None: @@ -11089,126 +11404,160 @@ def build_reserved_ips_create_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_reserved_ips_get_request(reserved_ip: str, **kwargs: Any) -> HttpRequest: +def build_registry_list_repositories_request( + registry_name: str, *, per_page: int = 20, page: int = 1, **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/reserved_ips/{reserved_ip}" + _url = "/v2/registry/{registry_name}/repositories" path_format_arguments = { - "reserved_ip": _SERIALIZER.url("reserved_ip", reserved_ip, "str"), + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_reserved_ips_delete_request(reserved_ip: str, **kwargs: Any) -> HttpRequest: +def build_registry_list_repositories_v2_request( # pylint: disable=name-too-long + registry_name: str, + *, + per_page: int = 20, + page: int = 1, + page_token: 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/reserved_ips/{reserved_ip}" + _url = "/v2/registry/{registry_name}/repositoriesV2" path_format_arguments = { - "reserved_ip": _SERIALIZER.url("reserved_ip", reserved_ip, "str"), + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if page_token is not None: + _params["page_token"] = _SERIALIZER.query("page_token", page_token, "str") + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_reserved_ips_actions_list_request( - reserved_ip: str, **kwargs: Any +def build_registry_list_repository_tags_request( # pylint: disable=name-too-long + registry_name: str, + repository_name: str, + *, + per_page: int = 20, + page: int = 1, + **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/reserved_ips/{reserved_ip}/actions" + _url = "/v2/registry/{registry_name}/repositories/{repository_name}/tags" path_format_arguments = { - "reserved_ip": _SERIALIZER.url("reserved_ip", reserved_ip, "str"), + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_reserved_ips_actions_post_request( - reserved_ip: str, **kwargs: Any +def build_registry_delete_repository_tag_request( # pylint: disable=name-too-long + registry_name: str, repository_name: str, repository_tag: 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/reserved_ips/{reserved_ip}/actions" + _url = "/v2/registry/{registry_name}/repositories/{repository_name}/tags/{repository_tag}" path_format_arguments = { - "reserved_ip": _SERIALIZER.url("reserved_ip", reserved_ip, "str"), + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), + "repository_tag": _SERIALIZER.url("repository_tag", repository_tag, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_reserved_ips_actions_get_request( - reserved_ip: str, action_id: int, **kwargs: Any +def build_registry_list_repository_manifests_request( # pylint: disable=name-too-long + registry_name: str, + repository_name: str, + *, + per_page: int = 20, + page: int = 1, + **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/reserved_ips/{reserved_ip}/actions/{action_id}" + _url = "/v2/registry/{registry_name}/repositories/{repository_name}/digests" path_format_arguments = { - "reserved_ip": _SERIALIZER.url("reserved_ip", reserved_ip, "str"), - "action_id": _SERIALIZER.url("action_id", action_id, "int", minimum=1), + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "repository_name": _SERIALIZER.url("repository_name", repository_name, "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_reserved_ipv6_list_request( - *, per_page: int = 20, page: int = 1, **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/reserved_ipv6" - # Construct parameters if per_page is not None: _params["per_page"] = _SERIALIZER.query( @@ -11225,16 +11574,46 @@ def build_reserved_ipv6_list_request( ) -def build_reserved_ipv6_create_request(**kwargs: Any) -> HttpRequest: +def build_registry_delete_repository_manifest_request( # pylint: disable=name-too-long + registry_name: str, repository_name: str, manifest_digest: 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/reserved_ipv6" + _url = "/v2/registry/{registry_name}/repositories/{repository_name}/digests/{manifest_digest}" + path_format_arguments = { + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "repository_name": _SERIALIZER.url("repository_name", repository_name, "str"), + "manifest_digest": _SERIALIZER.url("manifest_digest", manifest_digest, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + + +def build_registry_run_garbage_collection_request( # pylint: disable=name-too-long + registry_name: 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/registry/{registry_name}/garbage-collection" + path_format_arguments = { + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -11246,15 +11625,17 @@ def build_reserved_ipv6_create_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_reserved_ipv6_get_request(reserved_ipv6: str, **kwargs: Any) -> HttpRequest: +def build_registry_get_garbage_collection_request( # pylint: disable=name-too-long + registry_name: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/reserved_ipv6/{reserved_ipv6}" + _url = "/v2/registry/{registry_name}/garbage-collection" path_format_arguments = { - "reserved_ipv6": _SERIALIZER.url("reserved_ipv6", reserved_ipv6, "str"), + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -11265,29 +11646,40 @@ def build_reserved_ipv6_get_request(reserved_ipv6: str, **kwargs: Any) -> HttpRe return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_reserved_ipv6_delete_request( - reserved_ipv6: str, **kwargs: Any +def build_registry_list_garbage_collections_request( # pylint: disable=name-too-long + registry_name: str, *, per_page: int = 20, page: int = 1, **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/reserved_ipv6/{reserved_ipv6}" + _url = "/v2/registry/{registry_name}/garbage-collections" path_format_arguments = { - "reserved_ipv6": _SERIALIZER.url("reserved_ipv6", reserved_ipv6, "str"), + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_reserved_ipv6_actions_post_request( - reserved_ipv6: str, **kwargs: Any +def build_registry_update_garbage_collection_request( # pylint: disable=name-too-long + registry_name: str, garbage_collection_uuid: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -11297,9 +11689,12 @@ def build_reserved_ipv6_actions_post_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/reserved_ipv6/{reserved_ipv6}/actions" + _url = "/v2/registry/{registry_name}/garbage-collection/{garbage_collection_uuid}" path_format_arguments = { - "reserved_ipv6": _SERIALIZER.url("reserved_ipv6", reserved_ipv6, "str"), + "registry_name": _SERIALIZER.url("registry_name", registry_name, "str"), + "garbage_collection_uuid": _SERIALIZER.url( + "garbage_collection_uuid", garbage_collection_uuid, "str" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -11311,31 +11706,24 @@ def build_reserved_ipv6_actions_post_request( ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_byoip_prefixes_create_request(**kwargs: Any) -> HttpRequest: +def build_registry_get_options_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 = "/v2/byoip_prefixes" + _url = "/v2/registry/options" # 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) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_byoip_prefixes_list_request( +def build_reserved_ips_list_request( *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -11344,7 +11732,7 @@ def build_byoip_prefixes_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/byoip_prefixes" + _url = "/v2/reserved_ips" # Construct parameters if per_page is not None: @@ -11362,42 +11750,36 @@ def build_byoip_prefixes_list_request( ) -def build_byoip_prefixes_get_request( - byoip_prefix_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_reserved_ips_create_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 = "/v2/byoip_prefixes/{byoip_prefix_uuid}" - path_format_arguments = { - "byoip_prefix_uuid": _SERIALIZER.url( - "byoip_prefix_uuid", byoip_prefix_uuid, "str" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/reserved_ips" # 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="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_byoip_prefixes_delete_request( - byoip_prefix_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_reserved_ips_get_request(reserved_ip: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/byoip_prefixes/{byoip_prefix_uuid}" + _url = "/v2/reserved_ips/{reserved_ip}" path_format_arguments = { - "byoip_prefix_uuid": _SERIALIZER.url( - "byoip_prefix_uuid", byoip_prefix_uuid, "str" - ), + "reserved_ip": _SERIALIZER.url("reserved_ip", reserved_ip, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -11405,163 +11787,101 @@ def build_byoip_prefixes_delete_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_byoip_prefixes_patch_request( - byoip_prefix_uuid: str, **kwargs: Any -) -> HttpRequest: +def build_reserved_ips_delete_request(reserved_ip: 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/byoip_prefixes/{byoip_prefix_uuid}" + _url = "/v2/reserved_ips/{reserved_ip}" path_format_arguments = { - "byoip_prefix_uuid": _SERIALIZER.url( - "byoip_prefix_uuid", byoip_prefix_uuid, "str" - ), + "reserved_ip": _SERIALIZER.url("reserved_ip", reserved_ip, "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="PATCH", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_byoip_prefixes_list_resources_request( # pylint: disable=name-too-long - byoip_prefix_uuid: str, *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_reserved_ips_actions_list_request( + reserved_ip: str, **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/byoip_prefixes/{byoip_prefix_uuid}/ips" + _url = "/v2/reserved_ips/{reserved_ip}/actions" path_format_arguments = { - "byoip_prefix_uuid": _SERIALIZER.url( - "byoip_prefix_uuid", byoip_prefix_uuid, "str" - ), + "reserved_ip": _SERIALIZER.url("reserved_ip", reserved_ip, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_security_list_scans_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_reserved_ips_actions_post_request( + reserved_ip: str, **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/security/scans" - - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) ) - - -def build_security_create_scan_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/security/scans" + _url = "/v2/reserved_ips/{reserved_ip}/actions" + path_format_arguments = { + "reserved_ip": _SERIALIZER.url("reserved_ip", reserved_ip, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_security_get_scan_request( - scan_id: str, - *, - severity: Optional[str] = None, - per_page: int = 20, - page: int = 1, - type: Optional[str] = None, - **kwargs: Any, +def build_reserved_ips_actions_get_request( + reserved_ip: str, action_id: int, **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/security/scans/{scan_id}" + _url = "/v2/reserved_ips/{reserved_ip}/actions/{action_id}" path_format_arguments = { - "scan_id": _SERIALIZER.url("scan_id", scan_id, "str"), + "reserved_ip": _SERIALIZER.url("reserved_ip", reserved_ip, "str"), + "action_id": _SERIALIZER.url("action_id", action_id, "int", minimum=1), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if severity is not None: - _params["severity"] = _SERIALIZER.query("severity", severity, "str") - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "str") - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_security_get_latest_scan_request( - *, - per_page: int = 20, - page: int = 1, - severity: Optional[str] = None, - type: Optional[str] = None, - **kwargs: Any, +def build_reserved_ipv6_list_request( + *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -11569,7 +11889,7 @@ def build_security_get_latest_scan_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/security/scans/latest" + _url = "/v2/reserved_ipv6" # Construct parameters if per_page is not None: @@ -11578,10 +11898,6 @@ def build_security_get_latest_scan_request( ) if page is not None: _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if severity is not None: - _params["severity"] = _SERIALIZER.query("severity", severity, "str") - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -11591,7 +11907,7 @@ def build_security_get_latest_scan_request( ) -def build_security_create_scan_rule_request(**kwargs: Any) -> HttpRequest: +def build_reserved_ipv6_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -11600,7 +11916,7 @@ def build_security_create_scan_rule_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/security/scans/rules" + _url = "/v2/reserved_ipv6" # Construct headers if content_type is not None: @@ -11612,69 +11928,49 @@ def build_security_create_scan_rule_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_security_list_scan_finding_affected_resources_request( # pylint: disable=name-too-long - scan_id: str, finding_uuid: str, *, per_page: int = 20, page: int = 1, **kwargs: Any -) -> HttpRequest: +def build_reserved_ipv6_get_request(reserved_ipv6: str, **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/security/scans/{scan_id}/findings/{finding_uuid}/affected_resources" + _url = "/v2/reserved_ipv6/{reserved_ipv6}" path_format_arguments = { - "scan_id": _SERIALIZER.url("scan_id", scan_id, "str"), - "finding_uuid": _SERIALIZER.url("finding_uuid", finding_uuid, "str"), + "reserved_ipv6": _SERIALIZER.url("reserved_ipv6", reserved_ipv6, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_security_list_settings_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_reserved_ipv6_delete_request( + reserved_ipv6: str, **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/security/settings" + _url = "/v2/reserved_ipv6/{reserved_ipv6}" + path_format_arguments = { + "reserved_ipv6": _SERIALIZER.url("reserved_ipv6", reserved_ipv6, "str"), + } - # Construct parameters - if per_page is not None: - _params["per_page"] = _SERIALIZER.query( - "per_page", per_page, "int", maximum=200, minimum=1 - ) - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_security_update_settings_plan_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_reserved_ipv6_actions_post_request( + reserved_ipv6: str, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -11683,7 +11979,12 @@ def build_security_update_settings_plan_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/security/settings/plan" + _url = "/v2/reserved_ipv6/{reserved_ipv6}/actions" + path_format_arguments = { + "reserved_ipv6": _SERIALIZER.url("reserved_ipv6", reserved_ipv6, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -11692,12 +11993,10 @@ def build_security_update_settings_plan_request( ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_security_create_suppression_request( - **kwargs: Any, -) -> HttpRequest: # pylint: disable=name-too-long +def build_byoip_prefixes_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -11706,7 +12005,7 @@ def build_security_create_suppression_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/security/settings/suppressions" + _url = "/v2/byoip_prefixes" # Construct headers if content_type is not None: @@ -11718,18 +12017,68 @@ def build_security_create_suppression_request( return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_security_delete_suppression_request( # pylint: disable=name-too-long - suppression_uuid: str, **kwargs: Any +def build_byoip_prefixes_list_request( + *, per_page: int = 20, page: int = 1, **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/security/settings/suppressions/{suppression_uuid}" + _url = "/v2/byoip_prefixes" + + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) + + +def build_byoip_prefixes_get_request( + byoip_prefix_uuid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/byoip_prefixes/{byoip_prefix_uuid}" path_format_arguments = { - "suppression_uuid": _SERIALIZER.url( - "suppression_uuid", suppression_uuid, "str" + "byoip_prefix_uuid": _SERIALIZER.url( + "byoip_prefix_uuid", byoip_prefix_uuid, "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_byoip_prefixes_delete_request( + byoip_prefix_uuid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/byoip_prefixes/{byoip_prefix_uuid}" + path_format_arguments = { + "byoip_prefix_uuid": _SERIALIZER.url( + "byoip_prefix_uuid", byoip_prefix_uuid, "str" ), } @@ -11741,8 +12090,38 @@ def build_security_delete_suppression_request( # pylint: disable=name-too-long return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_sizes_list_request( - *, per_page: int = 20, page: int = 1, **kwargs: Any +def build_byoip_prefixes_patch_request( + byoip_prefix_uuid: 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/byoip_prefixes/{byoip_prefix_uuid}" + path_format_arguments = { + "byoip_prefix_uuid": _SERIALIZER.url( + "byoip_prefix_uuid", byoip_prefix_uuid, "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="PATCH", url=_url, headers=_headers, **kwargs) + + +def build_byoip_prefixes_list_resources_request( # pylint: disable=name-too-long + byoip_prefix_uuid: str, *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -11750,7 +12129,14 @@ def build_sizes_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/sizes" + _url = "/v2/byoip_prefixes/{byoip_prefix_uuid}/ips" + path_format_arguments = { + "byoip_prefix_uuid": _SERIALIZER.url( + "byoip_prefix_uuid", byoip_prefix_uuid, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters if per_page is not None: @@ -11768,12 +12154,8 @@ def build_sizes_list_request( ) -def build_snapshots_list_request( - *, - per_page: int = 20, - page: int = 1, - resource_type: Optional[str] = None, - **kwargs: Any, +def build_security_list_scans_request( + *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -11781,7 +12163,7 @@ def build_snapshots_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/snapshots" + _url = "/v2/security/scans" # Construct parameters if per_page is not None: @@ -11790,10 +12172,6 @@ def build_snapshots_list_request( ) if page is not None: _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if resource_type is not None: - _params["resource_type"] = _SERIALIZER.query( - "resource_type", resource_type, "str" - ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -11803,53 +12181,68 @@ def build_snapshots_list_request( ) -def build_snapshots_get_request(snapshot_id: JSON, **kwargs: Any) -> HttpRequest: +def build_security_create_scan_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/snapshots/{snapshot_id}" - path_format_arguments = { - "snapshot_id": _SERIALIZER.url("snapshot_id", snapshot_id, "object"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/security/scans" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_snapshots_delete_request(snapshot_id: JSON, **kwargs: Any) -> HttpRequest: +def build_security_get_scan_request( + scan_id: str, + *, + severity: Optional[str] = None, + per_page: int = 20, + page: int = 1, + type: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/snapshots/{snapshot_id}" + _url = "/v2/security/scans/{scan_id}" path_format_arguments = { - "snapshot_id": _SERIALIZER.url("snapshot_id", snapshot_id, "object"), + "scan_id": _SERIALIZER.url("scan_id", scan_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if severity is not None: + _params["severity"] = _SERIALIZER.query("severity", severity, "str") + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_spaces_key_list_request( +def build_security_get_latest_scan_request( *, per_page: int = 20, page: int = 1, - sort: str = "created_at", - sort_direction: str = "desc", - name: Optional[str] = None, - bucket: Optional[str] = None, - permission: Optional[str] = None, + severity: Optional[str] = None, + type: Optional[str] = None, **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -11858,7 +12251,7 @@ def build_spaces_key_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/spaces/keys" + _url = "/v2/security/scans/latest" # Construct parameters if per_page is not None: @@ -11867,18 +12260,10 @@ def build_spaces_key_list_request( ) if page is not None: _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) - if sort is not None: - _params["sort"] = _SERIALIZER.query("sort", sort, "str") - if sort_direction is not None: - _params["sort_direction"] = _SERIALIZER.query( - "sort_direction", sort_direction, "str" - ) - if name is not None: - _params["name"] = _SERIALIZER.query("name", name, "str") - if bucket is not None: - _params["bucket"] = _SERIALIZER.query("bucket", bucket, "str") - if permission is not None: - _params["permission"] = _SERIALIZER.query("permission", permission, "str") + if severity is not None: + _params["severity"] = _SERIALIZER.query("severity", severity, "str") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -11888,7 +12273,7 @@ def build_spaces_key_list_request( ) -def build_spaces_key_create_request(**kwargs: Any) -> HttpRequest: +def build_security_create_scan_rule_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -11897,7 +12282,7 @@ def build_spaces_key_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/spaces/keys" + _url = "/v2/security/scans/rules" # Construct headers if content_type is not None: @@ -11909,45 +12294,69 @@ def build_spaces_key_create_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_spaces_key_get_request(access_key: str, **kwargs: Any) -> HttpRequest: +def build_security_list_scan_finding_affected_resources_request( # pylint: disable=name-too-long + scan_id: str, finding_uuid: str, *, per_page: int = 20, page: int = 1, **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/spaces/keys/{access_key}" + _url = "/v2/security/scans/{scan_id}/findings/{finding_uuid}/affected_resources" path_format_arguments = { - "access_key": _SERIALIZER.url("access_key", access_key, "str"), + "scan_id": _SERIALIZER.url("scan_id", scan_id, "str"), + "finding_uuid": _SERIALIZER.url("finding_uuid", finding_uuid, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_spaces_key_delete_request(access_key: str, **kwargs: Any) -> HttpRequest: +def build_security_list_settings_request( + *, per_page: int = 20, page: int = 1, **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/spaces/keys/{access_key}" - path_format_arguments = { - "access_key": _SERIALIZER.url("access_key", access_key, "str"), - } + _url = "/v2/security/settings" - _url: str = _url.format(**path_format_arguments) # type: ignore + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_spaces_key_update_request(access_key: str, **kwargs: Any) -> HttpRequest: +def build_security_update_settings_plan_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -11956,12 +12365,7 @@ def build_spaces_key_update_request(access_key: str, **kwargs: Any) -> HttpReque accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/spaces/keys/{access_key}" - path_format_arguments = { - "access_key": _SERIALIZER.url("access_key", access_key, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/security/settings/plan" # Construct headers if content_type is not None: @@ -11973,7 +12377,9 @@ def build_spaces_key_update_request(access_key: str, **kwargs: Any) -> HttpReque return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_spaces_key_patch_request(access_key: str, **kwargs: Any) -> HttpRequest: +def build_security_create_suppression_request( + **kwargs: Any, +) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -11982,12 +12388,7 @@ def build_spaces_key_patch_request(access_key: str, **kwargs: Any) -> HttpReques accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/spaces/keys/{access_key}" - path_format_arguments = { - "access_key": _SERIALIZER.url("access_key", access_key, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/security/settings/suppressions" # Construct headers if content_type is not None: @@ -11996,10 +12397,33 @@ def build_spaces_key_patch_request(access_key: str, **kwargs: Any) -> HttpReques ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_tags_list_request( +def build_security_delete_suppression_request( # pylint: disable=name-too-long + suppression_uuid: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/security/settings/suppressions/{suppression_uuid}" + path_format_arguments = { + "suppression_uuid": _SERIALIZER.url( + "suppression_uuid", suppression_uuid, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + + +def build_sizes_list_request( *, per_page: int = 20, page: int = 1, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -12008,7 +12432,7 @@ def build_tags_list_request( accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/tags" + _url = "/v2/sizes" # Construct parameters if per_page is not None: @@ -12026,38 +12450,50 @@ def build_tags_list_request( ) -def build_tags_create_request(**kwargs: Any) -> HttpRequest: +def build_snapshots_list_request( + *, + per_page: int = 20, + page: int = 1, + resource_type: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: Optional[str] = kwargs.pop( - "content_type", _headers.pop("Content-Type", None) - ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/tags" + _url = "/v2/snapshots" - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header( - "content_type", content_type, "str" + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if resource_type is not None: + _params["resource_type"] = _SERIALIZER.query( + "resource_type", resource_type, "str" ) + + # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) -def build_tags_get_request(tag_id: str, **kwargs: Any) -> HttpRequest: +def build_snapshots_get_request(snapshot_id: JSON, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/tags/{tag_id}" + _url = "/v2/snapshots/{snapshot_id}" path_format_arguments = { - "tag_id": _SERIALIZER.url( - "tag_id", tag_id, "str", max_length=255, pattern=r"^[a-zA-Z0-9_\-\:]+$" - ), + "snapshot_id": _SERIALIZER.url("snapshot_id", snapshot_id, "object"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -12068,17 +12504,15 @@ def build_tags_get_request(tag_id: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_tags_delete_request(tag_id: str, **kwargs: Any) -> HttpRequest: +def build_snapshots_delete_request(snapshot_id: JSON, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/tags/{tag_id}" + _url = "/v2/snapshots/{snapshot_id}" path_format_arguments = { - "tag_id": _SERIALIZER.url( - "tag_id", tag_id, "str", max_length=255, pattern=r"^[a-zA-Z0-9_\-\:]+$" - ), + "snapshot_id": _SERIALIZER.url("snapshot_id", snapshot_id, "object"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -12089,7 +12523,54 @@ def build_tags_delete_request(tag_id: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_tags_assign_resources_request(tag_id: str, **kwargs: Any) -> HttpRequest: +def build_spaces_key_list_request( + *, + per_page: int = 20, + page: int = 1, + sort: str = "created_at", + sort_direction: str = "desc", + name: Optional[str] = None, + bucket: Optional[str] = None, + permission: 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/spaces/keys" + + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if sort is not None: + _params["sort"] = _SERIALIZER.query("sort", sort, "str") + if sort_direction is not None: + _params["sort_direction"] = _SERIALIZER.query( + "sort_direction", sort_direction, "str" + ) + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + if bucket is not None: + _params["bucket"] = _SERIALIZER.query("bucket", bucket, "str") + if permission is not None: + _params["permission"] = _SERIALIZER.query("permission", permission, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) + + +def build_spaces_key_create_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -12098,14 +12579,7 @@ def build_tags_assign_resources_request(tag_id: str, **kwargs: Any) -> HttpReque accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/tags/{tag_id}/resources" - path_format_arguments = { - "tag_id": _SERIALIZER.url( - "tag_id", tag_id, "str", max_length=255, pattern=r"^[a-zA-Z0-9_\-\:]+$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = "/v2/spaces/keys" # Construct headers if content_type is not None: @@ -12117,60 +12591,45 @@ def build_tags_assign_resources_request(tag_id: str, **kwargs: Any) -> HttpReque return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_tags_unassign_resources_request(tag_id: str, **kwargs: Any) -> HttpRequest: +def build_spaces_key_get_request(access_key: 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/tags/{tag_id}/resources" + _url = "/v2/spaces/keys/{access_key}" path_format_arguments = { - "tag_id": _SERIALIZER.url( - "tag_id", tag_id, "str", max_length=255, pattern=r"^[a-zA-Z0-9_\-\:]+$" - ), + "access_key": _SERIALIZER.url("access_key", access_key, "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="DELETE", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_vector_databases_list_request( - *, page: Optional[int] = None, per_page: Optional[int] = None, **kwargs: Any -) -> HttpRequest: +def build_spaces_key_delete_request(access_key: str, **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/vector-databases" + _url = "/v2/spaces/keys/{access_key}" + path_format_arguments = { + "access_key": _SERIALIZER.url("access_key", access_key, "str"), + } - # Construct parameters - if page is not None: - _params["page"] = _SERIALIZER.query("page", page, "int") - if per_page is not None: - _params["per_page"] = _SERIALIZER.query("per_page", per_page, "int") + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", url=_url, params=_params, headers=_headers, **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_vector_databases_create_request(**kwargs: Any) -> HttpRequest: +def build_spaces_key_update_request(access_key: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop( @@ -12179,7 +12638,12 @@ def build_vector_databases_create_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/v2/vector-databases" + _url = "/v2/spaces/keys/{access_key}" + path_format_arguments = { + "access_key": _SERIALIZER.url("access_key", access_key, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers if content_type is not None: @@ -12188,25 +12652,243 @@ def build_vector_databases_create_request(**kwargs: Any) -> HttpRequest: ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_vector_databases_get_request(id: str, **kwargs: Any) -> HttpRequest: +def build_spaces_key_patch_request(access_key: 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/vector-databases/{id}" + _url = "/v2/spaces/keys/{access_key}" path_format_arguments = { - "id": _SERIALIZER.url("id", id, "str"), + "access_key": _SERIALIZER.url("access_key", access_key, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - + 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="PATCH", url=_url, headers=_headers, **kwargs) + + +def build_tags_list_request( + *, per_page: int = 20, page: int = 1, **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/tags" + + # Construct parameters + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) + + +def build_tags_create_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 = "/v2/tags" + + # 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_tags_get_request(tag_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/tags/{tag_id}" + path_format_arguments = { + "tag_id": _SERIALIZER.url( + "tag_id", tag_id, "str", max_length=255, pattern=r"^[a-zA-Z0-9_\-\:]+$" + ), + } + + _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_tags_delete_request(tag_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/tags/{tag_id}" + path_format_arguments = { + "tag_id": _SERIALIZER.url( + "tag_id", tag_id, "str", max_length=255, pattern=r"^[a-zA-Z0-9_\-\:]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) + + +def build_tags_assign_resources_request(tag_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/tags/{tag_id}/resources" + path_format_arguments = { + "tag_id": _SERIALIZER.url( + "tag_id", tag_id, "str", max_length=255, pattern=r"^[a-zA-Z0-9_\-\:]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header( + "content_type", content_type, "str" + ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_tags_unassign_resources_request(tag_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop( + "content_type", _headers.pop("Content-Type", None) + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/tags/{tag_id}/resources" + path_format_arguments = { + "tag_id": _SERIALIZER.url( + "tag_id", tag_id, "str", max_length=255, pattern=r"^[a-zA-Z0-9_\-\:]+$" + ), + } + + _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="DELETE", url=_url, headers=_headers, **kwargs) + + +def build_vector_databases_list_request( + *, page: Optional[int] = None, per_page: Optional[int] = 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/vector-databases" + + # Construct parameters + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int") + if per_page is not None: + _params["per_page"] = _SERIALIZER.query("per_page", per_page, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) + + +def build_vector_databases_create_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 = "/v2/vector-databases" + + # 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_vector_databases_get_request(id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/vector-databases/{id}" + path_format_arguments = { + "id": _SERIALIZER.url("id", 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) @@ -17926,14 +18608,14 @@ def build_agent_inference_create_chat_completion_request( # pylint: disable=nam ) -class ToolsOperations: +class ActorLimitsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~pydo.GeneratedClient`'s - :attr:`tools` attribute. + :attr:`actor_limits` attribute. """ def __init__(self, *args, **kwargs): @@ -17946,25 +18628,17 @@ def __init__(self, *args, **kwargs): ) @distributed_trace - def list( - self, - *, - toolkit_id: Optional[str] = None, - page: int = 1, - per_page: int = 20, - **kwargs: Any, - ) -> JSON: + def get(self, actor_id: str, **kwargs: Any) -> JSON: # pylint: disable=line-too-long - """List Tools. + """Get an Actor's Limits. - Lists active Action Gateway tools visible to the authenticated team. + Returns the per-minute limits set for the actor and the limits in effect, each the lower of + your team's limit and the actor's override. Returns 404 when the actor has no sessions, + connections, or limit overrides. - :keyword toolkit_id: Filter tools by toolkit identifier. Default value is None. - :paramtype toolkit_id: str - :keyword page: Which 'page' of paginated results to return. Default value is 1. - :paramtype page: int - :keyword per_page: Number of items returned per page. Default value is 20. - :paramtype per_page: int + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -17974,307 +18648,39 @@ def list( # response body for status code(s): 200 response == { - "definitions": [ + "configured_limits": [ { - "annotations": { - "destructiveHint": bool, # Optional. - "idempotentHint": bool, # Optional. - "openWorldHint": bool, # Optional. - "readOnlyHint": bool, # Optional. - "title": "str" # Optional. - }, - "auth": { - "baseUrlResolution": { - "httpLookup": { - "baseUrlTemplate": "str", # - Optional. HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "caseInsensitive": bool, # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "extractField": "str", # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "matchField": "str", # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "matchValue": "str", # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "match_value_parameter": "str", # - Optional. HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "method": "str", # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "requiredScopes": [ - "str" # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access - token), selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When - both are empty, exactly one entry whose own "scopes" - array contains required_scopes must exist. Configuring - only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - ], - "trimTrailingSlash": bool, # - Optional. HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - "url": "str" # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both - are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one - match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - } - }, - "credentialBinding": "str", # Optional. - "credentialRefSource": "str", # Optional. - "doManagedCredentialRef": "str", # Optional. - "injection": { - "location": "str", # Optional. - "name": "str", # Optional. - "scheme": "str" # Optional. - }, - "modes": [ - "str" # Optional. - ], - "provider": "str", # Optional. - "scopes": [ - "str" # Optional. - ] - }, - "classification": { - "dataClasses": [ - "str" # Optional. - ], - "operation": "str", # Optional. - "risk": "str" # Optional. - }, - "description": "str", # Optional. - "execution": { - "adapterVersion": "str", # Optional. - "configRef": "str", # Optional. - "http": { - "allowedHosts": [ - "str" # Optional. - ], - "baseUrl": "str", # Optional. - "method": "str", # Optional. - "path": "str", # Optional. - "requestEncoding": "str", # Optional. - "responseFormat": "str" # Optional. - }, - "mcp": { - "allowedHosts": [ - "str" # Optional. MCPExecution - describes how to invoke a tool that is fronted by a remote - MCP server (as opposed to a plain HTTP endpoint). endpoint is - the remote MCP server's URL, tool_name is the name the remote - server expects on tools/call (may differ from this tool's - registry name), transport selects the wire protocol - ("streamable_http" is the only kind implemented today), and - server_ref is an opaque label identifying the remote server - for logging/metrics/allowlisting. - ], - "endpoint": "str", # Optional. MCPExecution - describes how to invoke a tool that is fronted by a remote MCP - server (as opposed to a plain HTTP endpoint). endpoint is the - remote MCP server's URL, tool_name is the name the remote server - expects on tools/call (may differ from this tool's registry - name), transport selects the wire protocol ("streamable_http" is - the only kind implemented today), and server_ref is an opaque - label identifying the remote server for - logging/metrics/allowlisting. - "serverRef": "str", # Optional. MCPExecution - describes how to invoke a tool that is fronted by a remote MCP - server (as opposed to a plain HTTP endpoint). endpoint is the - remote MCP server's URL, tool_name is the name the remote server - expects on tools/call (may differ from this tool's registry - name), transport selects the wire protocol ("streamable_http" is - the only kind implemented today), and server_ref is an opaque - label identifying the remote server for - logging/metrics/allowlisting. - "toolName": "str", # Optional. MCPExecution - describes how to invoke a tool that is fronted by a remote MCP - server (as opposed to a plain HTTP endpoint). endpoint is the - remote MCP server's URL, tool_name is the name the remote server - expects on tools/call (may differ from this tool's registry - name), transport selects the wire protocol ("streamable_http" is - the only kind implemented today), and server_ref is an opaque - label identifying the remote server for - logging/metrics/allowlisting. - "transport": "str" # Optional. MCPExecution - describes how to invoke a tool that is fronted by a remote MCP - server (as opposed to a plain HTTP endpoint). endpoint is the - remote MCP server's URL, tool_name is the name the remote server - expects on tools/call (may differ from this tool's registry - name), transport selects the wire protocol ("streamable_http" is - the only kind implemented today), and server_ref is an opaque - label identifying the remote server for - logging/metrics/allowlisting. - }, - "type": "str" # Optional. - }, - "flipperName": "str", # Optional. - "hooks": { - "usage": { - "billable": bool, # Optional. When usage - metadata is present, false prevents billing. Omitting usage - metadata leaves consumers' legacy billing classification - unchanged. - "meters": [ - { - "quantitySource": "str", # - Optional. - "sku": "str", # Optional. - "unit": "str" # Optional. - } - ] - } - }, - "inputSchema": {}, # Optional. Any object. - "name": "str", # Optional. - "outputSchema": {}, # Optional. Any object. - "parallelizable": bool, # Optional. - "policy": { - "permission": "str" # Optional. - }, - "reliability": { - "maxOutputBytes": "str", # Optional. - "retry": { - "backoff": "str", # Optional. - "maxAttempts": 0, # Optional. - "retryOn": [ - "str" # Optional. - ] - }, - "timeoutMs": 0 # Optional. - }, - "schemaVersion": "str", # Optional. - "status": "str", # Optional. - "streamingSafe": bool, # Optional. - "tags": [ - "str" # Optional. - ], - "title": "str", # Optional. - "toolId": "str", # Optional. - "toolSlug": "str", # Optional. tool_slug is the - provider-qualified, stable tool identifier - ":code:``_:code:``". Pass this value back verbatim to - the toolbelt add/remove endpoints; clients should treat it as opaque. - "toolkitId": "str", # Optional. - "transform": { - "input": {}, # Optional. Any object. - "language": "str", # Optional. - "output": {} # Optional. Any object. - }, - "version": "str" # Optional. - } - ], - "pagination": { - "page": 0, # Required. - "per_page": 0, # Required. - "total": 0 # Required. - }, - "tools": [ - { - "annotations": { - "destructiveHint": bool, # Optional. - "idempotentHint": bool, # Optional. - "openWorldHint": bool, # Optional. - "readOnlyHint": bool, # Optional. - "title": "str" # Optional. - }, - "description": "str", # Optional. - "inputSchema": {}, # Optional. Any object. - "name": "str", # Optional. - "outputSchema": {}, # Optional. Any object. - "parallelizable": bool, # Optional. - "streamingSafe": bool, # Optional. - "title": "str", # Optional. - "toolSlug": "str", # Optional. tool_slug is the - provider-qualified, stable tool identifier - ":code:``_:code:``". Pass this value back verbatim to - the toolbelt add/remove endpoints; clients should treat it as opaque - rather than reconstructing it from toolkit_id and name. - "toolkitId": "str", # Optional. - "version": "str" # Optional. + "category": "str", # The category the limit applies to. + Required. Known values are: + "LIMIT_CATEGORY_WEB_SEARCH_REQUESTS_PER_MINUTE", + "LIMIT_CATEGORY_WEB_FETCH_REQUESTS_PER_MINUTE", + "LIMIT_CATEGORY_NATIVE_TOOL_CALLS_REQUESTS_PER_MINUTE", and + "LIMIT_CATEGORY_NON_NATIVE_TOOL_CALLS_REQUESTS_PER_MINUTE". + "requests_per_minute": "str" # Calls allowed per minute. 0 + blocks every call in the category. Required. } ], - "version": "str" # Optional. + "effective_limits": { + "native_tool_calls_requests_per_minute": "str", # Optional. Calls + per minute to DigitalOcean tools. + "non_native_tool_calls_requests_per_minute": "str", # Optional. + Calls per minute to all other tools. + "web_fetch_requests_per_minute": "str", # Optional. Calls per minute + to the ``exa_web_fetch`` tool. + "web_search_requests_per_minute": "str" # Optional. Calls per minute + to the ``exa_web_search`` tool. + } + } + # 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]] = { @@ -18295,10 +18701,8 @@ def list( cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_tools_list_request( - toolkit_id=toolkit_id, - page=page, - per_page=per_page, + _request = build_actor_limits_get_request( + actor_id=actor_id, headers=_headers, params=_params, ) @@ -18313,56 +18717,198 @@ def list( response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = {} - 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.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.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 + def delete( + self, + actor_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Clear an Actor's Limits. + + Removes the actor's overrides for the listed categories, which then follow your team's limits + again. Clearing a category without an override succeeds. + + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON or 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 = { + "categories": [ + "str" # Required. Categories to clear, each at most once. Required. + ] + } + + # 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 + def delete( + self, + actor_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Clear an Actor's Limits. + + Removes the actor's overrides for the listed categories, which then follow your team's limits + again. Clearing a category without an override succeeds. + + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON or JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # 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 - def list_toolkits(self, **kwargs: Any) -> JSON: - """List Toolkits. + def delete( + self, actor_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Clear an Actor's Limits. - Lists the toolkits that group Action Gateway tools. + Removes the actor's overrides for the listed categories, which then follow your team's limits + again. Clearing a category without an override succeeds. - :return: JSON object + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON or JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # JSON input template you can fill out and use as your body input. + body = { + "categories": [ + "str" # Required. Categories to clear, each at most once. Required. + ] + } + + # response body for status code(s): 400, 404 response == { - "toolkits": [ - { - "description": "str", # Optional. - "id": "str", # Optional. - "name": "str" # Optional. - } - ], - "version": "str" # Optional. + "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]] = { @@ -18378,12 +18924,27 @@ def list_toolkits(self, **kwargs: Any) -> JSON: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) 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) - _request = build_tools_list_toolkits_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_actor_limits_delete_request( + actor_id=actor_id, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -18398,76 +18959,5963 @@ def list_toolkits(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = {} - 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 == 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 cls: - return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + if response.content: + deserialized = response.json() + else: + deserialized = None - return cast(JSON, deserialized) # type: ignore + 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 + def update( + self, + actor_id: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Set an Actor's Limits. + + Sets per-minute limits for the listed categories and leaves the others unchanged. A limit may + not exceed your team's current limit for the category (400 otherwise), and 0 blocks every call + in the category. The actor does not need to exist yet. + + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON or 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 = { + "overrides": [ + { + "category": "str", # The category the limit applies to. + Required. Known values are: + "LIMIT_CATEGORY_WEB_SEARCH_REQUESTS_PER_MINUTE", + "LIMIT_CATEGORY_WEB_FETCH_REQUESTS_PER_MINUTE", + "LIMIT_CATEGORY_NATIVE_TOOL_CALLS_REQUESTS_PER_MINUTE", and + "LIMIT_CATEGORY_NON_NATIVE_TOOL_CALLS_REQUESTS_PER_MINUTE". + "requests_per_minute": "str" # Calls allowed per minute. 0 + blocks every call in the category. Required. + } + ] + } + + # 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 + def update( + self, + actor_id: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Set an Actor's Limits. + + Sets per-minute limits for the listed categories and leaves the others unchanged. A limit may + not exceed your team's current limit for the category (400 otherwise), and 0 blocks every call + in the category. The actor does not need to exist yet. + + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON or JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # 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 + def update( + self, actor_id: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Set an Actor's Limits. + + Sets per-minute limits for the listed categories and leaves the others unchanged. A limit may + not exceed your team's current limit for the category (400 otherwise), and 0 blocks every call + in the category. The actor does not need to exist yet. + + :param actor_id: Actor ID: a session ``actor_id`` or a connection ``user_id``\\ , 1 to 64 + characters from ``[A-Za-z0-9._-]``. Required. + :type actor_id: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :return: JSON or 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 = { + "overrides": [ + { + "category": "str", # The category the limit applies to. + Required. Known values are: + "LIMIT_CATEGORY_WEB_SEARCH_REQUESTS_PER_MINUTE", + "LIMIT_CATEGORY_WEB_FETCH_REQUESTS_PER_MINUTE", + "LIMIT_CATEGORY_NATIVE_TOOL_CALLS_REQUESTS_PER_MINUTE", and + "LIMIT_CATEGORY_NON_NATIVE_TOOL_CALLS_REQUESTS_PER_MINUTE". + "requests_per_minute": "str" # Calls allowed per minute. 0 + blocks every call in the category. Required. + } + ] + } + + # 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_actor_limits_update_request( + actor_id=actor_id, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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 ConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.GeneratedClient`'s + :attr:`connections` 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") + ) + + @overload + def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a Connection. + + Connects one of your users, identified by ``user_id``\\ , to a provider so tools can act on + their + account. An OAuth connection starts pending, and authorization carries the URL to send the user + to; + read the connection until it is active or expired. A connection through a team API-key + credential is + active immediately. + + There is one connection per provider and ``user_id`` for each DigitalOcean user who creates + connections. Repeating the request returns the existing connection when its scopes cover the + request, reusing a pending connection's link, and restarts an expired or revoked connection + under + the same ID. Requesting scopes beyond an existing connection's, or a different credential, + returns + 400 until that connection is deleted. + + :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 = { + "provider": "str", # Required provider slug, from the provider list. + Required. + "user_id": "str", # Required. Your identifier for the user the connection + acts for: 1 to 64 characters from ``[A-Za-z0-9._-]``. A session whose + ``actor_id`` equals it uses this connection. Required. + "connection_parameters": {}, # Optional. Values for the provider's + ``connection_parameters``"" , validated against their specifications. + "credential": { + "digitalocean_oauth": {}, # Optional. Use DigitalOcean's shared + OAuth application. + "team_credential": { + "credential_id": "str" # Optional. Required. ID of an active + provider credential for the same provider that you can use. + } + }, + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional CIDR + ranges; when set, every address the host resolves to must + fall within one of them. + ], + "host": "str", # Optional. Host name or IP + address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to 65535. + } + ], + "vpc_uuid": "str" # Optional. UUID of a VPC owned by your + team. + } + }, + "scopes": [ + "str" # Optional. Optional OAuth scopes to request. Defaults to + every scope the provider offers; scopes outside that set are rejected. + Ignored for API-key credentials. + ] + } + + # response body for status code(s): 200 + response == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "connection": { + "api_key": {}, # Optional. Set for ``team_api_key`` connections. + "connection_parameters": {}, # Optional. Non-sensitive provider + configuration. + "created_at": "2020-02-20 00:00:00", # Optional. When the connection + was created. + "credential_id": "str", # Optional. Empty for + ``digitalocean_oauth``"" ; otherwise the ID of the team provider credential + the connection uses. + "credential_kind": "str", # Optional. ``digitalocean_oauth``"" , + ``private_oauth``"" , or ``team_api_key``. Known values are: + "digitalocean_oauth", "private_oauth", and "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. Deprecated: read + ``oauth.granted_at``. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional + CIDR ranges; when set, every address the host resolves to + must fall within one of them. + ], + "host": "str", # Optional. Host name + or IP address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to + 65535. + } + ], + "region": "str", # Optional. Region of the VPC. Set + by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID of a VPC owned by + your team. + } + }, + "oauth": { + "granted_at": "2020-02-20 00:00:00", # Optional. When the + user completed authorization. + "scopes": [ + "str" # Optional. Provider scopes granted, or + requested while pending. + ] + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for example ``jira``. + "provider_display_name": "str", # Optional. Human-readable provider + name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. When the connection + was revoked. + "scopes": [ + "str" # Optional. Deprecated: read ``oauth.scopes``. + Duplicated here so a reader of the pre-union shape keeps working; empty + for a kind with no OAuth grant. + ], + "status": "str", # Optional. pending, active, revoked, or expired. + Known values are: "pending", "active", "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. When the connection + was last modified. + "user_id": "str" # Optional. Your identifier for the user the + connection acts for. + } + } + # response body for status code(s): 400, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a Connection. + + Connects one of your users, identified by ``user_id``\\ , to a provider so tools can act on + their + account. An OAuth connection starts pending, and authorization carries the URL to send the user + to; + read the connection until it is active or expired. A connection through a team API-key + credential is + active immediately. + + There is one connection per provider and ``user_id`` for each DigitalOcean user who creates + connections. Repeating the request returns the existing connection when its scopes cover the + request, reusing a pending connection's link, and restarts an expired or revoked connection + under + the same ID. Requesting scopes beyond an existing connection's, or a different credential, + returns + 400 until that connection is deleted. + + :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 == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "connection": { + "api_key": {}, # Optional. Set for ``team_api_key`` connections. + "connection_parameters": {}, # Optional. Non-sensitive provider + configuration. + "created_at": "2020-02-20 00:00:00", # Optional. When the connection + was created. + "credential_id": "str", # Optional. Empty for + ``digitalocean_oauth``"" ; otherwise the ID of the team provider credential + the connection uses. + "credential_kind": "str", # Optional. ``digitalocean_oauth``"" , + ``private_oauth``"" , or ``team_api_key``. Known values are: + "digitalocean_oauth", "private_oauth", and "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. Deprecated: read + ``oauth.granted_at``. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional + CIDR ranges; when set, every address the host resolves to + must fall within one of them. + ], + "host": "str", # Optional. Host name + or IP address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to + 65535. + } + ], + "region": "str", # Optional. Region of the VPC. Set + by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID of a VPC owned by + your team. + } + }, + "oauth": { + "granted_at": "2020-02-20 00:00:00", # Optional. When the + user completed authorization. + "scopes": [ + "str" # Optional. Provider scopes granted, or + requested while pending. + ] + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for example ``jira``. + "provider_display_name": "str", # Optional. Human-readable provider + name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. When the connection + was revoked. + "scopes": [ + "str" # Optional. Deprecated: read ``oauth.scopes``. + Duplicated here so a reader of the pre-union shape keeps working; empty + for a kind with no OAuth grant. + ], + "status": "str", # Optional. pending, active, revoked, or expired. + Known values are: "pending", "active", "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. When the connection + was last modified. + "user_id": "str" # Optional. Your identifier for the user the + connection acts for. + } + } + # response body for status code(s): 400, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace + def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Create a Connection. + + Connects one of your users, identified by ``user_id``\\ , to a provider so tools can act on + their + account. An OAuth connection starts pending, and authorization carries the URL to send the user + to; + read the connection until it is active or expired. A connection through a team API-key + credential is + active immediately. + + There is one connection per provider and ``user_id`` for each DigitalOcean user who creates + connections. Repeating the request returns the existing connection when its scopes cover the + request, reusing a pending connection's link, and restarts an expired or revoked connection + under + the same ID. Requesting scopes beyond an existing connection's, or a different credential, + returns + 400 until that connection is deleted. + + :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 = { + "provider": "str", # Required provider slug, from the provider list. + Required. + "user_id": "str", # Required. Your identifier for the user the connection + acts for: 1 to 64 characters from ``[A-Za-z0-9._-]``. A session whose + ``actor_id`` equals it uses this connection. Required. + "connection_parameters": {}, # Optional. Values for the provider's + ``connection_parameters``"" , validated against their specifications. + "credential": { + "digitalocean_oauth": {}, # Optional. Use DigitalOcean's shared + OAuth application. + "team_credential": { + "credential_id": "str" # Optional. Required. ID of an active + provider credential for the same provider that you can use. + } + }, + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional CIDR + ranges; when set, every address the host resolves to must + fall within one of them. + ], + "host": "str", # Optional. Host name or IP + address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to 65535. + } + ], + "vpc_uuid": "str" # Optional. UUID of a VPC owned by your + team. + } + }, + "scopes": [ + "str" # Optional. Optional OAuth scopes to request. Defaults to + every scope the provider offers; scopes outside that set are rejected. + Ignored for API-key credentials. + ] + } + + # response body for status code(s): 200 + response == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "connection": { + "api_key": {}, # Optional. Set for ``team_api_key`` connections. + "connection_parameters": {}, # Optional. Non-sensitive provider + configuration. + "created_at": "2020-02-20 00:00:00", # Optional. When the connection + was created. + "credential_id": "str", # Optional. Empty for + ``digitalocean_oauth``"" ; otherwise the ID of the team provider credential + the connection uses. + "credential_kind": "str", # Optional. ``digitalocean_oauth``"" , + ``private_oauth``"" , or ``team_api_key``. Known values are: + "digitalocean_oauth", "private_oauth", and "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. Deprecated: read + ``oauth.granted_at``. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional + CIDR ranges; when set, every address the host resolves to + must fall within one of them. + ], + "host": "str", # Optional. Host name + or IP address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to + 65535. + } + ], + "region": "str", # Optional. Region of the VPC. Set + by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID of a VPC owned by + your team. + } + }, + "oauth": { + "granted_at": "2020-02-20 00:00:00", # Optional. When the + user completed authorization. + "scopes": [ + "str" # Optional. Provider scopes granted, or + requested while pending. + ] + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for example ``jira``. + "provider_display_name": "str", # Optional. Human-readable provider + name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. When the connection + was revoked. + "scopes": [ + "str" # Optional. Deprecated: read ``oauth.scopes``. + Duplicated here so a reader of the pre-union shape keeps working; empty + for a kind with no OAuth grant. + ], + "status": "str", # Optional. pending, active, revoked, or expired. + Known values are: "pending", "active", "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. When the connection + was last modified. + "user_id": "str" # Optional. Your identifier for the user the + connection acts for. + } + } + # response body for status code(s): 400, 409 + 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_connections_create_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, 400, 409]: + 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 == 409: + 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( + self, + *, + provider: Optional[str] = None, + user_id: Optional[str] = None, + status: Optional[str] = None, + sort: Optional[str] = None, + sort_direction: Optional[str] = None, + page: int = 1, + per_page: int = 20, + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """List Connections. + + Returns the connections you can see, excluding revoked ones. Offset-paged with page and + ``per_page``\\ ; filter by provider, ``user_id``\\ , and status. + + :keyword provider: Optional provider slug, matched exactly. Default value is None. + :paramtype provider: str + :keyword user_id: Optional substring of ``user_id``. It must use the ``user_id`` alphabet, + ``[A-Za-z0-9._-]``. Default value is None. + :paramtype user_id: str + :keyword status: pending|active|revoked|expired. List results always omit revoked connections, + including when this filter is revoked. Known values are: "pending", "active", and "expired". + Default value is None. + :paramtype status: str + :keyword sort: ``created_at``\\ , provider, ``user_id``\\ , or status. Defaults to provider, + then ``user_id``. Known values are: "created_at", "provider", "user_id", and "status". Default + value is None. + :paramtype sort: str + :keyword sort_direction: asc (the default) or desc. Known values are: "asc" and "desc". Default + value is None. + :paramtype sort_direction: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "connections": [ + { + "api_key": {}, # Optional. Set for ``team_api_key`` + connections. + "connection_parameters": {}, # Optional. Non-sensitive + provider configuration. + "created_at": "2020-02-20 00:00:00", # Optional. When the + connection was created. + "credential_id": "str", # Optional. Empty for + ``digitalocean_oauth``"" ; otherwise the ID of the team provider + credential the connection uses. + "credential_kind": "str", # Optional. + ``digitalocean_oauth``"" , ``private_oauth``"" , or ``team_api_key``. + Known values are: "digitalocean_oauth", "private_oauth", and + "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. Deprecated: + read ``oauth.granted_at``. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. + Optional CIDR ranges; when set, every address the + host resolves to must fall within one of them. + ], + "host": "str", # Optional. + Host name or IP address. It must resolve only to private + addresses. + "port": 0 # Optional. Port, + 1 to 65535. + } + ], + "region": "str", # Optional. Region of the + VPC. Set by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID of a VPC + owned by your team. + } + }, + "oauth": { + "granted_at": "2020-02-20 00:00:00", # Optional. + When the user completed authorization. + "scopes": [ + "str" # Optional. Provider scopes granted, + or requested while pending. + ] + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of + the user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for example + ``jira``. + "provider_display_name": "str", # Optional. Human-readable + provider name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. When the + connection was revoked. + "scopes": [ + "str" # Optional. Deprecated: read ``oauth.scopes``. + Duplicated here so a reader of the pre-union shape keeps working; + empty for a kind with no OAuth grant. + ], + "status": "str", # Optional. pending, active, revoked, or + expired. Known values are: "pending", "active", "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. When the + connection was last modified. + "user_id": "str" # Optional. Your identifier for the user + the connection acts for. + } + ], + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. + } + } + # 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_connections_list_request( + provider=provider, + user_id=user_id, + status=status, + sort=sort, + sort_direction=sort_direction, + page=page, + per_page=per_page, + 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 get(self, id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Get a Connection. + + Returns the connection and, while it is pending, the authorization the user still has to + complete. Reading a pending connection picks up a completed authorization, and marks the + connection expired once its link has lapsed. Returns 404 for an unknown connection or one you + cannot see. + + :param id: Connection ID. Required. + :type id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "connection": { + "api_key": {}, # Optional. Set for ``team_api_key`` connections. + "connection_parameters": {}, # Optional. Non-sensitive provider + configuration. + "created_at": "2020-02-20 00:00:00", # Optional. When the connection + was created. + "credential_id": "str", # Optional. Empty for + ``digitalocean_oauth``"" ; otherwise the ID of the team provider credential + the connection uses. + "credential_kind": "str", # Optional. ``digitalocean_oauth``"" , + ``private_oauth``"" , or ``team_api_key``. Known values are: + "digitalocean_oauth", "private_oauth", and "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. Deprecated: read + ``oauth.granted_at``. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional + CIDR ranges; when set, every address the host resolves to + must fall within one of them. + ], + "host": "str", # Optional. Host name + or IP address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to + 65535. + } + ], + "region": "str", # Optional. Region of the VPC. Set + by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID of a VPC owned by + your team. + } + }, + "oauth": { + "granted_at": "2020-02-20 00:00:00", # Optional. When the + user completed authorization. + "scopes": [ + "str" # Optional. Provider scopes granted, or + requested while pending. + ] + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for example ``jira``. + "provider_display_name": "str", # Optional. Human-readable provider + name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. When the connection + was revoked. + "scopes": [ + "str" # Optional. Deprecated: read ``oauth.scopes``. + Duplicated here so a reader of the pre-union shape keeps working; empty + for a kind with no OAuth grant. + ], + "status": "str", # Optional. pending, active, revoked, or expired. + Known values are: "pending", "active", "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. When the connection + was last modified. + "user_id": "str" # Optional. Your identifier for the user the + connection acts for. + } + } + # 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_connections_get_request( + id=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 delete(self, id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Delete a Connection. + + Marks the connection revoked and returns it; for an OAuth connection, its stored tokens are + deleted first. Creating a connection for the same provider and ``user_id`` later reuses the + same ID. Only the user who created the connection can delete it; for anyone else it is 404. + + :param id: Connection ID. Required. + :type id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "connection": { + "api_key": {}, # Optional. Set for ``team_api_key`` connections. + "connection_parameters": {}, # Optional. Non-sensitive provider + configuration. + "created_at": "2020-02-20 00:00:00", # Optional. When the connection + was created. + "credential_id": "str", # Optional. Empty for + ``digitalocean_oauth``"" ; otherwise the ID of the team provider credential + the connection uses. + "credential_kind": "str", # Optional. ``digitalocean_oauth``"" , + ``private_oauth``"" , or ``team_api_key``. Known values are: + "digitalocean_oauth", "private_oauth", and "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. Deprecated: read + ``oauth.granted_at``. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # Optional. Optional + CIDR ranges; when set, every address the host resolves to + must fall within one of them. + ], + "host": "str", # Optional. Host name + or IP address. It must resolve only to private addresses. + "port": 0 # Optional. Port, 1 to + 65535. + } + ], + "region": "str", # Optional. Region of the VPC. Set + by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID of a VPC owned by + your team. + } + }, + "oauth": { + "granted_at": "2020-02-20 00:00:00", # Optional. When the + user completed authorization. + "scopes": [ + "str" # Optional. Provider scopes granted, or + requested while pending. + ] + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for example ``jira``. + "provider_display_name": "str", # Optional. Human-readable provider + name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. When the connection + was revoked. + "scopes": [ + "str" # Optional. Deprecated: read ``oauth.scopes``. + Duplicated here so a reader of the pre-union shape keeps working; empty + for a kind with no OAuth grant. + ], + "status": "str", # Optional. pending, active, revoked, or expired. + Known values are: "pending", "active", "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. When the connection + was last modified. + "user_id": "str" # Optional. Your identifier for the user the + connection acts for. + } + } + # 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_connections_delete_request( + id=id, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + +class McpServersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.GeneratedClient`'s + :attr:`mcp_servers` 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") + ) + + @overload + def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Register an MCP Server. + + Registers a remote MCP server for your team, using the streamable HTTP transport. The server + starts with ``syncStatus`` pending and no tools: discover its tools with ``POST + .../mcp-servers/{server_ref}/resync``\\ , then choose which to enable with ``PUT + .../mcp-servers/{server_ref}/tools``. The endpoint must be HTTPS and resolve only to public IP + addresses. The number of servers per team is limited (10 by default); registering beyond it + returns 429. Returns 409 when ``serverRef`` is already in use. + + :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 = { + "endpoint": "str", # HTTPS URL of the server's MCP endpoint. Its host must + resolve only to public IP addresses. Required. Required. + "serverRef": "str", # Identifier for the server, unique within your team. + Must match ``^``"" [a-z]"" ```[a-z0-9-]``"" {0,63}$`. Required. + "api_key": "str", # Optional. For ``credentialRefSource`` secret: the key or + token itself. DigitalOcean stores it; it is write-only and no response returns + it. Set exactly one of ``credentialRef`` and ``api_key``. + "credentialRef": "str", # Optional. For ``credentialRefSource`` secret: a + reference to a secret your team stores with DigitalOcean. Must match ``^``"" + [A-Za-z0-9]"" ```[A-Za-z0-9:/_.-]``"" {0,254}$"" ``. Set exactly one of``"" + credentialRef"" ``and``"" api_key`. + "credentialRefSource": "none", # Optional. Default value is "none". How + requests to the server authenticate: none (the default), secret, or connection. + With secret, the value from ``credentialRef`` or ``api_key`` is sent in the + Authorization header, prefixed with "Bearer " unless it already contains a space. + Known values are: "none", "secret", and "connection". + "description": "str", # Optional. Optional description shown on the server's + catalog card. At most 1024 characters. + "oauth_authorization_ttl_seconds": "str", # Optional. How long, in seconds, + a user's authorization may be reused before they must consent again. Optional; 0 + means 30 days, and the maximum is 100 years. Authorizations are not refreshed + automatically, so this window, not the provider's token lifetime, decides how + often a user is sent back through consent. Set it no longer than the provider's + own token lifetime, so the prompt arrives before a tool call fails against an + expired token. + "oauth_authorize_url": "str", # Optional. Required for + ``credentialRefSource`` connection: the OAuth authorization endpoint. It must use + the endpoint's scheme and port, on the endpoint's host or another host under the + same registrable domain. + "oauth_client_id": "str", # Optional. Required for ``credentialRefSource`` + connection: the client ID of your team's OAuth client for the server. Each user + of the server then authorizes individually. + "oauth_client_secret": "str", # Optional. Required for + ``credentialRefSource`` connection. Write-only; no response returns it. + "oauth_scopes": [ + "str" # Optional. Required for ``credentialRefSource`` connection: + the scopes to request from each user, 1 to 64 of them. + ], + "oauth_token_url": "str", # Optional. Required for ``credentialRefSource`` + connection: the OAuth token endpoint, under the same rules as + ``oauth_authorize_url``. + "transport": "streamable_http" # Optional. Default value is + "streamable_http". Optional. ``streamable_http``"" , the default and only + accepted value. "streamable_http" + } + + # response body for status code(s): 200 + response == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # response body for status code(s): 400, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Register an MCP Server. + + Registers a remote MCP server for your team, using the streamable HTTP transport. The server + starts with ``syncStatus`` pending and no tools: discover its tools with ``POST + .../mcp-servers/{server_ref}/resync``\\ , then choose which to enable with ``PUT + .../mcp-servers/{server_ref}/tools``. The endpoint must be HTTPS and resolve only to public IP + addresses. The number of servers per team is limited (10 by default); registering beyond it + returns 429. Returns 409 when ``serverRef`` is already in use. + + :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 == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # response body for status code(s): 400, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace + def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Register an MCP Server. + + Registers a remote MCP server for your team, using the streamable HTTP transport. The server + starts with ``syncStatus`` pending and no tools: discover its tools with ``POST + .../mcp-servers/{server_ref}/resync``\\ , then choose which to enable with ``PUT + .../mcp-servers/{server_ref}/tools``. The endpoint must be HTTPS and resolve only to public IP + addresses. The number of servers per team is limited (10 by default); registering beyond it + returns 429. Returns 409 when ``serverRef`` is already in use. + + :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 = { + "endpoint": "str", # HTTPS URL of the server's MCP endpoint. Its host must + resolve only to public IP addresses. Required. Required. + "serverRef": "str", # Identifier for the server, unique within your team. + Must match ``^``"" [a-z]"" ```[a-z0-9-]``"" {0,63}$`. Required. + "api_key": "str", # Optional. For ``credentialRefSource`` secret: the key or + token itself. DigitalOcean stores it; it is write-only and no response returns + it. Set exactly one of ``credentialRef`` and ``api_key``. + "credentialRef": "str", # Optional. For ``credentialRefSource`` secret: a + reference to a secret your team stores with DigitalOcean. Must match ``^``"" + [A-Za-z0-9]"" ```[A-Za-z0-9:/_.-]``"" {0,254}$"" ``. Set exactly one of``"" + credentialRef"" ``and``"" api_key`. + "credentialRefSource": "none", # Optional. Default value is "none". How + requests to the server authenticate: none (the default), secret, or connection. + With secret, the value from ``credentialRef`` or ``api_key`` is sent in the + Authorization header, prefixed with "Bearer " unless it already contains a space. + Known values are: "none", "secret", and "connection". + "description": "str", # Optional. Optional description shown on the server's + catalog card. At most 1024 characters. + "oauth_authorization_ttl_seconds": "str", # Optional. How long, in seconds, + a user's authorization may be reused before they must consent again. Optional; 0 + means 30 days, and the maximum is 100 years. Authorizations are not refreshed + automatically, so this window, not the provider's token lifetime, decides how + often a user is sent back through consent. Set it no longer than the provider's + own token lifetime, so the prompt arrives before a tool call fails against an + expired token. + "oauth_authorize_url": "str", # Optional. Required for + ``credentialRefSource`` connection: the OAuth authorization endpoint. It must use + the endpoint's scheme and port, on the endpoint's host or another host under the + same registrable domain. + "oauth_client_id": "str", # Optional. Required for ``credentialRefSource`` + connection: the client ID of your team's OAuth client for the server. Each user + of the server then authorizes individually. + "oauth_client_secret": "str", # Optional. Required for + ``credentialRefSource`` connection. Write-only; no response returns it. + "oauth_scopes": [ + "str" # Optional. Required for ``credentialRefSource`` connection: + the scopes to request from each user, 1 to 64 of them. + ], + "oauth_token_url": "str", # Optional. Required for ``credentialRefSource`` + connection: the OAuth token endpoint, under the same rules as + ``oauth_authorize_url``. + "transport": "streamable_http" # Optional. Default value is + "streamable_http". Optional. ``streamable_http``"" , the default and only + accepted value. "streamable_http" + } + + # response body for status code(s): 200 + response == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # response body for status code(s): 400, 409 + 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_mcp_servers_create_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, 400, 409]: + 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 == 409: + 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(self, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """List MCP Servers. + + Returns every MCP server your team has registered, sorted by ``serverRef``. + + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "mcpServers": [ + { + "createdAt": "str", # Optional. When the server was + registered, in RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference + supplied at registration when source=secret, or the team's OAuth + credential ID when source=connection. Empty when the server was + registered with an ``api_key``"" , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to + the server authenticate: none, secret (a key or token sent in the + Authorization header), or connection (each user's own OAuth + authorization). Known values are: "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, + shown on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last + succeeded, in RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How + long a user's authorization is reused before re-consent. Echoed so a team + can read the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth + authorization endpoint. Set only when ``credentialRefSource`` is + connection; the client secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each + user. Set only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique + within your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery + failed; empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest + discovery: pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known + values are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on + the server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last + modified, in RFC 3339 format. + } + ] + } + """ + 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_mcp_servers_list_request( + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace + def get(self, server_ref: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Get an MCP Server. + + Returns one of your team's MCP servers, or 404 when your team has none with this ``serverRef``. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # 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_mcp_servers_get_request( + server_ref=server_ref, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + def patch( + self, + server_ref: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Update an MCP Server. + + Changes the server's description, which is shown on its catalog card immediately. The endpoint + and credentials cannot be changed; to change them, delete the server and register it again. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 = { + "description": "str" # Optional. Replaces the stored description; empty + clears it. At most 1024 characters. + } + + # response body for status code(s): 200 + response == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # 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 + def patch( + self, + server_ref: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Update an MCP Server. + + Changes the server's description, which is shown on its catalog card immediately. The endpoint + and credentials cannot be changed; to change them, delete the server and register it again. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # 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 + def patch( + self, server_ref: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Update an MCP Server. + + Changes the server's description, which is shown on its catalog card immediately. The endpoint + and credentials cannot be changed; to change them, delete the server and register it again. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 = { + "description": "str" # Optional. Replaces the stored description; empty + clears it. At most 1024 characters. + } + + # response body for status code(s): 200 + response == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # 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_mcp_servers_patch_request( + server_ref=server_ref, + 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, 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 + + @distributed_trace + def delete(self, server_ref: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Delete an MCP Server. + + Disables all of the server's tools, removes them from your team's catalog, and deletes the + server. An ``api_key`` supplied at registration is deleted; a ``credentialRef`` you supplied is + left untouched. For a server registered with ``credentialRefSource`` connection, every user + connection made through its OAuth client is revoked. Returns the deleted server, or 404 when it + does not exist. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + } + } + # 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_mcp_servers_delete_request( + server_ref=server_ref, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + def run_resync( + self, + server_ref: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Discover an MCP Server's Tools. + + Connects to the server, lists its tools, and records them. Discovered tools are not callable + until + you enable them. + + When discovery finishes in time, returns 200 with the server and its tools; a discovery failure + is + reported in ``syncStatus`` and ``syncError`` rather than as an error. Otherwise returns 202 + with pending + set while discovery continues: poll ``GET .../mcp-servers/{server_ref}`` until ``lastSyncedAt`` + or + ``syncError`` changes (\\ ``syncStatus`` is not reset while discovery runs). + + For a server registered with ``credentialRefSource`` connection, ``user_id`` is required; if + that user + has not authorized the server yet, the response carries authorization with the URL to send them + to. + Resyncs are rate limited per team, and a team can run only a few discoveries at once; either + limit + returns 429. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 = { + "user_id": "str" # Optional. Required for a server registered with + ``credentialRefSource`` connection: discovery reaches the server as this user, + through their connection, because such a server has no team-wide credential. + Ignored otherwise. + } + + # response body for status code(s): 200, 202 + response == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + }, + "pending": bool, # Optional. True when discovery is still running (HTTP + 202). Poll the server to see the outcome. + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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 + def run_resync( + self, + server_ref: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Discover an MCP Server's Tools. + + Connects to the server, lists its tools, and records them. Discovered tools are not callable + until + you enable them. + + When discovery finishes in time, returns 200 with the server and its tools; a discovery failure + is + reported in ``syncStatus`` and ``syncError`` rather than as an error. Otherwise returns 202 + with pending + set while discovery continues: poll ``GET .../mcp-servers/{server_ref}`` until ``lastSyncedAt`` + or + ``syncError`` changes (\\ ``syncStatus`` is not reset while discovery runs). + + For a server registered with ``credentialRefSource`` connection, ``user_id`` is required; if + that user + has not authorized the server yet, the response carries authorization with the URL to send them + to. + Resyncs are rate limited per team, and a team can run only a few discoveries at once; either + limit + returns 429. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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, 202 + response == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + }, + "pending": bool, # Optional. True when discovery is still running (HTTP + 202). Poll the server to see the outcome. + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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 + def run_resync( + self, server_ref: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Discover an MCP Server's Tools. + + Connects to the server, lists its tools, and records them. Discovered tools are not callable + until + you enable them. + + When discovery finishes in time, returns 200 with the server and its tools; a discovery failure + is + reported in ``syncStatus`` and ``syncError`` rather than as an error. Otherwise returns 202 + with pending + set while discovery continues: poll ``GET .../mcp-servers/{server_ref}`` until ``lastSyncedAt`` + or + ``syncError`` changes (\\ ``syncStatus`` is not reset while discovery runs). + + For a server registered with ``credentialRefSource`` connection, ``user_id`` is required; if + that user + has not authorized the server yet, the response carries authorization with the URL to send them + to. + Resyncs are rate limited per team, and a team can run only a few discoveries at once; either + limit + returns 429. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 = { + "user_id": "str" # Optional. Required for a server registered with + ``credentialRefSource`` connection: discovery reaches the server as this user, + through their connection, because such a server has no team-wide credential. + Ignored otherwise. + } + + # response body for status code(s): 200, 202 + response == { + "authorization": { + "connect_url": "str", # Optional. Browser URL, on a DigitalOcean + Cloud origin, where the user authorizes the connection. + "expires_at": "2020-02-20 00:00:00", # Optional. When the + authorization expires. The link can stop working earlier; if the connection + becomes expired, create it again for a new link. + "status": "str", # Optional. Currently always + ``requires_authorization``. "requires_authorization" + "verification_code": "str" # Optional. Verification code issued with + ``connect_url``. + }, + "mcpServer": { + "createdAt": "str", # Optional. When the server was registered, in + RFC 3339 format. + "credentialRef": "str", # Optional. The secret reference supplied at + registration when source=secret, or the team's OAuth credential ID when + source=connection. Empty when the server was registered with an ``api_key``"" + , whose storage DigitalOcean manages. + "credentialRefSource": "str", # Optional. How requests to the server + authenticate: none, secret (a key or token sent in the Authorization header), + or connection (each user's own OAuth authorization). Known values are: + "none", "secret", and "connection". + "description": "str", # Optional. Team-authored description, shown + on the server's catalog card. A resync does not replace it. + "endpoint": "str", # Optional. HTTPS URL of the server's MCP + endpoint. + "lastSyncedAt": "str", # Optional. When discovery last succeeded, in + RFC 3339 format; empty until the first success. + "oauth_authorization_ttl_seconds": "str", # Optional. How long a + user's authorization is reused before re-consent. Echoed so a team can read + the window without re-registering to discover it. + "oauth_authorize_url": "str", # Optional. OAuth authorization + endpoint. Set only when ``credentialRefSource`` is connection; the client + secret is never returned. + "oauth_scopes": [ + "str" # Optional. OAuth scopes requested from each user. Set + only when ``credentialRefSource`` is connection. + ], + "protocolVersion": "str", # Optional. MCP protocol revision + negotiated with the server. + "serverRef": "str", # Optional. Server identifier, unique within + your team. The server's tool slugs are ``_``. + "syncError": "str", # Optional. Why the latest discovery failed; + empty after a successful one. + "syncStatus": "str", # Optional. Outcome of the latest discovery: + pending (no discovery has finished yet), ok, failed, or + ``unsupported_protocol``. It is not reset while a resync runs. Known values + are: "pending", "ok", "failed", and "unsupported_protocol". + "toolCount": 0, # Optional. Number of tools discovered on the + server, whether enabled or not. + "transport": "str", # Optional. Always ``streamable_http``. + "streamable_http" + "updatedAt": "str" # Optional. When the server was last modified, in + RFC 3339 format. + }, + "pending": bool, # Optional. True when discovery is still running (HTTP + 202). Poll the server to see the outcome. + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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_mcp_servers_run_resync_request( + server_ref=server_ref, + 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, 202, 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 == 202: + 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 + + @distributed_trace + def list_tools(self, server_ref: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """List an MCP Server's Tools. + + Returns every tool discovered on the server, sorted by name, with whether each is enabled. + Tools that have since disappeared from the server stay listed. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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_mcp_servers_list_tools_request( + server_ref=server_ref, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @overload + def update_tools( + self, + server_ref: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Set Which of an MCP Server's Tools Are Enabled. + + ``enabledToolSlugs`` is the complete set to enable; every other tool of the server is disabled. + An + enabled tool is added to your team's catalog at its latest discovered version, and a disabled + one is + removed from it. Repeating the same set changes nothing. + + Before changing anything, each tool being enabled, re-enabled, or moved to a newer discovered + version is verified against the live server: it must still be listed there, with the same input + schema as when it was discovered. If any check fails or the server cannot be reached, the + request + fails with 400 and nothing changes; resync and try again. An unknown tool slug is also rejected + with + + + #. A request that needs verification counts against the resync rate limit (429). Returns the + server's full tool list. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 = { + "enabledToolSlugs": [ + "str" # The complete set of tool slugs ("" ``_``"" + ) to enable; every other tool of the server is disabled. Empty disables every + tool. Required. + ], + "user_id": "str" # Optional. Required for a server registered with + ``credentialRefSource`` connection when a tool needs verification against the + live server, which can only be reached as a user who has authorized it. Ignored + otherwise. + } + + # response body for status code(s): 200 + response == { + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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 + def update_tools( + self, + server_ref: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Set Which of an MCP Server's Tools Are Enabled. + + ``enabledToolSlugs`` is the complete set to enable; every other tool of the server is disabled. + An + enabled tool is added to your team's catalog at its latest discovered version, and a disabled + one is + removed from it. Repeating the same set changes nothing. + + Before changing anything, each tool being enabled, re-enabled, or moved to a newer discovered + version is verified against the live server: it must still be listed there, with the same input + schema as when it was discovered. If any check fails or the server cannot be reached, the + request + fails with 400 and nothing changes; resync and try again. An unknown tool slug is also rejected + with + + + #. A request that needs verification counts against the resync rate limit (429). Returns the + server's full tool list. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 == { + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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 + def update_tools( + self, server_ref: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Set Which of an MCP Server's Tools Are Enabled. + + ``enabledToolSlugs`` is the complete set to enable; every other tool of the server is disabled. + An + enabled tool is added to your team's catalog at its latest discovered version, and a disabled + one is + removed from it. Repeating the same set changes nothing. + + Before changing anything, each tool being enabled, re-enabled, or moved to a newer discovered + version is verified against the live server: it must still be listed there, with the same input + schema as when it was discovered. If any check fails or the server cannot be reached, the + request + fails with 400 and nothing changes; resync and try again. An unknown tool slug is also rejected + with + + + #. A request that needs verification counts against the resync rate limit (429). Returns the + server's full tool list. + + :param server_ref: Server identifier (\\ ``serverRef``\\ ) of one of your team's MCP servers. + Required. + :type server_ref: 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 = { + "enabledToolSlugs": [ + "str" # The complete set of tool slugs ("" ``_``"" + ) to enable; every other tool of the server is disabled. Empty disables every + tool. Required. + ], + "user_id": "str" # Optional. Required for a server registered with + ``credentialRefSource`` connection when a tool needs verification against the + live server, which can only be reached as a user who has authorized it. Ignored + otherwise. + } + + # response body for status code(s): 200 + response == { + "tools": [ + { + "description": "str", # Optional. Tool description as the + server reports it. + "enabled": bool, # Optional. Whether the tool is enabled in + your team's catalog. + "name": "str", # Optional. Tool name as the server reports + it, normalized to the catalog's naming rules. + "quarantineReason": "str", # Optional. Why the tool was + quarantined; empty otherwise. + "quarantined": bool, # Optional. True when the enabled tool + was suspended because it disappeared from the server or its input schema + changed incompatibly. Calls to it fail until it is enabled again. + "toolSlug": "str" # Optional. ``_``"" : + the tool's catalog slug, and the value to list in ``enabledToolSlugs``. + } + ] + } + # 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_mcp_servers_update_tools_request( + server_ref=server_ref, + 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, 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 OutputViewsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.GeneratedClient`'s + :attr:`output_views` 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") + ) + + @overload + def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create an Output View. + + An output view is a named projection of one tool version's output: tool calls that use it + return only the listed fields, and its ``output_schema`` describes the result. The view is + bound to the tool version your catalog currently releases. Returns 409 when your team already + has a view with this name on the tool version, and 429 when your team already has the maximum + of 20 views on it. + + :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 = { + "fields": [ + "str" # Output paths to keep, 1 to 64 of them. Each is a dotted path + of up to 8 segments made of ``[A-Za-z0-9_-]``"" , and must be declared by the + tool's output schema; arrays are traversed element-wise. Paths may not repeat + or be a prefix of one another. The tool version must declare an object output + schema. Required. + ], + "name": "str", # View name. Must match ``^``"" [a-z]"" ```[a-z0-9_-]``"" + {0,63}$` and be unique per tool version within your team. Required. + "description": "str", # Optional. Optional description. At most 512 bytes. + "tool": "str", # Optional. Exactly one of tool or ``tool_id`` selects the + tool version. tool is a provider-qualified slug, optionally pinned as + ``@``. You can bind only the released version your catalog + exposes: an unpinned slug resolves it and the response echoes it as version; a + pin must equal it, and a ``tool_id`` (the opaque identity from tool search) must + be that version. Any other version returns 404. + "tool_id": "str" # Optional. Opaque ID of the tool version; see tool. + } + + # response body for status code(s): 200 + response == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # response body for status code(s): 400, 404, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create an Output View. + + An output view is a named projection of one tool version's output: tool calls that use it + return only the listed fields, and its ``output_schema`` describes the result. The view is + bound to the tool version your catalog currently releases. Returns 409 when your team already + has a view with this name on the tool version, and 429 when your team already has the maximum + of 20 views on it. + + :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 == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # response body for status code(s): 400, 404, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace + def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Create an Output View. + + An output view is a named projection of one tool version's output: tool calls that use it + return only the listed fields, and its ``output_schema`` describes the result. The view is + bound to the tool version your catalog currently releases. Returns 409 when your team already + has a view with this name on the tool version, and 429 when your team already has the maximum + of 20 views on it. + + :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 = { + "fields": [ + "str" # Output paths to keep, 1 to 64 of them. Each is a dotted path + of up to 8 segments made of ``[A-Za-z0-9_-]``"" , and must be declared by the + tool's output schema; arrays are traversed element-wise. Paths may not repeat + or be a prefix of one another. The tool version must declare an object output + schema. Required. + ], + "name": "str", # View name. Must match ``^``"" [a-z]"" ```[a-z0-9_-]``"" + {0,63}$` and be unique per tool version within your team. Required. + "description": "str", # Optional. Optional description. At most 512 bytes. + "tool": "str", # Optional. Exactly one of tool or ``tool_id`` selects the + tool version. tool is a provider-qualified slug, optionally pinned as + ``@``. You can bind only the released version your catalog + exposes: an unpinned slug resolves it and the response echoes it as version; a + pin must equal it, and a ``tool_id`` (the opaque identity from tool search) must + be that version. Any other version returns 404. + "tool_id": "str" # Optional. Opaque ID of the tool version; see tool. + } + + # response body for status code(s): 200 + response == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # response body for status code(s): 400, 404, 409 + 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_output_views_create_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, 400, 404, 409]: + 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 response.status_code == 409: + 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( + self, + *, + tool: Optional[str] = None, + tool_id: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """List Output Views. + + Returns the output views your team can use: views DigitalOcean publishes to every team, plus + your team's own. Cursor-paged with ``page_size`` and ``page_token``\\ ; no total is reported. + + :keyword tool: At most one of tool or ``tool_id``\\ , as on create. With one set, the list is + the published views plus your team's own on that tool version. With neither, it is every live + view your team owns plus every published view on a tool version your catalog exposes, across + tools. Default value is None. + :paramtype tool: str + :keyword tool_id: Opaque ID of the tool version; see tool. Default value is None. + :paramtype tool_id: str + :keyword page_size: Page size, 1 to 100. Defaults to 20 when omitted or 0; other values are + rejected with 400. Default value is 20. + :paramtype page_size: int + :keyword page_token: ``next_page_token`` from the previous response. Valid only with the same + tool selection; otherwise the request is rejected with 400. Default value is None. + :paramtype page_token: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "next_page_token": "str", # Optional. Empty on the last page. + "tool": "str", # Optional. Tool slug of that version. Empty when the request + named no tool. + "tool_id": "str", # Optional. The tool version the views are bound to, + echoed so an unpinned request learns which version it resolved. Empty when the + request named no tool. + "version": "str", # Optional. Version of that tool, for example ``v3``. + Empty when the request named no tool. + "views": [ + { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When + the resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set + once the resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When + the resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a + projection keeps; arrays are traversed element-wise. Empty for a + transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` + or ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool + version among its owner's views. + "output_schema": {}, # Optional. The JSON Schema every + result of this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's + views, and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, + for example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the + exact tool version the view is bound to; tool and version are its + readable coordinates. + "version": "str", # Optional. The tool version, for example + ``v3``. + "view_id": "str" # Optional. Output view ID, for example + ``ov_`` followed by 32 hex digits. Empty on a preview. + } + ] + } + # 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_output_views_list_request( + tool=tool, + tool_id=tool_id, + page_size=page_size, + page_token=page_token, + 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, 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 + + @overload + def validate( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Preview an Output View. + + Validates a projection exactly as create does and returns the view it would produce, including + ``output_schema``\\ , without storing anything. name and description are optional here; name + uniqueness and the per-tool-version limit are not checked. + + :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 = { + "fields": [ + "str" # Output paths to keep; as on create. Required. + ], + "description": "str", # Optional. Optional description, validated as on + create when present. + "name": "str", # Optional. Optional view name, validated as on create when + present. + "tool": "str", # Optional. Tool slug, optionally pinned; as on create. + "tool_id": "str" # Optional. Opaque ID of the tool version; as on create. + } + + # response body for status code(s): 200 + response == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # 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 + def validate( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Preview an Output View. + + Validates a projection exactly as create does and returns the view it would produce, including + ``output_schema``\\ , without storing anything. name and description are optional here; name + uniqueness and the per-tool-version limit are not checked. + + :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 == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # 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 + def validate(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Preview an Output View. + + Validates a projection exactly as create does and returns the view it would produce, including + ``output_schema``\\ , without storing anything. name and description are optional here; name + uniqueness and the per-tool-version limit are not checked. + + :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 = { + "fields": [ + "str" # Output paths to keep; as on create. Required. + ], + "description": "str", # Optional. Optional description, validated as on + create when present. + "name": "str", # Optional. Optional view name, validated as on create when + present. + "tool": "str", # Optional. Tool slug, optionally pinned; as on create. + "tool_id": "str" # Optional. Opaque ID of the tool version; as on create. + } + + # response body for status code(s): 200 + response == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # 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_output_views_validate_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, 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 + + @distributed_trace + def get(self, view_id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Get an Output View. + + Returns one of your team's views, or a published view on a tool version your catalog exposes. + Returns 404 when the view does not exist, was deleted, or belongs to another team. + + :param view_id: Output view ID. Required. + :type view_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # 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_output_views_get_request( + view_id=view_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 delete(self, view_id: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Delete an Output View. + + Deletes one of your team's views and returns it with audit.deleted_at set; it can no longer be + used. Published views cannot be deleted. Returns 404 when the view does not exist, is already + deleted, or is not your team's. + + :param view_id: Output view ID. Required. + :type view_id: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "view": { + "audit": { + "createdAt": "2020-02-20 00:00:00", # Optional. When the + resource was created. + "deletedAt": "2020-02-20 00:00:00", # Optional. Set once the + resource is deleted. + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + resource was last modified. + }, + "description": "str", # Optional. View description. + "fields": [ + "str" # Optional. The dotted output paths a projection + keeps; arrays are traversed element-wise. Empty for a transform. + ], + "kind": "str", # Optional. ``OUTPUT_VIEW_KIND_PROJECTION`` or + ``OUTPUT_VIEW_KIND_TRANSFORM``. Known values are: + "OUTPUT_VIEW_KIND_PROJECTION" and "OUTPUT_VIEW_KIND_TRANSFORM". + "name": "str", # Optional. View name, unique per tool version among + its owner's views. + "output_schema": {}, # Optional. The JSON Schema every result of + this view satisfies. + "team_id": "str", # Optional. Your team's ID on your team's views, + and empty for a view DigitalOcean publishes to every team. + "tool": "str", # Optional. The provider-qualified tool slug, for + example ``exa_search``. + "tool_id": "str", # Optional. The opaque identity of the exact tool + version the view is bound to; tool and version are its readable coordinates. + "version": "str", # Optional. The tool version, for example ``v3``. + "view_id": "str" # Optional. Output view ID, for example ``ov_`` + followed by 32 hex digits. Empty on a preview. + } + } + # 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_output_views_delete_request( + view_id=view_id, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + +class SessionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.GeneratedClient`'s + :attr:`sessions` 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") + ) + + @overload + def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a Session. + + Creates a session owned by your team, with a new session URN, and returns the MCP URL an agent + connects to. tools selects the tools and toolbelts the session exposes, and policy decides + which calls run, need approval, or are refused. + + :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 = { + "name": "str", # Required human-readable session name. Required. + "actorId": "str", # Optional. Optional actor binding: the user whose + connections the session's tool calls use, matched against connection ``user_id``. + When set it must use the same alphabet as a connection's ``user_id``"" , + ``[A-Za-z0-9._-]``"" , at most 64 characters; anything else is rejected with 400. + "config": {}, # Optional. Optional session options. config.preloadTools may + contain concrete tool names (optionally version-pinned) and version-pinned + toolbelt references. config.customInstructions is a string of at most 1000 + characters. config.outputViews maps up to 100 tool slugs to the name of an output + view to apply to that tool's results. + "insights": { + "logs": bool, # Optional. Whether the session's customer logs are + sent to Insights. + "metrics": bool, # Optional. Accepted and stored for parity with the + Insights schema. + "traces": bool # Optional. Whether the session's customer traces are + sent to Insights. + }, + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by your team, in a + region that supports sessions. + }, + "policy": { + "defaultAction": "str", # Optional. Action for calls no rule + matches. Empty means ask; otherwise this must be allow, ask, or deny. Known + values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. Required: allow, ask, + or deny. Known values are: "allow", "ask", and "deny". + "match": { + "str": "str" # Optional. Optional argument + conditions, keyed by argument name; the rule applies only to + calls whose arguments match. + }, + "tool": "str" # Optional. Required. A tool slug, + optionally ``@``"" , or a toolbelt as + ``toolbelt:@``. When the session selects tools, the + rule must name one of them. + } + ] + }, + "tools": [ + "str" # Optional. Omitted enables every tool. An explicit empty + array enables no tools. Direct tools may be ```` or + ``@``"" , using provider-qualified tool slugs, and a pinned + version must be the released one; toolbelt references must be version-pinned + as ``toolbelt:@``. + ] + } + + # response body for status code(s): 200 + response == { + "mcpUrl": "str", # Optional. URL of the session's MCP endpoint, for the + agent to connect to. + "session": { + "actorId": "str", # Optional. Empty when the session is not bound to + an actor. + "agentName": "str", # Optional. Name of the agent that started the + session. Empty for sessions created through this API. + "agentUrn": "str", # Optional. URN of the agent that started the + session. Empty for sessions created through this API. + "config": {}, # Optional. Session options as supplied at creation. + Omitted when none were supplied. + "createdAt": "2020-02-20 00:00:00", # Optional. When the session was + created. + "insights": { + "logs": bool, # Optional. Whether the session's customer + logs are sent to Insights. + "metrics": bool, # Optional. Accepted and stored for parity + with the Insights schema. + "traces": bool # Optional. Whether the session's customer + traces are sent to Insights. + }, + "name": "str", # Optional. The required human-readable session name. + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by your + team, in a region that supports sessions. + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the session, when recorded. + "policy": { + "defaultAction": "str", # Optional. Action for calls no rule + matches. Empty means ask; otherwise this must be allow, ask, or deny. + Known values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. Required: + allow, ask, or deny. Known values are: "allow", "ask", and + "deny". + "match": { + "str": "str" # Optional. Optional + argument conditions, keyed by argument name; the rule applies + only to calls whose arguments match. + }, + "tool": "str" # Optional. Required. A tool + slug, optionally ``@``"" , or a toolbelt as + ``toolbelt:@``. When the session selects tools, + the rule must name one of them. + } + ] + }, + "sessionUrn": "str", # Optional. Session URN, for example + ``do:managed_agent_session:``. + "tools": { + "references": [ + { + "kind": "str", # Optional. Whether name is a + tool or a toolbelt. Known values are: + "SESSION_TOOL_REFERENCE_KIND_TOOL" and + "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". + "name": "str", # Optional. Tool slug or + toolbelt name. + "version": "str" # Optional. Pinned version. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. When the session was + last modified. + }, + "tools": [ + "str" # Optional. Canonical, version-pinned selected tool + references. Empty when the session exposes every tool. + ] + } + # 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 create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a Session. + + Creates a session owned by your team, with a new session URN, and returns the MCP URL an agent + connects to. tools selects the tools and toolbelts the session exposes, and policy decides + which calls run, need approval, or are refused. + + :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 == { + "mcpUrl": "str", # Optional. URL of the session's MCP endpoint, for the + agent to connect to. + "session": { + "actorId": "str", # Optional. Empty when the session is not bound to + an actor. + "agentName": "str", # Optional. Name of the agent that started the + session. Empty for sessions created through this API. + "agentUrn": "str", # Optional. URN of the agent that started the + session. Empty for sessions created through this API. + "config": {}, # Optional. Session options as supplied at creation. + Omitted when none were supplied. + "createdAt": "2020-02-20 00:00:00", # Optional. When the session was + created. + "insights": { + "logs": bool, # Optional. Whether the session's customer + logs are sent to Insights. + "metrics": bool, # Optional. Accepted and stored for parity + with the Insights schema. + "traces": bool # Optional. Whether the session's customer + traces are sent to Insights. + }, + "name": "str", # Optional. The required human-readable session name. + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by your + team, in a region that supports sessions. + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the session, when recorded. + "policy": { + "defaultAction": "str", # Optional. Action for calls no rule + matches. Empty means ask; otherwise this must be allow, ask, or deny. + Known values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. Required: + allow, ask, or deny. Known values are: "allow", "ask", and + "deny". + "match": { + "str": "str" # Optional. Optional + argument conditions, keyed by argument name; the rule applies + only to calls whose arguments match. + }, + "tool": "str" # Optional. Required. A tool + slug, optionally ``@``"" , or a toolbelt as + ``toolbelt:@``. When the session selects tools, + the rule must name one of them. + } + ] + }, + "sessionUrn": "str", # Optional. Session URN, for example + ``do:managed_agent_session:``. + "tools": { + "references": [ + { + "kind": "str", # Optional. Whether name is a + tool or a toolbelt. Known values are: + "SESSION_TOOL_REFERENCE_KIND_TOOL" and + "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". + "name": "str", # Optional. Tool slug or + toolbelt name. + "version": "str" # Optional. Pinned version. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. When the session was + last modified. + }, + "tools": [ + "str" # Optional. Canonical, version-pinned selected tool + references. Empty when the session exposes every tool. + ] + } + # 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 create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Create a Session. + + Creates a session owned by your team, with a new session URN, and returns the MCP URL an agent + connects to. tools selects the tools and toolbelts the session exposes, and policy decides + which calls run, need approval, or are refused. + + :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 = { + "name": "str", # Required human-readable session name. Required. + "actorId": "str", # Optional. Optional actor binding: the user whose + connections the session's tool calls use, matched against connection ``user_id``. + When set it must use the same alphabet as a connection's ``user_id``"" , + ``[A-Za-z0-9._-]``"" , at most 64 characters; anything else is rejected with 400. + "config": {}, # Optional. Optional session options. config.preloadTools may + contain concrete tool names (optionally version-pinned) and version-pinned + toolbelt references. config.customInstructions is a string of at most 1000 + characters. config.outputViews maps up to 100 tool slugs to the name of an output + view to apply to that tool's results. + "insights": { + "logs": bool, # Optional. Whether the session's customer logs are + sent to Insights. + "metrics": bool, # Optional. Accepted and stored for parity with the + Insights schema. + "traces": bool # Optional. Whether the session's customer traces are + sent to Insights. + }, + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by your team, in a + region that supports sessions. + }, + "policy": { + "defaultAction": "str", # Optional. Action for calls no rule + matches. Empty means ask; otherwise this must be allow, ask, or deny. Known + values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. Required: allow, ask, + or deny. Known values are: "allow", "ask", and "deny". + "match": { + "str": "str" # Optional. Optional argument + conditions, keyed by argument name; the rule applies only to + calls whose arguments match. + }, + "tool": "str" # Optional. Required. A tool slug, + optionally ``@``"" , or a toolbelt as + ``toolbelt:@``. When the session selects tools, the + rule must name one of them. + } + ] + }, + "tools": [ + "str" # Optional. Omitted enables every tool. An explicit empty + array enables no tools. Direct tools may be ```` or + ``@``"" , using provider-qualified tool slugs, and a pinned + version must be the released one; toolbelt references must be version-pinned + as ``toolbelt:@``. + ] + } + + # response body for status code(s): 200 + response == { + "mcpUrl": "str", # Optional. URL of the session's MCP endpoint, for the + agent to connect to. + "session": { + "actorId": "str", # Optional. Empty when the session is not bound to + an actor. + "agentName": "str", # Optional. Name of the agent that started the + session. Empty for sessions created through this API. + "agentUrn": "str", # Optional. URN of the agent that started the + session. Empty for sessions created through this API. + "config": {}, # Optional. Session options as supplied at creation. + Omitted when none were supplied. + "createdAt": "2020-02-20 00:00:00", # Optional. When the session was + created. + "insights": { + "logs": bool, # Optional. Whether the session's customer + logs are sent to Insights. + "metrics": bool, # Optional. Accepted and stored for parity + with the Insights schema. + "traces": bool # Optional. Whether the session's customer + traces are sent to Insights. + }, + "name": "str", # Optional. The required human-readable session name. + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by your + team, in a region that supports sessions. + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of the + user who created the session, when recorded. + "policy": { + "defaultAction": "str", # Optional. Action for calls no rule + matches. Empty means ask; otherwise this must be allow, ask, or deny. + Known values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. Required: + allow, ask, or deny. Known values are: "allow", "ask", and + "deny". + "match": { + "str": "str" # Optional. Optional + argument conditions, keyed by argument name; the rule applies + only to calls whose arguments match. + }, + "tool": "str" # Optional. Required. A tool + slug, optionally ``@``"" , or a toolbelt as + ``toolbelt:@``. When the session selects tools, + the rule must name one of them. + } + ] + }, + "sessionUrn": "str", # Optional. Session URN, for example + ``do:managed_agent_session:``. + "tools": { + "references": [ + { + "kind": "str", # Optional. Whether name is a + tool or a toolbelt. Known values are: + "SESSION_TOOL_REFERENCE_KIND_TOOL" and + "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". + "name": "str", # Optional. Tool slug or + toolbelt name. + "version": "str" # Optional. Pinned version. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. When the session was + last modified. + }, + "tools": [ + "str" # Optional. Canonical, version-pinned selected tool + references. Empty when the session exposes every tool. + ] + } + # 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_sessions_create_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, 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( + self, + *, + end_user_id: Optional[str] = None, + page: int = 1, + per_page: int = 20, + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """List Sessions. + + Returns the sessions you can see, newest first. Offset-paged with page and ``per_page``\\ ; + ``end_user_id`` filters to one actor. + + :keyword end_user_id: Optional ``actor_id``\\ , matched exactly. Default value is None. + :paramtype end_user_id: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int + :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. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. + }, + "sessions": [ + { + "actorId": "str", # Optional. Empty when the session is not + bound to an actor. + "agentName": "str", # Optional. Name of the agent that + started the session. Empty for sessions created through this API. + "agentUrn": "str", # Optional. URN of the agent that started + the session. Empty for sessions created through this API. + "config": {}, # Optional. Session options as supplied at + creation. Omitted when none were supplied. + "createdAt": "2020-02-20 00:00:00", # Optional. When the + session was created. + "insights": { + "logs": bool, # Optional. Whether the session's + customer logs are sent to Insights. + "metrics": bool, # Optional. Accepted and stored for + parity with the Insights schema. + "traces": bool # Optional. Whether the session's + customer traces are sent to Insights. + }, + "name": "str", # Optional. The required human-readable + session name. + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by + your team, in a region that supports sessions. + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of + the user who created the session, when recorded. + "policy": { + "defaultAction": "str", # Optional. Action for calls + no rule matches. Empty means ask; otherwise this must be allow, ask, + or deny. Known values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. + Required: allow, ask, or deny. Known values are: "allow", + "ask", and "deny". + "match": { + "str": "str" # Optional. + Optional argument conditions, keyed by argument name; the + rule applies only to calls whose arguments match. + }, + "tool": "str" # Optional. Required. + A tool slug, optionally ``@``"" , or a + toolbelt as ``toolbelt:@``. When the session + selects tools, the rule must name one of them. + } + ] + }, + "sessionUrn": "str", # Optional. Session URN, for example + ``do:managed_agent_session:``. + "tools": { + "references": [ + { + "kind": "str", # Optional. Whether + name is a tool or a toolbelt. Known values are: + "SESSION_TOOL_REFERENCE_KIND_TOOL" and + "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". + "name": "str", # Optional. Tool slug + or toolbelt name. + "version": "str" # Optional. Pinned + version. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + session was last modified. + } + ] + } + """ + 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_sessions_list_request( + end_user_id=end_user_id, + page=page, + per_page=per_page, + 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 list_search( + self, + *, + query: Optional[str] = None, + end_user_id: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Search Sessions. + + Returns the sessions you can see whose name, ``actor_id``\\ , ``session_urn``\\ , or + ``agentName`` contains query, case-insensitively, ranked across the whole result set. + Cursor-paged with ``page_size`` and ``page_token``\\ ; no total is reported. + + :keyword query: Matched case-insensitively as a substring of name, ``actor_id``\\ , + ``session_urn``\\ , or ``agentName``. Empty matches every session you can see. Results are + ordered by match quality (an exact name, ``session_urn``\\ , or ``actor_id`` match, then a + prefix, then a substring), then by name, across the whole result set, so a client must not + re-sort a page to rank it. Default value is None. + :paramtype query: str + :keyword end_user_id: ``end_user_id``\\ , when set, is an exact filter on ``actor_id`` (the + same filter as on the session list) and combines with query as AND. Default value is None. + :paramtype end_user_id: str + :keyword page_size: Page size, 1 to 100. Defaults to 20 when omitted or 0; other values are + rejected with 400. Default value is 20. + :paramtype page_size: int + :keyword page_token: ``next_page_token`` from the previous response. Valid only with the same + query and ``end_user_id``\\ ; otherwise the request is rejected with 400. Default value is + None. + :paramtype page_token: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "next_page_token": "str", # Optional. Token for the next page; empty on the + last page. + "sessions": [ + { + "actorId": "str", # Optional. Empty when the session is not + bound to an actor. + "agentName": "str", # Optional. Name of the agent that + started the session. Empty for sessions created through this API. + "agentUrn": "str", # Optional. URN of the agent that started + the session. Empty for sessions created through this API. + "config": {}, # Optional. Session options as supplied at + creation. Omitted when none were supplied. + "createdAt": "2020-02-20 00:00:00", # Optional. When the + session was created. + "insights": { + "logs": bool, # Optional. Whether the session's + customer logs are sent to Insights. + "metrics": bool, # Optional. Accepted and stored for + parity with the Insights schema. + "traces": bool # Optional. Whether the session's + customer traces are sent to Insights. + }, + "name": "str", # Optional. The required human-readable + session name. + "network": { + "vpcUuid": "str" # Optional. UUID of a VPC owned by + your team, in a region that supports sessions. + }, + "owning_user_id": "str", # Optional. DigitalOcean user ID of + the user who created the session, when recorded. + "policy": { + "defaultAction": "str", # Optional. Action for calls + no rule matches. Empty means ask; otherwise this must be allow, ask, + or deny. Known values are: "allow", "ask", and "deny". + "rules": [ + { + "action": "str", # Optional. + Required: allow, ask, or deny. Known values are: "allow", + "ask", and "deny". + "match": { + "str": "str" # Optional. + Optional argument conditions, keyed by argument name; the + rule applies only to calls whose arguments match. + }, + "tool": "str" # Optional. Required. + A tool slug, optionally ``@``"" , or a + toolbelt as ``toolbelt:@``. When the session + selects tools, the rule must name one of them. + } + ] + }, + "sessionUrn": "str", # Optional. Session URN, for example + ``do:managed_agent_session:``. + "tools": { + "references": [ + { + "kind": "str", # Optional. Whether + name is a tool or a toolbelt. Known values are: + "SESSION_TOOL_REFERENCE_KIND_TOOL" and + "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". + "name": "str", # Optional. Tool slug + or toolbelt name. + "version": "str" # Optional. Pinned + version. + } + ] + }, + "updatedAt": "2020-02-20 00:00:00" # Optional. When the + session was last modified. + } + ] + } + # 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_sessions_list_search_request( + query=query, + end_user_id=end_user_id, + page_size=page_size, + page_token=page_token, + 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_providers(self, **kwargs: Any) -> JSON: - """List Tool Providers. + def delete(self, session_urn: str, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Delete a Session. - Lists Action Gateway providers and their connection requirements. + Deletes the session and its policy. Succeeds without deleting anything when the session does + not exist or you cannot delete it, so repeating a delete also succeeds. A malformed + ``session_urn`` is rejected with 400. - :return: JSON object + :param session_urn: URN of the session, for example ``do:managed_agent_session:``. + Required. + :type session_urn: str + :return: JSON or JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 400, 404 response == { - "providers": [ - { - "auth_type": "str", # Optional. - "connection_parameters": [ - { - "allowed_host_suffixes": [ - "str" # Optional. - ], - "allowed_values": [ - "str" # Optional. - ], - "description": "str", # Optional. - "input_kind": "str", # Optional. - "key": "str", # Optional. - "label": "str", # Optional. - "max_length": 0, # Optional. - "normalization": "str", # Optional. - "required": bool # Optional. - } - ], - "description": "str", # Optional. - "display_name": "str", # Optional. - "name": "str", # Optional. - "scopes": [ - "str" # Optional. - ] - } - ] + "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]] = { @@ -18488,7 +24936,8 @@ def list_providers(self, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_tools_list_providers_request( + _request = build_sessions_delete_request( + session_urn=session_urn, headers=_headers, params=_params, ) @@ -18503,55 +24952,246 @@ def list_providers(self, **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = {} - 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.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.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 - @distributed_trace - def get_definition( - self, - name: str, - *, - version: Optional[str] = None, - toolkit_id: Optional[str] = None, - **kwargs: Any, + +class ToolbeltsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.GeneratedClient`'s + :attr:`toolbelts` 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") + ) + + @overload + def create( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> JSON: # pylint: disable=line-too-long - """Retrieve a Tool Definition. + """Create a Toolbelt. - Retrieves the executable definition for an active Action Gateway tool. + A toolbelt is a named set of tools, each pinned to a version, that your team can attach to + sessions as ``toolbelt:@``. The first version is 1 unless version is set. + Returns 409 if an active toolbelt with the same name exists. The name of a deleted toolbelt can + be reused; its versions start again from the initial version. - :param name: The provider-qualified tool name. Required. - :type name: str - :keyword version: The tool version. Omit to retrieve the current version. Default value is - None. - :paramtype version: str - :keyword toolkit_id: The toolkit identifier used to disambiguate a bare tool name. Default - value is None. - :paramtype toolkit_id: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "name": "str", # Toolbelt name, unique among your team's active toolbelts. + Must match ``^``"" [a-z]"" ```[a-z0-9_-]``"" {0,63}$"" ``;``"" search` is + reserved. Required. + "description": "str", # Optional. Optional description. At most 255 bytes. + "display_name": "str", # Optional. Optional human-readable label, separate + from name. At most 128 bytes. + "tools": [ + "str" # Optional. Optional initial members, as catalog tool slugs + ("" ``_``"" ). Each may be pinned as + ``@``"" ; a pin must equal the tool's current released + version, and an unpinned tool is pinned to that version. Every tool must be + an active catalog tool. Duplicates are merged; at most 500 tools. Empty + creates a toolbelt with no tools. + ], + "version": "1" # Optional. Default value is "1". Optional initial version + number, a positive integer such as ``1``. Defaults to 1. + } + + # response body for status code(s): 200 + response == { + "toolbelt": { + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. + "tools": [ + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. + ], + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. + } + } + # response body for status code(s): 400, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @overload + def create( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Create a Toolbelt. + + A toolbelt is a named set of tools, each pinned to a version, that your team can attach to + sessions as ``toolbelt:@``. The first version is 1 unless version is set. + Returns 409 if an active toolbelt with the same name exists. The name of a deleted toolbelt can + be reused; its versions start again from the initial version. + + :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 == { + "toolbelt": { + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. + "tools": [ + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. + ], + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. + } + } + # response body for status code(s): 400, 409 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + + @distributed_trace + def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """Create a Toolbelt. + + A toolbelt is a named set of tools, each pinned to a version, that your team can attach to + sessions as ``toolbelt:@``. The first version is 1 unless version is set. + Returns 409 if an active toolbelt with the same name exists. The name of a deleted toolbelt can + be reused; its versions start again from the initial version. + + :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: @@ -18559,251 +25199,54 @@ def get_definition( Example: .. code-block:: python + # JSON input template you can fill out and use as your body input. + body = { + "name": "str", # Toolbelt name, unique among your team's active toolbelts. + Must match ``^``"" [a-z]"" ```[a-z0-9_-]``"" {0,63}$"" ``;``"" search` is + reserved. Required. + "description": "str", # Optional. Optional description. At most 255 bytes. + "display_name": "str", # Optional. Optional human-readable label, separate + from name. At most 128 bytes. + "tools": [ + "str" # Optional. Optional initial members, as catalog tool slugs + ("" ``_``"" ). Each may be pinned as + ``@``"" ; a pin must equal the tool's current released + version, and an unpinned tool is pinned to that version. Every tool must be + an active catalog tool. Duplicates are merged; at most 500 tools. Empty + creates a toolbelt with no tools. + ], + "version": "1" # Optional. Default value is "1". Optional initial version + number, a positive integer such as ``1``. Defaults to 1. + } + # response body for status code(s): 200 response == { - "annotations": { - "destructiveHint": bool, # Optional. - "idempotentHint": bool, # Optional. - "openWorldHint": bool, # Optional. - "readOnlyHint": bool, # Optional. - "title": "str" # Optional. - }, - "auth": { - "baseUrlResolution": { - "httpLookup": { - "baseUrlTemplate": "str", # Optional. HTTPLookupSpec - resolves a base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON array, - extracting extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and match_value are - both set, they select the entry. When both are empty, exactly one - entry whose own "scopes" array contains required_scopes must exist. - Configuring only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - "caseInsensitive": bool, # Optional. HTTPLookupSpec - resolves a base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON array, - extracting extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and match_value are - both set, they select the entry. When both are empty, exactly one - entry whose own "scopes" array contains required_scopes must exist. - Configuring only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - "extractField": "str", # Optional. HTTPLookupSpec - resolves a base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON array, - extracting extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and match_value are - both set, they select the entry. When both are empty, exactly one - entry whose own "scopes" array contains required_scopes must exist. - Configuring only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - "matchField": "str", # Optional. HTTPLookupSpec - resolves a base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON array, - extracting extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and match_value are - both set, they select the entry. When both are empty, exactly one - entry whose own "scopes" array contains required_scopes must exist. - Configuring only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - "matchValue": "str", # Optional. HTTPLookupSpec - resolves a base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON array, - extracting extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and match_value are - both set, they select the entry. When both are empty, exactly one - entry whose own "scopes" array contains required_scopes must exist. - Configuring only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - "match_value_parameter": "str", # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting extract_field from - that entry, and substituting it for "{value}" in base_url_template. - When match_field and match_value are both set, they select the entry. - When both are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one match field - is invalid. Resolution fails fast on zero or multiple compatible - entries. - "method": "str", # Optional. HTTPLookupSpec resolves - a base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON array, - extracting extract_field from that entry, and substituting it for - "{value}" in base_url_template. When match_field and match_value are - both set, they select the entry. When both are empty, exactly one - entry whose own "scopes" array contains required_scopes must exist. - Configuring only one match field is invalid. Resolution fails fast on - zero or multiple compatible entries. - "requiredScopes": [ - "str" # Optional. HTTPLookupSpec resolves a - base_url by calling url (bearer-authenticated with the - just-exchanged access token), selecting an entry in the JSON - array, extracting extract_field from that entry, and substituting - it for "{value}" in base_url_template. When match_field and - match_value are both set, they select the entry. When both are - empty, exactly one entry whose own "scopes" array contains - required_scopes must exist. Configuring only one match field is - invalid. Resolution fails fast on zero or multiple compatible - entries. - ], - "trimTrailingSlash": bool, # Optional. - HTTPLookupSpec resolves a base_url by calling url - (bearer-authenticated with the just-exchanged access token), - selecting an entry in the JSON array, extracting extract_field from - that entry, and substituting it for "{value}" in base_url_template. - When match_field and match_value are both set, they select the entry. - When both are empty, exactly one entry whose own "scopes" array - contains required_scopes must exist. Configuring only one match field - is invalid. Resolution fails fast on zero or multiple compatible - entries. - "url": "str" # Optional. HTTPLookupSpec resolves a - base_url by calling url (bearer-authenticated with the just-exchanged - access token), selecting an entry in the JSON array, extracting - extract_field from that entry, and substituting it for "{value}" in - base_url_template. When match_field and match_value are both set, - they select the entry. When both are empty, exactly one entry whose - own "scopes" array contains required_scopes must exist. Configuring - only one match field is invalid. Resolution fails fast on zero or - multiple compatible entries. - } - }, - "credentialBinding": "str", # Optional. - "credentialRefSource": "str", # Optional. - "doManagedCredentialRef": "str", # Optional. - "injection": { - "location": "str", # Optional. - "name": "str", # Optional. - "scheme": "str" # Optional. - }, - "modes": [ - "str" # Optional. - ], - "provider": "str", # Optional. - "scopes": [ - "str" # Optional. - ] - }, - "classification": { - "dataClasses": [ - "str" # Optional. + "toolbelt": { + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. + "tools": [ + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "operation": "str", # Optional. - "risk": "str" # Optional. - }, - "description": "str", # Optional. - "execution": { - "adapterVersion": "str", # Optional. - "configRef": "str", # Optional. - "http": { - "allowedHosts": [ - "str" # Optional. - ], - "baseUrl": "str", # Optional. - "method": "str", # Optional. - "path": "str", # Optional. - "requestEncoding": "str", # Optional. - "responseFormat": "str" # Optional. - }, - "mcp": { - "allowedHosts": [ - "str" # Optional. MCPExecution describes how to - invoke a tool that is fronted by a remote MCP server (as opposed to a - plain HTTP endpoint). endpoint is the remote MCP server's URL, - tool_name is the name the remote server expects on tools/call (may - differ from this tool's registry name), transport selects the wire - protocol ("streamable_http" is the only kind implemented today), and - server_ref is an opaque label identifying the remote server for - logging/metrics/allowlisting. - ], - "endpoint": "str", # Optional. MCPExecution describes how to - invoke a tool that is fronted by a remote MCP server (as opposed to a - plain HTTP endpoint). endpoint is the remote MCP server's URL, tool_name - is the name the remote server expects on tools/call (may differ from this - tool's registry name), transport selects the wire protocol - ("streamable_http" is the only kind implemented today), and server_ref is - an opaque label identifying the remote server for - logging/metrics/allowlisting. - "serverRef": "str", # Optional. MCPExecution describes how - to invoke a tool that is fronted by a remote MCP server (as opposed to a - plain HTTP endpoint). endpoint is the remote MCP server's URL, tool_name - is the name the remote server expects on tools/call (may differ from this - tool's registry name), transport selects the wire protocol - ("streamable_http" is the only kind implemented today), and server_ref is - an opaque label identifying the remote server for - logging/metrics/allowlisting. - "toolName": "str", # Optional. MCPExecution describes how to - invoke a tool that is fronted by a remote MCP server (as opposed to a - plain HTTP endpoint). endpoint is the remote MCP server's URL, tool_name - is the name the remote server expects on tools/call (may differ from this - tool's registry name), transport selects the wire protocol - ("streamable_http" is the only kind implemented today), and server_ref is - an opaque label identifying the remote server for - logging/metrics/allowlisting. - "transport": "str" # Optional. MCPExecution describes how to - invoke a tool that is fronted by a remote MCP server (as opposed to a - plain HTTP endpoint). endpoint is the remote MCP server's URL, tool_name - is the name the remote server expects on tools/call (may differ from this - tool's registry name), transport selects the wire protocol - ("streamable_http" is the only kind implemented today), and server_ref is - an opaque label identifying the remote server for - logging/metrics/allowlisting. - }, - "type": "str" # Optional. - }, - "flipperName": "str", # Optional. - "hooks": { - "usage": { - "billable": bool, # Optional. When usage metadata is - present, false prevents billing. Omitting usage metadata leaves - consumers' legacy billing classification unchanged. - "meters": [ - { - "quantitySource": "str", # Optional. - "sku": "str", # Optional. - "unit": "str" # Optional. - } - ] - } - }, - "inputSchema": {}, # Optional. Any object. - "name": "str", # Optional. - "outputSchema": {}, # Optional. Any object. - "parallelizable": bool, # Optional. - "policy": { - "permission": "str" # Optional. - }, - "reliability": { - "maxOutputBytes": "str", # Optional. - "retry": { - "backoff": "str", # Optional. - "maxAttempts": 0, # Optional. - "retryOn": [ - "str" # Optional. - ] - }, - "timeoutMs": 0 # Optional. - }, - "schemaVersion": "str", # Optional. - "status": "str", # Optional. - "streamingSafe": bool, # Optional. - "tags": [ - "str" # Optional. - ], - "title": "str", # Optional. - "toolId": "str", # Optional. - "toolSlug": "str", # Optional. tool_slug is the provider-qualified, stable - tool identifier ":code:``_:code:``". Pass this value back - verbatim to the toolbelt add/remove endpoints; clients should treat it as opaque. - "toolkitId": "str", # Optional. - "transform": { - "input": {}, # Optional. Any object. - "language": "str", # Optional. - "output": {} # Optional. Any object. - }, - "version": "str" # Optional. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. + } } - # response body for status code(s): 404 + # response body for status code(s): 400, 409 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 @@ -18828,15 +25271,26 @@ def get_definition( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) 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) - _request = build_tools_get_definition_request( - name=name, - version=version, - toolkit_id=toolkit_id, + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = body + + _request = build_toolbelts_create_request( + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -18851,7 +25305,7 @@ def get_definition( response = pipeline_response.http_response - if response.status_code not in [200, 404]: + if response.status_code not in [200, 400, 409]: 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 @@ -18874,7 +25328,23 @@ def get_definition( else: deserialized = None - if response.status_code == 404: + 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 == 409: response_headers["ratelimit-limit"] = self._deserialize( "int", response.headers.get("ratelimit-limit") ) @@ -18895,26 +25365,6 @@ def get_definition( return cast(JSON, deserialized) # type: ignore - -class ToolbeltsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~pydo.GeneratedClient`'s - :attr:`toolbelts` 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( self, @@ -18924,16 +25374,19 @@ def list( per_page: int = 20, **kwargs: Any, ) -> JSON: + # pylint: disable=line-too-long """List Toolbelts. - Lists the latest version of each toolbelt owned by the authenticated team. + Returns your team's toolbelts, one entry per name describing its latest version, sorted by + name. Offset-paged with page and ``per_page``\\ ; pagination reports the total. - :keyword status: Filter toolbelts by status. Known values are: "active", "deprecated", and - "all". Default value is "active". + :keyword status: active (default), deprecated, or all. Case-insensitive. Known values are: + "active", "deprecated", and "all". Default value is "active". :paramtype status: str - :keyword page: Which 'page' of paginated results to return. Default value is 1. + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. :paramtype page: int - :keyword per_page: Number of items returned per page. Default value is 20. + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. :paramtype per_page: int :return: JSON object :rtype: JSON @@ -18945,25 +25398,45 @@ def list( # response body for status code(s): 200 response == { "pagination": { - "page": 0, # Required. - "per_page": 0, # Required. - "total": 0 # Required. + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. }, "toolbelts": [ { - "latest_version": "str", # Required. - "name": "str", # Required. - "reference_latest": "str", # Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. - "updated_at": "2020-02-20 00:00:00", # Required. - "version_count": 0, # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "description": "str", # Optional. Description of the latest + version. + "display_name": "str", # Optional. Human-readable label of + the latest version. + "latest_version": "str", # Optional. Latest version number, + as a string. + "name": "str", # Optional. Toolbelt name. + "reference_latest": "str", # Optional. The toolbelt name, + which refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the + toolbelt is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of members in the latest + version. + "updated_at": "2020-02-20 00:00:00", # Optional. When the + latest version was last modified, in RFC 3339 format. + "version_count": 0 # Optional. Number of versions recorded + under this name, including versions from before the toolbelt was deleted + and the name reused. } ] } + # 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, @@ -19001,163 +25474,79 @@ def list( response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = {} - response_headers["ratelimit-limit"] = self._deserialize( - "int", response.headers.get("ratelimit-limit") - ) - response_headers["ratelimit-remaining"] = self._deserialize( - "int", response.headers.get("ratelimit-remaining") - ) - response_headers["ratelimit-reset"] = self._deserialize( - "int", response.headers.get("ratelimit-reset") - ) - - if response.content: - deserialized = response.json() - else: - deserialized = None - - if cls: - return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore - - return cast(JSON, deserialized) # type: ignore - - @overload - def create( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> JSON: - # pylint: disable=line-too-long - """Create a Toolbelt. - - Creates a versioned collection of provider-qualified Action Gateway tool names. - - :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 = { - "name": "str", # Required. - "tools": [ - "str" # Required. - ], - "description": "str", # Optional. - "display_name": "str", # Optional. - "version": "1" # Optional. Default value is "1". - } - - # response body for status code(s): 200 - response == { - "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. - "tools": [ - "str" # Required. - ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. - } - } - # response body for status code(s): 400, 409 - response == { - "id": "str", # A short identifier corresponding to the HTTP status code - returned. For example, the ID for a response returning a 404 status code would - be "not_found.". Required. - "message": "str", # A message providing additional information about the - error, including details to help resolve it when possible. Required. - "request_id": "str" # Optional. Optionally, some endpoints may include a - request ID that should be provided when reporting bugs or opening support - tickets to help identify the issue. - } - """ - - @overload - def create( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> JSON: - # pylint: disable=line-too-long - """Create a Toolbelt. - - Creates a versioned collection of provider-qualified Action Gateway tool names. - - :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: + 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") + ) - Example: - .. code-block:: python + if response.content: + deserialized = response.json() + else: + deserialized = None - # response body for status code(s): 200 - response == { - "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. - "tools": [ - "str" # Required. - ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. - } - } - # response body for status code(s): 400, 409 - 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. - } - """ + 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 create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + def list_search( + self, + *, + query: Optional[str] = None, + status: str = "active", + page_size: int = 20, + page_token: Optional[str] = None, + **kwargs: Any, + ) -> JSON: # pylint: disable=line-too-long - """Create a Toolbelt. + """Search Toolbelts. - Creates a versioned collection of provider-qualified Action Gateway tool names. + Returns your team's toolbelts whose name, display name, or description contains query, + case-insensitively, sorted by name. Cursor-paged with ``page_size`` and ``page_token``\\ ; no + total is reported. - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :keyword query: Matched case-insensitively as a substring of name, ``display_name``\\ , or + description. Empty matches every toolbelt of your team. Default value is None. + :paramtype query: str + :keyword status: active (default), deprecated, or all. Case-insensitive. Known values are: + "active", "deprecated", and "all". Default value is "active". + :paramtype status: str + :keyword page_size: Page size, 1 to 100. Defaults to 20 when omitted or 0; other values are + rejected with 400. Default value is 20. + :paramtype page_size: int + :keyword page_token: ``next_page_token`` from the previous response. Valid only with the same + query and status; otherwise the request is rejected with 400. Default value is None. + :paramtype page_token: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -19165,39 +25554,34 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - body = { - "name": "str", # Required. - "tools": [ - "str" # Required. - ], - "description": "str", # Optional. - "display_name": "str", # Optional. - "version": "1" # Optional. Default value is "1". - } - # response body for status code(s): 200 response == { - "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. - "tools": [ - "str" # Required. - ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. - } + "next_page_token": "str", # Optional. Token for the next page; empty on the + last page. + "toolbelts": [ + { + "description": "str", # Optional. Description of the latest + version. + "display_name": "str", # Optional. Human-readable label of + the latest version. + "latest_version": "str", # Optional. Latest version number, + as a string. + "name": "str", # Optional. Toolbelt name. + "reference_latest": "str", # Optional. The toolbelt name, + which refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the + toolbelt is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of members in the latest + version. + "updated_at": "2020-02-20 00:00:00", # Optional. When the + latest version was last modified, in RFC 3339 format. + "version_count": 0 # Optional. Number of versions recorded + under this name, including versions from before the toolbelt was deleted + and the name reused. + } + ] } - # response body for status code(s): 400, 409 + # 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 @@ -19222,26 +25606,16 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = 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_toolbelts_create_request( - content_type=content_type, - json=_json, - content=_content, + _request = build_toolbelts_list_search_request( + query=query, + status=status, + page_size=page_size, + page_token=page_token, headers=_headers, params=_params, ) @@ -19256,7 +25630,7 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200, 400, 409]: + 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 @@ -19295,39 +25669,45 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: else: deserialized = None - if response.status_code == 409: - 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(self, name: str, *, version: Optional[str] = None, **kwargs: Any) -> JSON: + def get( + self, + name: str, + *, + version: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, + search: Optional[str] = None, + **kwargs: Any, + ) -> JSON: # pylint: disable=line-too-long - """Retrieve a Toolbelt. + """Get a Toolbelt. - Retrieves the latest active version or a specified immutable version of a toolbelt. + Returns the latest version of the named toolbelt, or the version requested, with catalog + metadata for one page of its members in ``tool_details``. A deleted toolbelt returns 404 unless + a version is requested. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name. Required. :type name: str - :keyword version: An immutable numeric toolbelt version. Omit to retrieve the latest active - version. Default value is None. + :keyword version: Version number to read. Empty returns the latest version. Default value is + None. :paramtype version: str + :keyword page_size: Page size for ``tool_details`` only; toolbelt.tools always lists every + member. Defaults to 20; values above 100 are capped at 100. Default value is 20. + :paramtype page_size: int + :keyword page_token: ``next_page_token`` from the previous response, to continue + ``tool_details``. Treat it as opaque, and send it only with the same toolbelt, version, and + search. Default value is None. + :paramtype page_token: str + :keyword search: Restricts ``tool_details`` to members whose tool slug, name, title, + description, provider, or category contains this value, case-insensitively. It does not filter + toolbelt.tools. This is a substring match, not a filter expression. Default value is None. + :paramtype search: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -19337,26 +25717,53 @@ def get(self, name: str, *, version: Optional[str] = None, **kwargs: Any) -> JSO # response body for status code(s): 200 response == { + "next_page_token": "str", # Optional. Token for the next page of + ``tool_details``"" ; empty on the last page. + "tool_details": [ + { + "category": "str", # Optional. Best-effort catalog metadata + and is empty for a large share of the catalog. Do not rely on it being + present. + "description": "str", # Optional. What the tool does. + "name": "str", # Optional. The unqualified tool name, + without the provider prefix. + "provider": "str", # Optional. The ID of the provider that + offers the tool, broken out so a client never has to split ``tool_slug``. + "title": "str", # Optional. Human-readable tool title. + "tool_slug": "str", # Optional. The provider-qualified, + stable tool identifier ("" ``_``"" ). Treat it as opaque + and pass it back verbatim. + "version": 0 # Optional. The version this toolbelt version + pins for the member, matching the ``@`` suffix in the + corresponding toolbelt.tools entry. + } + ], "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. "tools": [ - "str" # Required. + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } - # response body for status code(s): 404 + # 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 @@ -19389,6 +25796,9 @@ def get(self, name: str, *, version: Optional[str] = None, **kwargs: Any) -> JSO _request = build_toolbelts_get_request( name=name, version=version, + page_size=page_size, + page_token=page_token, + search=search, headers=_headers, params=_params, ) @@ -19403,7 +25813,7 @@ def get(self, name: str, *, version: Optional[str] = None, **kwargs: Any) -> JSO response = pipeline_response.http_response - if response.status_code not in [200, 404]: + 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 @@ -19426,6 +25836,22 @@ def get(self, name: str, *, version: Optional[str] = None, **kwargs: Any) -> JSO 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") @@ -19452,9 +25878,12 @@ def delete(self, name: str, **kwargs: Any) -> JSON: # pylint: disable=line-too-long """Delete a Toolbelt. - Deprecates the latest active version of a toolbelt. + Marks the toolbelt deleted and returns its latest version with status deprecated. Its versions + stay readable by explicit version until the name is reused. The name is free to reuse + immediately; a new toolbelt with it starts a fresh version history. Returns 404 when the + toolbelt does not exist or is already deleted. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name. Required. :type name: str :return: JSON object :rtype: JSON @@ -19466,22 +25895,28 @@ def delete(self, name: str, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == { "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. "tools": [ - "str" # Required. + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } # response body for status code(s): 404 @@ -19574,27 +26009,37 @@ def delete(self, name: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore - @overload - def add_tools( + @distributed_trace + def list_providers( self, name: str, - body: JSON, *, - content_type: str = "application/json", + version: Optional[str] = None, + page: int = 1, + per_page: int = 20, + search: Optional[str] = None, **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Add Tools to a Toolbelt. + """List the Providers in a Toolbelt. - Adds provider-qualified tool names and creates a new immutable toolbelt version. + Returns the distinct providers of the toolbelt's members, each with its member count, sorted by + provider ID. List one provider's members with ``GET + .../toolbelts/{name}/providers/{provider}/tools``. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name. Required. :type name: 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 + :keyword version: Version number to read. Empty reads the latest version. Default value is + None. + :paramtype version: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int + :keyword search: Restricts providers whose ID, name, or description contains this value, + case-insensitively. Default value is None. + :paramtype search: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -19602,32 +26047,59 @@ def add_tools( Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - body = { - "tools": [ - "str" # Required. - ] - } - # response body for status code(s): 200 response == { + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. + }, + "providers": [ + { + "categories": [ + "str" # Optional. The distinct tool categories among + this toolbelt's members for the provider (sorted). Empty for + ``_legacy`` or when no member has a category. + ], + "created_at": "2020-02-20 00:00:00", # Optional. When the + provider was added to the catalog. Unset for ``_legacy``. + "description": "str", # Optional. Provider description. + Empty for ``_legacy``. + "id": "str", # Optional. Equals provider; present so the + entry has the same shape as a toolkit. + "name": "str", # Optional. The provider's display name. + Empty for ``_legacy``. + "provider": "str", # Optional. The provider ID. Members + recorded without a provider are grouped under ``_legacy``"" , which is + also accepted in the provider path. + "tool_count": 0 # Optional. How many toolbelt members belong + to this provider. + } + ], "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. "tools": [ - "str" # Required. + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } # response body for status code(s): 400, 404 @@ -19642,28 +26114,138 @@ def add_tools( 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 {}) - @overload - def add_tools( + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_toolbelts_list_providers_request( + name=name, + version=version, + page=page, + per_page=per_page, + search=search, + 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, 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 + + @distributed_trace + def list_provider_tools( self, name: str, - body: IO[bytes], + provider: str, *, - content_type: str = "application/json", + version: Optional[str] = None, + page: int = 1, + per_page: int = 20, + search: Optional[str] = None, **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Add Tools to a Toolbelt. + """List a Toolbelt's Tools from One Provider. - Adds provider-qualified tool names and creates a new immutable toolbelt version. + Returns a page of catalog metadata for the toolbelt's members from the named provider, sorted + by tool slug. An unknown provider returns an empty page. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name. Required. :type name: 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 + :param provider: A provider ID from the toolbelt's provider list, or ``_legacy`` for members + recorded without a provider. Matched exactly. Required. + :type provider: str + :keyword version: Version number to read. Empty reads the latest version. Default value is + None. + :paramtype version: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int + :keyword search: Restricts tools whose slug, name, title, description, provider, or category + contains this value, case-insensitively, within the provider only. Default value is None. + :paramtype search: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -19673,84 +26255,32 @@ def add_tools( # response body for status code(s): 200 response == { - "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. - "tools": [ - "str" # Required. - ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. - } - } - # 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 - def add_tools(self, name: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: - # pylint: disable=line-too-long - """Add Tools to a Toolbelt. - - Adds provider-qualified tool names and creates a new immutable toolbelt version. - - :param name: The natural key identifying the toolbelt. Required. - :type name: 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 = { + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. + }, "tools": [ - "str" # Required. + { + "category": "str", # Optional. Best-effort catalog metadata + and is empty for a large share of the catalog. Do not rely on it being + present. + "description": "str", # Optional. What the tool does. + "name": "str", # Optional. The unqualified tool name, + without the provider prefix. + "provider": "str", # Optional. The ID of the provider that + offers the tool, broken out so a client never has to split ``tool_slug``. + "title": "str", # Optional. Human-readable tool title. + "tool_slug": "str", # Optional. The provider-qualified, + stable tool identifier ("" ``_``"" ). Treat it as opaque + and pass it back verbatim. + "version": 0 # Optional. The version this toolbelt version + pins for the member, matching the ``@`` suffix in the + corresponding toolbelt.tools entry. + } ] } - - # response body for status code(s): 200 - response == { - "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. - "tools": [ - "str" # Required. - ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. - } - } # response body for status code(s): 400, 404 response == { "id": "str", # A short identifier corresponding to the HTTP status code @@ -19776,27 +26306,18 @@ def add_tools(self, name: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> J } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = 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_toolbelts_add_tools_request( + _request = build_toolbelts_list_provider_tools_request( name=name, - content_type=content_type, - json=_json, - content=_content, + provider=provider, + version=version, + page=page, + per_page=per_page, + search=search, headers=_headers, params=_params, ) @@ -19872,7 +26393,7 @@ def add_tools(self, name: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> J return cast(JSON, deserialized) # type: ignore @overload - def delete_tools( + def add_tools( self, name: str, body: JSON, @@ -19881,11 +26402,16 @@ def delete_tools( **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Remove Tools from a Toolbelt. + """Add Tools to a Toolbelt. - Removes tool names and creates a new immutable toolbelt version. + Adds the listed tools and returns the toolbelt. When membership changes, this creates a new + version that keeps the display name and description. Tools already in the toolbelt are left as + they are, so a request that adds nothing new returns the current version unchanged. Returns 400 + when a tool is not an active catalog tool, when a pin differs from the tool's current released + version or from the version the toolbelt already holds, or when the toolbelt would exceed 500 + tools. Returns 404 for an unknown or deleted toolbelt. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name, from the path. Required. :type name: str :param body: Required. :type body: JSON @@ -19902,29 +26428,38 @@ def delete_tools( # JSON input template you can fill out and use as your body input. body = { "tools": [ - "str" # Required. + "str" # Tool slugs ("" ``_``"" ) to add or remove, + each optionally pinned as ``@``. At least one is + required. When adding, a pin must equal the tool's current released version. + Required. ] } # response body for status code(s): 200 response == { "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. "tools": [ - "str" # Required. + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } # response body for status code(s): 400, 404 @@ -19941,7 +26476,7 @@ def delete_tools( """ @overload - def delete_tools( + def add_tools( self, name: str, body: IO[bytes], @@ -19950,11 +26485,16 @@ def delete_tools( **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Remove Tools from a Toolbelt. + """Add Tools to a Toolbelt. - Removes tool names and creates a new immutable toolbelt version. + Adds the listed tools and returns the toolbelt. When membership changes, this creates a new + version that keeps the display name and description. Tools already in the toolbelt are left as + they are, so a request that adds nothing new returns the current version unchanged. Returns 400 + when a tool is not an active catalog tool, when a pin differs from the tool's current released + version or from the version the toolbelt already holds, or when the toolbelt would exceed 500 + tools. Returns 404 for an unknown or deleted toolbelt. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name, from the path. Required. :type name: str :param body: Required. :type body: IO[bytes] @@ -19971,22 +26511,28 @@ def delete_tools( # response body for status code(s): 200 response == { "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. "tools": [ - "str" # Required. + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } # response body for status code(s): 400, 404 @@ -20003,15 +26549,18 @@ def delete_tools( """ @distributed_trace - def delete_tools( - self, name: str, body: Union[JSON, IO[bytes]], **kwargs: Any - ) -> JSON: + def add_tools(self, name: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: # pylint: disable=line-too-long - """Remove Tools from a Toolbelt. + """Add Tools to a Toolbelt. - Removes tool names and creates a new immutable toolbelt version. + Adds the listed tools and returns the toolbelt. When membership changes, this creates a new + version that keeps the display name and description. Tools already in the toolbelt are left as + they are, so a request that adds nothing new returns the current version unchanged. Returns 400 + when a tool is not an active catalog tool, when a pin differs from the tool's current released + version or from the version the toolbelt already holds, or when the toolbelt would exceed 500 + tools. Returns 404 for an unknown or deleted toolbelt. - :param name: The natural key identifying the toolbelt. Required. + :param name: Toolbelt name, from the path. Required. :type name: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] @@ -20025,29 +26574,38 @@ def delete_tools( # JSON input template you can fill out and use as your body input. body = { "tools": [ - "str" # Required. + "str" # Tool slugs ("" ``_``"" ) to add or remove, + each optionally pinned as ``@``. At least one is + required. When adding, a pin must equal the tool's current released version. + Required. ] } # response body for status code(s): 200 response == { "toolbelt": { - "created_at": "2020-02-20 00:00:00", # Required. - "name": "str", # Required. - "reference": "str", # A reference pinned to this immutable toolbelt - version. Required. - "reference_latest": "str", # An unversioned reference to the latest - active version. Required. - "status": "str", # Required. Known values are: "active" and - "deprecated". - "tool_count": 0, # Required. + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. "tools": [ - "str" # Required. + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "updated_at": "2020-02-20 00:00:00", # Required. - "version": "str", # Required. - "description": "str", # Optional. Required. - "display_name": "str" # Optional. Required. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } # response body for status code(s): 400, 404 @@ -20091,7 +26649,7 @@ def delete_tools( else: _json = body - _request = build_toolbelts_delete_tools_request( + _request = build_toolbelts_add_tools_request( name=name, content_type=content_type, json=_json, @@ -20151,170 +26709,19 @@ def delete_tools( 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 ConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~pydo.GeneratedClient`'s - :attr:`connections` 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( - self, - *, - provider: Optional[str] = None, - user_id: Optional[str] = None, - status: Optional[str] = None, - sort: Optional[str] = None, - sort_direction: Optional[str] = None, - page: int = 1, - per_page: int = 20, - **kwargs: Any, - ) -> JSON: - """List Connections. - - Lists OAuth connections owned by the authenticated team. - - :keyword provider: Filter by provider name. Default value is None. - :paramtype provider: str - :keyword user_id: Filter by end-user identifier. Default value is None. - :paramtype user_id: str - :keyword status: Filter by connection status. Default value is None. - :paramtype status: str - :keyword sort: Field used to sort results. Default value is None. - :paramtype sort: str - :keyword sort_direction: Sort direction. Default value is None. - :paramtype sort_direction: str - :keyword page: Which 'page' of paginated results to return. Default value is 1. - :paramtype page: int - :keyword per_page: Number of items returned per page. Default value is 20. - :paramtype per_page: int - :return: JSON object - :rtype: JSON - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "connections": [ - { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. - "granted_at": "2020-02-20 00:00:00", # Optional. - "id": "str", # Optional. - "provider": "str", # Optional. - "provider_display_name": "str", # Optional. - "revoked_at": "2020-02-20 00:00:00", # Optional. - "scopes": [ - "str" # Optional. - ], - "status": "str", # Optional. - "updated_at": "2020-02-20 00:00:00", # Optional. - "user_id": "str" # Optional. - } - ], - "pagination": { - "page": 0, # Required. - "per_page": 0, # Required. - "total": 0 # Required. - } - } - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - 401: cast( - Type[HttpResponseError], - lambda response: ClientAuthenticationError(response=response), - ), - 429: HttpResponseError, - 500: HttpResponseError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[JSON] = kwargs.pop("cls", None) - - _request = build_connections_list_request( - provider=provider, - user_id=user_id, - status=status, - sort=sort, - sort_direction=sort_direction, - page=page, - per_page=per_page, - 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") - ) + "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.content: + deserialized = response.json() + else: + deserialized = None if cls: return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore @@ -20322,14 +26729,25 @@ def list( return cast(JSON, deserialized) # type: ignore @overload - def create( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + def delete_tools( + self, + name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Create a Connection. + """Remove Tools from a Toolbelt. - Creates or begins authorization for an OAuth connection to an Action Gateway provider. + Removes the listed tools and returns the toolbelt. When membership changes, this creates a new + version that keeps the display name and description. Tools that are not members are ignored, + and removing every tool is allowed; deleting the toolbelt itself is a separate DELETE. Returns + 400 when a pin differs from the version the toolbelt holds, and 404 for an unknown or deleted + toolbelt. + :param name: Toolbelt name, from the path. Required. + :type name: str :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -20344,91 +26762,42 @@ def create( # JSON input template you can fill out and use as your body input. body = { - "connection_parameters": {}, # Optional. Any object. - "provider": "str", # Optional. - "scopes": [ - "str" # Optional. - ], - "user_id": "str" # Optional. + "tools": [ + "str" # Tool slugs ("" ``_``"" ) to add or remove, + each optionally pinned as ``@``. At least one is + required. When adding, a pin must equal the tool's current released version. + Required. + ] } # response body for status code(s): 200 response == { - "authorization": { - "connect_url": "str", # Optional. ConnectionAuthorization is present - only while a connection is pending. The UI sends the user to connect_url and - polls GetConnection until the connection becomes active or expires. The - Secrets Manager poll URL is never exposed. - "expires_at": "2020-02-20 00:00:00", # Optional. - ConnectionAuthorization is present only while a connection is pending. The UI - sends the user to connect_url and polls GetConnection until the connection - becomes active or expires. The Secrets Manager poll URL is never exposed. - "status": "str", # Optional. ConnectionAuthorization is present only - while a connection is pending. The UI sends the user to connect_url and polls - GetConnection until the connection becomes active or expires. The Secrets - Manager poll URL is never exposed. - "verification_code": "str" # Optional. ConnectionAuthorization is - present only while a connection is pending. The UI sends the user to - connect_url and polls GetConnection until the connection becomes active or - expires. The Secrets Manager poll URL is never exposed. - }, - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. + "toolbelt": { + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. + "tools": [ + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } - # response body for status code(s): 400, 409 + # 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 @@ -20442,14 +26811,25 @@ def create( """ @overload - def create( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + def delete_tools( + self, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Create a Connection. + """Remove Tools from a Toolbelt. - Creates or begins authorization for an OAuth connection to an Action Gateway provider. + Removes the listed tools and returns the toolbelt. When membership changes, this creates a new + version that keeps the display name and description. Tools that are not members are ignored, + and removing every tool is allowed; deleting the toolbelt itself is a separate DELETE. Returns + 400 when a pin differs from the version the toolbelt holds, and 404 for an unknown or deleted + toolbelt. + :param name: Toolbelt name, from the path. Required. + :type name: str :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -20464,81 +26844,32 @@ def create( # response body for status code(s): 200 response == { - "authorization": { - "connect_url": "str", # Optional. ConnectionAuthorization is present - only while a connection is pending. The UI sends the user to connect_url and - polls GetConnection until the connection becomes active or expires. The - Secrets Manager poll URL is never exposed. - "expires_at": "2020-02-20 00:00:00", # Optional. - ConnectionAuthorization is present only while a connection is pending. The UI - sends the user to connect_url and polls GetConnection until the connection - becomes active or expires. The Secrets Manager poll URL is never exposed. - "status": "str", # Optional. ConnectionAuthorization is present only - while a connection is pending. The UI sends the user to connect_url and polls - GetConnection until the connection becomes active or expires. The Secrets - Manager poll URL is never exposed. - "verification_code": "str" # Optional. ConnectionAuthorization is - present only while a connection is pending. The UI sends the user to - connect_url and polls GetConnection until the connection becomes active or - expires. The Secrets Manager poll URL is never exposed. - }, - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. + "toolbelt": { + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. + "tools": [ + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } - # response body for status code(s): 400, 409 + # 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 @@ -20552,12 +26883,20 @@ def create( """ @distributed_trace - def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + def delete_tools( + self, name: str, body: Union[JSON, IO[bytes]], **kwargs: Any + ) -> JSON: # pylint: disable=line-too-long - """Create a Connection. + """Remove Tools from a Toolbelt. - Creates or begins authorization for an OAuth connection to an Action Gateway provider. + Removes the listed tools and returns the toolbelt. When membership changes, this creates a new + version that keeps the display name and description. Tools that are not members are ignored, + and removing every tool is allowed; deleting the toolbelt itself is a separate DELETE. Returns + 400 when a pin differs from the version the toolbelt holds, and 404 for an unknown or deleted + toolbelt. + :param name: Toolbelt name, from the path. Required. + :type name: str :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] :return: JSON object @@ -20569,91 +26908,42 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: # JSON input template you can fill out and use as your body input. body = { - "connection_parameters": {}, # Optional. Any object. - "provider": "str", # Optional. - "scopes": [ - "str" # Optional. - ], - "user_id": "str" # Optional. + "tools": [ + "str" # Tool slugs ("" ``_``"" ) to add or remove, + each optionally pinned as ``@``. At least one is + required. When adding, a pin must equal the tool's current released version. + Required. + ] } # response body for status code(s): 200 response == { - "authorization": { - "connect_url": "str", # Optional. ConnectionAuthorization is present - only while a connection is pending. The UI sends the user to connect_url and - polls GetConnection until the connection becomes active or expires. The - Secrets Manager poll URL is never exposed. - "expires_at": "2020-02-20 00:00:00", # Optional. - ConnectionAuthorization is present only while a connection is pending. The UI - sends the user to connect_url and polls GetConnection until the connection - becomes active or expires. The Secrets Manager poll URL is never exposed. - "status": "str", # Optional. ConnectionAuthorization is present only - while a connection is pending. The UI sends the user to connect_url and polls - GetConnection until the connection becomes active or expires. The Secrets - Manager poll URL is never exposed. - "verification_code": "str" # Optional. ConnectionAuthorization is - present only while a connection is pending. The UI sends the user to - connect_url and polls GetConnection until the connection becomes active or - expires. The Secrets Manager poll URL is never exposed. - }, - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. + "toolbelt": { + "created_at": "2020-02-20 00:00:00", # Optional. When this version + was created, in RFC 3339 format. + "description": "str", # Optional. Team-authored description. + "display_name": "str", # Optional. Human-readable label. + "name": "str", # Optional. Toolbelt name, unique among your team's + active toolbelts. + "reference": "str", # Optional. ``@``"" , identifying + this exact version. Sessions reference it as ``toolbelt:@``. + "reference_latest": "str", # Optional. The toolbelt name, which + refers to whichever version is latest. + "status": "str", # Optional. active, or deprecated once the toolbelt + is deleted. Known values are: "active" and "deprecated". + "tool_count": 0, # Optional. Number of entries in tools. + "tools": [ + "str" # Optional. Members, sorted, each as + ``@``"" : the tool and the version this toolbelt + version pins. ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. + "updated_at": "2020-02-20 00:00:00", # Optional. When this version + was last modified, in RFC 3339 format. + "version": "str" # Optional. Version number of this toolbelt + version, as a string, for example ``3``. } } - # response body for status code(s): 400, 409 + # 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 @@ -20694,7 +26984,8 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: else: _json = body - _request = build_connections_create_request( + _request = build_toolbelts_delete_tools_request( + name=name, content_type=content_type, json=_json, content=_content, @@ -20712,7 +27003,7 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200, 400, 409]: + 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 @@ -20751,7 +27042,7 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: else: deserialized = None - if response.status_code == 409: + if response.status_code == 404: response_headers["ratelimit-limit"] = self._deserialize( "int", response.headers.get("ratelimit-limit") ) @@ -20772,15 +27063,51 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore + +class ToolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.GeneratedClient`'s + :attr:`tools` 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 get(self, id: str, **kwargs: Any) -> JSON: + def list( + self, + *, + toolkit_id: Optional[str] = None, + page: int = 1, + per_page: int = 100, + **kwargs: Any, + ) -> JSON: # pylint: disable=line-too-long - """Retrieve a Connection. + """List Tools. - Retrieves an OAuth connection owned by the authenticated team. + Returns one page of the tools your team can use: released catalog tools plus the enabled tools + of your team's MCP servers. definitions[i] describes tools[i]. Offset-paged with page and + ``per_page``\\ ; an unknown ``toolkitId`` returns an empty page. - :param id: The connection UUID. Required. - :type id: str + :keyword toolkit_id: Restricts the page to one provider. It accepts the provider ID the catalog + returns, including the ``serverRef`` of one of your team's MCP servers. Default value is None. + :paramtype toolkit_id: str + :keyword page: 1-based page index; values below 1 are treated as 1. A page past the end returns + an empty tools list with the real total. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 100 when omitted or 0; values above 100 are capped at + 100. Default value is 100. + :paramtype per_page: int :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -20790,81 +27117,255 @@ def get(self, id: str, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == { - "authorization": { - "connect_url": "str", # Optional. ConnectionAuthorization is present - only while a connection is pending. The UI sends the user to connect_url and - polls GetConnection until the connection becomes active or expires. The - Secrets Manager poll URL is never exposed. - "expires_at": "2020-02-20 00:00:00", # Optional. - ConnectionAuthorization is present only while a connection is pending. The UI - sends the user to connect_url and polls GetConnection until the connection - becomes active or expires. The Secrets Manager poll URL is never exposed. - "status": "str", # Optional. ConnectionAuthorization is present only - while a connection is pending. The UI sends the user to connect_url and polls - GetConnection until the connection becomes active or expires. The Secrets - Manager poll URL is never exposed. - "verification_code": "str" # Optional. ConnectionAuthorization is - present only while a connection is pending. The UI sends the user to - connect_url and polls GetConnection until the connection becomes active or - expires. The Secrets Manager poll URL is never exposed. + "definitions": [ + { + "annotations": { + "destructiveHint": bool, # Optional. The tool may + perform destructive updates. + "idempotentHint": bool, # Optional. Repeating a call + with the same arguments has no additional effect. + "openWorldHint": bool, # Optional. The tool + interacts with external systems beyond the provider's own data. + "readOnlyHint": bool, # Optional. The tool does not + modify anything. + "title": "str" # Optional. Human-readable tool + title. + }, + "auth": { + "modes": [ + "str" # Optional. Lists how the tool + authenticates: oauth (a user connection), ``user_token`` (a key + your team supplies), ``shared_key`` (a key DigitalOcean + supplies), or none. + ], + "provider": "str", # Optional. The provider slug a + connection is created for. Empty when the tool needs no provider + account. + "scopes": [ + "str" # Optional. The provider permissions + the tool requests. + ] + }, + "description": "str", # Optional. What the tool does. + "inputSchema": {}, # Optional. The JSON Schema the tool's + arguments must satisfy. + "name": "str", # Optional. The tool name without the + provider prefix. + "outputSchema": {}, # Optional. The JSON Schema of the + tool's result, when declared. + "providerKind": "str", # Optional. Classifies the provider: + native, ``managed_api``"" , ``customer_mcp``"" , sandbox, or ``byo_mcp`` + (one of your team's MCP servers). + "title": "str", # Optional. Human-readable tool title. + "toolId": "str", # Optional. The opaque identity of this + released tool version. + "toolSlug": "str", # Optional. The provider-qualified tool + identifier ``_``. Treat it as opaque and pass it back + verbatim. + "toolkitId": "str", # Optional. The ID of the provider that + offers the tool. For a tool from one of your team's MCP servers it is + that server's ``serverRef``. + "version": "str" # Optional. The released version, for + example ``v3``. + } + ], + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. }, - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - } + "tools": [ + { + "annotations": { + "destructiveHint": bool, # Optional. The tool may + perform destructive updates. + "idempotentHint": bool, # Optional. Repeating a call + with the same arguments has no additional effect. + "openWorldHint": bool, # Optional. The tool + interacts with external systems beyond the provider's own data. + "readOnlyHint": bool, # Optional. The tool does not + modify anything. + "title": "str" # Optional. Human-readable tool + title. + }, + "description": "str", # Optional. What the tool does. + "inputSchema": {}, # Optional. JSON Schema the tool's + arguments must satisfy. + "name": "str", # Optional. Tool name, without the provider + prefix. + "outputSchema": {}, # Optional. JSON Schema of the tool's + result, when declared. + "parallelizable": bool, # Optional. Catalog hint that calls + to the tool may run in parallel. + "streamingSafe": bool, # Optional. Catalog hint that the + tool's result can be streamed. + "title": "str", # Optional. Human-readable tool title. + "toolSlug": "str", # Optional. The provider-qualified, + stable tool identifier ``_``. Pass this value back + verbatim to the toolbelt add/remove endpoints; clients should treat it as + opaque rather than reconstructing it from ``toolkitId`` and name. + "toolkitId": "str", # Optional. ID of the provider that + offers the tool. For a tool from one of your team's MCP servers it is + that server's ``serverRef``. + "version": "str" # Optional. Released version, for example + ``v3``. + } + ], + "version": "str" # Optional. Catalog version identifier, for example ``v1``. } - # response body for status code(s): 404 + """ + 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_tools_list_request( + toolkit_id=toolkit_id, + page=page, + per_page=per_page, + 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 list_health( + self, + *, + provider: Optional[str] = None, + window: str = "HEALTH_WINDOW_TWENTY_FOUR_HOURS", + page: int = 1, + per_page: int = 20, + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """List Tool Health. + + Returns availability and latency for each catalog tool over the requested window, sorted by + provider and then tool slug. A tool with no calls in the window is listed with ``data_status`` + ``HEALTH_DATA_STATUS_NO_DATA``. Metrics are aggregated across all customers; request volumes + are not reported. Tools of your team's MCP servers are not included. Offset-paged with page and + ``per_page``. + + :keyword provider: Optional provider ID, matched exactly, to return only that provider's tools. + Default value is None. + :paramtype provider: str + :keyword window: Window to aggregate over. Defaults to twenty-four hours. + + + * ``HEALTH_WINDOW_UNSPECIFIED``\\ : Twenty-four hours. + * ``HEALTH_WINDOW_ONE_HOUR``\\ : One hour; history points are 10 minutes. + * ``HEALTH_WINDOW_TWENTY_FOUR_HOURS``\\ : Twenty-four hours; history points are 1 hour. + * ``HEALTH_WINDOW_SEVEN_DAYS``\\ : Seven days; history points are 6 hours. + * ``HEALTH_WINDOW_THIRTY_DAYS``\\ : Thirty days; history points are 24 hours. Known values + are: "HEALTH_WINDOW_ONE_HOUR", "HEALTH_WINDOW_TWENTY_FOUR_HOURS", "HEALTH_WINDOW_SEVEN_DAYS", + and "HEALTH_WINDOW_THIRTY_DAYS". Default value is "HEALTH_WINDOW_TWENTY_FOUR_HOURS". + :paramtype window: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int + :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. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. + }, + "snapshot": { + "measured_at": "2020-02-20 00:00:00", # Optional. When the metrics + were computed. They are recomputed at most every five minutes. + "stale": bool, # Optional. True when the latest recomputation failed + and earlier metrics, up to 30 minutes old, are returned instead. + "window": "str" # Optional. Length of the window the metrics cover, + ending at ``measured_at``. + }, + "tools": [ + { + "health": { + "data_status": "str", # Optional. + ``HEALTH_DATA_STATUS_AVAILABLE`` when the window has calls to + measure; ``HEALTH_DATA_STATUS_NO_DATA`` when it has none, in which + case the metrics are null. Do not treat no data as healthy. Known + values are: "HEALTH_DATA_STATUS_AVAILABLE" and + "HEALTH_DATA_STATUS_NO_DATA". + "latency_p50_ms": 0.0, # Optional. Median duration + of successful calls, in milliseconds. Durations above 40960 ms are + reported as 40960. + "latency_p95_ms": 0.0, # Optional. 95th-percentile + duration of successful calls, in milliseconds. Durations above 40960 + ms are reported as 40960. + "uptime_percentage": 0.0 # Optional. Percentage of + calls that did not fail because of the provider (an upstream error, + timeout, rate limit, or unavailability). Calls that failed for other + reasons are not counted. + }, + "provider": "str", # Optional. ID of the provider that + offers the tool. + "tool_slug": "str" # Optional. Catalog tool slug. + } + ] + } + # 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 @@ -20894,8 +27395,11 @@ def get(self, id: str, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_connections_get_request( - id=id, + _request = build_tools_list_health_request( + provider=provider, + window=window, + page=page, + per_page=per_page, headers=_headers, params=_params, ) @@ -20910,7 +27414,7 @@ def get(self, id: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200, 404]: + 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 @@ -20933,7 +27437,7 @@ def get(self, id: str, **kwargs: Any) -> JSON: else: deserialized = None - if response.status_code == 404: + if response.status_code == 400: response_headers["ratelimit-limit"] = self._deserialize( "int", response.headers.get("ratelimit-limit") ) @@ -20954,221 +27458,42 @@ def get(self, id: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore - @overload - def update( - self, - id: str, - body: JSON, - *, - content_type: str = "application/json", - **kwargs: Any, - ) -> JSON: - # pylint: disable=line-too-long - """Update Connection Parameters. - - Updates non-sensitive connection parameters for an OAuth connection. - - :param id: The connection UUID. Required. - :type id: str - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: JSON object - :rtype: JSON - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "connection_parameters": {}, # Optional. Any object. - "id": "str" # Optional. - } - - # response body for status code(s): 200 - response == { - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - } - } - # 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 - def update( + @distributed_trace + def list_health_providers( self, - id: str, - body: IO[bytes], *, - content_type: str = "application/json", + provider: Optional[str] = None, + window: str = "HEALTH_WINDOW_TWENTY_FOUR_HOURS", + page: int = 1, + per_page: int = 20, **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """Update Connection Parameters. - - Updates non-sensitive connection parameters for an OAuth connection. - - :param id: The connection UUID. Required. - :type id: str - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: JSON object - :rtype: JSON - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # response body for status code(s): 200 - response == { - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - } - } - # 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 - def update(self, id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: - # pylint: disable=line-too-long - """Update Connection Parameters. + """List Provider Health. - Updates non-sensitive connection parameters for an OAuth connection. + Returns availability and latency for each catalog provider over the requested window, sorted by + provider ID. Metrics are aggregated across all customers; request volumes are not reported. + Tools of your team's MCP servers are not included. Offset-paged with page and ``per_page``. - :param id: The connection UUID. Required. - :type id: str - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :keyword provider: Optional provider ID, matched exactly, to return only that provider. Default + value is None. + :paramtype provider: str + :keyword window: Window to aggregate over. Defaults to twenty-four hours. + + + * ``HEALTH_WINDOW_UNSPECIFIED``\\ : Twenty-four hours. + * ``HEALTH_WINDOW_ONE_HOUR``\\ : One hour; history points are 10 minutes. + * ``HEALTH_WINDOW_TWENTY_FOUR_HOURS``\\ : Twenty-four hours; history points are 1 hour. + * ``HEALTH_WINDOW_SEVEN_DAYS``\\ : Seven days; history points are 6 hours. + * ``HEALTH_WINDOW_THIRTY_DAYS``\\ : Thirty days; history points are 24 hours. Known values + are: "HEALTH_WINDOW_ONE_HOUR", "HEALTH_WINDOW_TWENTY_FOUR_HOURS", "HEALTH_WINDOW_SEVEN_DAYS", + and "HEALTH_WINDOW_THIRTY_DAYS". Default value is "HEALTH_WINDOW_TWENTY_FOUR_HOURS". + :paramtype window: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -21176,71 +27501,47 @@ def update(self, id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - body = { - "connection_parameters": {}, # Optional. Any object. - "id": "str" # Optional. - } - # response body for status code(s): 200 response == { - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. + }, + "providers": [ + { + "health": { + "data_status": "str", # Optional. + ``HEALTH_DATA_STATUS_AVAILABLE`` when the window has calls to + measure; ``HEALTH_DATA_STATUS_NO_DATA`` when it has none, in which + case the metrics are null. Do not treat no data as healthy. Known + values are: "HEALTH_DATA_STATUS_AVAILABLE" and + "HEALTH_DATA_STATUS_NO_DATA". + "latency_p50_ms": 0.0, # Optional. Median duration + of successful calls, in milliseconds. Durations above 40960 ms are + reported as 40960. + "latency_p95_ms": 0.0, # Optional. 95th-percentile + duration of successful calls, in milliseconds. Durations above 40960 + ms are reported as 40960. + "uptime_percentage": 0.0 # Optional. Percentage of + calls that did not fail because of the provider (an upstream error, + timeout, rate limit, or unavailability). Calls that failed for other + reasons are not counted. + }, + "provider": "str" # Optional. Provider ID. + } + ], + "snapshot": { + "measured_at": "2020-02-20 00:00:00", # Optional. When the metrics + were computed. They are recomputed at most every five minutes. + "stale": bool, # Optional. True when the latest recomputation failed + and earlier metrics, up to 30 minutes old, are returned instead. + "window": "str" # Optional. Length of the window the metrics cover, + ending at ``measured_at``. } } - # response body for status code(s): 400, 404 + # 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 @@ -21265,27 +27566,16 @@ def update(self, id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = 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_connections_update_request( - id=id, - content_type=content_type, - json=_json, - content=_content, + _request = build_tools_list_health_providers_request( + provider=provider, + window=window, + page=page, + per_page=per_page, headers=_headers, params=_params, ) @@ -21300,7 +27590,7 @@ def update(self, id: str, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200, 400, 404]: + 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 @@ -21339,36 +27629,43 @@ def update(self, id: str, body: Union[JSON, IO[bytes]], **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 @distributed_trace - def delete(self, id: str, **kwargs: Any) -> JSON: + def get_health( + self, + tool_slug: str, + *, + window: str = "HEALTH_WINDOW_TWENTY_FOUR_HOURS", + include_history: bool = False, + **kwargs: Any, + ) -> JSON: # pylint: disable=line-too-long - """Delete a Connection. + """Get Tool Health. - Revokes and deletes an OAuth connection owned by the authenticated team. + Returns availability and latency for one catalog tool over the requested window, optionally + with a history series. Metrics are aggregated across all customers; request volumes are not + reported. Returns 404 when ``tool_slug`` is not a catalog tool. - :param id: The connection UUID. Required. - :type id: str + :param tool_slug: Catalog tool slug, for example ``exa_search``. Required. Required. + :type tool_slug: str + :keyword window: Window to aggregate over. Defaults to twenty-four hours. + + + * ``HEALTH_WINDOW_UNSPECIFIED``\\ : Twenty-four hours. + * ``HEALTH_WINDOW_ONE_HOUR``\\ : One hour; history points are 10 minutes. + * ``HEALTH_WINDOW_TWENTY_FOUR_HOURS``\\ : Twenty-four hours; history points are 1 hour. + * ``HEALTH_WINDOW_SEVEN_DAYS``\\ : Seven days; history points are 6 hours. + * ``HEALTH_WINDOW_THIRTY_DAYS``\\ : Thirty days; history points are 24 hours. Known values + are: "HEALTH_WINDOW_ONE_HOUR", "HEALTH_WINDOW_TWENTY_FOUR_HOURS", "HEALTH_WINDOW_SEVEN_DAYS", + and "HEALTH_WINDOW_THIRTY_DAYS". Default value is "HEALTH_WINDOW_TWENTY_FOUR_HOURS". + :paramtype window: str + :keyword include_history: Additionally returns the window split into resolution-aligned points + (the history field below). Default value is False. + :paramtype include_history: bool :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -21378,63 +27675,68 @@ def delete(self, id: str, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == { - "connection": { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "granted_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "id": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "provider_display_name": "str", # Optional. ---- OAuth connection - resources -------------------------- OAuthConnection is the public, - team-scoped connection metadata returned to the UI. It deliberately excludes - the team ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. - "revoked_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "scopes": [ - "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team - ID, Secrets Manager assignment, actor identifiers, poll URL, and - authorization handle. + "history": { + "points": [ + { + "bucket_start": "2020-02-20 00:00:00", # Optional. + Start of the slot. + "health": { + "data_status": "str", # Optional. + ``HEALTH_DATA_STATUS_AVAILABLE`` when the window has calls to + measure; ``HEALTH_DATA_STATUS_NO_DATA`` when it has none, in + which case the metrics are null. Do not treat no data as healthy. + Known values are: "HEALTH_DATA_STATUS_AVAILABLE" and + "HEALTH_DATA_STATUS_NO_DATA". + "latency_p50_ms": 0.0, # Optional. Median + duration of successful calls, in milliseconds. Durations above + 40960 ms are reported as 40960. + "latency_p95_ms": 0.0, # Optional. + 95th-percentile duration of successful calls, in milliseconds. + Durations above 40960 ms are reported as 40960. + "uptime_percentage": 0.0 # Optional. + Percentage of calls that did not fail because of the provider (an + upstream error, timeout, rate limit, or unavailability). Calls + that failed for other reasons are not counted. + } + } ], - "status": "str", # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. - "updated_at": "2020-02-20 00:00:00", # Optional. ---- OAuth - connection resources -------------------------- OAuthConnection is the - public, team-scoped connection metadata returned to the UI. It deliberately - excludes the team ID, Secrets Manager assignment, actor identifiers, poll - URL, and authorization handle. - "user_id": "str" # Optional. ---- OAuth connection resources - -------------------------- OAuthConnection is the public, team-scoped - connection metadata returned to the UI. It deliberately excludes the team ID, - Secrets Manager assignment, actor identifiers, poll URL, and authorization - handle. + "resolution": "str", # Optional. Length of each point. + "stale": bool # Optional. Means the same as HealthSnapshot.stale, + for the history series. The series is refreshed independently, so a fresh + snapshot can accompany an older history and vice versa. + }, + "snapshot": { + "measured_at": "2020-02-20 00:00:00", # Optional. When the metrics + were computed. They are recomputed at most every five minutes. + "stale": bool, # Optional. True when the latest recomputation failed + and earlier metrics, up to 30 minutes old, are returned instead. + "window": "str" # Optional. Length of the window the metrics cover, + ending at ``measured_at``. + }, + "tool": { + "health": { + "data_status": "str", # Optional. + ``HEALTH_DATA_STATUS_AVAILABLE`` when the window has calls to measure; + ``HEALTH_DATA_STATUS_NO_DATA`` when it has none, in which case the + metrics are null. Do not treat no data as healthy. Known values are: + "HEALTH_DATA_STATUS_AVAILABLE" and "HEALTH_DATA_STATUS_NO_DATA". + "latency_p50_ms": 0.0, # Optional. Median duration of + successful calls, in milliseconds. Durations above 40960 ms are reported + as 40960. + "latency_p95_ms": 0.0, # Optional. 95th-percentile duration + of successful calls, in milliseconds. Durations above 40960 ms are + reported as 40960. + "uptime_percentage": 0.0 # Optional. Percentage of calls + that did not fail because of the provider (an upstream error, timeout, + rate limit, or unavailability). Calls that failed for other reasons are + not counted. + }, + "provider": "str", # Optional. ID of the provider that offers the + tool. + "tool_slug": "str" # Optional. Catalog tool slug. } } - # response body for status code(s): 404 + # 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 @@ -21464,8 +27766,10 @@ def delete(self, id: str, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_connections_delete_request( - id=id, + _request = build_tools_get_health_request( + tool_slug=tool_slug, + window=window, + include_history=include_history, headers=_headers, params=_params, ) @@ -21480,7 +27784,7 @@ def delete(self, id: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200, 404]: + 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 @@ -21503,6 +27807,22 @@ def delete(self, id: str, **kwargs: Any) -> 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") @@ -21524,37 +27844,15 @@ def delete(self, id: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore - -class UsersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~pydo.GeneratedClient`'s - :attr:`users` 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(self, *, page: int = 1, per_page: int = 20, **kwargs: Any) -> JSON: - """List Action Gateway Users. + def list_providers(self, **kwargs: Any) -> JSON: + # pylint: disable=line-too-long + """List Providers. - Lists end-user identifiers derived from sessions and OAuth connections for the authenticated - team. + Returns the active catalog providers with at least one released tool, sorted by display name, + with the credential kinds each accepts and the parameters a connection or team credential + needs. Your team's MCP servers are listed separately under ``/v2/action-gateway/mcp-servers``. - :keyword page: Which 'page' of paginated results to return. Default value is 1. - :paramtype page: int - :keyword per_page: Number of items returned per page. Default value is 20. - :paramtype per_page: int :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -21564,13 +27862,103 @@ def list(self, *, page: int = 1, per_page: int = 20, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == { - "pagination": { - "page": 0, # Required. - "per_page": 0, # Required. - "total": 0 # Required. - }, - "user_ids": [ - "str" # Optional. + "providers": [ + { + "auth_type": "str", # Optional. Deprecated: read + ``auth_types``"" , since a provider may accept more than one credential + kind. This is the first entry of ``auth_types`` other than ``none``"" , + or ``none`` when that is the only entry. + "auth_types": [ + "str" # Optional. Credential kinds the provider + accepts, sorted: none|oauth|"" ``shared_api_key``"" |unknown|"" + ``user_oauth_app``"" |"" ``user_token``. ``none`` means the provider + needs no credential. ``oauth`` means users can connect through + DigitalOcean's shared OAuth application. ``user_oauth_app`` means + users can connect through an OAuth client your team registers as a + provider credential; without ``oauth`` alongside it, that is the only + way to connect. ``shared_api_key`` means DigitalOcean supplies the + key. ``user_token`` means your team or its users supply a key or + token. ``unknown`` means the provider declares no kind this API + recognizes, including an OAuth provider whose shared application is + not available. It is never paired with another kind. + ], + "connection_parameters": [ + { + "allowed_host_suffixes": [ + "str" # Optional. For + ``https_origin`` inputs, the host suffixes the origin's host + must match. + ], + "allowed_values": [ + "str" # Optional. For enum inputs, + the accepted values. + ], + "description": "str", # Optional. Help text. + "input_kind": "str", # Optional. How the + value is entered: string, ``https_origin``"" , or enum. Known + values are: "string", "https_origin", and "enum". + "key": "str", # Optional. Key of the value + in ``connection_parameters`` or ``credential_parameters``. + "label": "str", # Optional. Display label. + "max_length": 0, # Optional. Maximum length + of the value. 0 means the default maximum of 4096. + "normalization": "str", # Optional. How the + value is normalized before it is validated and stored: trim, + lowercase, uppercase, or ``https_origin``. + "pattern": "str", # Optional. Optional RE2 + expression matched against the whole normalized value. + "required": bool # Optional. Whether the + value must be supplied. + } + ], + "credential_parameters": [ + { + "allowed_host_suffixes": [ + "str" # Optional. For + ``https_origin`` inputs, the host suffixes the origin's host + must match. + ], + "allowed_values": [ + "str" # Optional. For enum inputs, + the accepted values. + ], + "description": "str", # Optional. Help text. + "input_kind": "str", # Optional. How the + value is entered: string, ``https_origin``"" , or enum. Known + values are: "string", "https_origin", and "enum". + "key": "str", # Optional. Key of the value + in ``connection_parameters`` or ``credential_parameters``. + "label": "str", # Optional. Display label. + "max_length": 0, # Optional. Maximum length + of the value. 0 means the default maximum of 4096. + "normalization": "str", # Optional. How the + value is normalized before it is validated and stored: trim, + lowercase, uppercase, or ``https_origin``. + "pattern": "str", # Optional. Optional RE2 + expression matched against the whole normalized value. + "required": bool # Optional. Whether the + value must be supplied. + } + ], + "description": "str", # Optional. Provider description. + "display_name": "str", # Optional. Human-readable provider + name. + "name": "str", # Optional. Provider slug, used as provider + when creating a connection or a provider credential. + "oauth_client_setup_url": "str", # Optional. HTTPS page at + the provider where a team creates that OAuth client, such as its + developer console or setup guide. Empty unless ``auth_types`` contains + ``user_oauth_app`` and the provider declares one. + "oauth_redirect_url": "str", # Optional. Callback URL a team + must register with the provider when it creates its own OAuth client. It + is the same for every provider and cannot be changed per credential. + Empty unless ``auth_types`` contains ``user_oauth_app``. + "scopes": [ + "str" # Optional. The OAuth scopes a connection may + request; a connection that requests none gets all of them. Set only + when ``auth_types`` contains ``oauth`` or ``user_oauth_app``. + ] + } ] } """ @@ -21592,9 +27980,7 @@ def list(self, *, page: int = 1, per_page: int = 20, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_users_list_request( - page=page, - per_page=per_page, + _request = build_tools_list_providers_request( headers=_headers, params=_params, ) @@ -21637,14 +28023,32 @@ def list(self, *, page: int = 1, per_page: int = 20, **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore @distributed_trace - def get(self, user_id: str, **kwargs: Any) -> JSON: + def list_search_providers( + self, + *, + query: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, + **kwargs: Any, + ) -> JSON: # pylint: disable=line-too-long - """Retrieve an Action Gateway User. + """Search Providers. - Retrieves a derived end-user view containing its sessions and OAuth connections. + Returns the providers of ``GET /v2/action-gateway/tools/providers`` whose name, display name, + or description contains query, case-insensitively, sorted by name. Cursor-paged with + ``page_size`` and ``page_token``\\ ; no total is reported. - :param user_id: The end-user identifier. Required. - :type user_id: str + :keyword query: Matched case-insensitively as a substring of name, ``display_name``\\ , or + description. It does not match the titles of the tools a provider owns: "providers owning a + tool that matches" is a tool search grouped by the provider field of each result. Default value + is None. + :paramtype query: str + :keyword page_size: Page size, 1 to 100. Defaults to 20 when omitted or 0; other values are + rejected with 400. Default value is 20. + :paramtype page_size: int + :keyword page_token: ``next_page_token`` from the previous response. Valid only with the same + query; otherwise the request is rejected with 400. Default value is None. + :paramtype page_token: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -21654,56 +28058,108 @@ def get(self, user_id: str, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == { - "user": { - "connections": [ - { - "connection_parameters": {}, # Optional. Any object. - "created_at": "2020-02-20 00:00:00", # Optional. - User is a derived, team-scoped view across sessions and OAuth - connections. - "granted_at": "2020-02-20 00:00:00", # Optional. - User is a derived, team-scoped view across sessions and OAuth - connections. - "id": "str", # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - "provider": "str", # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - "provider_display_name": "str", # Optional. User is - a derived, team-scoped view across sessions and OAuth connections. - "revoked_at": "2020-02-20 00:00:00", # Optional. - User is a derived, team-scoped view across sessions and OAuth - connections. - "scopes": [ - "str" # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - ], - "status": "str", # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - "updated_at": "2020-02-20 00:00:00", # Optional. - User is a derived, team-scoped view across sessions and OAuth - connections. - "user_id": "str" # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - } - ], - "sessions": [ - { - "created_at": "2020-02-20 00:00:00", # Optional. - User is a derived, team-scoped view across sessions and OAuth - connections. - "name": "str", # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - "session_urn": "str", # Optional. User is a derived, - team-scoped view across sessions and OAuth connections. - "updated_at": "2020-02-20 00:00:00" # Optional. User - is a derived, team-scoped view across sessions and OAuth connections. - } - ], - "user_id": "str" # Optional. User is a derived, team-scoped view - across sessions and OAuth connections. - } + "next_page_token": "str", # Optional. Token for the next page; empty on the + last page. + "providers": [ + { + "auth_type": "str", # Optional. Deprecated: read + ``auth_types``"" , since a provider may accept more than one credential + kind. This is the first entry of ``auth_types`` other than ``none``"" , + or ``none`` when that is the only entry. + "auth_types": [ + "str" # Optional. Credential kinds the provider + accepts, sorted: none|oauth|"" ``shared_api_key``"" |unknown|"" + ``user_oauth_app``"" |"" ``user_token``. ``none`` means the provider + needs no credential. ``oauth`` means users can connect through + DigitalOcean's shared OAuth application. ``user_oauth_app`` means + users can connect through an OAuth client your team registers as a + provider credential; without ``oauth`` alongside it, that is the only + way to connect. ``shared_api_key`` means DigitalOcean supplies the + key. ``user_token`` means your team or its users supply a key or + token. ``unknown`` means the provider declares no kind this API + recognizes, including an OAuth provider whose shared application is + not available. It is never paired with another kind. + ], + "connection_parameters": [ + { + "allowed_host_suffixes": [ + "str" # Optional. For + ``https_origin`` inputs, the host suffixes the origin's host + must match. + ], + "allowed_values": [ + "str" # Optional. For enum inputs, + the accepted values. + ], + "description": "str", # Optional. Help text. + "input_kind": "str", # Optional. How the + value is entered: string, ``https_origin``"" , or enum. Known + values are: "string", "https_origin", and "enum". + "key": "str", # Optional. Key of the value + in ``connection_parameters`` or ``credential_parameters``. + "label": "str", # Optional. Display label. + "max_length": 0, # Optional. Maximum length + of the value. 0 means the default maximum of 4096. + "normalization": "str", # Optional. How the + value is normalized before it is validated and stored: trim, + lowercase, uppercase, or ``https_origin``. + "pattern": "str", # Optional. Optional RE2 + expression matched against the whole normalized value. + "required": bool # Optional. Whether the + value must be supplied. + } + ], + "credential_parameters": [ + { + "allowed_host_suffixes": [ + "str" # Optional. For + ``https_origin`` inputs, the host suffixes the origin's host + must match. + ], + "allowed_values": [ + "str" # Optional. For enum inputs, + the accepted values. + ], + "description": "str", # Optional. Help text. + "input_kind": "str", # Optional. How the + value is entered: string, ``https_origin``"" , or enum. Known + values are: "string", "https_origin", and "enum". + "key": "str", # Optional. Key of the value + in ``connection_parameters`` or ``credential_parameters``. + "label": "str", # Optional. Display label. + "max_length": 0, # Optional. Maximum length + of the value. 0 means the default maximum of 4096. + "normalization": "str", # Optional. How the + value is normalized before it is validated and stored: trim, + lowercase, uppercase, or ``https_origin``. + "pattern": "str", # Optional. Optional RE2 + expression matched against the whole normalized value. + "required": bool # Optional. Whether the + value must be supplied. + } + ], + "description": "str", # Optional. Provider description. + "display_name": "str", # Optional. Human-readable provider + name. + "name": "str", # Optional. Provider slug, used as provider + when creating a connection or a provider credential. + "oauth_client_setup_url": "str", # Optional. HTTPS page at + the provider where a team creates that OAuth client, such as its + developer console or setup guide. Empty unless ``auth_types`` contains + ``user_oauth_app`` and the provider declares one. + "oauth_redirect_url": "str", # Optional. Callback URL a team + must register with the provider when it creates its own OAuth client. It + is the same for every provider and cannot be changed per credential. + Empty unless ``auth_types`` contains ``user_oauth_app``. + "scopes": [ + "str" # Optional. The OAuth scopes a connection may + request; a connection that requests none gets all of them. Set only + when ``auth_types`` contains ``oauth`` or ``user_oauth_app``. + ] + } + ] } - # response body for status code(s): 404 + # 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 @@ -21733,8 +28189,10 @@ def get(self, user_id: str, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_users_get_request( - user_id=user_id, + _request = build_tools_list_search_providers_request( + query=query, + page_size=page_size, + page_token=page_token, headers=_headers, params=_params, ) @@ -21749,7 +28207,7 @@ def get(self, user_id: str, **kwargs: Any) -> JSON: response = pipeline_response.http_response - if response.status_code not in [200, 404]: + 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 @@ -21772,7 +28230,7 @@ def get(self, user_id: str, **kwargs: Any) -> JSON: else: deserialized = None - if response.status_code == 404: + if response.status_code == 400: response_headers["ratelimit-limit"] = self._deserialize( "int", response.headers.get("ratelimit-limit") ) @@ -21793,46 +28251,45 @@ def get(self, user_id: str, **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore - -class SessionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~pydo.GeneratedClient`'s - :attr:`sessions` 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( + def list_search( self, *, - end_user_id: Optional[str] = None, - page: int = 1, - per_page: int = 20, + query: Optional[str] = None, + provider: Optional[List[str]] = None, + toolbelt: Optional[str] = None, + page_size: int = 20, + page_token: Optional[str] = None, **kwargs: Any, ) -> JSON: # pylint: disable=line-too-long - """List Action Gateway Sessions. + """Search Tools. - Lists Action Gateway sessions owned by the authenticated team. + Returns the tools your team can use that match query, optionally restricted to some providers + or to the members of one of your toolbelts. Results are ranked across the whole result set: + exact tool name matches first, then name or title prefixes, then name or title substrings, then + other matches. Cursor-paged with ``page_size`` and ``page_token``\\ ; no total is reported. - :keyword end_user_id: Filter sessions by actor identifier. Default value is None. - :paramtype end_user_id: str - :keyword page: Which 'page' of paginated results to return. Default value is 1. - :paramtype page: int - :keyword per_page: Number of items returned per page. Default value is 20. - :paramtype per_page: int + :keyword query: Matched case- and accent-insensitively as a substring of the tool's name, + title, description, category, provider ID, or tool slug. Empty matches every tool your team can + use. Default value is None. + :paramtype query: str + :keyword provider: Restricts results to these provider IDs, OR'd together. Repeat the parameter + to select several. An unknown ID matches nothing. Default value is None. + :paramtype provider: list[str] + :keyword toolbelt: Restricts results to the members of that toolbelt of your team at its latest + version, combined with query and provider as AND. Members are matched at the version the + toolbelt pins, which is the same set and the same versions ``GET + /v2/action-gateway/toolbelts/{name}`` reports. An unknown or deleted toolbelt returns 404 + rather than an empty page. Default value is None. + :paramtype toolbelt: str + :keyword page_size: Page size, 1 to 100. Defaults to 20 when omitted or 0; other values are + rejected with 400. Default value is 20. + :paramtype page_size: int + :keyword page_token: A ``next_page_token`` from the preceding response. It is pinned to the + query and filters that produced it: replaying one against a different search is rejected with + 400, not a silent restart from the top. Default value is None. + :paramtype page_token: str :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -21842,66 +28299,39 @@ def list( # response body for status code(s): 200 response == { - "pagination": { - "page": 0, # Required. - "per_page": 0, # Required. - "total": 0 # Required. - }, - "sessions": [ + "next_page_token": "str", # Optional. Token for the next page; empty on the + last page. + "tools": [ { - "actorId": "str", # Optional. actor_id is empty when the - session is not bound to an actor. - "config": {}, # Optional. Preserved as an opaque object. - Gateway currently interprets config.preloadTools to add selected direct - tools to the session MCP. - "createdAt": "2020-02-20 00:00:00", # Optional. - "name": "str", # Optional. name is the required - human-readable session name. - "policy": { - "defaultAction": "ask", # Optional. Default value is - "ask". SessionPolicyAction is the disposition applied to a tool call. - Lowercase values are canonical so ProtoJSON matches the public REST - vocabulary; the prefixed aliases preserve compatibility for existing - protobuf clients. Known values are: "allow", "ask", and "deny". - "rules": [ - { - "action": "ask", # Optional. Default - value is "ask". SessionPolicyAction is the disposition - applied to a tool call. Lowercase values are canonical so - ProtoJSON matches the public REST vocabulary; the prefixed - aliases preserve compatibility for existing protobuf clients. - Known values are: "allow", "ask", and "deny". - "match": { - "str": "str" # Optional. - Dictionary of :code:``. - }, - "tool": "str" # Optional. - SessionPolicySpec is the Gateway-relevant subset of a - session's permission policy. Filesystem and network policy - remain enforced by the sandbox. - } - ] - }, - "sessionUrn": "str", # Optional. - "tools": { - "references": [ - { - "kind": "str", # Optional. Known - values are: "SESSION_TOOL_REFERENCE_KIND_TOOL" and - "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". - "name": "str", # Optional. Omitted - when the request omitted tools (all tools). A present - selection with no references represents tools: []. - "version": "str" # Optional. Omitted - when the request omitted tools (all tools). A present - selection with no references represents tools: []. - } - ] - }, - "updatedAt": "2020-02-20 00:00:00" # Optional. + "category": "str", # Optional. Best-effort catalog metadata + and is empty for a large share of the catalog. Do not rely on it being + present. + "description": "str", # Optional. What the tool does. + "name": "str", # Optional. The unqualified tool name, + without the provider prefix. + "provider": "str", # Optional. The owning toolkit ID, broken + out so a client never has to split ``tool_slug``. It is what a client + groups results by. + "title": "str", # Optional. Human-readable tool title. + "tool_slug": "str", # Optional. The provider-qualified, + stable tool identifier ("" ``_``"" ). Treat it as opaque + and pass it back verbatim. + "version": 0 # Optional. The released version number of the + tool, for example 3. } ] } + # 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, @@ -21921,10 +28351,12 @@ def list( cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_sessions_list_request( - end_user_id=end_user_id, - page=page, - per_page=per_page, + _request = build_tools_list_search_request( + query=query, + provider=provider, + toolbelt=toolbelt, + page_size=page_size, + page_token=page_token, headers=_headers, params=_params, ) @@ -21939,185 +28371,74 @@ def list( response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = {} - 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 + 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") + ) - @overload - def create( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> JSON: - # pylint: disable=line-too-long - """Create an Action Gateway Session. + if response.content: + deserialized = response.json() + else: + deserialized = None - Creates a session with a tool selection, invocation policy, and optional direct-tool preload - configuration. + 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") + ) - :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: + if response.content: + deserialized = response.json() + else: + deserialized = None - Example: - .. code-block:: python + 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") + ) - # JSON input template you can fill out and use as your body input. - body = { - "actor_id": "str", # Required. - "name": "str", # Required. - "config": { - "preloadTools": [ - "str" # Optional. Concrete tools or pinned toolbelts to - expose directly beside the session meta-tools. - ] - }, - "policy": { - "defaultAction": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. Lowercase - values are canonical so ProtoJSON matches the public REST vocabulary; the - prefixed aliases preserve compatibility for existing protobuf clients. Known - values are: "allow", "ask", and "deny". - "rules": [ - { - "action": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. - Lowercase values are canonical so ProtoJSON matches the public REST - vocabulary; the prefixed aliases preserve compatibility for existing - protobuf clients. Known values are: "allow", "ask", and "deny". - "match": { - "str": "str" # Optional. Dictionary of - :code:``. - }, - "tool": "str" # Optional. Invocation policy. Omit to - use a default action of ask. - } - ] - }, - "tools": [ - "str" # Optional. Omitted enables every tool. An explicit empty - array enables no tools. Direct tools may be :code:`` or - @:code:``; toolbelt references must be version-pinned as - toolbelt::code:``@:code:``. - ] - } + if response.content: + deserialized = response.json() + else: + deserialized = None - # response body for status code(s): 200 - response == { - "mcpUrl": "str", # Public session-pinned MCP URL. Required. - "session": { - "actorId": "str", # Optional. actor_id is empty when the session is - not bound to an actor. - "config": {}, # Optional. Preserved as an opaque object. Gateway - currently interprets config.preloadTools to add selected direct tools to the - session MCP. - "createdAt": "2020-02-20 00:00:00", # Optional. A session and the - tool-permission policy bound to it. Required. - "name": "str", # Optional. name is the required human-readable - session name. - "policy": { - "defaultAction": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. Lowercase - values are canonical so ProtoJSON matches the public REST vocabulary; the - prefixed aliases preserve compatibility for existing protobuf clients. - Known values are: "allow", "ask", and "deny". - "rules": [ - { - "action": "ask", # Optional. Default value - is "ask". SessionPolicyAction is the disposition applied to a - tool call. Lowercase values are canonical so ProtoJSON matches - the public REST vocabulary; the prefixed aliases preserve - compatibility for existing protobuf clients. Known values are: - "allow", "ask", and "deny". - "match": { - "str": "str" # Optional. Dictionary - of :code:``. - }, - "tool": "str" # Optional. SessionPolicySpec - is the Gateway-relevant subset of a session's permission policy. - Filesystem and network policy remain enforced by the sandbox. - } - ] - }, - "sessionUrn": "str", # Optional. A session and the tool-permission - policy bound to it. Required. - "tools": { - "references": [ - { - "kind": "str", # Optional. Known values are: - "SESSION_TOOL_REFERENCE_KIND_TOOL" and - "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". - "name": "str", # Optional. Omitted when the - request omitted tools (all tools). A present selection with no - references represents tools: []. - "version": "str" # Optional. Omitted when - the request omitted tools (all tools). A present selection with - no references represents tools: []. - } - ] - }, - "updatedAt": "2020-02-20 00:00:00" # Optional. A session and the - tool-permission policy bound to it. Required. - }, - "tools": [ - "str" # Canonical, version-pinned selected tool references. - 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. - } - """ + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore - @overload - def create( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> JSON: + return cast(JSON, deserialized) # type: ignore + + @distributed_trace + def list_toolkits(self, **kwargs: Any) -> JSON: # pylint: disable=line-too-long - """Create an Action Gateway Session. + """List Toolkits. - Creates a session with a tool selection, invocation policy, and optional direct-tool preload - configuration. + Returns the providers (toolkits) whose tools your team can use: catalog providers with at least + one released tool, plus your team's registered MCP servers. - :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: @@ -22127,89 +28448,142 @@ def create( # response body for status code(s): 200 response == { - "mcpUrl": "str", # Public session-pinned MCP URL. Required. - "session": { - "actorId": "str", # Optional. actor_id is empty when the session is - not bound to an actor. - "config": {}, # Optional. Preserved as an opaque object. Gateway - currently interprets config.preloadTools to add selected direct tools to the - session MCP. - "createdAt": "2020-02-20 00:00:00", # Optional. A session and the - tool-permission policy bound to it. Required. - "name": "str", # Optional. name is the required human-readable - session name. - "policy": { - "defaultAction": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. Lowercase - values are canonical so ProtoJSON matches the public REST vocabulary; the - prefixed aliases preserve compatibility for existing protobuf clients. - Known values are: "allow", "ask", and "deny". - "rules": [ - { - "action": "ask", # Optional. Default value - is "ask". SessionPolicyAction is the disposition applied to a - tool call. Lowercase values are canonical so ProtoJSON matches - the public REST vocabulary; the prefixed aliases preserve - compatibility for existing protobuf clients. Known values are: - "allow", "ask", and "deny". - "match": { - "str": "str" # Optional. Dictionary - of :code:``. - }, - "tool": "str" # Optional. SessionPolicySpec - is the Gateway-relevant subset of a session's permission policy. - Filesystem and network policy remain enforced by the sandbox. - } - ] - }, - "sessionUrn": "str", # Optional. A session and the tool-permission - policy bound to it. Required. - "tools": { - "references": [ - { - "kind": "str", # Optional. Known values are: - "SESSION_TOOL_REFERENCE_KIND_TOOL" and - "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". - "name": "str", # Optional. Omitted when the - request omitted tools (all tools). A present selection with no - references represents tools: []. - "version": "str" # Optional. Omitted when - the request omitted tools (all tools). A present selection with - no references represents tools: []. - } - ] - }, - "updatedAt": "2020-02-20 00:00:00" # Optional. A session and the - tool-permission policy bound to it. Required. - }, - "tools": [ - "str" # Canonical, version-pinned selected tool references. - 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. + "toolkits": [ + { + "categories": [ + "str" # Optional. Distinct categories of the + provider's released tools, sorted. + ], + "created_at": "2020-02-20 00:00:00", # Optional. When the + provider was added. + "description": "str", # Optional. Provider description. + "id": "str", # Optional. Provider ID. For one of your team's + MCP servers it is normally the server's ``serverRef``"" ; + ``provider_kind`` tells the two kinds apart. + "name": "str", # Optional. Human-readable provider name. + "provider_kind": "str" # Optional. Classifies the provider, + for example ``managed_api`` or ``byo_mcp`` (one of your team's MCP + servers). It is the same value as PublicToolDefinition.provider_kind for + the provider's tools. + } + ], + "version": "str" # Optional. Catalog version identifier, for example ``v1``. } """ + 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_tools_list_toolkits_request( + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + +class UsersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~pydo.GeneratedClient`'s + :attr:`users` 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 create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: + def list( + self, + *, + user_id: Optional[str] = None, + sort: str = "created_at", + sort_direction: Optional[str] = None, + page: int = 1, + per_page: int = 20, + **kwargs: Any, + ) -> JSON: # pylint: disable=line-too-long - """Create an Action Gateway Session. + """List Users. - Creates a session with a tool selection, invocation policy, and optional direct-tool preload - configuration. + Returns the user IDs known for your team: session ``actor_id`` values, the ``user_id`` of + connections that are not revoked, and actors with limit overrides. Only sessions and + connections you can see count. Offset-paged with page and ``per_page``. - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :keyword user_id: User ID prefix to return. An empty value returns all users. Default value is + None. + :paramtype user_id: str + :keyword sort: ``user_id``\\ |\\ ``created_at``\\ |\\ ``session_count``\\ |\\ + ``connection_count``. ``created_at`` is the earliest creation time among the user's sessions, + connections, and limit overrides. Defaults to ``created_at``. Known values are: "created_at", + "user_id", "session_count", and "connection_count". Default value is "created_at". + :paramtype sort: str + :keyword sort_direction: asc|desc. Defaults to desc. Known values are: "asc" and "desc". + Default value is None. + :paramtype sort_direction: str + :keyword page: 1-based page number. Values below 1 are treated as 1. Default value is 1. + :paramtype page: int + :keyword per_page: Page size. Defaults to 20; values above 100 are capped at 100. Default value + is 20. + :paramtype per_page: int :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: @@ -22217,106 +28591,16 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: Example: .. code-block:: python - # JSON input template you can fill out and use as your body input. - body = { - "actor_id": "str", # Required. - "name": "str", # Required. - "config": { - "preloadTools": [ - "str" # Optional. Concrete tools or pinned toolbelts to - expose directly beside the session meta-tools. - ] - }, - "policy": { - "defaultAction": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. Lowercase - values are canonical so ProtoJSON matches the public REST vocabulary; the - prefixed aliases preserve compatibility for existing protobuf clients. Known - values are: "allow", "ask", and "deny". - "rules": [ - { - "action": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. - Lowercase values are canonical so ProtoJSON matches the public REST - vocabulary; the prefixed aliases preserve compatibility for existing - protobuf clients. Known values are: "allow", "ask", and "deny". - "match": { - "str": "str" # Optional. Dictionary of - :code:``. - }, - "tool": "str" # Optional. Invocation policy. Omit to - use a default action of ask. - } - ] - }, - "tools": [ - "str" # Optional. Omitted enables every tool. An explicit empty - array enables no tools. Direct tools may be :code:`` or - @:code:``; toolbelt references must be version-pinned as - toolbelt::code:``@:code:``. - ] - } - # response body for status code(s): 200 response == { - "mcpUrl": "str", # Public session-pinned MCP URL. Required. - "session": { - "actorId": "str", # Optional. actor_id is empty when the session is - not bound to an actor. - "config": {}, # Optional. Preserved as an opaque object. Gateway - currently interprets config.preloadTools to add selected direct tools to the - session MCP. - "createdAt": "2020-02-20 00:00:00", # Optional. A session and the - tool-permission policy bound to it. Required. - "name": "str", # Optional. name is the required human-readable - session name. - "policy": { - "defaultAction": "ask", # Optional. Default value is "ask". - SessionPolicyAction is the disposition applied to a tool call. Lowercase - values are canonical so ProtoJSON matches the public REST vocabulary; the - prefixed aliases preserve compatibility for existing protobuf clients. - Known values are: "allow", "ask", and "deny". - "rules": [ - { - "action": "ask", # Optional. Default value - is "ask". SessionPolicyAction is the disposition applied to a - tool call. Lowercase values are canonical so ProtoJSON matches - the public REST vocabulary; the prefixed aliases preserve - compatibility for existing protobuf clients. Known values are: - "allow", "ask", and "deny". - "match": { - "str": "str" # Optional. Dictionary - of :code:``. - }, - "tool": "str" # Optional. SessionPolicySpec - is the Gateway-relevant subset of a session's permission policy. - Filesystem and network policy remain enforced by the sandbox. - } - ] - }, - "sessionUrn": "str", # Optional. A session and the tool-permission - policy bound to it. Required. - "tools": { - "references": [ - { - "kind": "str", # Optional. Known values are: - "SESSION_TOOL_REFERENCE_KIND_TOOL" and - "SESSION_TOOL_REFERENCE_KIND_TOOLBELT". - "name": "str", # Optional. Omitted when the - request omitted tools (all tools). A present selection with no - references represents tools: []. - "version": "str" # Optional. Omitted when - the request omitted tools (all tools). A present selection with - no references represents tools: []. - } - ] - }, - "updatedAt": "2020-02-20 00:00:00" # Optional. A session and the - tool-permission policy bound to it. Required. + "pagination": { + "page": 0, # Optional. 1-based page number of this response. + "per_page": 0, # Optional. Page size applied to this response, after + defaults and caps. + "total": 0 # Optional. Number of matching items across all pages. }, - "tools": [ - "str" # Canonical, version-pinned selected tool references. - Required. + "user_ids": [ + "str" # Optional. User IDs on this page. ] } # response body for status code(s): 400 @@ -22344,26 +28628,17 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = 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_sessions_create_request( - content_type=content_type, - json=_json, - content=_content, + _request = build_users_list_request( + user_id=user_id, + sort=sort, + sort_direction=sort_direction, + page=page, + per_page=per_page, headers=_headers, params=_params, ) @@ -22423,21 +28698,99 @@ def create(self, body: Union[JSON, IO[bytes]], **kwargs: Any) -> JSON: return cast(JSON, deserialized) # type: ignore @distributed_trace - def delete(self, session_urn: str, **kwargs: Any) -> JSON: + def get(self, user_id: str, **kwargs: Any) -> JSON: # pylint: disable=line-too-long - """Delete an Action Gateway Session. + """Get a User. - Deletes an Action Gateway session owned by the authenticated team. + Returns the sessions and non-revoked connections of one user ID. Returns 404 when the user has + none you can see and no limit overrides. - :param session_urn: The URL-encoded managed agents session URN. Required. - :type session_urn: str - :return: JSON or JSON object + :param user_id: User ID. Required. + :type user_id: str + :return: JSON object :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python + # response body for status code(s): 200 + response == { + "user": { + "connections": [ + { + "connection_parameters": {}, # Optional. + Non-sensitive provider configuration. + "created_at": "2020-02-20 00:00:00", # Optional. + When the connection was created. + "credential_id": "str", # Optional. ID of the team + provider credential the connection uses; empty for DigitalOcean's + shared application. + "credential_kind": "str", # Optional. + ``digitalocean_oauth``"" , ``private_oauth``"" , or ``team_api_key``. + Known values are: "digitalocean_oauth", "private_oauth", and + "team_api_key". + "granted_at": "2020-02-20 00:00:00", # Optional. + When the user completed authorization. + "id": "str", # Optional. Opaque connection ID. + "network": { + "vpc": { + "destinations": [ + { + "allowed_ip_cidrs": [ + "str" # + Optional. Optional CIDR ranges; when set, every + address the host resolves to must fall within one + of them. + ], + "host": "str", # + Optional. Host name or IP address. It must resolve + only to private addresses. + "port": 0 # + Optional. Port, 1 to 65535. + } + ], + "region": "str", # Optional. Region + of the VPC. Set by DigitalOcean; do not send it. + "vpc_uuid": "str" # Optional. UUID + of a VPC owned by your team. + } + }, + "owning_user_id": "str", # Optional. DigitalOcean + user ID of the user who created the connection, when recorded. + "provider": "str", # Optional. Provider slug, for + example ``jira``. + "provider_display_name": "str", # Optional. + Human-readable provider name, for example ``Jira``. + "revoked_at": "2020-02-20 00:00:00", # Optional. + When the connection was revoked. + "scopes": [ + "str" # Optional. Provider scopes granted, + or requested while pending. + ], + "status": "str", # Optional. pending, active, + revoked, or expired. Known values are: "pending", "active", + "revoked", and "expired". + "updated_at": "2020-02-20 00:00:00", # Optional. + When the connection was last modified. + "user_id": "str" # Optional. Your identifier for the + user the connection acts for. + } + ], + "sessions": [ + { + "created_at": "2020-02-20 00:00:00", # Optional. + When the session was created. + "name": "str", # Optional. Session name. + "session_urn": "str", # Optional. Session URN. + "updated_at": "2020-02-20 00:00:00" # Optional. When + the session was last modified. + } + ], + "user_id": "str" # Optional. The user ID: a session ``actor_id`` or + a connection ``user_id``. + } + } # response body for status code(s): 404 response == { "id": "str", # A short identifier corresponding to the HTTP status code @@ -22468,8 +28821,8 @@ def delete(self, session_urn: str, **kwargs: Any) -> JSON: cls: ClsType[JSON] = kwargs.pop("cls", None) - _request = build_sessions_delete_request( - session_urn=session_urn, + _request = build_users_get_request( + user_id=user_id, headers=_headers, params=_params, )