From 0437444d72263662634de8ce24f7fc751867fec7 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Fri, 27 Oct 2023 17:10:58 -0500 Subject: [PATCH 01/27] create extension, update examples, remove import/export commands --- src/apic-extension/HISTORY.rst | 8 + src/apic-extension/README.md | 5 + .../azext_apic_extension/__init__.py | 42 ++ .../azext_apic_extension/_help.py | 11 + .../azext_apic_extension/_params.py | 13 + .../azext_apic_extension/aaz/__init__.py | 6 + .../aaz/latest/__init__.py | 6 + .../aaz/latest/apic/__cmd_group.py | 23 + .../aaz/latest/apic/__init__.py | 11 + .../aaz/latest/apic/api/__cmd_group.py | 23 + .../aaz/latest/apic/api/__init__.py | 17 + .../aaz/latest/apic/api/_create.py | 485 +++++++++++++ .../aaz/latest/apic/api/_delete.py | 172 +++++ .../aaz/latest/apic/api/_head.py | 163 +++++ .../aaz/latest/apic/api/_list.py | 290 ++++++++ .../aaz/latest/apic/api/_show.py | 285 ++++++++ .../aaz/latest/apic/api/_update.py | 653 ++++++++++++++++++ .../latest/apic/api/definition/__cmd_group.py | 23 + .../latest/apic/api/definition/__init__.py | 17 + .../aaz/latest/apic/api/definition/_create.py | 306 ++++++++ .../aaz/latest/apic/api/definition/_delete.py | 200 ++++++ .../aaz/latest/apic/api/definition/_head.py | 191 +++++ .../aaz/latest/apic/api/definition/_list.py | 277 ++++++++ .../aaz/latest/apic/api/definition/_show.py | 274 ++++++++ .../aaz/latest/apic/api/definition/_update.py | 468 +++++++++++++ .../latest/apic/api/deployment/__cmd_group.py | 23 + .../latest/apic/api/deployment/__init__.py | 17 + .../aaz/latest/apic/api/deployment/_create.py | 359 ++++++++++ .../aaz/latest/apic/api/deployment/_delete.py | 186 +++++ .../aaz/latest/apic/api/deployment/_head.py | 177 +++++ .../aaz/latest/apic/api/deployment/_list.py | 274 ++++++++ .../aaz/latest/apic/api/deployment/_show.py | 270 ++++++++ .../aaz/latest/apic/api/deployment/_update.py | 524 ++++++++++++++ .../latest/apic/api/version/__cmd_group.py | 23 + .../aaz/latest/apic/api/version/__init__.py | 17 + .../aaz/latest/apic/api/version/_create.py | 290 ++++++++ .../aaz/latest/apic/api/version/_delete.py | 186 +++++ .../aaz/latest/apic/api/version/_head.py | 177 +++++ .../aaz/latest/apic/api/version/_list.py | 260 +++++++ .../aaz/latest/apic/api/version/_show.py | 256 +++++++ .../aaz/latest/apic/api/version/_update.py | 446 ++++++++++++ .../latest/apic/environment/__cmd_group.py | 23 + .../aaz/latest/apic/environment/__init__.py | 17 + .../aaz/latest/apic/environment/_create.py | 367 ++++++++++ .../aaz/latest/apic/environment/_delete.py | 172 +++++ .../aaz/latest/apic/environment/_head.py | 163 +++++ .../aaz/latest/apic/environment/_list.py | 270 ++++++++ .../aaz/latest/apic/environment/_show.py | 265 +++++++ .../aaz/latest/apic/environment/_update.py | 530 ++++++++++++++ .../apic/metadata_schema/__cmd_group.py | 23 + .../latest/apic/metadata_schema/__init__.py | 17 + .../latest/apic/metadata_schema/_create.py | 290 ++++++++ .../latest/apic/metadata_schema/_delete.py | 160 +++++ .../aaz/latest/apic/metadata_schema/_head.py | 148 ++++ .../aaz/latest/apic/metadata_schema/_list.py | 240 +++++++ .../aaz/latest/apic/metadata_schema/_show.py | 237 +++++++ .../latest/apic/metadata_schema/_update.py | 442 ++++++++++++ .../aaz/latest/apic/service/__cmd_group.py | 23 + .../aaz/latest/apic/service/__init__.py | 16 + .../aaz/latest/apic/service/_create.py | 319 +++++++++ .../aaz/latest/apic/service/_delete.py | 143 ++++ .../aaz/latest/apic/service/_list.py | 420 +++++++++++ .../aaz/latest/apic/service/_show.py | 249 +++++++ .../aaz/latest/apic/service/_update.py | 462 +++++++++++++ .../aaz/latest/apic/workspace/__cmd_group.py | 23 + .../aaz/latest/apic/workspace/__init__.py | 17 + .../aaz/latest/apic/workspace/_create.py | 260 +++++++ .../aaz/latest/apic/workspace/_delete.py | 158 +++++ .../aaz/latest/apic/workspace/_head.py | 149 ++++ .../aaz/latest/apic/workspace/_list.py | 230 ++++++ .../aaz/latest/apic/workspace/_show.py | 225 ++++++ .../aaz/latest/apic/workspace/_update.py | 407 +++++++++++ .../azext_apic_extension/azext_metadata.json | 4 + .../azext_apic_extension/commands.py | 15 + .../azext_apic_extension/custom.py | 14 + .../azext_apic_extension/tests/__init__.py | 6 + .../tests/latest/__init__.py | 6 + .../tests/latest/test_apic_extension.py | 13 + src/apic-extension/setup.cfg | 1 + src/apic-extension/setup.py | 49 ++ 80 files changed, 14027 insertions(+) create mode 100644 src/apic-extension/HISTORY.rst create mode 100644 src/apic-extension/README.md create mode 100644 src/apic-extension/azext_apic_extension/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/_help.py create mode 100644 src/apic-extension/azext_apic_extension/_params.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/__cmd_group.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/__cmd_group.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_create.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_delete.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_head.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_list.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_show.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_update.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/__cmd_group.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_create.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_delete.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_head.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_list.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_show.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_update.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/__cmd_group.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_create.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_delete.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_head.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_list.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_show.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_update.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/__cmd_group.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_create.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_delete.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_head.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_list.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_show.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_update.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/__cmd_group.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_create.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_delete.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_head.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_list.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_show.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_update.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/__cmd_group.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_create.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_delete.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_head.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_list.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_show.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_update.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__cmd_group.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_create.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_delete.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_list.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_show.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_update.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/__cmd_group.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_create.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_delete.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_head.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_list.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_show.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_update.py create mode 100644 src/apic-extension/azext_apic_extension/azext_metadata.json create mode 100644 src/apic-extension/azext_apic_extension/commands.py create mode 100644 src/apic-extension/azext_apic_extension/custom.py create mode 100644 src/apic-extension/azext_apic_extension/tests/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/tests/latest/__init__.py create mode 100644 src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py create mode 100644 src/apic-extension/setup.cfg create mode 100644 src/apic-extension/setup.py diff --git a/src/apic-extension/HISTORY.rst b/src/apic-extension/HISTORY.rst new file mode 100644 index 00000000000..abbff5a61a7 --- /dev/null +++ b/src/apic-extension/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +1.0.0b1 +++++++ +* Initial release. \ No newline at end of file diff --git a/src/apic-extension/README.md b/src/apic-extension/README.md new file mode 100644 index 00000000000..161a557951d --- /dev/null +++ b/src/apic-extension/README.md @@ -0,0 +1,5 @@ +# Azure CLI ApicExtension Extension # +This is an extension to Azure CLI to manage ApicExtension resources. + +## How to use ## +Please add commands usage here. \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/__init__.py b/src/apic-extension/azext_apic_extension/__init__.py new file mode 100644 index 00000000000..487554e612a --- /dev/null +++ b/src/apic-extension/azext_apic_extension/__init__.py @@ -0,0 +1,42 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_apic_extension._help import helps # pylint: disable=unused-import + + +class ApicExtensionCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + custom_command_type = CliCommandType( + operations_tmpl='azext_apic_extension.custom#{}') + super().__init__(cli_ctx=cli_ctx, + custom_command_type=custom_command_type) + + def load_command_table(self, args): + from azext_apic_extension.commands import load_command_table + from azure.cli.core.aaz import load_aaz_command_table + try: + from . import aaz + except ImportError: + aaz = None + if aaz: + load_aaz_command_table( + loader=self, + aaz_pkg_name=aaz.__name__, + args=args + ) + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from azext_apic_extension._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = ApicExtensionCommandsLoader diff --git a/src/apic-extension/azext_apic_extension/_help.py b/src/apic-extension/azext_apic_extension/_help.py new file mode 100644 index 00000000000..126d5d00714 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/_help.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + +from knack.help_files import helps # pylint: disable=unused-import diff --git a/src/apic-extension/azext_apic_extension/_params.py b/src/apic-extension/azext_apic_extension/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/apic-extension/azext_apic_extension/_params.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + + +def load_arguments(self, _): # pylint: disable=unused-argument + pass diff --git a/src/apic-extension/azext_apic_extension/aaz/__init__.py b/src/apic-extension/azext_apic_extension/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/__cmd_group.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/__cmd_group.py new file mode 100644 index 00000000000..58da38743e9 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "apic", +) +class __CMDGroup(AAZCommandGroup): + """API Center + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/__init__.py new file mode 100644 index 00000000000..5a9d61963d6 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/__init__.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/__cmd_group.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/__cmd_group.py new file mode 100644 index 00000000000..eff8f691a34 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "apic api", +) +class __CMDGroup(AAZCommandGroup): + """API + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/__init__.py new file mode 100644 index 00000000000..a6ed8b6688f --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._head import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_create.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_create.py new file mode 100644 index 00000000000..71e6bb7741a --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_create.py @@ -0,0 +1,485 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api create", +) +class Create(AAZCommand): + """Create new or updates existing API. + + :example: Create API + az apic api create -g contoso-resources -s contoso --name echo-api --title "Echo API" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--name", "--api-name"], + help="The name of the API.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.contacts = AAZListArg( + options=["--contacts"], + arg_group="Properties", + help="The contact information for the API.", + ) + _args_schema.custom_properties = AAZObjectArg( + options=["--custom-properties"], + arg_group="Properties", + help="The custom metadata defined for API catalog entities.", + blank={}, + ) + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="Description of the API.", + fmt=AAZStrArgFormat( + max_length=1000, + ), + ) + _args_schema.external_documentation = AAZListArg( + options=["--external-documentation"], + arg_group="Properties", + help="Additional, external documentation for the API.", + ) + _args_schema.kind = AAZStrArg( + options=["--kind"], + arg_group="Properties", + help="Kind of API. For example, REST or GraphQL.", + enum={"graphql": "graphql", "grpc": "grpc", "rest": "rest", "soap": "soap", "webhook": "webhook", "websocket": "websocket"}, + ) + _args_schema.license = AAZObjectArg( + options=["--license"], + arg_group="Properties", + help="The license information for the API.", + ) + _args_schema.summary = AAZStrArg( + options=["--summary"], + arg_group="Properties", + help="Short description of the API.", + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + _args_schema.terms_of_service = AAZObjectArg( + options=["--terms-of-service"], + arg_group="Properties", + help="Terms of service for the API.", + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="API title.", + fmt=AAZStrArgFormat( + max_length=50, + min_length=1, + ), + ) + + contacts = cls._args_schema.contacts + contacts.Element = AAZObjectArg() + + _element = cls._args_schema.contacts.Element + _element.email = AAZStrArg( + options=["email"], + help="Email address of the contact.", + fmt=AAZStrArgFormat( + max_length=100, + ), + ) + _element.name = AAZStrArg( + options=["name"], + help="Name of the contact.", + fmt=AAZStrArgFormat( + max_length=100, + ), + ) + _element.url = AAZStrArg( + options=["url"], + help="URL for the contact.", + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + + external_documentation = cls._args_schema.external_documentation + external_documentation.Element = AAZObjectArg() + + _element = cls._args_schema.external_documentation.Element + _element.description = AAZStrArg( + options=["description"], + help="Description of the documentation.", + fmt=AAZStrArgFormat( + max_length=500, + ), + ) + _element.title = AAZStrArg( + options=["title"], + help="Title of the documentation.", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + _element.url = AAZStrArg( + options=["url"], + help="URL pointing to the documentation.", + required=True, + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + + license = cls._args_schema.license + license.identifier = AAZStrArg( + options=["identifier"], + help="SPDX license information for the API. The identifier field is mutually exclusive of the URL field.", + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + license.name = AAZStrArg( + options=["name"], + help="Name of the license.", + fmt=AAZStrArgFormat( + max_length=100, + ), + ) + license.url = AAZStrArg( + options=["url"], + help="URL pointing to the license details. The URL field is mutually exclusive of the identifier field.", + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + + terms_of_service = cls._args_schema.terms_of_service + terms_of_service.url = AAZStrArg( + options=["url"], + help="URL pointing to the terms of service.", + required=True, + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApisCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ApisCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("contacts", AAZListType, ".contacts") + properties.set_prop("customProperties", AAZObjectType, ".custom_properties") + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("externalDocumentation", AAZListType, ".external_documentation") + properties.set_prop("kind", AAZStrType, ".kind", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("license", AAZObjectType, ".license") + properties.set_prop("summary", AAZStrType, ".summary") + properties.set_prop("termsOfService", AAZObjectType, ".terms_of_service") + properties.set_prop("title", AAZStrType, ".title", typ_kwargs={"flags": {"required": True}}) + + contacts = _builder.get(".properties.contacts") + if contacts is not None: + contacts.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.contacts[]") + if _elements is not None: + _elements.set_prop("email", AAZStrType, ".email") + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("url", AAZStrType, ".url") + + external_documentation = _builder.get(".properties.externalDocumentation") + if external_documentation is not None: + external_documentation.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.externalDocumentation[]") + if _elements is not None: + _elements.set_prop("description", AAZStrType, ".description") + _elements.set_prop("title", AAZStrType, ".title") + _elements.set_prop("url", AAZStrType, ".url", typ_kwargs={"flags": {"required": True}}) + + license = _builder.get(".properties.license") + if license is not None: + license.set_prop("identifier", AAZStrType, ".identifier") + license.set_prop("name", AAZStrType, ".name") + license.set_prop("url", AAZStrType, ".url") + + terms_of_service = _builder.get(".properties.termsOfService") + if terms_of_service is not None: + terms_of_service.set_prop("url", AAZStrType, ".url", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.contacts = AAZListType() + properties.custom_properties = AAZObjectType( + serialized_name="customProperties", + ) + properties.description = AAZStrType() + properties.external_documentation = AAZListType( + serialized_name="externalDocumentation", + ) + properties.kind = AAZStrType( + flags={"required": True}, + ) + properties.license = AAZObjectType() + properties.lifecycle_stage = AAZStrType( + serialized_name="lifecycleStage", + ) + properties.summary = AAZStrType() + properties.terms_of_service = AAZObjectType( + serialized_name="termsOfService", + ) + properties.title = AAZStrType( + flags={"required": True}, + ) + + contacts = cls._schema_on_200_201.properties.contacts + contacts.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.contacts.Element + _element.email = AAZStrType() + _element.name = AAZStrType() + _element.url = AAZStrType() + + external_documentation = cls._schema_on_200_201.properties.external_documentation + external_documentation.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.external_documentation.Element + _element.description = AAZStrType() + _element.title = AAZStrType() + _element.url = AAZStrType( + flags={"required": True}, + ) + + license = cls._schema_on_200_201.properties.license + license.identifier = AAZStrType() + license.name = AAZStrType() + license.url = AAZStrType() + + terms_of_service = cls._schema_on_200_201.properties.terms_of_service + terms_of_service.url = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_delete.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_delete.py new file mode 100644 index 00000000000..9ffe5f1ceac --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_delete.py @@ -0,0 +1,172 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete specified API. + + :example: Delete API + az apic api delete -g contoso-resources -s contoso --name echo-api + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--name", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApisDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ApisDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_head.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_head.py new file mode 100644 index 00000000000..2f5ea67d21a --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_head.py @@ -0,0 +1,163 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api head", +) +class Head(AAZCommand): + """Checks if specified API exists. + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--name", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApisHead(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ApisHead(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + **self.url_parameters + ) + + @property + def method(self): + return "HEAD" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + +class _HeadHelper: + """Helper class for Head""" + + +__all__ = ["Head"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_list.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_list.py new file mode 100644 index 00000000000..ad82509e6d5 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_list.py @@ -0,0 +1,290 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api list", +) +class List(AAZCommand): + """List a collection of APIs. + + :example: List APIs + az apic api list -g contoso-resources -s contoso + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis", "2024-03-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.filter = AAZStrArg( + options=["--filter"], + help="OData filter parameter.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApisList(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class ApisList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "$filter", self.ctx.args.filter, + ), + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + flags={"read_only": True}, + ) + _schema_on_200.value = AAZListType( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.contacts = AAZListType() + properties.custom_properties = AAZObjectType( + serialized_name="customProperties", + ) + properties.description = AAZStrType() + properties.external_documentation = AAZListType( + serialized_name="externalDocumentation", + ) + properties.kind = AAZStrType( + flags={"required": True}, + ) + properties.license = AAZObjectType() + properties.lifecycle_stage = AAZStrType( + serialized_name="lifecycleStage", + ) + properties.summary = AAZStrType() + properties.terms_of_service = AAZObjectType( + serialized_name="termsOfService", + ) + properties.title = AAZStrType( + flags={"required": True}, + ) + + contacts = cls._schema_on_200.value.Element.properties.contacts + contacts.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.contacts.Element + _element.email = AAZStrType() + _element.name = AAZStrType() + _element.url = AAZStrType() + + external_documentation = cls._schema_on_200.value.Element.properties.external_documentation + external_documentation.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.external_documentation.Element + _element.description = AAZStrType() + _element.title = AAZStrType() + _element.url = AAZStrType( + flags={"required": True}, + ) + + license = cls._schema_on_200.value.Element.properties.license + license.identifier = AAZStrType() + license.name = AAZStrType() + license.url = AAZStrType() + + terms_of_service = cls._schema_on_200.value.Element.properties.terms_of_service + terms_of_service.url = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_show.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_show.py new file mode 100644 index 00000000000..bfccf1bb126 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_show.py @@ -0,0 +1,285 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api show", +) +class Show(AAZCommand): + """Get details of the API. + + :example: Show API details + az apic api show -g contoso-resources -s contoso --name echo-api + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--name", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApisGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ApisGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.contacts = AAZListType() + properties.custom_properties = AAZObjectType( + serialized_name="customProperties", + ) + properties.description = AAZStrType() + properties.external_documentation = AAZListType( + serialized_name="externalDocumentation", + ) + properties.kind = AAZStrType( + flags={"required": True}, + ) + properties.license = AAZObjectType() + properties.lifecycle_stage = AAZStrType( + serialized_name="lifecycleStage", + ) + properties.summary = AAZStrType() + properties.terms_of_service = AAZObjectType( + serialized_name="termsOfService", + ) + properties.title = AAZStrType( + flags={"required": True}, + ) + + contacts = cls._schema_on_200.properties.contacts + contacts.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.contacts.Element + _element.email = AAZStrType() + _element.name = AAZStrType() + _element.url = AAZStrType() + + external_documentation = cls._schema_on_200.properties.external_documentation + external_documentation.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.external_documentation.Element + _element.description = AAZStrType() + _element.title = AAZStrType() + _element.url = AAZStrType( + flags={"required": True}, + ) + + license = cls._schema_on_200.properties.license + license.identifier = AAZStrType() + license.name = AAZStrType() + license.url = AAZStrType() + + terms_of_service = cls._schema_on_200.properties.terms_of_service + terms_of_service.url = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_update.py new file mode 100644 index 00000000000..ceed393a2b4 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_update.py @@ -0,0 +1,653 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api update", +) +class Update(AAZCommand): + """Update new or updates existing API. + + :example: Update API + az apic api update -g contoso-resources -s contoso --name echo-api --summary "Basic REST API service" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}", "2024-03-01"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--name", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.contacts = AAZListArg( + options=["--contacts"], + arg_group="Properties", + help="The contact information for the API.", + nullable=True, + ) + _args_schema.custom_properties = AAZObjectArg( + options=["--custom-properties"], + arg_group="Properties", + help="The custom metadata defined for API catalog entities.", + nullable=True, + blank={}, + ) + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="Description of the API.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=1000, + ), + ) + _args_schema.external_documentation = AAZListArg( + options=["--external-documentation"], + arg_group="Properties", + help="Additional, external documentation for the API.", + nullable=True, + ) + _args_schema.kind = AAZStrArg( + options=["--kind"], + arg_group="Properties", + help="Kind of API. For example, REST or GraphQL.", + enum={"graphql": "graphql", "grpc": "grpc", "rest": "rest", "soap": "soap", "webhook": "webhook", "websocket": "websocket"}, + ) + _args_schema.license = AAZObjectArg( + options=["--license"], + arg_group="Properties", + help="The license information for the API.", + nullable=True, + ) + _args_schema.summary = AAZStrArg( + options=["--summary"], + arg_group="Properties", + help="Short description of the API.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + _args_schema.terms_of_service = AAZObjectArg( + options=["--terms-of-service"], + arg_group="Properties", + help="Terms of service for the API.", + nullable=True, + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="API title.", + fmt=AAZStrArgFormat( + max_length=50, + min_length=1, + ), + ) + + contacts = cls._args_schema.contacts + contacts.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_schema.contacts.Element + _element.email = AAZStrArg( + options=["email"], + help="Email address of the contact.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=100, + ), + ) + _element.name = AAZStrArg( + options=["name"], + help="Name of the contact.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=100, + ), + ) + _element.url = AAZStrArg( + options=["url"], + help="URL for the contact.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + + external_documentation = cls._args_schema.external_documentation + external_documentation.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_schema.external_documentation.Element + _element.description = AAZStrArg( + options=["description"], + help="Description of the documentation.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=500, + ), + ) + _element.title = AAZStrArg( + options=["title"], + help="Title of the documentation.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + _element.url = AAZStrArg( + options=["url"], + help="URL pointing to the documentation.", + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + + license = cls._args_schema.license + license.identifier = AAZStrArg( + options=["identifier"], + help="SPDX license information for the API. The identifier field is mutually exclusive of the URL field.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=50, + ), + ) + license.name = AAZStrArg( + options=["name"], + help="Name of the license.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=100, + ), + ) + license.url = AAZStrArg( + options=["url"], + help="URL pointing to the license details. The URL field is mutually exclusive of the identifier field.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + + terms_of_service = cls._args_schema.terms_of_service + terms_of_service.url = AAZStrArg( + options=["url"], + help="URL pointing to the terms of service.", + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApisGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.ApisCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ApisGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_api_read(cls._schema_on_200) + + return cls._schema_on_200 + + class ApisCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_api_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("contacts", AAZListType, ".contacts") + properties.set_prop("customProperties", AAZObjectType, ".custom_properties") + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("externalDocumentation", AAZListType, ".external_documentation") + properties.set_prop("kind", AAZStrType, ".kind", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("license", AAZObjectType, ".license") + properties.set_prop("summary", AAZStrType, ".summary") + properties.set_prop("termsOfService", AAZObjectType, ".terms_of_service") + properties.set_prop("title", AAZStrType, ".title", typ_kwargs={"flags": {"required": True}}) + + contacts = _builder.get(".properties.contacts") + if contacts is not None: + contacts.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.contacts[]") + if _elements is not None: + _elements.set_prop("email", AAZStrType, ".email") + _elements.set_prop("name", AAZStrType, ".name") + _elements.set_prop("url", AAZStrType, ".url") + + external_documentation = _builder.get(".properties.externalDocumentation") + if external_documentation is not None: + external_documentation.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.externalDocumentation[]") + if _elements is not None: + _elements.set_prop("description", AAZStrType, ".description") + _elements.set_prop("title", AAZStrType, ".title") + _elements.set_prop("url", AAZStrType, ".url", typ_kwargs={"flags": {"required": True}}) + + license = _builder.get(".properties.license") + if license is not None: + license.set_prop("identifier", AAZStrType, ".identifier") + license.set_prop("name", AAZStrType, ".name") + license.set_prop("url", AAZStrType, ".url") + + terms_of_service = _builder.get(".properties.termsOfService") + if terms_of_service is not None: + terms_of_service.set_prop("url", AAZStrType, ".url", typ_kwargs={"flags": {"required": True}}) + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_api_read = None + + @classmethod + def _build_schema_api_read(cls, _schema): + if cls._schema_api_read is not None: + _schema.id = cls._schema_api_read.id + _schema.name = cls._schema_api_read.name + _schema.properties = cls._schema_api_read.properties + _schema.system_data = cls._schema_api_read.system_data + _schema.type = cls._schema_api_read.type + return + + cls._schema_api_read = _schema_api_read = AAZObjectType() + + api_read = _schema_api_read + api_read.id = AAZStrType( + flags={"read_only": True}, + ) + api_read.name = AAZStrType( + flags={"read_only": True}, + ) + api_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + api_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + api_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_api_read.properties + properties.contacts = AAZListType() + properties.custom_properties = AAZObjectType( + serialized_name="customProperties", + ) + properties.description = AAZStrType() + properties.external_documentation = AAZListType( + serialized_name="externalDocumentation", + ) + properties.kind = AAZStrType( + flags={"required": True}, + ) + properties.license = AAZObjectType() + properties.lifecycle_stage = AAZStrType( + serialized_name="lifecycleStage", + ) + properties.summary = AAZStrType() + properties.terms_of_service = AAZObjectType( + serialized_name="termsOfService", + ) + properties.title = AAZStrType( + flags={"required": True}, + ) + + contacts = _schema_api_read.properties.contacts + contacts.Element = AAZObjectType() + + _element = _schema_api_read.properties.contacts.Element + _element.email = AAZStrType() + _element.name = AAZStrType() + _element.url = AAZStrType() + + external_documentation = _schema_api_read.properties.external_documentation + external_documentation.Element = AAZObjectType() + + _element = _schema_api_read.properties.external_documentation.Element + _element.description = AAZStrType() + _element.title = AAZStrType() + _element.url = AAZStrType( + flags={"required": True}, + ) + + license = _schema_api_read.properties.license + license.identifier = AAZStrType() + license.name = AAZStrType() + license.url = AAZStrType() + + terms_of_service = _schema_api_read.properties.terms_of_service + terms_of_service.url = AAZStrType( + flags={"required": True}, + ) + + system_data = _schema_api_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.id = cls._schema_api_read.id + _schema.name = cls._schema_api_read.name + _schema.properties = cls._schema_api_read.properties + _schema.system_data = cls._schema_api_read.system_data + _schema.type = cls._schema_api_read.type + + +__all__ = ["Update"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/__cmd_group.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/__cmd_group.py new file mode 100644 index 00000000000..5f95202e0df --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "apic api definition", +) +class __CMDGroup(AAZCommandGroup): + """API definition + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/__init__.py new file mode 100644 index 00000000000..a6ed8b6688f --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._head import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_create.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_create.py new file mode 100644 index 00000000000..176b0972967 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_create.py @@ -0,0 +1,306 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api definition create", +) +class Create(AAZCommand): + """Create new or updates existing API definition. + + :example: Create API definition + az apic api definition create -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi" --title "OpenAPI" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}/definitions/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.definition_name = AAZStrArg( + options=["--name", "--definition", "--definition-name"], + help="The name of the API definition.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--version", "--version-name"], + help="The name of the API version.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="API definition description.", + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="API version.", + fmt=AAZStrArgFormat( + max_length=50, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiDefinitionsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ApiDefinitionsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "definitionName", self.ctx.args.definition_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("title", AAZStrType, ".title", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.description = AAZStrType() + properties.specification = AAZObjectType( + flags={"read_only": True}, + ) + properties.title = AAZStrType( + flags={"required": True}, + ) + + specification = cls._schema_on_200_201.properties.specification + specification.name = AAZStrType() + specification.version = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_delete.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_delete.py new file mode 100644 index 00000000000..5c508834a41 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_delete.py @@ -0,0 +1,200 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api definition delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete specified API definition. + + :example: Delete API definition + az apic api definition delete -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}/definitions/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.definition_name = AAZStrArg( + options=["--name", "--definition", "--definition-name"], + help="The name of the API definition.", + required=True, + id_part="child_name_4", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--version", "--version-name"], + help="The name of the API version.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiDefinitionsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ApiDefinitionsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "definitionName", self.ctx.args.definition_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_head.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_head.py new file mode 100644 index 00000000000..53d99fabe0d --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_head.py @@ -0,0 +1,191 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api definition head", +) +class Head(AAZCommand): + """Checks if specified API definition exists. + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}/definitions/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.definition_name = AAZStrArg( + options=["--name", "--definition", "--definition-name"], + help="The name of the API definition.", + required=True, + id_part="child_name_4", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--version", "--version-name"], + help="The name of the API version.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiDefinitionsHead(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ApiDefinitionsHead(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + **self.url_parameters + ) + + @property + def method(self): + return "HEAD" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "definitionName", self.ctx.args.definition_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + +class _HeadHelper: + """Helper class for Head""" + + +__all__ = ["Head"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_list.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_list.py new file mode 100644 index 00000000000..f49a56e5e15 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_list.py @@ -0,0 +1,277 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api definition list", +) +class List(AAZCommand): + """List a collection of API definitions. + + :example: List API definitions + az apic api version definition list -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}/definitions", "2024-03-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--version", "--version-name"], + help="The name of the API version.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.filter = AAZStrArg( + options=["--filter"], + help="OData filter parameter.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiDefinitionsList(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class ApiDefinitionsList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "$filter", self.ctx.args.filter, + ), + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + flags={"read_only": True}, + ) + _schema_on_200.value = AAZListType( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.description = AAZStrType() + properties.specification = AAZObjectType( + flags={"read_only": True}, + ) + properties.title = AAZStrType( + flags={"required": True}, + ) + + specification = cls._schema_on_200.value.Element.properties.specification + specification.name = AAZStrType() + specification.version = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_show.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_show.py new file mode 100644 index 00000000000..a181bf06a30 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_show.py @@ -0,0 +1,274 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api definition show", +) +class Show(AAZCommand): + """Get details of the API definition. + + :example: Show API definition details + az apic api version definition show -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}/definitions/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.definition_name = AAZStrArg( + options=["--name", "--definition", "--definition-name"], + help="The name of the API definition.", + required=True, + id_part="child_name_4", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--version", "--version-name"], + help="The name of the API version.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiDefinitionsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ApiDefinitionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "definitionName", self.ctx.args.definition_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.description = AAZStrType() + properties.specification = AAZObjectType( + flags={"read_only": True}, + ) + properties.title = AAZStrType( + flags={"required": True}, + ) + + specification = cls._schema_on_200.properties.specification + specification.name = AAZStrType() + specification.version = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_update.py new file mode 100644 index 00000000000..5c7eb09440b --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_update.py @@ -0,0 +1,468 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api definition update", +) +class Update(AAZCommand): + """Update new or updates existing API definition. + + :example: Update API definition + az apic api definition update -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi" --title "OpenAPI" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}/definitions/{}", "2024-03-01"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.definition_name = AAZStrArg( + options=["--name", "--definition", "--definition-name"], + help="The name of the API definition.", + required=True, + id_part="child_name_4", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--version", "--version-name"], + help="The name of the API version.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="API definition description.", + nullable=True, + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="API version title.", + fmt=AAZStrArgFormat( + max_length=50, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiDefinitionsGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.ApiDefinitionsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ApiDefinitionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "definitionName", self.ctx.args.definition_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_api_definition_read(cls._schema_on_200) + + return cls._schema_on_200 + + class ApiDefinitionsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "definitionName", self.ctx.args.definition_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_api_definition_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("title", AAZStrType, ".title", typ_kwargs={"flags": {"required": True}}) + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_api_definition_read = None + + @classmethod + def _build_schema_api_definition_read(cls, _schema): + if cls._schema_api_definition_read is not None: + _schema.id = cls._schema_api_definition_read.id + _schema.name = cls._schema_api_definition_read.name + _schema.properties = cls._schema_api_definition_read.properties + _schema.system_data = cls._schema_api_definition_read.system_data + _schema.type = cls._schema_api_definition_read.type + return + + cls._schema_api_definition_read = _schema_api_definition_read = AAZObjectType() + + api_definition_read = _schema_api_definition_read + api_definition_read.id = AAZStrType( + flags={"read_only": True}, + ) + api_definition_read.name = AAZStrType( + flags={"read_only": True}, + ) + api_definition_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + api_definition_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + api_definition_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_api_definition_read.properties + properties.description = AAZStrType() + properties.specification = AAZObjectType( + flags={"read_only": True}, + ) + properties.title = AAZStrType( + flags={"required": True}, + ) + + specification = _schema_api_definition_read.properties.specification + specification.name = AAZStrType() + specification.version = AAZStrType() + + system_data = _schema_api_definition_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.id = cls._schema_api_definition_read.id + _schema.name = cls._schema_api_definition_read.name + _schema.properties = cls._schema_api_definition_read.properties + _schema.system_data = cls._schema_api_definition_read.system_data + _schema.type = cls._schema_api_definition_read.type + + +__all__ = ["Update"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/__cmd_group.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/__cmd_group.py new file mode 100644 index 00000000000..79d9942f958 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "apic api deployment", +) +class __CMDGroup(AAZCommandGroup): + """API deployment + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/__init__.py new file mode 100644 index 00000000000..a6ed8b6688f --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._head import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_create.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_create.py new file mode 100644 index 00000000000..4dab39f92b5 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_create.py @@ -0,0 +1,359 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api deployment create", +) +class Create(AAZCommand): + """Create new or updates existing API deployment. + + :example: Create deployment + az apic api deployment create -g api-center-test -s contoso --name production --title "Production deployment" --description "Public cloud production deployment." --api echo-api --environmentId "/workspaces/default/environments/production" --definitionId "/workspaces/default/apis/echo-api/versions/2023-01-01/definitions/openapi" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/deployments/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.deployment_name = AAZStrArg( + options=["--name", "--deployment", "--deployment-name"], + help="The name of the API deployment.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.custom_properties = AAZObjectArg( + options=["--custom-properties"], + arg_group="Properties", + help="The custom metadata defined for API catalog entities.", + blank={}, + ) + _args_schema.definition_id = AAZStrArg( + options=["--definition-id"], + arg_group="Properties", + help="API center-scoped definition resource ID.", + ) + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="Description of the deployment.", + fmt=AAZStrArgFormat( + max_length=500, + ), + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + arg_group="Properties", + help="API center-scoped environment resource ID.", + ) + _args_schema.server = AAZObjectArg( + options=["--server"], + arg_group="Properties", + help="Server", + ) + _args_schema.state = AAZStrArg( + options=["--state"], + arg_group="Properties", + help="State of API deployment.", + enum={"active": "active", "inactive": "inactive"}, + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="Deployment title", + fmt=AAZStrArgFormat( + max_length=50, + min_length=1, + ), + ) + + server = cls._args_schema.server + server.runtime_uri = AAZListArg( + options=["runtime-uri"], + help="Base runtime URLs for this deployment.", + ) + + runtime_uri = cls._args_schema.server.runtime_uri + runtime_uri.Element = AAZStrArg( + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DeploymentsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class DeploymentsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "deploymentName", self.ctx.args.deployment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("customProperties", AAZObjectType, ".custom_properties") + properties.set_prop("definitionId", AAZStrType, ".definition_id") + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("environmentId", AAZStrType, ".environment_id") + properties.set_prop("server", AAZObjectType, ".server") + properties.set_prop("state", AAZStrType, ".state") + properties.set_prop("title", AAZStrType, ".title") + + server = _builder.get(".properties.server") + if server is not None: + server.set_prop("runtimeUri", AAZListType, ".runtime_uri") + + runtime_uri = _builder.get(".properties.server.runtimeUri") + if runtime_uri is not None: + runtime_uri.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.custom_properties = AAZObjectType( + serialized_name="customProperties", + ) + properties.definition_id = AAZStrType( + serialized_name="definitionId", + ) + properties.description = AAZStrType() + properties.environment_id = AAZStrType( + serialized_name="environmentId", + ) + properties.server = AAZObjectType() + properties.state = AAZStrType() + properties.title = AAZStrType() + + server = cls._schema_on_200_201.properties.server + server.runtime_uri = AAZListType( + serialized_name="runtimeUri", + ) + + runtime_uri = cls._schema_on_200_201.properties.server.runtime_uri + runtime_uri.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_delete.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_delete.py new file mode 100644 index 00000000000..6584964b542 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_delete.py @@ -0,0 +1,186 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api deployment delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete API deployment. + + :example: Delete API deployment + az apic api deployment delete -g api-center-test -s contoso --name production --api-name echo-api + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/deployments/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.deployment_name = AAZStrArg( + options=["--name", "--deployment", "--deployment-name"], + help="The name of the API deployment.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DeploymentsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class DeploymentsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "deploymentName", self.ctx.args.deployment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_head.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_head.py new file mode 100644 index 00000000000..6b24bbf7cb2 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_head.py @@ -0,0 +1,177 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api deployment head", +) +class Head(AAZCommand): + """Checks if specified API deployment exists. + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/deployments/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.deployment_name = AAZStrArg( + options=["--name", "--deployment", "--deployment-name"], + help="The name of the API deployment.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DeploymentsHead(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class DeploymentsHead(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + **self.url_parameters + ) + + @property + def method(self): + return "HEAD" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "deploymentName", self.ctx.args.deployment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + +class _HeadHelper: + """Helper class for Head""" + + +__all__ = ["Head"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_list.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_list.py new file mode 100644 index 00000000000..1df71cf6cba --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_list.py @@ -0,0 +1,274 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api deployment list", +) +class List(AAZCommand): + """List a collection of API deployments. + + :example: List API deployments + az apic api deployment list -g api-center-test -s contoso --api-name echo-api + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/deployments", "2024-03-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.filter = AAZStrArg( + options=["--filter"], + help="OData filter parameter.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DeploymentsList(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class DeploymentsList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "$filter", self.ctx.args.filter, + ), + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + flags={"read_only": True}, + ) + _schema_on_200.value = AAZListType( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.custom_properties = AAZObjectType( + serialized_name="customProperties", + ) + properties.definition_id = AAZStrType( + serialized_name="definitionId", + ) + properties.description = AAZStrType() + properties.environment_id = AAZStrType( + serialized_name="environmentId", + ) + properties.server = AAZObjectType() + properties.state = AAZStrType() + properties.title = AAZStrType() + + server = cls._schema_on_200.value.Element.properties.server + server.runtime_uri = AAZListType( + serialized_name="runtimeUri", + ) + + runtime_uri = cls._schema_on_200.value.Element.properties.server.runtime_uri + runtime_uri.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_show.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_show.py new file mode 100644 index 00000000000..3e7484335ba --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_show.py @@ -0,0 +1,270 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api deployment show", +) +class Show(AAZCommand): + """Get details of the API deployment. + + :example: Show API deployment details + az apic api deployment show -g api-center-test -s contoso --name production --api-name echo-api + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/deployments/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.deployment_name = AAZStrArg( + options=["--name", "--deployment", "--deployment-name"], + help="The name of the API deployment.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DeploymentsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class DeploymentsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "deploymentName", self.ctx.args.deployment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.custom_properties = AAZObjectType( + serialized_name="customProperties", + ) + properties.definition_id = AAZStrType( + serialized_name="definitionId", + ) + properties.description = AAZStrType() + properties.environment_id = AAZStrType( + serialized_name="environmentId", + ) + properties.server = AAZObjectType() + properties.state = AAZStrType() + properties.title = AAZStrType() + + server = cls._schema_on_200.properties.server + server.runtime_uri = AAZListType( + serialized_name="runtimeUri", + ) + + runtime_uri = cls._schema_on_200.properties.server.runtime_uri + runtime_uri.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_update.py new file mode 100644 index 00000000000..0a129bf05be --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_update.py @@ -0,0 +1,524 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api deployment update", +) +class Update(AAZCommand): + """Update new or updates existing API deployment. + + :example: Update API deployment + az apic api deployment update -g api-center-test -s contoso --name production --title "Production deployment" --api echo-api + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/deployments/{}", "2024-03-01"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.deployment_name = AAZStrArg( + options=["--name", "--deployment", "--deployment-name"], + help="The name of the API deployment.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.custom_properties = AAZObjectArg( + options=["--custom-properties"], + arg_group="Properties", + help="The custom metadata defined for API catalog entities.", + nullable=True, + blank={}, + ) + _args_schema.definition_id = AAZStrArg( + options=["--definition-id"], + arg_group="Properties", + help="Service-scoped definition resource ID.", + nullable=True, + ) + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="Description of the deployment.", + nullable=True, + fmt=AAZStrArgFormat( + max_length=500, + ), + ) + _args_schema.environment_id = AAZStrArg( + options=["--environment-id"], + arg_group="Properties", + help="Service-scoped environment resource ID.", + nullable=True, + ) + _args_schema.server = AAZObjectArg( + options=["--server"], + arg_group="Properties", + help="Server", + nullable=True, + ) + _args_schema.state = AAZStrArg( + options=["--state"], + arg_group="Properties", + help="State of API deployment.", + nullable=True, + enum={"active": "active", "inactive": "inactive"}, + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="Title", + nullable=True, + fmt=AAZStrArgFormat( + max_length=50, + min_length=1, + ), + ) + + server = cls._args_schema.server + server.runtime_uri = AAZListArg( + options=["runtime-uri"], + help="Base runtime URLs for this deployment.", + nullable=True, + ) + + runtime_uri = cls._args_schema.server.runtime_uri + runtime_uri.Element = AAZStrArg( + nullable=True, + fmt=AAZStrArgFormat( + max_length=200, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DeploymentsGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.DeploymentsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class DeploymentsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "deploymentName", self.ctx.args.deployment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_deployment_read(cls._schema_on_200) + + return cls._schema_on_200 + + class DeploymentsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "deploymentName", self.ctx.args.deployment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_deployment_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("customProperties", AAZObjectType, ".custom_properties") + properties.set_prop("definitionId", AAZStrType, ".definition_id") + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("environmentId", AAZStrType, ".environment_id") + properties.set_prop("server", AAZObjectType, ".server") + properties.set_prop("state", AAZStrType, ".state") + properties.set_prop("title", AAZStrType, ".title") + + server = _builder.get(".properties.server") + if server is not None: + server.set_prop("runtimeUri", AAZListType, ".runtime_uri") + + runtime_uri = _builder.get(".properties.server.runtimeUri") + if runtime_uri is not None: + runtime_uri.set_elements(AAZStrType, ".") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_deployment_read = None + + @classmethod + def _build_schema_deployment_read(cls, _schema): + if cls._schema_deployment_read is not None: + _schema.id = cls._schema_deployment_read.id + _schema.name = cls._schema_deployment_read.name + _schema.properties = cls._schema_deployment_read.properties + _schema.system_data = cls._schema_deployment_read.system_data + _schema.type = cls._schema_deployment_read.type + return + + cls._schema_deployment_read = _schema_deployment_read = AAZObjectType() + + deployment_read = _schema_deployment_read + deployment_read.id = AAZStrType( + flags={"read_only": True}, + ) + deployment_read.name = AAZStrType( + flags={"read_only": True}, + ) + deployment_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + deployment_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + deployment_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_deployment_read.properties + properties.custom_properties = AAZObjectType( + serialized_name="customProperties", + ) + properties.definition_id = AAZStrType( + serialized_name="definitionId", + ) + properties.description = AAZStrType() + properties.environment_id = AAZStrType( + serialized_name="environmentId", + ) + properties.server = AAZObjectType() + properties.state = AAZStrType() + properties.title = AAZStrType() + + server = _schema_deployment_read.properties.server + server.runtime_uri = AAZListType( + serialized_name="runtimeUri", + ) + + runtime_uri = _schema_deployment_read.properties.server.runtime_uri + runtime_uri.Element = AAZStrType() + + system_data = _schema_deployment_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.id = cls._schema_deployment_read.id + _schema.name = cls._schema_deployment_read.name + _schema.properties = cls._schema_deployment_read.properties + _schema.system_data = cls._schema_deployment_read.system_data + _schema.type = cls._schema_deployment_read.type + + +__all__ = ["Update"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/__cmd_group.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/__cmd_group.py new file mode 100644 index 00000000000..9fdf76f0a5f --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "apic api version", +) +class __CMDGroup(AAZCommandGroup): + """API version + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/__init__.py new file mode 100644 index 00000000000..a6ed8b6688f --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._head import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_create.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_create.py new file mode 100644 index 00000000000..da640e69e57 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_create.py @@ -0,0 +1,290 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api version create", +) +class Create(AAZCommand): + """Create new or update existing API version. + + :example: Create API version + az apic api version create -g api-center-test -s contosoeuap --api-name echo-api --name 2023-01-01 --title "2023-01-01" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--name", "--version", "--version-name"], + help="The name of the API version.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.lifecycle_stage = AAZStrArg( + options=["--lifecycle-stage"], + arg_group="Properties", + help="Current lifecycle stage of the API.", + enum={"deprecated": "deprecated", "design": "design", "development": "development", "preview": "preview", "production": "production", "retired": "retired", "testing": "testing"}, + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="API version.", + fmt=AAZStrArgFormat( + max_length=50, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiVersionsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ApiVersionsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("lifecycleStage", AAZStrType, ".lifecycle_stage", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("title", AAZStrType, ".title", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.lifecycle_stage = AAZStrType( + serialized_name="lifecycleStage", + flags={"required": True}, + ) + properties.title = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_delete.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_delete.py new file mode 100644 index 00000000000..f5d088936fa --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_delete.py @@ -0,0 +1,186 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api version delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete specified API version + + :example: Delete API version + az apic api version delete -g api-center-test -s contosoeuap --api-name echo-api --name 2023-01-01 + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--name", "--version", "--version-name"], + help="The name of the API version.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiVersionsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ApiVersionsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_head.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_head.py new file mode 100644 index 00000000000..342fe97d095 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_head.py @@ -0,0 +1,177 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api version head", +) +class Head(AAZCommand): + """Checks if specified API version exists. + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--version", "--version-name"], + help="The name of the API version.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiVersionsHead(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ApiVersionsHead(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + **self.url_parameters + ) + + @property + def method(self): + return "HEAD" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + +class _HeadHelper: + """Helper class for Head""" + + +__all__ = ["Head"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_list.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_list.py new file mode 100644 index 00000000000..1df7b2cbb31 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_list.py @@ -0,0 +1,260 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api version list", +) +class List(AAZCommand): + """List a collection of API versions. + + :example: List API versions + az apic api version list -g api-center-test -s contosoeuap --api-name echo-api + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions", "2024-03-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.filter = AAZStrArg( + options=["--filter"], + help="OData filter parameter.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiVersionsList(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class ApiVersionsList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "$filter", self.ctx.args.filter, + ), + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + flags={"read_only": True}, + ) + _schema_on_200.value = AAZListType( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.lifecycle_stage = AAZStrType( + serialized_name="lifecycleStage", + flags={"required": True}, + ) + properties.title = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_show.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_show.py new file mode 100644 index 00000000000..ee2fa6e309a --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_show.py @@ -0,0 +1,256 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api version show", +) +class Show(AAZCommand): + """Get details of the API version. + + :example: Show API version details + az apic api version show -g api-center-test -s contoso --api-name echo-api --name 2023-01-01 + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--name", "--version", "--version-name"], + help="The name of the API version.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiVersionsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ApiVersionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.lifecycle_stage = AAZStrType( + serialized_name="lifecycleStage", + flags={"required": True}, + ) + properties.title = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_update.py new file mode 100644 index 00000000000..b9cce88e3ca --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_update.py @@ -0,0 +1,446 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api version update", +) +class Update(AAZCommand): + """Update new or updates existing API version. + + :example: Update API version + az apic api version update -g api-center-test -s contosoeuap --api-name echo-api --name 2023-01-01 --title "2023-01-01" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}", "2024-03-01"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--name", "--version", "--version-name"], + help="The name of the API version.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.lifecycle_stage = AAZStrArg( + options=["--lifecycle-stage"], + arg_group="Properties", + help="Current lifecycle stage of the API.", + enum={"deprecated": "deprecated", "design": "design", "development": "development", "preview": "preview", "production": "production", "retired": "retired", "testing": "testing"}, + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="API version.", + fmt=AAZStrArgFormat( + max_length=50, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiVersionsGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.ApiVersionsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ApiVersionsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_api_version_read(cls._schema_on_200) + + return cls._schema_on_200 + + class ApiVersionsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_api_version_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("lifecycleStage", AAZStrType, ".lifecycle_stage", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("title", AAZStrType, ".title", typ_kwargs={"flags": {"required": True}}) + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_api_version_read = None + + @classmethod + def _build_schema_api_version_read(cls, _schema): + if cls._schema_api_version_read is not None: + _schema.id = cls._schema_api_version_read.id + _schema.name = cls._schema_api_version_read.name + _schema.properties = cls._schema_api_version_read.properties + _schema.system_data = cls._schema_api_version_read.system_data + _schema.type = cls._schema_api_version_read.type + return + + cls._schema_api_version_read = _schema_api_version_read = AAZObjectType() + + api_version_read = _schema_api_version_read + api_version_read.id = AAZStrType( + flags={"read_only": True}, + ) + api_version_read.name = AAZStrType( + flags={"read_only": True}, + ) + api_version_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + api_version_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + api_version_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_api_version_read.properties + properties.lifecycle_stage = AAZStrType( + serialized_name="lifecycleStage", + flags={"required": True}, + ) + properties.title = AAZStrType( + flags={"required": True}, + ) + + system_data = _schema_api_version_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.id = cls._schema_api_version_read.id + _schema.name = cls._schema_api_version_read.name + _schema.properties = cls._schema_api_version_read.properties + _schema.system_data = cls._schema_api_version_read.system_data + _schema.type = cls._schema_api_version_read.type + + +__all__ = ["Update"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/__cmd_group.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/__cmd_group.py new file mode 100644 index 00000000000..8011cf0897f --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "apic environment", +) +class __CMDGroup(AAZCommandGroup): + """Environment + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/__init__.py new file mode 100644 index 00000000000..a6ed8b6688f --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._head import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_create.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_create.py new file mode 100644 index 00000000000..0c398be20a8 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_create.py @@ -0,0 +1,367 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic environment create", +) +class Create(AAZCommand): + """Create new or updates existing environment. + + :example: Create environment + az apic environment create -g api-center-test -s contosoeuap --name public --title "Public cloud" --kind "development" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/environments/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.environment_name = AAZStrArg( + options=["--name", "--environment", "--environment-name"], + help="The name of the environment.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.custom_properties = AAZObjectArg( + options=["--custom-properties"], + arg_group="Properties", + help="The custom metadata defined for API catalog entities.", + blank={}, + ) + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="Description.", + ) + _args_schema.kind = AAZStrArg( + options=["--kind"], + arg_group="Properties", + help="Environment kind.", + enum={"development": "development", "production": "production", "staging": "staging", "testing": "testing"}, + ) + _args_schema.onboarding = AAZObjectArg( + options=["--onboarding"], + arg_group="Properties", + ) + _args_schema.server = AAZObjectArg( + options=["--server"], + arg_group="Properties", + help="Server information of the environment.", + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="Environment title.", + fmt=AAZStrArgFormat( + max_length=50, + min_length=1, + ), + ) + + onboarding = cls._args_schema.onboarding + onboarding.developer_portal_uri = AAZListArg( + options=["developer-portal-uri"], + ) + onboarding.instructions = AAZStrArg( + options=["instructions"], + help="Onboarding guide.", + ) + + developer_portal_uri = cls._args_schema.onboarding.developer_portal_uri + developer_portal_uri.Element = AAZStrArg() + + server = cls._args_schema.server + server.management_portal_uri = AAZListArg( + options=["management-portal-uri"], + ) + server.type = AAZStrArg( + options=["type"], + help="Type of the server that represents the environment.", + enum={"AWS API Gateway": "AWS API Gateway", "Apigee API Management": "Apigee API Management", "Azure API Management": "Azure API Management", "Azure compute service": "Azure compute service", "Kong API Gateway": "Kong API Gateway", "Kubernetes": "Kubernetes", "MuleSoft API Management": "MuleSoft API Management"}, + ) + + management_portal_uri = cls._args_schema.server.management_portal_uri + management_portal_uri.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.EnvironmentsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class EnvironmentsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "environmentName", self.ctx.args.environment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("customProperties", AAZObjectType, ".custom_properties") + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("kind", AAZStrType, ".kind", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("onboarding", AAZObjectType, ".onboarding") + properties.set_prop("server", AAZObjectType, ".server") + properties.set_prop("title", AAZStrType, ".title", typ_kwargs={"flags": {"required": True}}) + + onboarding = _builder.get(".properties.onboarding") + if onboarding is not None: + onboarding.set_prop("developerPortalUri", AAZListType, ".developer_portal_uri") + onboarding.set_prop("instructions", AAZStrType, ".instructions") + + developer_portal_uri = _builder.get(".properties.onboarding.developerPortalUri") + if developer_portal_uri is not None: + developer_portal_uri.set_elements(AAZStrType, ".") + + server = _builder.get(".properties.server") + if server is not None: + server.set_prop("managementPortalUri", AAZListType, ".management_portal_uri") + server.set_prop("type", AAZStrType, ".type") + + management_portal_uri = _builder.get(".properties.server.managementPortalUri") + if management_portal_uri is not None: + management_portal_uri.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.custom_properties = AAZObjectType( + serialized_name="customProperties", + ) + properties.description = AAZStrType() + properties.kind = AAZStrType( + flags={"required": True}, + ) + properties.onboarding = AAZObjectType() + properties.server = AAZObjectType() + properties.title = AAZStrType( + flags={"required": True}, + ) + + onboarding = cls._schema_on_200_201.properties.onboarding + onboarding.developer_portal_uri = AAZListType( + serialized_name="developerPortalUri", + ) + onboarding.instructions = AAZStrType() + + developer_portal_uri = cls._schema_on_200_201.properties.onboarding.developer_portal_uri + developer_portal_uri.Element = AAZStrType() + + server = cls._schema_on_200_201.properties.server + server.management_portal_uri = AAZListType( + serialized_name="managementPortalUri", + ) + server.type = AAZStrType() + + management_portal_uri = cls._schema_on_200_201.properties.server.management_portal_uri + management_portal_uri.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_delete.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_delete.py new file mode 100644 index 00000000000..f13fa95c16d --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_delete.py @@ -0,0 +1,172 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic environment delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the environment. + + :example: Delete environment + az apic environment delete -g api-center-test -s contosoeuap --name public + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/environments/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.environment_name = AAZStrArg( + options=["--name", "--environment", "--environment-name"], + help="The name of the environment.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.EnvironmentsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class EnvironmentsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "environmentName", self.ctx.args.environment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_head.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_head.py new file mode 100644 index 00000000000..714acd4191d --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_head.py @@ -0,0 +1,163 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic environment head", +) +class Head(AAZCommand): + """Checks if specified environment exists. + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/environments/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.environment_name = AAZStrArg( + options=["--name", "--environment", "--environment-name"], + help="The name of the environment.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.EnvironmentsHead(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class EnvironmentsHead(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + **self.url_parameters + ) + + @property + def method(self): + return "HEAD" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "environmentName", self.ctx.args.environment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + +class _HeadHelper: + """Helper class for Head""" + + +__all__ = ["Head"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_list.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_list.py new file mode 100644 index 00000000000..158e9480dfe --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_list.py @@ -0,0 +1,270 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic environment list", +) +class List(AAZCommand): + """List a collection of environments. + + :example: List environments + az apic environment list -g api-center-test -s contosoeuap + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/environments", "2024-03-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.filter = AAZStrArg( + options=["--filter"], + help="OData filter parameter.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.EnvironmentsList(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class EnvironmentsList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "$filter", self.ctx.args.filter, + ), + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + flags={"read_only": True}, + ) + _schema_on_200.value = AAZListType( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.custom_properties = AAZObjectType( + serialized_name="customProperties", + ) + properties.description = AAZStrType() + properties.kind = AAZStrType( + flags={"required": True}, + ) + properties.onboarding = AAZObjectType() + properties.server = AAZObjectType() + properties.title = AAZStrType( + flags={"required": True}, + ) + + onboarding = cls._schema_on_200.value.Element.properties.onboarding + onboarding.developer_portal_uri = AAZListType( + serialized_name="developerPortalUri", + ) + onboarding.instructions = AAZStrType() + + developer_portal_uri = cls._schema_on_200.value.Element.properties.onboarding.developer_portal_uri + developer_portal_uri.Element = AAZStrType() + + server = cls._schema_on_200.value.Element.properties.server + server.management_portal_uri = AAZListType( + serialized_name="managementPortalUri", + ) + server.type = AAZStrType() + + management_portal_uri = cls._schema_on_200.value.Element.properties.server.management_portal_uri + management_portal_uri.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_show.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_show.py new file mode 100644 index 00000000000..7334504d1a9 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_show.py @@ -0,0 +1,265 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic environment show", +) +class Show(AAZCommand): + """Get details of the environment. + + :example: Show environment details + az apic environment show -g api-center-test -s contosoeuap --name public + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/environments/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.environment_name = AAZStrArg( + options=["--name", "--environment", "--environment-name"], + help="The name of the environment.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.EnvironmentsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class EnvironmentsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "environmentName", self.ctx.args.environment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.custom_properties = AAZObjectType( + serialized_name="customProperties", + ) + properties.description = AAZStrType() + properties.kind = AAZStrType( + flags={"required": True}, + ) + properties.onboarding = AAZObjectType() + properties.server = AAZObjectType() + properties.title = AAZStrType( + flags={"required": True}, + ) + + onboarding = cls._schema_on_200.properties.onboarding + onboarding.developer_portal_uri = AAZListType( + serialized_name="developerPortalUri", + ) + onboarding.instructions = AAZStrType() + + developer_portal_uri = cls._schema_on_200.properties.onboarding.developer_portal_uri + developer_portal_uri.Element = AAZStrType() + + server = cls._schema_on_200.properties.server + server.management_portal_uri = AAZListType( + serialized_name="managementPortalUri", + ) + server.type = AAZStrType() + + management_portal_uri = cls._schema_on_200.properties.server.management_portal_uri + management_portal_uri.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_update.py new file mode 100644 index 00000000000..a03722c27d2 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_update.py @@ -0,0 +1,530 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic environment update", +) +class Update(AAZCommand): + """Update new or updates existing environment. + + :example: Update environment + az apic environment update -g api-center-test -s contosoeuap --name public --title "Public cloud" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/environments/{}", "2024-03-01"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.environment_name = AAZStrArg( + options=["--name", "--environment", "--environment-name"], + help="The name of the environment.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.custom_properties = AAZObjectArg( + options=["--custom-properties"], + arg_group="Properties", + help="The custom metadata defined for API catalog entities.", + nullable=True, + blank={}, + ) + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="Description.", + nullable=True, + ) + _args_schema.kind = AAZStrArg( + options=["--kind"], + arg_group="Properties", + help="Environment kind.", + enum={"development": "development", "production": "production", "staging": "staging", "testing": "testing"}, + ) + _args_schema.onboarding = AAZObjectArg( + options=["--onboarding"], + arg_group="Properties", + nullable=True, + ) + _args_schema.server = AAZObjectArg( + options=["--server"], + arg_group="Properties", + help="Server information of the environment.", + nullable=True, + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="Environment title.", + fmt=AAZStrArgFormat( + max_length=50, + min_length=1, + ), + ) + + onboarding = cls._args_schema.onboarding + onboarding.developer_portal_uri = AAZListArg( + options=["developer-portal-uri"], + nullable=True, + ) + onboarding.instructions = AAZStrArg( + options=["instructions"], + help="Onboarding guide.", + nullable=True, + ) + + developer_portal_uri = cls._args_schema.onboarding.developer_portal_uri + developer_portal_uri.Element = AAZStrArg( + nullable=True, + ) + + server = cls._args_schema.server + server.management_portal_uri = AAZListArg( + options=["management-portal-uri"], + nullable=True, + ) + server.type = AAZStrArg( + options=["type"], + help="Type of the server that represents the environment.", + nullable=True, + enum={"AWS API Gateway": "AWS API Gateway", "Apigee API Management": "Apigee API Management", "Azure API Management": "Azure API Management", "Azure compute service": "Azure compute service", "Kong API Gateway": "Kong API Gateway", "Kubernetes": "Kubernetes", "MuleSoft API Management": "MuleSoft API Management"}, + ) + + management_portal_uri = cls._args_schema.server.management_portal_uri + management_portal_uri.Element = AAZStrArg( + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.EnvironmentsGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.EnvironmentsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class EnvironmentsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "environmentName", self.ctx.args.environment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_environment_read(cls._schema_on_200) + + return cls._schema_on_200 + + class EnvironmentsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "environmentName", self.ctx.args.environment_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_environment_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("customProperties", AAZObjectType, ".custom_properties") + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("kind", AAZStrType, ".kind", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("onboarding", AAZObjectType, ".onboarding") + properties.set_prop("server", AAZObjectType, ".server") + properties.set_prop("title", AAZStrType, ".title", typ_kwargs={"flags": {"required": True}}) + + onboarding = _builder.get(".properties.onboarding") + if onboarding is not None: + onboarding.set_prop("developerPortalUri", AAZListType, ".developer_portal_uri") + onboarding.set_prop("instructions", AAZStrType, ".instructions") + + developer_portal_uri = _builder.get(".properties.onboarding.developerPortalUri") + if developer_portal_uri is not None: + developer_portal_uri.set_elements(AAZStrType, ".") + + server = _builder.get(".properties.server") + if server is not None: + server.set_prop("managementPortalUri", AAZListType, ".management_portal_uri") + server.set_prop("type", AAZStrType, ".type") + + management_portal_uri = _builder.get(".properties.server.managementPortalUri") + if management_portal_uri is not None: + management_portal_uri.set_elements(AAZStrType, ".") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_environment_read = None + + @classmethod + def _build_schema_environment_read(cls, _schema): + if cls._schema_environment_read is not None: + _schema.id = cls._schema_environment_read.id + _schema.name = cls._schema_environment_read.name + _schema.properties = cls._schema_environment_read.properties + _schema.system_data = cls._schema_environment_read.system_data + _schema.type = cls._schema_environment_read.type + return + + cls._schema_environment_read = _schema_environment_read = AAZObjectType() + + environment_read = _schema_environment_read + environment_read.id = AAZStrType( + flags={"read_only": True}, + ) + environment_read.name = AAZStrType( + flags={"read_only": True}, + ) + environment_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + environment_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + environment_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_environment_read.properties + properties.custom_properties = AAZObjectType( + serialized_name="customProperties", + ) + properties.description = AAZStrType() + properties.kind = AAZStrType( + flags={"required": True}, + ) + properties.onboarding = AAZObjectType() + properties.server = AAZObjectType() + properties.title = AAZStrType( + flags={"required": True}, + ) + + onboarding = _schema_environment_read.properties.onboarding + onboarding.developer_portal_uri = AAZListType( + serialized_name="developerPortalUri", + ) + onboarding.instructions = AAZStrType() + + developer_portal_uri = _schema_environment_read.properties.onboarding.developer_portal_uri + developer_portal_uri.Element = AAZStrType() + + server = _schema_environment_read.properties.server + server.management_portal_uri = AAZListType( + serialized_name="managementPortalUri", + ) + server.type = AAZStrType() + + management_portal_uri = _schema_environment_read.properties.server.management_portal_uri + management_portal_uri.Element = AAZStrType() + + system_data = _schema_environment_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.id = cls._schema_environment_read.id + _schema.name = cls._schema_environment_read.name + _schema.properties = cls._schema_environment_read.properties + _schema.system_data = cls._schema_environment_read.system_data + _schema.type = cls._schema_environment_read.type + + +__all__ = ["Update"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/__cmd_group.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/__cmd_group.py new file mode 100644 index 00000000000..dc9dc8ecea3 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "apic metadata-schema", +) +class __CMDGroup(AAZCommandGroup): + """Metadata schema + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/__init__.py new file mode 100644 index 00000000000..a6ed8b6688f --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._head import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_create.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_create.py new file mode 100644 index 00000000000..44833b8ee3a --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_create.py @@ -0,0 +1,290 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic metadata-schema create", +) +class Create(AAZCommand): + """Create new or updates existing metadata schema. + + :example: Create schema + az az apic metadata-schema create --resource-group api-center-test --service-name contoso --name "test1" --schema '{\"type\":\"string\", \"title\":\"First name\", \"pattern\": \"^[a-zA-Z0-9]+$\"}' + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/metadataschemas/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.metadata_schema_name = AAZStrArg( + options=["--name", "--metadata-schema", "--metadata-schema-name"], + help="The name of the metadata schema.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.assigned_to = AAZListArg( + options=["--assigned-to"], + arg_group="Properties", + ) + _args_schema.schema = AAZStrArg( + options=["--schema"], + arg_group="Properties", + help="JSON schema defining the type.", + ) + + assigned_to = cls._args_schema.assigned_to + assigned_to.Element = AAZObjectArg() + + _element = cls._args_schema.assigned_to.Element + _element.deprecated = AAZBoolArg( + options=["deprecated"], + ) + _element.entity = AAZStrArg( + options=["entity"], + help="The entities this metadata schema component gets applied to.", + enum={"api": "api", "deployment": "deployment", "environment": "environment"}, + ) + _element.required = AAZBoolArg( + options=["required"], + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MetadataSchemasCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class MetadataSchemasCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "metadataSchemaName", self.ctx.args.metadata_schema_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("assignedTo", AAZListType, ".assigned_to") + properties.set_prop("schema", AAZStrType, ".schema", typ_kwargs={"flags": {"required": True}}) + + assigned_to = _builder.get(".properties.assignedTo") + if assigned_to is not None: + assigned_to.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.assignedTo[]") + if _elements is not None: + _elements.set_prop("deprecated", AAZBoolType, ".deprecated") + _elements.set_prop("entity", AAZStrType, ".entity") + _elements.set_prop("required", AAZBoolType, ".required") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.assigned_to = AAZListType( + serialized_name="assignedTo", + ) + properties.schema = AAZStrType( + flags={"required": True}, + ) + + assigned_to = cls._schema_on_200_201.properties.assigned_to + assigned_to.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.assigned_to.Element + _element.deprecated = AAZBoolType() + _element.entity = AAZStrType() + _element.required = AAZBoolType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_delete.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_delete.py new file mode 100644 index 00000000000..f43943f8e96 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_delete.py @@ -0,0 +1,160 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic metadata-schema delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete specified metadata schema. + + :example: Delete Metadata Schema + az az apic metadata-schema delete --resource-group api-center-test --service-name contoso --name "test1" + + :example: Delete schema + az apic metadata-schema delete -g api-center-test -s contosoeuap --name "approver" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/metadataschemas/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.metadata_schema_name = AAZStrArg( + options=["--name", "--metadata-schema", "--metadata-schema-name"], + help="The name of the metadata schema.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MetadataSchemasDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class MetadataSchemasDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "metadataSchemaName", self.ctx.args.metadata_schema_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_head.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_head.py new file mode 100644 index 00000000000..e711e70be17 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_head.py @@ -0,0 +1,148 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic metadata-schema head", +) +class Head(AAZCommand): + """Checks if specified metadata schema exists. + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/metadataschemas/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.metadata_schema_name = AAZStrArg( + options=["--name", "--metadata-schema", "--metadata-schema-name"], + help="The name of the metadata schema.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MetadataSchemasHead(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class MetadataSchemasHead(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + **self.url_parameters + ) + + @property + def method(self): + return "HEAD" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "metadataSchemaName", self.ctx.args.metadata_schema_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + +class _HeadHelper: + """Helper class for Head""" + + +__all__ = ["Head"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_list.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_list.py new file mode 100644 index 00000000000..9c37ddd3c5a --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_list.py @@ -0,0 +1,240 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic metadata-schema list", +) +class List(AAZCommand): + """List a collection of metadata schemas. + + :example: List schemas + az apic metadata-schema list -g api-center-test -s contosoeuap + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/metadataschemas", "2024-03-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.filter = AAZStrArg( + options=["--filter"], + help="OData filter parameter.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MetadataSchemasList(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class MetadataSchemasList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "$filter", self.ctx.args.filter, + ), + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + flags={"read_only": True}, + ) + _schema_on_200.value = AAZListType( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.assigned_to = AAZListType( + serialized_name="assignedTo", + ) + properties.schema = AAZStrType( + flags={"required": True}, + ) + + assigned_to = cls._schema_on_200.value.Element.properties.assigned_to + assigned_to.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.assigned_to.Element + _element.deprecated = AAZBoolType() + _element.entity = AAZStrType() + _element.required = AAZBoolType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_show.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_show.py new file mode 100644 index 00000000000..1a5cc17a037 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_show.py @@ -0,0 +1,237 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic metadata-schema show", +) +class Show(AAZCommand): + """Get details of the metadata schema. + + :example: Show schema details 1 + az apic metadata-schema show -g api-center-test -s contosoeuap --name approver + + :example: Show schema details 2 + az az apic metadata-schema show --resource-group api-center-test --service-name contoso --name "testchoices" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/metadataschemas/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.metadata_schema_name = AAZStrArg( + options=["--name", "--metadata-schema", "--metadata-schema-name"], + help="The name of the metadata schema.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MetadataSchemasGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class MetadataSchemasGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "metadataSchemaName", self.ctx.args.metadata_schema_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.assigned_to = AAZListType( + serialized_name="assignedTo", + ) + properties.schema = AAZStrType( + flags={"required": True}, + ) + + assigned_to = cls._schema_on_200.properties.assigned_to + assigned_to.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.assigned_to.Element + _element.deprecated = AAZBoolType() + _element.entity = AAZStrType() + _element.required = AAZBoolType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_update.py new file mode 100644 index 00000000000..77987d7e7ff --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_update.py @@ -0,0 +1,442 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic metadata-schema update", +) +class Update(AAZCommand): + """Update new or updates existing metadata schema. + + :example: Update schema + az az apic metadata-schema update --resource-group api-center-test --service-name contoso --name "test1" --schema '{\"type\":\"string\", \"title\":\"Last name\", \"pattern\": \"^[a-zA-Z0-9]+$\"}' + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/metadataschemas/{}", "2024-03-01"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.metadata_schema_name = AAZStrArg( + options=["--name", "--metadata-schema", "--metadata-schema-name"], + help="The name of the metadata schema.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.assigned_to = AAZListArg( + options=["--assigned-to"], + arg_group="Properties", + nullable=True, + ) + _args_schema.schema = AAZStrArg( + options=["--schema"], + arg_group="Properties", + help="YAML schema defining the type.", + ) + + assigned_to = cls._args_schema.assigned_to + assigned_to.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_schema.assigned_to.Element + _element.deprecated = AAZBoolArg( + options=["deprecated"], + nullable=True, + ) + _element.entity = AAZStrArg( + options=["entity"], + help="The entities this metadata schema component gets applied to.", + nullable=True, + enum={"api": "api", "deployment": "deployment", "environment": "environment"}, + ) + _element.required = AAZBoolArg( + options=["required"], + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MetadataSchemasGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.MetadataSchemasCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class MetadataSchemasGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "metadataSchemaName", self.ctx.args.metadata_schema_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_metadata_schema_read(cls._schema_on_200) + + return cls._schema_on_200 + + class MetadataSchemasCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "metadataSchemaName", self.ctx.args.metadata_schema_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_metadata_schema_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("assignedTo", AAZListType, ".assigned_to") + properties.set_prop("schema", AAZStrType, ".schema", typ_kwargs={"flags": {"required": True}}) + + assigned_to = _builder.get(".properties.assignedTo") + if assigned_to is not None: + assigned_to.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.assignedTo[]") + if _elements is not None: + _elements.set_prop("deprecated", AAZBoolType, ".deprecated") + _elements.set_prop("entity", AAZStrType, ".entity") + _elements.set_prop("required", AAZBoolType, ".required") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_metadata_schema_read = None + + @classmethod + def _build_schema_metadata_schema_read(cls, _schema): + if cls._schema_metadata_schema_read is not None: + _schema.id = cls._schema_metadata_schema_read.id + _schema.name = cls._schema_metadata_schema_read.name + _schema.properties = cls._schema_metadata_schema_read.properties + _schema.system_data = cls._schema_metadata_schema_read.system_data + _schema.type = cls._schema_metadata_schema_read.type + return + + cls._schema_metadata_schema_read = _schema_metadata_schema_read = AAZObjectType() + + metadata_schema_read = _schema_metadata_schema_read + metadata_schema_read.id = AAZStrType( + flags={"read_only": True}, + ) + metadata_schema_read.name = AAZStrType( + flags={"read_only": True}, + ) + metadata_schema_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + metadata_schema_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + metadata_schema_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_metadata_schema_read.properties + properties.assigned_to = AAZListType( + serialized_name="assignedTo", + ) + properties.schema = AAZStrType( + flags={"required": True}, + ) + + assigned_to = _schema_metadata_schema_read.properties.assigned_to + assigned_to.Element = AAZObjectType() + + _element = _schema_metadata_schema_read.properties.assigned_to.Element + _element.deprecated = AAZBoolType() + _element.entity = AAZStrType() + _element.required = AAZBoolType() + + system_data = _schema_metadata_schema_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.id = cls._schema_metadata_schema_read.id + _schema.name = cls._schema_metadata_schema_read.name + _schema.properties = cls._schema_metadata_schema_read.properties + _schema.system_data = cls._schema_metadata_schema_read.system_data + _schema.type = cls._schema_metadata_schema_read.type + + +__all__ = ["Update"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__cmd_group.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__cmd_group.py new file mode 100644 index 00000000000..2b089d505b9 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "apic service", +) +class __CMDGroup(AAZCommandGroup): + """API Center service + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py new file mode 100644 index 00000000000..c401f439385 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_create.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_create.py new file mode 100644 index 00000000000..882d6e628e4 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_create.py @@ -0,0 +1,319 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic service create", +) +class Create(AAZCommand): + """Create an instance of Azure API Center service. + + :example: Create service + az apic create -g contoso-resources -s contoso + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--name", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Payload" + + _args_schema = cls._args_schema + _args_schema.identity = AAZObjectArg( + options=["--identity"], + arg_group="Payload", + help="Managed service identity (system assigned and/or user assigned identities)", + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="Payload", + help="The geo-location where the resource lives", + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Payload", + help="Resource tags.", + ) + + identity = cls._args_schema.identity + identity.type = AAZStrArg( + options=["type"], + help="Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).", + required=True, + enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"}, + ) + identity.user_assigned_identities = AAZDictArg( + options=["user-assigned-identities"], + help="The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", + ) + + user_assigned_identities = cls._args_schema.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectArg( + nullable=True, + blank={}, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ServicesCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ServicesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("identity", AAZObjectType, ".identity") + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + identity = _builder.get(".identity") + if identity is not None: + identity.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities") + + user_assigned_identities = _builder.get(".identity.userAssignedIdentities") + if user_assigned_identities is not None: + user_assigned_identities.set_elements(AAZObjectType, ".", typ_kwargs={"nullable": True}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.identity = AAZObjectType() + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200_201.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200_201.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = cls._schema_on_200_201.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_delete.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_delete.py new file mode 100644 index 00000000000..59236ef72eb --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_delete.py @@ -0,0 +1,143 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic service delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete service + + :example: Delete service + az apic service delete -s contoso -g contoso-resources + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--name", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ServicesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ServicesDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_list.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_list.py new file mode 100644 index 00000000000..eabdc18a9da --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_list.py @@ -0,0 +1,420 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic service list", +) +class List(AAZCommand): + """List services within an Azure subscription. + + :example: List services in resource group + az apic list -g contoso-resources + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.apicenter/services", "2024-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services", "2024-03-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.ServicesListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.ServicesListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class ServicesListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.identity = AAZObjectType() + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200.value.Element.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class ServicesListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.ApiCenter/services", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.identity = AAZObjectType() + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200.value.Element.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_show.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_show.py new file mode 100644 index 00000000000..3cb8512041b --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_show.py @@ -0,0 +1,249 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic service show", +) +class Show(AAZCommand): + """Show service details + + :example: Show service details + az apic service show -g contoso-resources -s contoso + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--name", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ServicesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ServicesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZObjectType() + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = cls._schema_on_200.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = cls._schema_on_200.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = cls._schema_on_200.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_update.py new file mode 100644 index 00000000000..325353c3a0e --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_update.py @@ -0,0 +1,462 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic service update", +) +class Update(AAZCommand): + """Update service + + :example: Update service details + az apic update -g contoso-resources -s contoso + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}", "2024-03-01"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--name", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Payload" + + _args_schema = cls._args_schema + _args_schema.identity = AAZObjectArg( + options=["--identity"], + arg_group="Payload", + help="Managed service identity (system assigned and/or user assigned identities)", + nullable=True, + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Payload", + help="Resource tags.", + nullable=True, + ) + + identity = cls._args_schema.identity + identity.type = AAZStrArg( + options=["type"], + help="Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).", + enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"}, + ) + identity.user_assigned_identities = AAZDictArg( + options=["user-assigned-identities"], + help="The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.", + nullable=True, + ) + + user_assigned_identities = cls._args_schema.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectArg( + nullable=True, + blank={}, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ServicesGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.ServicesCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ServicesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_service_read(cls._schema_on_200) + + return cls._schema_on_200 + + class ServicesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_service_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("identity", AAZObjectType, ".identity") + _builder.set_prop("tags", AAZDictType, ".tags") + + identity = _builder.get(".identity") + if identity is not None: + identity.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities") + + user_assigned_identities = _builder.get(".identity.userAssignedIdentities") + if user_assigned_identities is not None: + user_assigned_identities.set_elements(AAZObjectType, ".", typ_kwargs={"nullable": True}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_service_read = None + + @classmethod + def _build_schema_service_read(cls, _schema): + if cls._schema_service_read is not None: + _schema.id = cls._schema_service_read.id + _schema.identity = cls._schema_service_read.identity + _schema.location = cls._schema_service_read.location + _schema.name = cls._schema_service_read.name + _schema.properties = cls._schema_service_read.properties + _schema.system_data = cls._schema_service_read.system_data + _schema.tags = cls._schema_service_read.tags + _schema.type = cls._schema_service_read.type + return + + cls._schema_service_read = _schema_service_read = AAZObjectType() + + service_read = _schema_service_read + service_read.id = AAZStrType( + flags={"read_only": True}, + ) + service_read.identity = AAZObjectType() + service_read.location = AAZStrType( + flags={"required": True}, + ) + service_read.name = AAZStrType( + flags={"read_only": True}, + ) + service_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + service_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + service_read.tags = AAZDictType() + service_read.type = AAZStrType( + flags={"read_only": True}, + ) + + identity = _schema_service_read.identity + identity.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + identity.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"read_only": True}, + ) + identity.type = AAZStrType( + flags={"required": True}, + ) + identity.user_assigned_identities = AAZDictType( + serialized_name="userAssignedIdentities", + ) + + user_assigned_identities = _schema_service_read.identity.user_assigned_identities + user_assigned_identities.Element = AAZObjectType( + nullable=True, + ) + + _element = _schema_service_read.identity.user_assigned_identities.Element + _element.client_id = AAZStrType( + serialized_name="clientId", + flags={"read_only": True}, + ) + _element.principal_id = AAZStrType( + serialized_name="principalId", + flags={"read_only": True}, + ) + + properties = _schema_service_read.properties + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + system_data = _schema_service_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_service_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_service_read.id + _schema.identity = cls._schema_service_read.identity + _schema.location = cls._schema_service_read.location + _schema.name = cls._schema_service_read.name + _schema.properties = cls._schema_service_read.properties + _schema.system_data = cls._schema_service_read.system_data + _schema.tags = cls._schema_service_read.tags + _schema.type = cls._schema_service_read.type + + +__all__ = ["Update"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/__cmd_group.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/__cmd_group.py new file mode 100644 index 00000000000..8309c41f39f --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "apic workspace", +) +class __CMDGroup(AAZCommandGroup): + """Workspace + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/__init__.py new file mode 100644 index 00000000000..a6ed8b6688f --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._head import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_create.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_create.py new file mode 100644 index 00000000000..5fbc05a9f16 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_create.py @@ -0,0 +1,260 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic workspace create", +) +class Create(AAZCommand): + """Create new or updates existing workspace. + + :example: Create workspace + az apic workspace create -g api-center-test -s contoso --name devdiv --title "Developer division" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--name", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="Workspace description.", + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="Workspace display name.", + fmt=AAZStrArgFormat( + max_length=50, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.WorkspacesCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class WorkspacesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("title", AAZStrType, ".title", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.description = AAZStrType() + properties.title = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_delete.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_delete.py new file mode 100644 index 00000000000..4ff3c2f816e --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_delete.py @@ -0,0 +1,158 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic workspace delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete specified workspace. + + :example: Delete workspace + az apic workspace delete -g api-center-test -s contoso --name devdiv + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--name", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.WorkspacesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class WorkspacesDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_head.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_head.py new file mode 100644 index 00000000000..4c5a0b114c1 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_head.py @@ -0,0 +1,149 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic workspace head", +) +class Head(AAZCommand): + """Checks if specified workspace exists. + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--name", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.WorkspacesHead(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class WorkspacesHead(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + **self.url_parameters + ) + + @property + def method(self): + return "HEAD" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + +class _HeadHelper: + """Helper class for Head""" + + +__all__ = ["Head"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_list.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_list.py new file mode 100644 index 00000000000..17c8805cde7 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_list.py @@ -0,0 +1,230 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic workspace list", +) +class List(AAZCommand): + """List a collection of workspaces. + + :example: List workspaces + az apic workspace list -g api-center-test -s contoso --name devdiv + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces", "2024-03-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.filter = AAZStrArg( + options=["--filter"], + help="OData filter parameter.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.WorkspacesList(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class WorkspacesList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "$filter", self.ctx.args.filter, + ), + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + flags={"read_only": True}, + ) + _schema_on_200.value = AAZListType( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.description = AAZStrType() + properties.title = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_show.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_show.py new file mode 100644 index 00000000000..a55f27e818e --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_show.py @@ -0,0 +1,225 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic workspace show", +) +class Show(AAZCommand): + """Get details of the workspace. + + :example: Show workspace details + az apic workspace show -g api-center-test -s contoso --name devdiv + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--name", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.WorkspacesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class WorkspacesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.description = AAZStrType() + properties.title = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_update.py new file mode 100644 index 00000000000..5604e2364e3 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_update.py @@ -0,0 +1,407 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic workspace update", +) +class Update(AAZCommand): + """Update new or updates existing workspace. + + :example: Update workspace + az apic workspace update -g api-center-test -s contoso --name devdiv --title "Developer division" + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}", "2024-03-01"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--name", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="Workspace description.", + nullable=True, + ) + _args_schema.title = AAZStrArg( + options=["--title"], + arg_group="Properties", + help="Workspace display name.", + fmt=AAZStrArgFormat( + max_length=50, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.WorkspacesGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.WorkspacesCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class WorkspacesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_workspace_read(cls._schema_on_200) + + return cls._schema_on_200 + + class WorkspacesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_workspace_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("title", AAZStrType, ".title", typ_kwargs={"flags": {"required": True}}) + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_workspace_read = None + + @classmethod + def _build_schema_workspace_read(cls, _schema): + if cls._schema_workspace_read is not None: + _schema.id = cls._schema_workspace_read.id + _schema.name = cls._schema_workspace_read.name + _schema.properties = cls._schema_workspace_read.properties + _schema.system_data = cls._schema_workspace_read.system_data + _schema.type = cls._schema_workspace_read.type + return + + cls._schema_workspace_read = _schema_workspace_read = AAZObjectType() + + workspace_read = _schema_workspace_read + workspace_read.id = AAZStrType( + flags={"read_only": True}, + ) + workspace_read.name = AAZStrType( + flags={"read_only": True}, + ) + workspace_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + workspace_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + workspace_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_workspace_read.properties + properties.description = AAZStrType() + properties.title = AAZStrType( + flags={"required": True}, + ) + + system_data = _schema_workspace_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.id = cls._schema_workspace_read.id + _schema.name = cls._schema_workspace_read.name + _schema.properties = cls._schema_workspace_read.properties + _schema.system_data = cls._schema_workspace_read.system_data + _schema.type = cls._schema_workspace_read.type + + +__all__ = ["Update"] diff --git a/src/apic-extension/azext_apic_extension/azext_metadata.json b/src/apic-extension/azext_apic_extension/azext_metadata.json new file mode 100644 index 00000000000..24862c32571 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.51.0" +} \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/commands.py b/src/apic-extension/azext_apic_extension/commands.py new file mode 100644 index 00000000000..b0d842e4993 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/commands.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +# from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): # pylint: disable=unused-argument + pass diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py new file mode 100644 index 00000000000..86df1e48ef5 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.log import get_logger + + +logger = get_logger(__name__) diff --git a/src/apic-extension/azext_apic_extension/tests/__init__.py b/src/apic-extension/azext_apic_extension/tests/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/apic-extension/azext_apic_extension/tests/latest/__init__.py b/src/apic-extension/azext_apic_extension/tests/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/latest/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py b/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py new file mode 100644 index 00000000000..a7a42cd669d --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from azure.cli.testsdk import * + + +class ApicExtensionScenario(ScenarioTest): + # TODO: add tests here + pass diff --git a/src/apic-extension/setup.cfg b/src/apic-extension/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/apic-extension/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/apic-extension/setup.py b/src/apic-extension/setup.py new file mode 100644 index 00000000000..01b070c19d8 --- /dev/null +++ b/src/apic-extension/setup.py @@ -0,0 +1,49 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from codecs import open +from setuptools import setup, find_packages + + +# HISTORY.rst entry. +VERSION = '1.0.0b1' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='apic-extension', + version=VERSION, + description='Microsoft Azure Command-Line Tools ApicExtension Extension.', + long_description=README + '\n\n' + HISTORY, + license='MIT', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/main/src/apic-extension', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + package_data={'azext_apic_extension': ['azext_metadata.json']}, + install_requires=DEPENDENCIES +) From f9b18938414983c8f8a503d8cf3d1601686d660e Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 6 Nov 2023 18:59:08 -0600 Subject: [PATCH 02/27] import export spec inline and remove version from examples --- .github/CODEOWNERS | 2 + .../latest/apic/api/definition/__init__.py | 2 + .../api/definition/_export_specification.py | 232 ++++++++++++++++ .../api/definition/_import_specification.py | 256 ++++++++++++++++++ .../aaz/latest/apic/api/definition/_list.py | 2 +- .../aaz/latest/apic/api/definition/_show.py | 2 +- .../aaz/latest/apic/service/__init__.py | 1 + .../apic/service/_export_metadata_schema.py | 196 ++++++++++++++ 8 files changed, 691 insertions(+), 2 deletions(-) create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_export_specification.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_export_metadata_schema.py diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9bc3f546ded..edb27aa84f8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -14,6 +14,8 @@ /src/subscription/ @wilcobmsft +/src/apic-extension/ @arpishahmsft + /src/alias/ @Juliehzl /src/managementpartner/ @jeffrey-ace diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/__init__.py index a6ed8b6688f..831005a1398 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/__init__.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/__init__.py @@ -11,7 +11,9 @@ from .__cmd_group import * from ._create import * from ._delete import * +from ._export_specification import * from ._head import * +from ._import_specification import * from ._list import * from ._show import * from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_export_specification.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_export_specification.py new file mode 100644 index 00000000000..1a465a8cdf7 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_export_specification.py @@ -0,0 +1,232 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api definition export-specification", +) +class ExportSpecification(AAZCommand): + """Exports the API specification. + + :example: Export Specification + az az apic api version definition export-specification -g api-center-test -s contosoeuap --api-name echo-api --version-name 2023-01-01 --definition-name default + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}/definitions/{}/exportspecification", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.definition_name = AAZStrArg( + options=["--name", "--definition", "--definition-name"], + help="The name of the API definition.", + required=True, + id_part="child_name_4", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--version", "--version-name"], + help="The name of the API version.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiDefinitionsExportSpecification(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ApiDefinitionsExportSpecification(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [202]: + return self.on_202(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/exportSpecification", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "definitionName", self.ctx.args.definition_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.format = AAZStrType() + _schema_on_200.value = AAZStrType() + + return cls._schema_on_200 + + def on_202(self, session): + pass + + +class _ExportSpecificationHelper: + """Helper class for ExportSpecification""" + + +__all__ = ["ExportSpecification"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py new file mode 100644 index 00000000000..33f5e06073e --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py @@ -0,0 +1,256 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic api definition import-specification", +) +class ImportSpecification(AAZCommand): + """Imports the API specification. + + :example: Import Sepecification + az az apic api definition import-specification -g api-center-test -s contosoeuap --api-name echo-api-2 --version-name 2023-08-01 --definition-name openapi3 --format "inline" --value '{"openapi":"3.0.1","info":{"title":"httpbin.org","description":"API Management facade for a very handy and free online HTTP tool.","version":"1.0"}}' --specification '{"name":"openapi","version":"3.0.0"}' + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/workspaces/{}/apis/{}/versions/{}/definitions/{}/importspecification", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.api_name = AAZStrArg( + options=["--api", "--api-name"], + help="The name of the API.", + required=True, + id_part="child_name_2", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.definition_name = AAZStrArg( + options=["--name", "--definition", "--definition-name"], + help="The name of the API definition.", + required=True, + id_part="child_name_4", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.version_name = AAZStrArg( + options=["--version", "--version-name"], + help="The name of the API version.", + required=True, + id_part="child_name_3", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + _args_schema.workspace_name = AAZStrArg( + options=["-w", "--workspace", "--workspace-name"], + help="The name of the workspace.", + required=True, + id_part="child_name_1", + default="default", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Payload" + + _args_schema = cls._args_schema + _args_schema.format = AAZStrArg( + options=["--format"], + arg_group="Payload", + help="Format of the API specification source.", + enum={"inline": "inline", "link": "link"}, + ) + _args_schema.specification = AAZObjectArg( + options=["--specification"], + arg_group="Payload", + help="API specification details.", + ) + _args_schema.value = AAZStrArg( + options=["--value"], + arg_group="Payload", + help="Value of the API specification source.", + ) + + specification = cls._args_schema.specification + specification.name = AAZStrArg( + options=["name"], + help="Specification name.", + ) + specification.version = AAZStrArg( + options=["version"], + help="Specification version.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ApiDefinitionsImportSpecification(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ApiDefinitionsImportSpecification(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [202]: + return self.on_202(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/importSpecification", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "apiName", self.ctx.args.api_name, + required=True, + ), + **self.serialize_url_param( + "definitionName", self.ctx.args.definition_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "versionName", self.ctx.args.version_name, + required=True, + ), + **self.serialize_url_param( + "workspaceName", self.ctx.args.workspace_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("format", AAZStrType, ".format") + _builder.set_prop("specification", AAZObjectType, ".specification") + _builder.set_prop("value", AAZStrType, ".value") + + specification = _builder.get(".specification") + if specification is not None: + specification.set_prop("name", AAZStrType, ".name") + specification.set_prop("version", AAZStrType, ".version") + + return self.serialize_content(_content_value) + + def on_200(self, session): + pass + + def on_202(self, session): + pass + + +class _ImportSpecificationHelper: + """Helper class for ImportSpecification""" + + +__all__ = ["ImportSpecification"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_list.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_list.py index f49a56e5e15..5d1740729b3 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_list.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_list.py @@ -18,7 +18,7 @@ class List(AAZCommand): """List a collection of API definitions. :example: List API definitions - az apic api version definition list -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 + az apic api definition list -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 """ _aaz_info = { diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_show.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_show.py index a181bf06a30..41b9ac3cd4d 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_show.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_show.py @@ -18,7 +18,7 @@ class Show(AAZCommand): """Get details of the API definition. :example: Show API definition details - az apic api version definition show -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi" + az apic api definition show -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi" """ _aaz_info = { diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py index c401f439385..53d581db00d 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py @@ -11,6 +11,7 @@ from .__cmd_group import * from ._create import * from ._delete import * +from ._export_metadata_schema import * from ._list import * from ._show import * from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_export_metadata_schema.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_export_metadata_schema.py new file mode 100644 index 00000000000..f4844f85ba0 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_export_metadata_schema.py @@ -0,0 +1,196 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic service export-metadata-schema", +) +class ExportMetadataSchema(AAZCommand): + """Exports the effective metadata schema. + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/exportmetadataschema", "2024-03-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["-s", "--name", "--service", "--service-name"], + help="The name of the API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Payload" + + _args_schema = cls._args_schema + _args_schema.assigned_to = AAZStrArg( + options=["--assigned-to"], + arg_group="Payload", + help="An entity the metadata schema is requested for.", + enum={"api": "api", "deployment": "deployment", "environment": "environment"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ServicesExportMetadataSchema(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ServicesExportMetadataSchema(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [202]: + return self.on_202(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/exportMetadataSchema", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("assignedTo", AAZStrType, ".assigned_to") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.format = AAZStrType() + _schema_on_200.value = AAZStrType() + + return cls._schema_on_200 + + def on_202(self, session): + pass + + +class _ExportMetadataSchemaHelper: + """Helper class for ExportMetadataSchema""" + + +__all__ = ["ExportMetadataSchema"] From 8d872cdd16401f46c0a5467e14e0be44aedff50f Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 6 Nov 2023 22:45:31 -0600 Subject: [PATCH 03/27] import export spec - remove redundant az --- .../aaz/latest/apic/api/definition/_export_specification.py | 2 +- .../aaz/latest/apic/api/definition/_import_specification.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_export_specification.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_export_specification.py index 1a465a8cdf7..772b2652459 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_export_specification.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_export_specification.py @@ -18,7 +18,7 @@ class ExportSpecification(AAZCommand): """Exports the API specification. :example: Export Specification - az az apic api version definition export-specification -g api-center-test -s contosoeuap --api-name echo-api --version-name 2023-01-01 --definition-name default + az apic api version definition export-specification -g api-center-test -s contosoeuap --api-name echo-api --version-name 2023-01-01 --definition-name default """ _aaz_info = { diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py index 33f5e06073e..397747384ad 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py @@ -18,7 +18,7 @@ class ImportSpecification(AAZCommand): """Imports the API specification. :example: Import Sepecification - az az apic api definition import-specification -g api-center-test -s contosoeuap --api-name echo-api-2 --version-name 2023-08-01 --definition-name openapi3 --format "inline" --value '{"openapi":"3.0.1","info":{"title":"httpbin.org","description":"API Management facade for a very handy and free online HTTP tool.","version":"1.0"}}' --specification '{"name":"openapi","version":"3.0.0"}' + az apic api definition import-specification -g api-center-test -s contosoeuap --api-name echo-api-2 --version-name 2023-08-01 --definition-name openapi3 --format "inline" --value '{"openapi":"3.0.1","info":{"title":"httpbin.org","description":"API Management facade for a very handy and free online HTTP tool.","version":"1.0"}}' --specification '{"name":"openapi","version":"3.0.0"}' """ _aaz_info = { From 599a6be32b5a5104e8410f81a2f99356952729a9 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Tue, 7 Nov 2023 12:52:05 -0600 Subject: [PATCH 04/27] auto lro poller and check import spec size for inlne option via command line or file --- .../api/definition/_export_specification.py | 30 +++++++---- .../api/definition/_import_specification.py | 31 +++++++---- .../apic/service/_export_metadata_schema.py | 30 +++++++---- .../azext_apic_extension/commands.py | 6 ++- .../azext_apic_extension/custom.py | 53 +++++++++++++++++++ 5 files changed, 120 insertions(+), 30 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_export_specification.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_export_specification.py index 772b2652459..b738c8cf9f0 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_export_specification.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_export_specification.py @@ -28,10 +28,11 @@ class ExportSpecification(AAZCommand): ] } + AZ_SUPPORT_NO_WAIT = True + def _handler(self, command_args): super()._handler(command_args) - self._execute_operations() - return self._output() + return self.build_lro_poller(self._execute_operations, self._output) _args_schema = None @@ -102,7 +103,7 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - self.ApiDefinitionsExportSpecification(ctx=self.ctx)() + yield self.ApiDefinitionsExportSpecification(ctx=self.ctx)() self.post_operations() @register_callback @@ -123,10 +124,24 @@ class ApiDefinitionsExportSpecification(AAZHttpOperation): def __call__(self, *args, **kwargs): request = self.make_request() session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) if session.http_response.status_code in [202]: - return self.on_202(session) + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) return self.on_error(session.http_response) @@ -221,9 +236,6 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - def on_202(self, session): - pass - class _ExportSpecificationHelper: """Helper class for ExportSpecification""" diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py index 397747384ad..2598dca6683 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py @@ -28,10 +28,11 @@ class ImportSpecification(AAZCommand): ] } + AZ_SUPPORT_NO_WAIT = True + def _handler(self, command_args): super()._handler(command_args) - self._execute_operations() - return None + return self.build_lro_poller(self._execute_operations, None) _args_schema = None @@ -132,7 +133,7 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - self.ApiDefinitionsImportSpecification(ctx=self.ctx)() + yield self.ApiDefinitionsImportSpecification(ctx=self.ctx)() self.post_operations() @register_callback @@ -149,10 +150,24 @@ class ApiDefinitionsImportSpecification(AAZHttpOperation): def __call__(self, *args, **kwargs): request = self.make_request() session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) if session.http_response.status_code in [202]: - return self.on_202(session) + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) return self.on_error(session.http_response) @@ -245,10 +260,6 @@ def content(self): def on_200(self, session): pass - def on_202(self, session): - pass - - class _ImportSpecificationHelper: """Helper class for ImportSpecification""" diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_export_metadata_schema.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_export_metadata_schema.py index f4844f85ba0..89c514b2b4b 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_export_metadata_schema.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_export_metadata_schema.py @@ -25,10 +25,11 @@ class ExportMetadataSchema(AAZCommand): ] } + AZ_SUPPORT_NO_WAIT = True + def _handler(self, command_args): super()._handler(command_args) - self._execute_operations() - return self._output() + return self.build_lro_poller(self._execute_operations, self._output) _args_schema = None @@ -68,7 +69,7 @@ def _build_arguments_schema(cls, *args, **kwargs): def _execute_operations(self): self.pre_operations() - self.ServicesExportMetadataSchema(ctx=self.ctx)() + yield self.ServicesExportMetadataSchema(ctx=self.ctx)() self.post_operations() @register_callback @@ -89,10 +90,24 @@ class ServicesExportMetadataSchema(AAZHttpOperation): def __call__(self, *args, **kwargs): request = self.make_request() session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [200]: - return self.on_200(session) if session.http_response.status_code in [202]: - return self.on_202(session) + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) return self.on_error(session.http_response) @@ -185,9 +200,6 @@ def _build_schema_on_200(cls): return cls._schema_on_200 - def on_202(self, session): - pass - class _ExportMetadataSchemaHelper: """Helper class for ExportMetadataSchema""" diff --git a/src/apic-extension/azext_apic_extension/commands.py b/src/apic-extension/azext_apic_extension/commands.py index b0d842e4993..fcedbf56e25 100644 --- a/src/apic-extension/azext_apic_extension/commands.py +++ b/src/apic-extension/azext_apic_extension/commands.py @@ -9,7 +9,9 @@ # pylint: disable=too-many-statements # from azure.cli.core.commands import CliCommandType - +from .custom import ImportSpecificationExtension def load_command_table(self, _): # pylint: disable=unused-argument - pass + with self.command_group('apic api definition') as g: + self.command_table['apic api definition import-specification'] = ImportSpecificationExtension(loader=self) + diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index 86df1e48ef5..273fb0bde37 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -10,5 +10,58 @@ from knack.log import get_logger +from .aaz.latest.apic.api.definition import ImportSpecification +from azure.cli.core.aaz import has_value, AAZStrArg +import json +import sys logger = get_logger(__name__) + +class ImportSpecificationExtension(ImportSpecification): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.source_profile = AAZStrArg( + options=["--file-name"], + help='Name of the file from where to import the spec from.', + required=False, + registered=True + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + + # check size of the spec for inline format and raise error if size is greater than 3 mb + self.checkSpecSizeOrRaiseError(args) + + + def checkSpecSizeOrRaiseError(self, args): + data = None + value = None + format = None + + # Load the JSON file + if args.source_profile: + with open(str(args.source_profile)) as f: + data = json.load(f) + + if data: + # Extract the 'value', 'format', and 'specification' fields + value = data.get('value') + format = data.get('format') + + # If any of the fields are None, get them from self.args + if value is None: + value = args.value + if format is None: + format = args.format + + # Check the size of 'value' if format is inline and raise error if value is greater than 3 mb + if format == 'inline': + value_size_bytes = sys.getsizeof(value) + value_size_mb = value_size_bytes / (1024 * 1024) # Convert bytes to megabytes + if value_size_mb > 3: + raise ValueError('The size of "value" is greater than 3 MB. Please use --format "url" to import the specification from a URL for size greater than 3 mb.') + From 0544d1f6206e34b661a0c4f337a679bd69016717 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Wed, 8 Nov 2023 16:29:30 -0600 Subject: [PATCH 05/27] import export spec using a json file, link to json and commandline --- .../azext_apic_extension/commands.py | 3 +- .../azext_apic_extension/custom.py | 81 ++++++++++++++----- 2 files changed, 65 insertions(+), 19 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/commands.py b/src/apic-extension/azext_apic_extension/commands.py index fcedbf56e25..568d991bb8a 100644 --- a/src/apic-extension/azext_apic_extension/commands.py +++ b/src/apic-extension/azext_apic_extension/commands.py @@ -10,8 +10,9 @@ # from azure.cli.core.commands import CliCommandType from .custom import ImportSpecificationExtension +from .custom import ExportSpecificationExtension def load_command_table(self, _): # pylint: disable=unused-argument with self.command_group('apic api definition') as g: self.command_table['apic api definition import-specification'] = ImportSpecificationExtension(loader=self) - + self.command_table['apic api definition export-specification'] = ExportSpecificationExtension(loader=self) \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index 273fb0bde37..a120b0183d0 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -11,9 +11,12 @@ from knack.log import get_logger from .aaz.latest.apic.api.definition import ImportSpecification +from .aaz.latest.apic.api.definition import ExportSpecification from azure.cli.core.aaz import has_value, AAZStrArg import json import sys +import requests +import os logger = get_logger(__name__) @@ -32,36 +35,78 @@ def _build_arguments_schema(cls, *args, **kwargs): def pre_operations(self): args = self.ctx.args - - # check size of the spec for inline format and raise error if size is greater than 3 mb - self.checkSpecSizeOrRaiseError(args) - - - def checkSpecSizeOrRaiseError(self, args): + data = None value = None - format = None # Load the JSON file if args.source_profile: with open(str(args.source_profile)) as f: data = json.load(f) - - if data: - # Extract the 'value', 'format', and 'specification' fields - value = data.get('value') - format = data.get('format') - + if data: + value = json.dumps(data) + # If any of the fields are None, get them from self.args if value is None: value = args.value - if format is None: - format = args.format + + # Reassign the values to self.args + args.value = value # Check the size of 'value' if format is inline and raise error if value is greater than 3 mb - if format == 'inline': - value_size_bytes = sys.getsizeof(value) + if args.format == 'inline': + value_size_bytes = sys.getsizeof(args.value) value_size_mb = value_size_bytes / (1024 * 1024) # Convert bytes to megabytes if value_size_mb > 3: - raise ValueError('The size of "value" is greater than 3 MB. Please use --format "url" to import the specification from a URL for size greater than 3 mb.') + logger.error('The size of "value" is greater than 3 MB. Please use --format "url" to import the specification from a URL for size greater than 3 mb.') + +class ExportSpecificationExtension(ExportSpecification): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.source_profile = AAZStrArg( + options=["--file-name"], + help='Name of the file where to export the spec to.', + required=True, + registered=True + ) + return args_schema + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + + arguments = self.ctx.args + + if result: + response_format = result['format'] + exportedResults = result['value'] + + # if response_format == 'link': + # TODO: make a get call and save the result to filename + #check the status code and see content response + # set the value to exportedResults + + # getReponse = requests.get(exportedResults) + # if getReponse.status_code == 200: + # exportedResults = getReponse.content + # else: + # logger.error('Error while fetching the results from the link. Status code: %s', getReponse.status_code) + + if arguments.source_profile: + self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) + print('Results exported to', arguments.source_profile) + else: + logger.error('Please provide the --file-name to exports the results to.') + else: + logger.error('No results found.') + def writeResultsToFile(self, results, file_name): + if file_name: + with open(file_name, 'w') as f: + if os.path.splitext(file_name)[1] == '.json': + if isinstance(results, str): + results = json.loads(results) + json.dump(results, f, indent=None, separators=(',', ':')) + else: + f.write(results) From 2ef6c9e3442d540313d3421d21540ec4ca99d2ae Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Fri, 10 Nov 2023 14:38:31 -0600 Subject: [PATCH 06/27] import json with any encdoing, auto indent json on export --- src/apic-extension/azext_apic_extension/custom.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index a120b0183d0..f6f83a2bcaa 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -17,6 +17,7 @@ import sys import requests import os +import chardet logger = get_logger(__name__) @@ -41,7 +42,11 @@ def pre_operations(self): # Load the JSON file if args.source_profile: - with open(str(args.source_profile)) as f: + rawdata = open(str(args.source_profile), 'rb').read() + result = chardet.detect(rawdata) + encoding = result['encoding'] + + with open(str(args.source_profile), 'r', encoding=encoding) as f: data = json.load(f) if data: value = json.dumps(data) @@ -107,6 +112,6 @@ def writeResultsToFile(self, results, file_name): if os.path.splitext(file_name)[1] == '.json': if isinstance(results, str): results = json.loads(results) - json.dump(results, f, indent=None, separators=(',', ':')) + json.dump(results, f, indent=4, separators=(',', ':')) else: f.write(results) From 6569552a94311d43c28dcf40866b55d26e5bbd41 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Tue, 14 Nov 2023 17:16:27 -0600 Subject: [PATCH 07/27] quick add working, not apim import --- .../azext_apic_extension/_params.py | 27 +- .../api/definition/_import_specification.py | 4 + .../aaz/latest/apic/service/__init__.py | 1 + .../latest/apic/service/_import_from_apim.py | 186 ++++++++++++++ .../azext_apic_extension/commands.py | 5 +- .../azext_apic_extension/custom.py | 242 +++++++++++++++++- 6 files changed, 462 insertions(+), 3 deletions(-) create mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_import_from_apim.py diff --git a/src/apic-extension/azext_apic_extension/_params.py b/src/apic-extension/azext_apic_extension/_params.py index cfcec717c9c..bd17eb7061c 100644 --- a/src/apic-extension/azext_apic_extension/_params.py +++ b/src/apic-extension/azext_apic_extension/_params.py @@ -10,4 +10,29 @@ def load_arguments(self, _): # pylint: disable=unused-argument - pass + + with self.argument_context("apic service register") as c: + c.argument( + "api_location", + options_list=['--api-location', '-l'], + help="Specification file", + required=True, + ), + c.argument( + "resource_group", + options_list=['--resource-group', '-g'], + help="Resource group name", + required=True, + ), + c.argument( + "service_name", + options_list=['--service', '-s'], + help="Service name", + required=True, + ), + c.argument( + "environment_name", + options_list=['--environment-name', '-e'], + help="Environemnt name", + required=False, + ) \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py index 2598dca6683..943e3258a3a 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_import_specification.py @@ -19,6 +19,9 @@ class ImportSpecification(AAZCommand): :example: Import Sepecification az apic api definition import-specification -g api-center-test -s contosoeuap --api-name echo-api-2 --version-name 2023-08-01 --definition-name openapi3 --format "inline" --value '{"openapi":"3.0.1","info":{"title":"httpbin.org","description":"API Management facade for a very handy and free online HTTP tool.","version":"1.0"}}' --specification '{"name":"openapi","version":"3.0.0"}' + + :example: Import Specification from a file + az apic api definition import-specification -g api-center-test -s contosoeuap --api-name echo-api-2 --version-name 2023-11-01 --definition-name openapi8 --format "link" --value 'https://alzaslonaztest.blob.core.windows.net/arpitestblobs/importspec4.txt' --specification '{"name":"openapi","version":"3.0.0"}' """ _aaz_info = { @@ -260,6 +263,7 @@ def content(self): def on_200(self, session): pass + class _ImportSpecificationHelper: """Helper class for ImportSpecification""" diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py index 53d581db00d..c64660ad5e1 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py @@ -12,6 +12,7 @@ from ._create import * from ._delete import * from ._export_metadata_schema import * +from ._import_from_apim import * from ._list import * from ._show import * from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_import_from_apim.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_import_from_apim.py new file mode 100644 index 00000000000..14fa49c2a63 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_import_from_apim.py @@ -0,0 +1,186 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "apic service import-from-apim", +) +class ImportFromApim(AAZCommand): + """Imports from APIM instance. + """ + + _aaz_info = { + "version": "2024-03-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/importfromapim", "2024-03-01"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.service_name = AAZStrArg( + options=["--service-name"], + help="The name of Azure API Center service.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + max_length=90, + min_length=1, + ), + ) + + # define Arg Group "Payload" + + _args_schema = cls._args_schema + _args_schema.source_resource_ids = AAZListArg( + options=["--source-resource-ids"], + arg_group="Payload", + ) + + source_resource_ids = cls._args_schema.source_resource_ids + source_resource_ids.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ImportFromAPIM(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ImportFromAPIM(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/importFromApim", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "serviceName", self.ctx.args.service_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2024-03-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("sourceResourceIds", AAZListType, ".source_resource_ids") + + source_resource_ids = _builder.get(".sourceResourceIds") + if source_resource_ids is not None: + source_resource_ids.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + pass + + +class _ImportFromApimHelper: + """Helper class for ImportFromApim""" + + +__all__ = ["ImportFromApim"] diff --git a/src/apic-extension/azext_apic_extension/commands.py b/src/apic-extension/azext_apic_extension/commands.py index 568d991bb8a..b7572904cfa 100644 --- a/src/apic-extension/azext_apic_extension/commands.py +++ b/src/apic-extension/azext_apic_extension/commands.py @@ -15,4 +15,7 @@ def load_command_table(self, _): # pylint: disable=unused-argument with self.command_group('apic api definition') as g: self.command_table['apic api definition import-specification'] = ImportSpecificationExtension(loader=self) - self.command_table['apic api definition export-specification'] = ExportSpecificationExtension(loader=self) \ No newline at end of file + self.command_table['apic api definition export-specification'] = ExportSpecificationExtension(loader=self) + + with self.command_group('apic service') as g: + g.custom_command("register", "register_apic") \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index f6f83a2bcaa..88a2ba3740e 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -12,13 +12,16 @@ from .aaz.latest.apic.api.definition import ImportSpecification from .aaz.latest.apic.api.definition import ExportSpecification -from azure.cli.core.aaz import has_value, AAZStrArg + +from azure.cli.core.aaz import * +from urllib.parse import urlparse, urlunparse import json import sys import requests import os import chardet + logger = get_logger(__name__) class ImportSpecificationExtension(ImportSpecification): @@ -115,3 +118,240 @@ def writeResultsToFile(self, results, file_name): json.dump(results, f, indent=4, separators=(',', ':')) else: f.write(results) + +def register_apic(cmd, api_location, resource_group, service_name, environment_name=None): + + # Load the JSON file + if api_location: + + #TODO Confirm its a file and not link + + rawdata = open(str(api_location), 'rb').read() + result = chardet.detect(rawdata) + encoding = result['encoding'] + + with open(str(api_location), 'r', encoding=encoding) as f: + data = json.load(f) + if data: + value = json.dumps(data) + + # If we could not read the file, return error + if value is None: + logger.error('Could not load json file') + return + + value_dict = json.loads(value) + + # Check if the first field is 'swagger', 'openapi', or something else and get the definition name and version + first_key, first_value = list(data.items())[0] + if first_key in ['swagger', 'openapi']: + extracted_definition_name = 'openapi' + extracted_definition_version = first_value.replace(".", "-").lower() + extracted_api_kind = 'rest' #TODO + else: + extracted_definition_name = 'default' + extracted_definition_version = 'v1' + extracted_api_kind = 'rest' + #TODO how to determine other kinds - enum={"graphql": "graphql", "grpc": "grpc", "rest": "rest", "soap": "soap", "webhook": "webhook", "websocket": "websocket"} + + # Create API and Create API Version + info = data['info'] + if info: + # Create API and Create API Version + extracted_api_name = info.get('title', 'Default API').replace(" ", "-").lower() + extracted_api_description = info.get('description', 'API Description') + extracted_api_summary = info.get('summary', extracted_api_description) + extracted_api_title = info.get('title', 'API Title').replace(" ", "-").lower() + extracted_api_version = info.get('version', 'v1').replace(".", "-").lower() + extracted_api_version_title = info.get('version', 'v1').replace(".", "-").lower() + #TODO - Create API Version lifecycle_stage. Ask Alex about this + + # Create API - Get the contact details from info in spec + contact = info.get('contact') + if contact: + extracted_api_contact_email = contact.get('email') + extracted_api_contact_name = contact.get('name') + extracted_api_contact_url = contact.get('url') + contacts = [{'email': extracted_api_contact_email, 'name': extracted_api_contact_name, 'url': extracted_api_contact_url}] + else: + contacts = None + + # Create API - Get the license details from info in spec + license = info.get('license') + if license: + extracted_api_license_identifier = license.get('identifier') + extracted_api_license_name = license.get('name') + extracted_api_license_url = license.get('url') + extracted_api_license = {'identifier': extracted_api_license_identifier, 'name': extracted_api_license_name, 'url': extracted_api_license_url} + else: + extracted_api_license = None + + # Create API - Get the terms of service from info in spec + extracted_api_terms_of_service_value = info.get('termsOfService') + if extracted_api_terms_of_service_value: + extracted_api_terms_of_service = {'url': extracted_api_terms_of_service_value} + else: + extracted_api_terms_of_service = {'url': None} + + # Create API - Get the external documentation from info in spec + extracted_api_external_documentation = None + external_documentation = info.get('externalDocumentation') + if external_documentation: + extracted_api_external_documentation_description = external_documentation.get('description') + extracted_api_external_documentation_title = external_documentation.get('title') + extracted_api_external_documentation_url = external_documentation.get('url') + extracted_api_external_documentation = {'description': extracted_api_external_documentation_description, 'title': extracted_api_external_documentation_title, 'url': extracted_api_external_documentation_url} + else: + extracted_api_external_documentation = None + + #TODO: Create API - custom-properties + # - "The custom metadata defined for API catalog entities. #1 + #Ask Alex about this + + + # Create API ------------------------------------------------------------------------------------- + + from .aaz.latest.apic.api import Create as CreateAPI + + api_args = { + 'api_name': extracted_api_name, + 'resource_group': resource_group, + 'service_name': service_name, + 'workspace_name': 'default', + 'title' : extracted_api_title, + 'summary': extracted_api_summary, + 'kind': extracted_api_kind, + 'contacts': contacts, + 'license': extracted_api_license, + 'terms_of_service': extracted_api_terms_of_service, + 'external_documentation': extracted_api_external_documentation, + 'description': extracted_api_description, + } + createAPIResults = CreateAPI(cli_ctx=cmd.cli_ctx)(command_args=api_args) + print("API was created successfully") + + + + + # Create API Version ----------------------------------------------------------------------------- + + from .aaz.latest.apic.api.version import Create as CreateAPIVersion + + api_version_args = { + 'api_name': extracted_api_name, + 'resource_group': resource_group, + 'service_name': service_name, + 'version_name': extracted_api_version, + 'workspace_name': 'default', + 'lifecycle_stage': 'design', #TODO: Extract from spec or not pass. was it required? + 'title' : extracted_api_version_title + } + + createAPIVersionResults = CreateAPIVersion(cli_ctx=cmd.cli_ctx)(command_args=api_version_args) + print("API version was created successfully") + + + + + # Create API Definition ----------------------------------------------------------------------------- + + from .aaz.latest.apic.api.definition import Create as CreateAPIDefinition + + api_definition_args = { + 'api_name': extracted_api_name, + 'resource_group': resource_group, + 'service_name': service_name, + 'version_name': extracted_api_version, + 'workspace_name': 'default', + 'definition_name': extracted_definition_name, + 'title' : extracted_definition_name, #TODO Extract from spec + 'description' : extracted_api_description, #TODO Extract from spec + } + + createAPIDefinitionResults = CreateAPIDefinition(cli_ctx=cmd.cli_ctx)(command_args=api_definition_args) + print("API definition was created successfully") + + + + # Import Specification ----------------------------------------------------------------------------- + + from azure.cli.core.commands import LongRunningOperation + + # uses customized ImportSpecificationExtension class + specification_details = {'name':extracted_definition_name,'version':extracted_definition_version} + format = 'inline' + #TODO format - Link - what if the link is just pasted in the value? + #TODO format - inline - what if spec is just pasted in the value? + #TODO - other non json spec formats + + api_specification_args = { + 'resource_group': resource_group, + 'service_name': service_name, + 'workspace_name': 'default', + 'api_name': extracted_api_name, + 'version_name': extracted_api_version, + 'definition_name': extracted_definition_name, + 'format': 'inline', + 'specification': specification_details, #TODO write the correct spec object + 'source_profile' : api_location + } + + importAPISpecificationResults = ImportSpecificationExtension(cli_ctx=cmd.cli_ctx)(command_args=api_specification_args) + importAPISpecificationResults_Polled = LongRunningOperation(cmd.cli_ctx)(importAPISpecificationResults) + print("API specification was imported successfully") + + + # Create API Deployment ----------------------------------------------------------------------------- + + from .aaz.latest.apic.api.deployment import Create as CreateAPIDeployment + from .aaz.latest.apic.environment import Show as GetEnvironment + from datetime import datetime + + if environment_name: + # GET Environment ID + + environment_args = { + 'resource_group': resource_group, + 'service_name': service_name, + 'workspace_name': 'default', + 'environment_name': environment_name + } + + getEnvironmentResults = GetEnvironment(cli_ctx=cmd.cli_ctx)(command_args=environment_args) + environment_id = getEnvironmentResults['id'] + # full envId, extract actual envId if to be used later + + servers = data.get('servers') + if environment_id and servers: + for server in servers: + + default_deployment_title = (extracted_api_name + "deployment").replace("-", "") + extracted_deployment_name = server.get('name', default_deployment_title).replace(" ", "-") + extracted_deployment_title = server.get('title', default_deployment_title).replace(" ", "-") + extracted_deployment_description = server.get('description', default_deployment_title) + extracted_definition_id = '/workspaces/default/apis/'+ extracted_api_name +'/versions/'+ extracted_api_version +'/definitions/'+ extracted_definition_name + extracted_environment_id = '/workspaces/default/environments/' + environment_name + extracted_state = server.get('state', 'active') + + extracted_server_urls = [] + extracted_server_url = server.get('url') + extracted_server_urls.append(extracted_server_url) + extracted_server = {'runtime_uri': extracted_server_urls} + + api_deployment_args = { + 'resource_group': resource_group, + 'service_name': service_name, + 'workspace_name': 'default', + 'api_name': extracted_api_name, + 'deployment_name' : extracted_deployment_name, + 'description' : extracted_deployment_description, + 'title' : extracted_deployment_title, + 'definition_id': extracted_definition_id, + 'environment_id': extracted_environment_id, + 'server' : extracted_server, + 'state' : extracted_state + # TODO custom properties + } + + createAPIDeploymentResults = CreateAPIDeployment(cli_ctx=cmd.cli_ctx)(command_args=api_deployment_args) + print("API deployment was created successfully") \ No newline at end of file From b109ecce8a5dd29d94f7b4f45e2789136f0f7bc9 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Wed, 15 Nov 2023 16:11:58 -0600 Subject: [PATCH 08/27] quick add - fix envId bug --- src/apic-extension/azext_apic_extension/custom.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index 88a2ba3740e..f6d68ff229c 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -307,6 +307,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n from .aaz.latest.apic.environment import Show as GetEnvironment from datetime import datetime + environment_id = None if environment_name: # GET Environment ID From 4401bda88201594e420dacd9eb14b6e4137dff74 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 20 Nov 2023 15:02:49 -0600 Subject: [PATCH 09/27] export metadata schema to a file customized --- .../latest/apic/metadata_schema/__init__.py | 1 + .../_export_metadata_schema.py | 2 +- .../aaz/latest/apic/service/__init__.py | 1 - .../azext_apic_extension/commands.py | 6 + .../azext_apic_extension/custom.py | 125 +++++++++++++++--- 5 files changed, 117 insertions(+), 18 deletions(-) rename src/apic-extension/azext_apic_extension/aaz/latest/apic/{service => metadata_schema}/_export_metadata_schema.py (99%) diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/__init__.py index a6ed8b6688f..6d0e5820c01 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/__init__.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/__init__.py @@ -11,6 +11,7 @@ from .__cmd_group import * from ._create import * from ._delete import * +from ._export_metadata_schema import * from ._head import * from ._list import * from ._show import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_export_metadata_schema.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_export_metadata_schema.py similarity index 99% rename from src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_export_metadata_schema.py rename to src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_export_metadata_schema.py index 89c514b2b4b..d1d170679e6 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_export_metadata_schema.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_export_metadata_schema.py @@ -12,7 +12,7 @@ @register_command( - "apic service export-metadata-schema", + "apic metadata-schema export-metadata-schema", ) class ExportMetadataSchema(AAZCommand): """Exports the effective metadata schema. diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py index c64660ad5e1..7c7b1c75784 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py @@ -11,7 +11,6 @@ from .__cmd_group import * from ._create import * from ._delete import * -from ._export_metadata_schema import * from ._import_from_apim import * from ._list import * from ._show import * diff --git a/src/apic-extension/azext_apic_extension/commands.py b/src/apic-extension/azext_apic_extension/commands.py index b7572904cfa..6bef82cd521 100644 --- a/src/apic-extension/azext_apic_extension/commands.py +++ b/src/apic-extension/azext_apic_extension/commands.py @@ -11,11 +11,17 @@ # from azure.cli.core.commands import CliCommandType from .custom import ImportSpecificationExtension from .custom import ExportSpecificationExtension +from .custom import ExportMetadataSchemaExtension +from .custom import CreateMetadataSchemaExtension def load_command_table(self, _): # pylint: disable=unused-argument with self.command_group('apic api definition') as g: self.command_table['apic api definition import-specification'] = ImportSpecificationExtension(loader=self) self.command_table['apic api definition export-specification'] = ExportSpecificationExtension(loader=self) + + with self.command_group('apic metadata-schema') as g: + self.command_table['apic metadata-schema create'] = CreateMetadataSchemaExtension(loader=self) + self.command_table['apic metadata-schema export-metadata-schema'] = ExportMetadataSchemaExtension(loader=self) with self.command_group('apic service') as g: g.custom_command("register", "register_apic") \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index f6d68ff229c..d944d0f1f27 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -12,6 +12,8 @@ from .aaz.latest.apic.api.definition import ImportSpecification from .aaz.latest.apic.api.definition import ExportSpecification +from .aaz.latest.apic.metadata_schema import Create +from .aaz.latest.apic.metadata_schema import ExportMetadataSchema from azure.cli.core.aaz import * from urllib.parse import urlparse, urlunparse @@ -83,27 +85,119 @@ def _build_arguments_schema(cls, *args, **kwargs): def _output(self, *args, **kwargs): result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - arguments = self.ctx.args if result: + print('Results found. Exporting to', arguments.source_profile) + response_format = result['format'] exportedResults = result['value'] + + if response_format == 'link': + print('Fetching specification from:', exportedResults) + getReponse = requests.get(exportedResults) + if getReponse.status_code == 200: + exportedResults = getReponse.content.decode() + else: + logger.error('Error while fetching the results from the link. Status code: %s', getReponse.status_code) + + if arguments.source_profile: + try: + self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) + print('Results exported to', arguments.source_profile) + except Exception as e: + logger.error('Error while writing the results to the file. Error: %s', e) + else: + logger.error('Please provide the --file-name to exports the results to.') + else: + logger.error('No results found.') + + def writeResultsToFile(self, results, file_name): + if file_name: + with open(file_name, 'w') as f: + if os.path.splitext(file_name)[1] == '.json': + if isinstance(results, str): + results = json.loads(results) + json.dump(results, f, indent=4, separators=(',', ':')) + else: + f.write(results) + +class CreateMetadataSchemaExtension(Create): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.source_profile = AAZStrArg( + options=["--file-name"], + help='Name of the file from that contains the metadata schema.', + required=False, + registered=True + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + + data = None + value = args.schema + + # Load the JSON file + if args.source_profile: + rawdata = open(str(args.source_profile), 'rb').read() + result = chardet.detect(rawdata) + encoding = result['encoding'] + + if os.stat(str(args.source_profile)).st_size == 0: + raise ValueError('Metadtata schema file is empty. Please provide a valid metadata schema file.') + + with open(str(args.source_profile), 'r', encoding=encoding) as f: + data = json.load(f) + if data: + value = json.dumps(data) + + # If any of the fields are None, get them from self.args + if value is None: + logger.error('Please provide the schema to create the metadata schema through --schema option or through --file-name option via a file.') - # if response_format == 'link': - # TODO: make a get call and save the result to filename - #check the status code and see content response - # set the value to exportedResults + # Reassign the values to self.args + self.ctx.args.schema = value - # getReponse = requests.get(exportedResults) - # if getReponse.status_code == 200: - # exportedResults = getReponse.content - # else: - # logger.error('Error while fetching the results from the link. Status code: %s', getReponse.status_code) +class ExportMetadataSchemaExtension(ExportMetadataSchema): + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.source_profile = AAZStrArg( + options=["--file-name"], + help='Name of the file where to export the metadata schema to.', + required=True, + registered=True + ) + return args_schema + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + arguments = self.ctx.args + + if result: + print('Results found. Exporting to', arguments.source_profile) + + response_format = result['format'] + exportedResults = result['value'] + + if response_format == 'link': + print('Fetching metadata from:', exportedResults) + getReponse = requests.get(exportedResults) + if getReponse.status_code == 200: + exportedResults = getReponse.content.decode() + else: + logger.error('Error while fetching the results from the link. Status code: %s', getReponse.status_code) if arguments.source_profile: - self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) - print('Results exported to', arguments.source_profile) + try: + self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) + print('Results exported to', arguments.source_profile) + except Exception as e: + logger.error('Error while writing the results to the file. Error: %s', e) else: logger.error('Please provide the --file-name to exports the results to.') else: @@ -119,6 +213,7 @@ def writeResultsToFile(self, results, file_name): else: f.write(results) +# Quick Import def register_apic(cmd, api_location, resource_group, service_name, environment_name=None): # Load the JSON file @@ -130,6 +225,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n result = chardet.detect(rawdata) encoding = result['encoding'] + # TODO - read other file types later with open(str(api_location), 'r', encoding=encoding) as f: data = json.load(f) if data: @@ -164,7 +260,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n extracted_api_title = info.get('title', 'API Title').replace(" ", "-").lower() extracted_api_version = info.get('version', 'v1').replace(".", "-").lower() extracted_api_version_title = info.get('version', 'v1').replace(".", "-").lower() - #TODO - Create API Version lifecycle_stage. Ask Alex about this + #TODO -Create API Version lifecycle_stage # Create API - Get the contact details from info in spec contact = info.get('contact') @@ -206,7 +302,6 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n #TODO: Create API - custom-properties # - "The custom metadata defined for API catalog entities. #1 - #Ask Alex about this # Create API ------------------------------------------------------------------------------------- @@ -232,7 +327,6 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n - # Create API Version ----------------------------------------------------------------------------- from .aaz.latest.apic.api.version import Create as CreateAPIVersion @@ -252,7 +346,6 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n - # Create API Definition ----------------------------------------------------------------------------- from .aaz.latest.apic.api.definition import Create as CreateAPIDefinition From 4d8c5da791ad47507e7bc7411586a03ec56f3e73 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 20 Nov 2023 15:12:58 -0600 Subject: [PATCH 10/27] exmples export schema and create env --- .../aaz/latest/apic/environment/_create.py | 3 +++ .../apic/metadata_schema/_export_metadata_schema.py | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_create.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_create.py index 0c398be20a8..4d5589cb0bd 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_create.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_create.py @@ -19,6 +19,9 @@ class Create(AAZCommand): :example: Create environment az apic environment create -g api-center-test -s contosoeuap --name public --title "Public cloud" --kind "development" + + :example: Create environment with server information + az apic environment create -g api-center-test -s contosoeuap --name public-3 --title "Public cloud" --kind "development" --server "C:\Users\arpishah\examples\cli-examples\payload-examples\envcreate1.json" Where envcreate1.json contains { "type": "Azure API Management", "managementPortalUri": [ "management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service" ] } """ _aaz_info = { diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_export_metadata_schema.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_export_metadata_schema.py index d1d170679e6..2b8ba2a84ec 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_export_metadata_schema.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_export_metadata_schema.py @@ -16,6 +16,15 @@ ) class ExportMetadataSchema(AAZCommand): """Exports the effective metadata schema. + + :example: Export Metadata Schema assigned to api + az apic metadata-schema export-metadata-schema -g api-center-test -s contosoeuap --assigned-to api --file-name C:\Users\arpishah\examples\cli-examples\exported-results\exported-schema-3.json + + :example: Export Metadata Schema assigned to deployment + az apic metadata-schema export-metadata-schema -g api-center-test -s contosoeuap --assigned-to deployment --file-name C:\Users\arpishah\examples\cli-examples\exported-results\exported-schema-5.json + + :example: Export Metadata Schema assigned to environment + az apic metadata-schema export-metadata-schema -g api-center-test -s contosoeuap --assigned-to environment --file-name C:\Users\arpishah\examples\cli-examples\exported-results\exported-schema-6.json """ _aaz_info = { From 41d4ccc5e9b946afdf2e3b80a17961b8466052c2 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 20 Nov 2023 15:43:48 -0600 Subject: [PATCH 11/27] move quick add in api and remove redundant exmaple unicode --- src/apic-extension/azext_apic_extension/_params.py | 2 +- .../aaz/latest/apic/environment/_create.py | 3 --- .../latest/apic/metadata_schema/_export_metadata_schema.py | 6 +++--- src/apic-extension/azext_apic_extension/commands.py | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/_params.py b/src/apic-extension/azext_apic_extension/_params.py index bd17eb7061c..10bcd3f76c5 100644 --- a/src/apic-extension/azext_apic_extension/_params.py +++ b/src/apic-extension/azext_apic_extension/_params.py @@ -11,7 +11,7 @@ def load_arguments(self, _): # pylint: disable=unused-argument - with self.argument_context("apic service register") as c: + with self.argument_context("apic api register") as c: c.argument( "api_location", options_list=['--api-location', '-l'], diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_create.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_create.py index 4d5589cb0bd..0c398be20a8 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_create.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_create.py @@ -19,9 +19,6 @@ class Create(AAZCommand): :example: Create environment az apic environment create -g api-center-test -s contosoeuap --name public --title "Public cloud" --kind "development" - - :example: Create environment with server information - az apic environment create -g api-center-test -s contosoeuap --name public-3 --title "Public cloud" --kind "development" --server "C:\Users\arpishah\examples\cli-examples\payload-examples\envcreate1.json" Where envcreate1.json contains { "type": "Azure API Management", "managementPortalUri": [ "management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service" ] } """ _aaz_info = { diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_export_metadata_schema.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_export_metadata_schema.py index 2b8ba2a84ec..c70a73a0aea 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_export_metadata_schema.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/metadata_schema/_export_metadata_schema.py @@ -18,13 +18,13 @@ class ExportMetadataSchema(AAZCommand): """Exports the effective metadata schema. :example: Export Metadata Schema assigned to api - az apic metadata-schema export-metadata-schema -g api-center-test -s contosoeuap --assigned-to api --file-name C:\Users\arpishah\examples\cli-examples\exported-results\exported-schema-3.json + az apic metadata-schema export-metadata-schema -g api-center-test -s contosoeuap --assigned-to api --file-name filepath :example: Export Metadata Schema assigned to deployment - az apic metadata-schema export-metadata-schema -g api-center-test -s contosoeuap --assigned-to deployment --file-name C:\Users\arpishah\examples\cli-examples\exported-results\exported-schema-5.json + az apic metadata-schema export-metadata-schema -g api-center-test -s contosoeuap --assigned-to deployment --file-name filepath :example: Export Metadata Schema assigned to environment - az apic metadata-schema export-metadata-schema -g api-center-test -s contosoeuap --assigned-to environment --file-name C:\Users\arpishah\examples\cli-examples\exported-results\exported-schema-6.json + az apic metadata-schema export-metadata-schema -g api-center-test -s contosoeuap --assigned-to environment --file-name filepath """ _aaz_info = { diff --git a/src/apic-extension/azext_apic_extension/commands.py b/src/apic-extension/azext_apic_extension/commands.py index 6bef82cd521..44a491ea520 100644 --- a/src/apic-extension/azext_apic_extension/commands.py +++ b/src/apic-extension/azext_apic_extension/commands.py @@ -23,5 +23,5 @@ def load_command_table(self, _): # pylint: disable=unused-argument self.command_table['apic metadata-schema create'] = CreateMetadataSchemaExtension(loader=self) self.command_table['apic metadata-schema export-metadata-schema'] = ExportMetadataSchemaExtension(loader=self) - with self.command_group('apic service') as g: + with self.command_group('apic api') as g: g.custom_command("register", "register_apic") \ No newline at end of file From 9a6d0dd8de012924e8ad1a55119d35ad82db3251 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Wed, 22 Nov 2023 11:39:04 -0600 Subject: [PATCH 12/27] add tests --- .../latest/data/exported_md_schema_api.json | 177 + .../data/exported_md_schema_deployment.json | 56 + .../latest/data/exported_md_schema_env.json | 66 + .../tests/latest/data/exported_spec.json | 190 + .../data/import_metadataschema_input.json | 5 + .../latest/data/import_spec_payload.json | 1 + .../data/register_quickadd_openai_spec.json | 3193 +++++++++++++++++ .../recordings/test_apic_scenarios.yaml | 2485 +++++++++++++ .../tests/latest/test_apic_extension.py | 130 +- 9 files changed, 6301 insertions(+), 2 deletions(-) create mode 100644 src/apic-extension/azext_apic_extension/tests/latest/data/exported_md_schema_api.json create mode 100644 src/apic-extension/azext_apic_extension/tests/latest/data/exported_md_schema_deployment.json create mode 100644 src/apic-extension/azext_apic_extension/tests/latest/data/exported_md_schema_env.json create mode 100644 src/apic-extension/azext_apic_extension/tests/latest/data/exported_spec.json create mode 100644 src/apic-extension/azext_apic_extension/tests/latest/data/import_metadataschema_input.json create mode 100644 src/apic-extension/azext_apic_extension/tests/latest/data/import_spec_payload.json create mode 100644 src/apic-extension/azext_apic_extension/tests/latest/data/register_quickadd_openai_spec.json create mode 100644 src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml diff --git a/src/apic-extension/azext_apic_extension/tests/latest/data/exported_md_schema_api.json b/src/apic-extension/azext_apic_extension/tests/latest/data/exported_md_schema_api.json new file mode 100644 index 00000000000..1ab65409b68 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/latest/data/exported_md_schema_api.json @@ -0,0 +1,177 @@ +{ + "type":"object", + "properties":{ + "title":{ + "description":"The name of the API.", + "type":"string", + "maxLength":50 + }, + "summary":{ + "description":"Short description of the API.", + "type":"string", + "maxLength":200 + }, + "description":{ + "description":"The description of the API.", + "type":"string", + "maxLength":1000 + }, + "kind":{ + "description":"Kind of API. For example, REST or GraphQL.", + "type":"string" + }, + "lifecycleStage":{ + "description":"Current lifecycle stage of the API.", + "type":"string", + "enum":[ + "design", + "development", + "testing", + "preview", + "production", + "deprecated", + "retired" + ] + }, + "termsOfService":{ + "description":"Terms of service for the API.", + "type":"object", + "properties":{ + "url":{ + "description":"URL pointing to the terms of service.", + "type":"string", + "maxLength":200, + "format":"uri" + } + } + }, + "license":{ + "description":"The license information for the API.", + "type":"object", + "properties":{ + "name":{ + "description":"Name of the license.", + "type":"string", + "maxLength":50 + }, + "url":{ + "description":"URL pointing to the license details. The URL field is mutually exclusive of the identifier field.", + "type":"string", + "maxLength":200, + "format":"uri" + }, + "identifier":{ + "description":"SPDX license information for the API. The identifier field is mutually exclusive of the URL field.", + "type":"string", + "maxLength":200, + "format":"uri" + } + } + }, + "externalDocumentation":{ + "description":"External documentation", + "type":"array", + "items":{ + "type":"object", + "properties":{ + "title":{ + "description":"Title of the documentation.", + "type":"string", + "maxLength":50 + }, + "description":{ + "description":"Description of the documentation.", + "type":"string", + "maxLength":1000 + }, + "url":{ + "description":"URL pointing to the documentation.", + "type":"string", + "maxLength":200, + "format":"uri" + } + } + }, + "maxItems":20 + }, + "contacts":{ + "description":"Points of contact for the API.", + "type":"array", + "items":{ + "type":"object", + "properties":{ + "name":{ + "description":"Name of the contact.", + "type":"string", + "maxLength":100 + }, + "url":{ + "description":"URL for the contact.", + "type":"string", + "maxLength":200, + "format":"uri" + }, + "email":{ + "description":"Email address for the contact.", + "type":"string", + "maxLength":100, + "format":"email" + } + } + }, + "maxItems":10 + }, + "customProperties":{ + "type":"object", + "properties":{ + "compliance-status":{ + "type":"string", + "title":"compliance-status", + "oneOf":[ + { + "const":"new", + "description":"" + }, + { + "const":"pending", + "description":"" + }, + { + "const":"solved", + "description":"" + } + ] + }, + "approver":{ + "title":"approver", + "type":"string" + }, + "cost-center":{ + "title":"cost-center", + "type":"string" + }, + "ownership":{ + "title":"ownership", + "type":"string" + }, + "metadata-test-1":{ + "title":"metadata-test-1", + "type":"string" + }, + "metadata-test-2":{ + "title":"metadata-test-2", + "type":"boolean" + } + }, + "unevaluatedProperties":false, + "required":[ + "metadata-test-1", + "metadata-test-2" + ] + } + }, + "required":[ + "title", + "kind" + ] +} \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/tests/latest/data/exported_md_schema_deployment.json b/src/apic-extension/azext_apic_extension/tests/latest/data/exported_md_schema_deployment.json new file mode 100644 index 00000000000..3f3aa87832c --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/latest/data/exported_md_schema_deployment.json @@ -0,0 +1,56 @@ +{ + "type":"object", + "properties":{ + "title":{ + "description":"The name of the deployment.", + "type":"string", + "maxLength":50 + }, + "description":{ + "description":"The description of the deployment.", + "type":"string", + "maxLength":1000 + }, + "environmentId":{ + "description":"The service-scoped resource ID of the deployment environment.", + "type":"string" + }, + "definitionId":{ + "description":"The service-scoped resource ID of the API definition.", + "type":"string" + }, + "server":{ + "description":"The server information of the API deployment.", + "type":"object", + "properties":{ + "runtimeUri":{ + "description":"Base runtime URIs for this deployment.", + "type":"array", + "items":{ + "type":"string" + }, + "maxItems":200 + } + }, + "required":[ + "runtimeUri" + ] + }, + "customProperties":{ + "type":"object", + "properties":{}, + "unevaluatedProperties":false, + "required":[] + }, + "recommended":{ + "description":"Indicates if this is currently recommended deployment.", + "type":"boolean" + } + }, + "required":[ + "title", + "environmentId", + "definitionId", + "server" + ] +} \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/tests/latest/data/exported_md_schema_env.json b/src/apic-extension/azext_apic_extension/tests/latest/data/exported_md_schema_env.json new file mode 100644 index 00000000000..5d5d2dc00be --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/latest/data/exported_md_schema_env.json @@ -0,0 +1,66 @@ +{ + "type":"object", + "properties":{ + "title":{ + "description":"The name of the environment.", + "type":"string", + "maxLength":50 + }, + "kind":{ + "description":"Kind of deployment environment.", + "type":"string" + }, + "description":{ + "description":"Description of the environment.", + "type":"string", + "maxLength":1000 + }, + "server":{ + "description":"Server information of the environment.", + "type":"object", + "properties":{ + "type":{ + "description":"Type of the server that represents the environment.", + "type":"string" + }, + "managementPortalUri":{ + "description":"URIs of the server's management portal.", + "type":"array", + "items":{ + "type":"string" + }, + "maxItems":200 + } + } + }, + "onboarding":{ + "description":"Onboarding information for this environment.", + "type":"object", + "properties":{ + "instructions":{ + "description":"Instructions how to onboard to the environment.", + "type":"string", + "maxLength":1000 + }, + "developerPortalUri":{ + "description":"Developer portal URIs of the environment.", + "type":"array", + "items":{ + "type":"string" + }, + "maxItems":200 + } + } + }, + "customProperties":{ + "type":"object", + "properties":{}, + "unevaluatedProperties":false, + "required":[] + } + }, + "required":[ + "title", + "kind" + ] +} \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/tests/latest/data/exported_spec.json b/src/apic-extension/azext_apic_extension/tests/latest/data/exported_spec.json new file mode 100644 index 00000000000..921483e2a9c --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/latest/data/exported_spec.json @@ -0,0 +1,190 @@ +{ + "openapi":"3.0.0", + "info":{ + "title":"Cat Facts API", + "version":"1.0" + }, + "paths":{ + "/breeds":{ + "get":{ + "tags":[ + "Breeds" + ], + "summary":"Get a list of breeds", + "description":"Returns a a list of breeds", + "operationId":"getBreeds", + "parameters":[ + { + "name":"limit", + "in":"query", + "description":"limit the amount of results returned", + "required":false, + "schema":{ + "type":"integer", + "format":"int64" + } + } + ], + "responses":{ + "200":{ + "description":"successful operation", + "content":{ + "application/json":{ + "schema":{ + "type":"array", + "items":{ + "$ref":"#/components/schemas/Breed" + } + } + } + } + } + } + } + }, + "/fact":{ + "get":{ + "tags":[ + "Facts" + ], + "summary":"Get Random Fact", + "description":"Returns a random fact", + "operationId":"getRandomFact", + "parameters":[ + { + "name":"max_length", + "in":"query", + "description":"maximum length of returned fact", + "required":false, + "schema":{ + "type":"integer", + "format":"int64" + } + } + ], + "responses":{ + "200":{ + "description":"successful operation", + "content":{ + "application/json":{ + "schema":{ + "$ref":"#/components/schemas/CatFact" + } + } + } + }, + "404":{ + "description":"Fact not found" + } + } + } + }, + "/facts":{ + "get":{ + "tags":[ + "Facts" + ], + "summary":"Get a list of facts", + "description":"Returns a a list of facts", + "operationId":"getFacts", + "parameters":[ + { + "name":"max_length", + "in":"query", + "description":"maximum length of returned fact", + "required":false, + "schema":{ + "type":"integer", + "format":"int64" + } + }, + { + "name":"limit", + "in":"query", + "description":"limit the amount of results returned", + "required":false, + "schema":{ + "type":"integer", + "format":"int64" + } + } + ], + "responses":{ + "200":{ + "description":"successful operation", + "content":{ + "application/json":{ + "schema":{ + "type":"array", + "items":{ + "$ref":"#/components/schemas/CatFact" + } + } + } + } + } + } + } + } + }, + "components":{ + "schemas":{ + "Breed":{ + "title":"Breed model", + "description":"Breed", + "properties":{ + "breed":{ + "title":"Breed", + "description":"Breed", + "type":"string", + "format":"string" + }, + "country":{ + "title":"Country", + "description":"Country", + "type":"string", + "format":"string" + }, + "origin":{ + "title":"Origin", + "description":"Origin", + "type":"string", + "format":"string" + }, + "coat":{ + "title":"Coat", + "description":"Coat", + "type":"string", + "format":"string" + }, + "pattern":{ + "title":"Pattern", + "description":"Pattern", + "type":"string", + "format":"string" + } + }, + "type":"object" + }, + "CatFact":{ + "title":"CatFact model", + "description":"CatFact", + "properties":{ + "fact":{ + "title":"Fact", + "description":"Fact", + "type":"string", + "format":"string" + }, + "length":{ + "title":"Length", + "description":"Length", + "type":"integer", + "format":"int32" + } + }, + "type":"object" + } + } + } +} \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/tests/latest/data/import_metadataschema_input.json b/src/apic-extension/azext_apic_extension/tests/latest/data/import_metadataschema_input.json new file mode 100644 index 00000000000..c3a0db33ded --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/latest/data/import_metadataschema_input.json @@ -0,0 +1,5 @@ +{ + "type": "string", + "title": "CLI Test First name", + "pattern": "^[a-zA-Z0-9 ]+$" +} \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/tests/latest/data/import_spec_payload.json b/src/apic-extension/azext_apic_extension/tests/latest/data/import_spec_payload.json new file mode 100644 index 00000000000..30ae9b007f2 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/latest/data/import_spec_payload.json @@ -0,0 +1 @@ +{"openapi": "3.0.0", "info": {"title": "Cat Facts API", "version": "1.0"}, "paths": {"/breeds": {"get": {"tags": ["Breeds"], "summary": "Get a list of breeds", "description": "Returns a a list of breeds", "operationId": "getBreeds", "parameters": [{"name": "limit", "in": "query", "description": "limit the amount of results returned", "required": false, "schema": {"type": "integer", "format": "int64"}}], "responses": {"200": {"description": "successful operation", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Breed"}}}}}}}}, "/fact": {"get": {"tags": ["Facts"], "summary": "Get Random Fact", "description": "Returns a random fact", "operationId": "getRandomFact", "parameters": [{"name": "max_length", "in": "query", "description": "maximum length of returned fact", "required": false, "schema": {"type": "integer", "format": "int64"}}], "responses": {"200": {"description": "successful operation", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CatFact"}}}}, "404": {"description": "Fact not found"}}}}, "/facts": {"get": {"tags": ["Facts"], "summary": "Get a list of facts", "description": "Returns a a list of facts", "operationId": "getFacts", "parameters": [{"name": "max_length", "in": "query", "description": "maximum length of returned fact", "required": false, "schema": {"type": "integer", "format": "int64"}}, {"name": "limit", "in": "query", "description": "limit the amount of results returned", "required": false, "schema": {"type": "integer", "format": "int64"}}], "responses": {"200": {"description": "successful operation", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/CatFact"}}}}}}}}}, "components": {"schemas": {"Breed": {"title": "Breed model", "description": "Breed", "properties": {"breed": {"title": "Breed", "description": "Breed", "type": "string", "format": "string"}, "country": {"title": "Country", "description": "Country", "type": "string", "format": "string"}, "origin": {"title": "Origin", "description": "Origin", "type": "string", "format": "string"}, "coat": {"title": "Coat", "description": "Coat", "type": "string", "format": "string"}, "pattern": {"title": "Pattern", "description": "Pattern", "type": "string", "format": "string"}}, "type": "object"}, "CatFact": {"title": "CatFact model", "description": "CatFact", "properties": {"fact": {"title": "Fact", "description": "Fact", "type": "string", "format": "string"}, "length": {"title": "Length", "description": "Length", "type": "integer", "format": "int32"}}, "type": "object"}}}} \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/tests/latest/data/register_quickadd_openai_spec.json b/src/apic-extension/azext_apic_extension/tests/latest/data/register_quickadd_openai_spec.json new file mode 100644 index 00000000000..b4565cb5c08 --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/latest/data/register_quickadd_openai_spec.json @@ -0,0 +1,3193 @@ +{ + "openapi": "3.0.0", + "servers": [ + { + "url": "https://api.openai.com/v1" + } + ], + "info": { + "description": "APIs for sampling from and fine-tuning language models", + "title": "CLI Test OpenAI API 01", + "version": "1.2.0", + "x-apisguru-categories": [ + "machine_learning" + ], + "x-logo": { + "url": "https://learnodo-newtonic.com/wp-content/uploads/2020/04/Logo-of-OpenAI-768x161.jpg" + }, + "x-origin": [ + { + "format": "openapi", + "url": "https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml", + "version": "3.0" + } + ], + "x-providerName": "openai.com" + }, + "tags": [ + { + "description": "The OpenAI REST API", + "name": "OpenAI" + } + ], + "paths": { + "/answers": { + "post": { + "deprecated": true, + "operationId": "createAnswer", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAnswerRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAnswerResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Answers the specified question using the provided documents and examples.\n\nThe endpoint first [searches](/docs/api-reference/searches) over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for [completion](/docs/api-reference/completions).\n", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/answers \\\n -X POST \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"documents\": [\"Puppy A is happy.\", \"Puppy B is sad.\"],\n \"question\": \"which puppy is happy?\",\n \"search_model\": \"ada\",\n \"model\": \"curie\",\n \"examples_context\": \"In 2017, U.S. life expectancy was 78.6 years.\",\n \"examples\": [[\"What is human life expectancy in the United States?\",\"78 years.\"]],\n \"max_tokens\": 5,\n \"stop\": [\"\\n\", \"<|endoftext|>\"]\n }'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createAnswer({\n search_model: \"ada\",\n model: \"curie\",\n question: \"which puppy is happy?\",\n documents: [\"Puppy A is happy.\", \"Puppy B is sad.\"],\n examples_context: \"In 2017, U.S. life expectancy was 78.6 years.\",\n examples: [[\"What is human life expectancy in the United States?\",\"78 years.\"]],\n max_tokens: 5,\n stop: [\"\\n\", \"<|endoftext|>\"],\n});\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Answer.create(\n search_model=\"ada\",\n model=\"curie\",\n question=\"which puppy is happy?\",\n documents=[\"Puppy A is happy.\", \"Puppy B is sad.\"],\n examples_context=\"In 2017, U.S. life expectancy was 78.6 years.\",\n examples=[[\"What is human life expectancy in the United States?\",\"78 years.\"]],\n max_tokens=5,\n stop=[\"\\n\", \"<|endoftext|>\"],\n)\n" + }, + "group": "answers", + "name": "Create answer", + "parameters": "{\n \"documents\": [\"Puppy A is happy.\", \"Puppy B is sad.\"],\n \"question\": \"which puppy is happy?\",\n \"search_model\": \"ada\",\n \"model\": \"curie\",\n \"examples_context\": \"In 2017, U.S. life expectancy was 78.6 years.\",\n \"examples\": [[\"What is human life expectancy in the United States?\",\"78 years.\"]],\n \"max_tokens\": 5,\n \"stop\": [\"\\n\", \"<|endoftext|>\"]\n}\n", + "path": "create", + "response": "{\n \"answers\": [\n \"puppy A.\"\n ],\n \"completion\": \"cmpl-2euVa1kmKUuLpSX600M41125Mo9NI\",\n \"model\": \"curie:2020-05-03\",\n \"object\": \"answer\",\n \"search_model\": \"ada\",\n \"selected_documents\": [\n {\n \"document\": 0,\n \"text\": \"Puppy A is happy. \"\n },\n {\n \"document\": 1,\n \"text\": \"Puppy B is sad. \"\n }\n ]\n}\n" + } + } + }, + "/audio/transcriptions": { + "post": { + "operationId": "createTranscription", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateTranscriptionRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateTranscriptionResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Transcribes audio into the input language.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "beta": true, + "examples": { + "curl": "curl https://api.openai.com/v1/audio/transcriptions \\\n -X POST \\\n -H 'Authorization: Bearer TOKEN' \\\n -H 'Content-Type: multipart/form-data' \\\n -F file=@/path/to/file/audio.mp3 \\\n -F model=whisper-1\n", + "node": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst resp = await openai.createTranscription(\n fs.createReadStream(\"audio.mp3\"),\n \"whisper-1\"\n);\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\naudio_file = open(\"audio.mp3\", \"rb\")\ntranscript = openai.Audio.transcribe(\"whisper-1\", audio_file)\n" + }, + "group": "audio", + "name": "Create transcription", + "parameters": "{\n \"file\": \"audio.mp3\",\n \"model\": \"whisper-1\"\n}\n", + "path": "create", + "response": "{\n \"text\": \"Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.\"\n}\n" + } + } + }, + "/audio/translations": { + "post": { + "operationId": "createTranslation", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateTranslationRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateTranslationResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Translates audio into into English.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "beta": true, + "examples": { + "curl": "curl https://api.openai.com/v1/audio/translations \\\n -X POST \\\n -H 'Authorization: Bearer TOKEN' \\\n -H 'Content-Type: multipart/form-data' \\\n -F file=@/path/to/file/german.m4a \\\n -F model=whisper-1\n", + "node": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst resp = await openai.createTranslation(\n fs.createReadStream(\"audio.mp3\"),\n \"whisper-1\"\n);\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\naudio_file = open(\"german.m4a\", \"rb\")\ntranscript = openai.Audio.translate(\"whisper-1\", audio_file)\n" + }, + "group": "audio", + "name": "Create translation", + "parameters": "{\n \"file\": \"german.m4a\",\n \"model\": \"whisper-1\"\n}\n", + "path": "create", + "response": "{\n \"text\": \"Hello, my name is Wolfgang and I come from Germany. Where are you heading today?\"\n}\n" + } + } + }, + "/chat/completions": { + "post": { + "operationId": "createChatCompletion", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateChatCompletionRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateChatCompletionResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Creates a completion for the chat message", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "beta": true, + "examples": { + "curl": "curl https://api.openai.com/v1/chat/completions \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -d '{\n \"model\": \"gpt-3.5-turbo\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n}'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\n\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\n\nconst completion = await openai.createChatCompletion({\n model: \"gpt-3.5-turbo\",\n messages: [{role: \"user\", content: \"Hello world\"}],\n});\nconsole.log(completion.data.choices[0].message);\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\n\ncompletion = openai.ChatCompletion.create(\n model=\"gpt-3.5-turbo\",\n messages=[\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ]\n)\n\nprint(completion.choices[0].message)\n" + }, + "group": "chat", + "name": "Create chat completion", + "parameters": "{\n \"model\": \"gpt-3.5-turbo\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n}\n", + "path": "create", + "response": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1677652288,\n \"choices\": [{\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"\\n\\nHello there, how may I assist you today?\",\n },\n \"finish_reason\": \"stop\"\n }],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 12,\n \"total_tokens\": 21\n }\n}\n" + } + } + }, + "/classifications": { + "post": { + "deprecated": true, + "operationId": "createClassification", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateClassificationRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateClassificationResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Classifies the specified `query` using provided examples.\n\nThe endpoint first [searches](/docs/api-reference/searches) over the labeled examples\nto select the ones most relevant for the particular query. Then, the relevant examples\nare combined with the query to construct a prompt to produce the final label via the\n[completions](/docs/api-reference/completions) endpoint.\n\nLabeled examples can be provided via an uploaded `file`, or explicitly listed in the\nrequest using the `examples` parameter for quick tests and small scale use cases.\n", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/classifications \\\n -X POST \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"examples\": [\n [\"A happy moment\", \"Positive\"],\n [\"I am sad.\", \"Negative\"],\n [\"I am feeling awesome\", \"Positive\"]],\n \"query\": \"It is a raining day :(\",\n \"search_model\": \"ada\",\n \"model\": \"curie\",\n \"labels\":[\"Positive\", \"Negative\", \"Neutral\"]\n }'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createClassification({\n search_model: \"ada\",\n model: \"curie\",\n examples: [\n [\"A happy moment\", \"Positive\"],\n [\"I am sad.\", \"Negative\"],\n [\"I am feeling awesome\", \"Positive\"]\n ],\n query:\"It is a raining day :(\",\n labels: [\"Positive\", \"Negative\", \"Neutral\"],\n});\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Classification.create(\n search_model=\"ada\",\n model=\"curie\",\n examples=[\n [\"A happy moment\", \"Positive\"],\n [\"I am sad.\", \"Negative\"],\n [\"I am feeling awesome\", \"Positive\"]\n ],\n query=\"It is a raining day :(\",\n labels=[\"Positive\", \"Negative\", \"Neutral\"],\n)\n" + }, + "group": "classifications", + "name": "Create classification", + "parameters": "{\n \"examples\": [\n [\"A happy moment\", \"Positive\"],\n [\"I am sad.\", \"Negative\"],\n [\"I am feeling awesome\", \"Positive\"]\n ],\n \"labels\": [\"Positive\", \"Negative\", \"Neutral\"],\n \"query\": \"It is a raining day :(\",\n \"search_model\": \"ada\",\n \"model\": \"curie\"\n}\n", + "path": "create", + "response": "{\n \"completion\": \"cmpl-2euN7lUVZ0d4RKbQqRV79IiiE6M1f\",\n \"label\": \"Negative\",\n \"model\": \"curie:2020-05-03\",\n \"object\": \"classification\",\n \"search_model\": \"ada\",\n \"selected_examples\": [\n {\n \"document\": 1,\n \"label\": \"Negative\",\n \"text\": \"I am sad.\"\n },\n {\n \"document\": 0,\n \"label\": \"Positive\",\n \"text\": \"A happy moment\"\n },\n {\n \"document\": 2,\n \"label\": \"Positive\",\n \"text\": \"I am feeling awesome\"\n }\n ]\n}\n" + } + } + }, + "/completions": { + "post": { + "operationId": "createCompletion", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateCompletionRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateCompletionResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Creates a completion for the provided prompt and parameters", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/completions \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"prompt\": \"Say this is a test\",\n \"max_tokens\": 7,\n \"temperature\": 0\n}'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createCompletion({\n model: \"VAR_model_id\",\n prompt: \"Say this is a test\",\n max_tokens: 7,\n temperature: 0,\n});\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Completion.create(\n model=\"VAR_model_id\",\n prompt=\"Say this is a test\",\n max_tokens=7,\n temperature=0\n)\n" + }, + "group": "completions", + "name": "Create completion", + "parameters": "{\n \"model\": \"VAR_model_id\",\n \"prompt\": \"Say this is a test\",\n \"max_tokens\": 7,\n \"temperature\": 0,\n \"top_p\": 1,\n \"n\": 1,\n \"stream\": false,\n \"logprobs\": null,\n \"stop\": \"\\n\"\n}\n", + "path": "create", + "response": "{\n \"id\": \"cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7\",\n \"object\": \"text_completion\",\n \"created\": 1589478378,\n \"model\": \"VAR_model_id\",\n \"choices\": [\n {\n \"text\": \"\\n\\nThis is indeed a test\",\n \"index\": 0,\n \"logprobs\": null,\n \"finish_reason\": \"length\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 5,\n \"completion_tokens\": 7,\n \"total_tokens\": 12\n }\n}\n" + } + } + }, + "/edits": { + "post": { + "operationId": "createEdit", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateEditRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateEditResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Creates a new edit for the provided input, instruction, and parameters.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/edits \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"input\": \"What day of the wek is it?\",\n \"instruction\": \"Fix the spelling mistakes\"\n}'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createEdit({\n model: \"VAR_model_id\",\n input: \"What day of the wek is it?\",\n instruction: \"Fix the spelling mistakes\",\n});\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Edit.create(\n model=\"VAR_model_id\",\n input=\"What day of the wek is it?\",\n instruction=\"Fix the spelling mistakes\"\n)\n" + }, + "group": "edits", + "name": "Create edit", + "parameters": "{\n \"model\": \"VAR_model_id\",\n \"input\": \"What day of the wek is it?\",\n \"instruction\": \"Fix the spelling mistakes\",\n}\n", + "path": "create", + "response": "{\n \"object\": \"edit\",\n \"created\": 1589478378,\n \"choices\": [\n {\n \"text\": \"What day of the week is it?\",\n \"index\": 0,\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 25,\n \"completion_tokens\": 32,\n \"total_tokens\": 57\n }\n}\n" + } + } + }, + "/embeddings": { + "post": { + "operationId": "createEmbedding", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateEmbeddingRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateEmbeddingResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Creates an embedding vector representing the input text.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/embeddings \\\n -X POST \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"input\": \"The food was delicious and the waiter...\",\n \"model\": \"text-embedding-ada-002\"}'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createEmbedding({\n model: \"text-embedding-ada-002\",\n input: \"The food was delicious and the waiter...\",\n});\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Embedding.create(\n model=\"text-embedding-ada-002\",\n input=\"The food was delicious and the waiter...\"\n)\n" + }, + "group": "embeddings", + "name": "Create embeddings", + "parameters": "{\n \"model\": \"text-embedding-ada-002\",\n \"input\": \"The food was delicious and the waiter...\"\n}\n", + "path": "create", + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"embedding\",\n \"embedding\": [\n 0.0023064255,\n -0.009327292,\n .... (1536 floats total for ada-002)\n -0.0028842222,\n ],\n \"index\": 0\n }\n ],\n \"model\": \"text-embedding-ada-002\",\n \"usage\": {\n \"prompt_tokens\": 8,\n \"total_tokens\": 8\n }\n}\n" + } + } + }, + "/engines": { + "get": { + "deprecated": true, + "operationId": "listEngines", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListEnginesResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Lists the currently available (non-finetuned) models, and provides basic information about each one such as the owner and availability.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/engines \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.listEngines();\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Engine.list()\n" + }, + "group": "engines", + "name": "List engines", + "path": "list", + "response": "{\n \"data\": [\n {\n \"id\": \"engine-id-0\",\n \"object\": \"engine\",\n \"owner\": \"organization-owner\",\n \"ready\": true\n },\n {\n \"id\": \"engine-id-2\",\n \"object\": \"engine\",\n \"owner\": \"organization-owner\",\n \"ready\": true\n },\n {\n \"id\": \"engine-id-3\",\n \"object\": \"engine\",\n \"owner\": \"openai\",\n \"ready\": false\n },\n ],\n \"object\": \"list\"\n}\n" + } + } + }, + "/engines/{engine_id}": { + "get": { + "deprecated": true, + "operationId": "retrieveEngine", + "parameters": [ + { + "description": "The ID of the engine to use for this request\n", + "in": "path", + "name": "engine_id", + "required": true, + "schema": { + "example": "davinci", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Engine" + } + } + }, + "description": "OK" + } + }, + "summary": "Retrieves a model instance, providing basic information about it such as the owner and availability.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/engines/VAR_model_id \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.retrieveEngine(\"VAR_model_id\");\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Engine.retrieve(\"VAR_model_id\")\n" + }, + "group": "engines", + "name": "Retrieve engine", + "path": "retrieve", + "response": "{\n \"id\": \"VAR_model_id\",\n \"object\": \"engine\",\n \"owner\": \"openai\",\n \"ready\": true\n}\n" + } + } + }, + "/engines/{engine_id}/search": { + "post": { + "deprecated": true, + "operationId": "createSearch", + "parameters": [ + { + "description": "The ID of the engine to use for this request. You can select one of `ada`, `babbage`, `curie`, or `davinci`.", + "in": "path", + "name": "engine_id", + "required": true, + "schema": { + "example": "davinci", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateSearchRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateSearchResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them.\n\nTo go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When `file` is set, the search endpoint searches over all the documents in the given file and returns up to the `max_rerank` number of documents. These documents will be returned along with their search scores.\n\nThe similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.\n", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/engines/davinci/search \\\n -H \"Content-Type: application/json\" \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -d '{\n \"documents\": [\"White House\", \"hospital\", \"school\"],\n \"query\": \"the president\"\n}'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createSearch(\"davinci\", {\n documents: [\"White House\", \"hospital\", \"school\"],\n query: \"the president\",\n});\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Engine(\"davinci\").search(\n documents=[\"White House\", \"hospital\", \"school\"],\n query=\"the president\"\n)\n" + }, + "group": "searches", + "name": "Create search", + "parameters": "{\n \"documents\": [\n \"White House\",\n \"hospital\",\n \"school\"\n ],\n \"query\": \"the president\"\n}\n", + "path": "create", + "response": "{\n \"data\": [\n {\n \"document\": 0,\n \"object\": \"search_result\",\n \"score\": 215.412\n },\n {\n \"document\": 1,\n \"object\": \"search_result\",\n \"score\": 40.316\n },\n {\n \"document\": 2,\n \"object\": \"search_result\",\n \"score\": 55.226\n }\n ],\n \"object\": \"list\"\n}\n" + } + } + }, + "/files": { + "get": { + "operationId": "listFiles", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListFilesResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Returns a list of files that belong to the user's organization.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/files \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.listFiles();\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.File.list()\n" + }, + "group": "files", + "name": "List files", + "path": "list", + "response": "{\n \"data\": [\n {\n \"id\": \"file-ccdDZrC3iZVNiQVeEA6Z66wf\",\n \"object\": \"file\",\n \"bytes\": 175,\n \"created_at\": 1613677385,\n \"filename\": \"train.jsonl\",\n \"purpose\": \"search\"\n },\n {\n \"id\": \"file-XjGxS3KTG0uNmNOK362iJua3\",\n \"object\": \"file\",\n \"bytes\": 140,\n \"created_at\": 1613779121,\n \"filename\": \"puppy.jsonl\",\n \"purpose\": \"search\"\n }\n ],\n \"object\": \"list\"\n}\n" + } + }, + "post": { + "operationId": "createFile", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateFileRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OpenAIFile" + } + } + }, + "description": "OK" + } + }, + "summary": "Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.\n", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/files \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -F purpose=\"fine-tune\" \\\n -F file='@mydata.jsonl'\n", + "node.js": "const fs = require(\"fs\");\nconst { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createFile(\n fs.createReadStream(\"mydata.jsonl\"),\n \"fine-tune\"\n);\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.File.create(\n file=open(\"mydata.jsonl\", \"rb\"),\n purpose='fine-tune'\n)\n" + }, + "group": "files", + "name": "Upload file", + "path": "upload", + "response": "{\n \"id\": \"file-XjGxS3KTG0uNmNOK362iJua3\",\n \"object\": \"file\",\n \"bytes\": 140,\n \"created_at\": 1613779121,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\"\n}\n" + } + } + }, + "/files/{file_id}": { + "delete": { + "operationId": "deleteFile", + "parameters": [ + { + "description": "The ID of the file to use for this request", + "in": "path", + "name": "file_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteFileResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Delete a file.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/files/file-XjGxS3KTG0uNmNOK362iJua3 \\\n -X DELETE \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.deleteFile(\"file-XjGxS3KTG0uNmNOK362iJua3\");\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.File.delete(\"file-XjGxS3KTG0uNmNOK362iJua3\")\n" + }, + "group": "files", + "name": "Delete file", + "path": "delete", + "response": "{\n \"id\": \"file-XjGxS3KTG0uNmNOK362iJua3\",\n \"object\": \"file\",\n \"deleted\": true\n}\n" + } + }, + "get": { + "operationId": "retrieveFile", + "parameters": [ + { + "description": "The ID of the file to use for this request", + "in": "path", + "name": "file_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OpenAIFile" + } + } + }, + "description": "OK" + } + }, + "summary": "Returns information about a specific file.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/files/file-XjGxS3KTG0uNmNOK362iJua3 \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.retrieveFile(\"file-XjGxS3KTG0uNmNOK362iJua3\");\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.File.retrieve(\"file-XjGxS3KTG0uNmNOK362iJua3\")\n" + }, + "group": "files", + "name": "Retrieve file", + "path": "retrieve", + "response": "{\n \"id\": \"file-XjGxS3KTG0uNmNOK362iJua3\",\n \"object\": \"file\",\n \"bytes\": 140,\n \"created_at\": 1613779657,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\"\n}\n" + } + } + }, + "/files/{file_id}/content": { + "get": { + "operationId": "downloadFile", + "parameters": [ + { + "description": "The ID of the file to use for this request", + "in": "path", + "name": "file_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + }, + "description": "OK" + } + }, + "summary": "Returns the contents of the specified file", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/files/file-XjGxS3KTG0uNmNOK362iJua3/content \\\n -H 'Authorization: Bearer YOUR_API_KEY' > file.jsonl\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.downloadFile(\"file-XjGxS3KTG0uNmNOK362iJua3\");\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\ncontent = openai.File.download(\"file-XjGxS3KTG0uNmNOK362iJua3\")\n" + }, + "group": "files", + "name": "Retrieve file content", + "path": "retrieve-content" + } + } + }, + "/fine-tunes": { + "get": { + "operationId": "listFineTunes", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListFineTunesResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "List your organization's fine-tuning jobs\n", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/fine-tunes \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.listFineTunes();\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.FineTune.list()\n" + }, + "group": "fine-tunes", + "name": "List fine-tunes", + "path": "list", + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n \"object\": \"fine-tune\",\n \"model\": \"curie\",\n \"created_at\": 1614807352,\n \"fine_tuned_model\": null,\n \"hyperparams\": { ... },\n \"organization_id\": \"org-...\",\n \"result_files\": [],\n \"status\": \"pending\",\n \"validation_files\": [],\n \"training_files\": [ { ... } ],\n \"updated_at\": 1614807352,\n },\n { ... },\n { ... }\n ]\n}\n" + } + }, + "post": { + "operationId": "createFineTune", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateFineTuneRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FineTune" + } + } + }, + "description": "OK" + } + }, + "summary": "Creates a job that fine-tunes a specified model from a given dataset.\n\nResponse includes details of the enqueued job including job status and the name of the fine-tuned models once complete.\n\n[Learn more about Fine-tuning](/docs/guides/fine-tuning)\n", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/fine-tunes \\\n -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"training_file\": \"file-XGinujblHPwGLSztz8cPS8XY\"\n}'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createFineTune({\n training_file: \"file-XGinujblHPwGLSztz8cPS8XY\",\n});\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.FineTune.create(training_file=\"file-XGinujblHPwGLSztz8cPS8XY\")\n" + }, + "group": "fine-tunes", + "name": "Create fine-tune", + "path": "create", + "response": "{\n \"id\": \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n \"object\": \"fine-tune\",\n \"model\": \"curie\",\n \"created_at\": 1614807352,\n \"events\": [\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807352,\n \"level\": \"info\",\n \"message\": \"Job enqueued. Waiting for jobs ahead to complete. Queue number: 0.\"\n }\n ],\n \"fine_tuned_model\": null,\n \"hyperparams\": {\n \"batch_size\": 4,\n \"learning_rate_multiplier\": 0.1,\n \"n_epochs\": 4,\n \"prompt_loss_weight\": 0.1,\n },\n \"organization_id\": \"org-...\",\n \"result_files\": [],\n \"status\": \"pending\",\n \"validation_files\": [],\n \"training_files\": [\n {\n \"id\": \"file-XGinujblHPwGLSztz8cPS8XY\",\n \"object\": \"file\",\n \"bytes\": 1547276,\n \"created_at\": 1610062281,\n \"filename\": \"my-data-train.jsonl\",\n \"purpose\": \"fine-tune-train\"\n }\n ],\n \"updated_at\": 1614807352,\n}\n" + } + } + }, + "/fine-tunes/{fine_tune_id}": { + "get": { + "operationId": "retrieveFineTune", + "parameters": [ + { + "description": "The ID of the fine-tune job\n", + "in": "path", + "name": "fine_tune_id", + "required": true, + "schema": { + "example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FineTune" + } + } + }, + "description": "OK" + } + }, + "summary": "Gets info about the fine-tune job.\n\n[Learn more about Fine-tuning](/docs/guides/fine-tuning)\n", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/fine-tunes/ft-AF1WoRqd3aJAHsqc9NY7iL8F \\\n -H \"Authorization: Bearer YOUR_API_KEY\"\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.retrieveFineTune(\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\");\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.FineTune.retrieve(id=\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n" + }, + "group": "fine-tunes", + "name": "Retrieve fine-tune", + "path": "retrieve", + "response": "{\n \"id\": \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n \"object\": \"fine-tune\",\n \"model\": \"curie\",\n \"created_at\": 1614807352,\n \"events\": [\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807352,\n \"level\": \"info\",\n \"message\": \"Job enqueued. Waiting for jobs ahead to complete. Queue number: 0.\"\n },\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807356,\n \"level\": \"info\",\n \"message\": \"Job started.\"\n },\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807861,\n \"level\": \"info\",\n \"message\": \"Uploaded snapshot: curie:ft-acmeco-2021-03-03-21-44-20.\"\n },\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807864,\n \"level\": \"info\",\n \"message\": \"Uploaded result files: file-QQm6ZpqdNwAaVC3aSz5sWwLT.\"\n },\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807864,\n \"level\": \"info\",\n \"message\": \"Job succeeded.\"\n }\n ],\n \"fine_tuned_model\": \"curie:ft-acmeco-2021-03-03-21-44-20\",\n \"hyperparams\": {\n \"batch_size\": 4,\n \"learning_rate_multiplier\": 0.1,\n \"n_epochs\": 4,\n \"prompt_loss_weight\": 0.1,\n },\n \"organization_id\": \"org-...\",\n \"result_files\": [\n {\n \"id\": \"file-QQm6ZpqdNwAaVC3aSz5sWwLT\",\n \"object\": \"file\",\n \"bytes\": 81509,\n \"created_at\": 1614807863,\n \"filename\": \"compiled_results.csv\",\n \"purpose\": \"fine-tune-results\"\n }\n ],\n \"status\": \"succeeded\",\n \"validation_files\": [],\n \"training_files\": [\n {\n \"id\": \"file-XGinujblHPwGLSztz8cPS8XY\",\n \"object\": \"file\",\n \"bytes\": 1547276,\n \"created_at\": 1610062281,\n \"filename\": \"my-data-train.jsonl\",\n \"purpose\": \"fine-tune-train\"\n }\n ],\n \"updated_at\": 1614807865,\n}\n" + } + } + }, + "/fine-tunes/{fine_tune_id}/cancel": { + "post": { + "operationId": "cancelFineTune", + "parameters": [ + { + "description": "The ID of the fine-tune job to cancel\n", + "in": "path", + "name": "fine_tune_id", + "required": true, + "schema": { + "example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FineTune" + } + } + }, + "description": "OK" + } + }, + "summary": "Immediately cancel a fine-tune job.\n", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/fine-tunes/ft-AF1WoRqd3aJAHsqc9NY7iL8F/cancel \\\n -X POST \\\n -H \"Authorization: Bearer YOUR_API_KEY\"\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.cancelFineTune(\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\");\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.FineTune.cancel(id=\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n" + }, + "group": "fine-tunes", + "name": "Cancel fine-tune", + "path": "cancel", + "response": "{\n \"id\": \"ft-xhrpBbvVUzYGo8oUO1FY4nI7\",\n \"object\": \"fine-tune\",\n \"model\": \"curie\",\n \"created_at\": 1614807770,\n \"events\": [ { ... } ],\n \"fine_tuned_model\": null,\n \"hyperparams\": { ... },\n \"organization_id\": \"org-...\",\n \"result_files\": [],\n \"status\": \"cancelled\",\n \"validation_files\": [],\n \"training_files\": [\n {\n \"id\": \"file-XGinujblHPwGLSztz8cPS8XY\",\n \"object\": \"file\",\n \"bytes\": 1547276,\n \"created_at\": 1610062281,\n \"filename\": \"my-data-train.jsonl\",\n \"purpose\": \"fine-tune-train\"\n }\n ],\n \"updated_at\": 1614807789,\n}\n" + } + } + }, + "/fine-tunes/{fine_tune_id}/events": { + "get": { + "operationId": "listFineTuneEvents", + "parameters": [ + { + "description": "The ID of the fine-tune job to get events for.\n", + "in": "path", + "name": "fine_tune_id", + "required": true, + "schema": { + "example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F", + "type": "string" + } + }, + { + "description": "Whether to stream events for the fine-tune job. If set to true,\nevents will be sent as data-only\n[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)\nas they become available. The stream will terminate with a\n`data: [DONE]` message when the job is finished (succeeded, cancelled,\nor failed).\n\nIf set to false, only events generated so far will be returned.\n", + "in": "query", + "name": "stream", + "required": false, + "schema": { + "default": false, + "type": "boolean" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListFineTuneEventsResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Get fine-grained status updates for a fine-tune job.\n", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/fine-tunes/ft-AF1WoRqd3aJAHsqc9NY7iL8F/events \\\n -H \"Authorization: Bearer YOUR_API_KEY\"\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.listFineTuneEvents(\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\");\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.FineTune.list_events(id=\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n" + }, + "group": "fine-tunes", + "name": "List fine-tune events", + "path": "events", + "response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807352,\n \"level\": \"info\",\n \"message\": \"Job enqueued. Waiting for jobs ahead to complete. Queue number: 0.\"\n },\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807356,\n \"level\": \"info\",\n \"message\": \"Job started.\"\n },\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807861,\n \"level\": \"info\",\n \"message\": \"Uploaded snapshot: curie:ft-acmeco-2021-03-03-21-44-20.\"\n },\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807864,\n \"level\": \"info\",\n \"message\": \"Uploaded result files: file-QQm6ZpqdNwAaVC3aSz5sWwLT.\"\n },\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807864,\n \"level\": \"info\",\n \"message\": \"Job succeeded.\"\n }\n ]\n}\n" + } + } + }, + "/images/edits": { + "post": { + "operationId": "createImageEdit", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateImageEditRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImagesResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Creates an edited or extended image given an original image and a prompt.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "beta": true, + "examples": { + "curl": "curl https://api.openai.com/v1/images/edits \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -F image='@otter.png' \\\n -F mask='@mask.png' \\\n -F prompt=\"A cute baby sea otter wearing a beret\" \\\n -F n=2 \\\n -F size=\"1024x1024\"\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createImageEdit(\n fs.createReadStream(\"otter.png\"),\n fs.createReadStream(\"mask.png\"),\n \"A cute baby sea otter wearing a beret\",\n 2,\n \"1024x1024\"\n);\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Image.create_edit(\n image=open(\"otter.png\", \"rb\"),\n mask=open(\"mask.png\", \"rb\"),\n prompt=\"A cute baby sea otter wearing a beret\",\n n=2,\n size=\"1024x1024\"\n)\n" + }, + "group": "images", + "name": "Create image edit", + "path": "create-edit", + "response": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}\n" + } + } + }, + "/images/generations": { + "post": { + "operationId": "createImage", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateImageRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImagesResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Creates an image given a prompt.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "beta": true, + "examples": { + "curl": "curl https://api.openai.com/v1/images/generations \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -d '{\n \"prompt\": \"A cute baby sea otter\",\n \"n\": 2,\n \"size\": \"1024x1024\"\n}'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createImage({\n prompt: \"A cute baby sea otter\",\n n: 2,\n size: \"1024x1024\",\n});\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Image.create(\n prompt=\"A cute baby sea otter\",\n n=2,\n size=\"1024x1024\"\n)\n" + }, + "group": "images", + "name": "Create image", + "parameters": "{\n \"prompt\": \"A cute baby sea otter\",\n \"n\": 2,\n \"size\": \"1024x1024\"\n}\n", + "path": "create", + "response": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}\n" + } + } + }, + "/images/variations": { + "post": { + "operationId": "createImageVariation", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateImageVariationRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImagesResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Creates a variation of a given image.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "beta": true, + "examples": { + "curl": "curl https://api.openai.com/v1/images/variations \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -F image='@otter.png' \\\n -F n=2 \\\n -F size=\"1024x1024\"\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createImageVariation(\n fs.createReadStream(\"otter.png\"),\n 2,\n \"1024x1024\"\n);\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Image.create_variation(\n image=open(\"otter.png\", \"rb\"),\n n=2,\n size=\"1024x1024\"\n)\n" + }, + "group": "images", + "name": "Create image variation", + "path": "create-variation", + "response": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}\n" + } + } + }, + "/models": { + "get": { + "operationId": "listModels", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListModelsResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Lists the currently available models, and provides basic information about each one such as the owner and availability.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/models \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.listModels();\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Model.list()\n" + }, + "group": "models", + "name": "List models", + "path": "list", + "response": "{\n \"data\": [\n {\n \"id\": \"model-id-0\",\n \"object\": \"model\",\n \"owned_by\": \"organization-owner\",\n \"permission\": [...]\n },\n {\n \"id\": \"model-id-1\",\n \"object\": \"model\",\n \"owned_by\": \"organization-owner\",\n \"permission\": [...]\n },\n {\n \"id\": \"model-id-2\",\n \"object\": \"model\",\n \"owned_by\": \"openai\",\n \"permission\": [...]\n },\n ],\n \"object\": \"list\"\n}\n" + } + } + }, + "/models/{model}": { + "delete": { + "operationId": "deleteModel", + "parameters": [ + { + "description": "The model to delete", + "in": "path", + "name": "model", + "required": true, + "schema": { + "example": "curie:ft-acmeco-2021-03-03-21-44-20", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteModelResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Delete a fine-tuned model. You must have the Owner role in your organization.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/models/curie:ft-acmeco-2021-03-03-21-44-20 \\\n -X DELETE \\\n -H \"Authorization: Bearer YOUR_API_KEY\"\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.deleteModel('curie:ft-acmeco-2021-03-03-21-44-20');\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Model.delete(\"curie:ft-acmeco-2021-03-03-21-44-20\")\n" + }, + "group": "fine-tunes", + "name": "Delete fine-tune model", + "path": "delete-model", + "response": "{\n \"id\": \"curie:ft-acmeco-2021-03-03-21-44-20\",\n \"object\": \"model\",\n \"deleted\": true\n}\n" + } + }, + "get": { + "operationId": "retrieveModel", + "parameters": [ + { + "description": "The ID of the model to use for this request", + "in": "path", + "name": "model", + "required": true, + "schema": { + "example": "text-davinci-001", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Model" + } + } + }, + "description": "OK" + } + }, + "summary": "Retrieves a model instance, providing basic information about the model such as the owner and permissioning.", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/models/VAR_model_id \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.retrieveModel(\"VAR_model_id\");\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Model.retrieve(\"VAR_model_id\")\n" + }, + "group": "models", + "name": "Retrieve model", + "path": "retrieve", + "response": "{\n \"id\": \"VAR_model_id\",\n \"object\": \"model\",\n \"owned_by\": \"openai\",\n \"permission\": [...]\n}\n" + } + } + }, + "/moderations": { + "post": { + "operationId": "createModeration", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateModerationRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateModerationResponse" + } + } + }, + "description": "OK" + } + }, + "summary": "Classifies if text violates OpenAI's Content Policy", + "tags": [ + "OpenAI" + ], + "x-oaiMeta": { + "examples": { + "curl": "curl https://api.openai.com/v1/moderations \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -d '{\n \"input\": \"I want to kill them.\"\n}'\n", + "node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createModeration({\n input: \"I want to kill them.\",\n});\n", + "python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Moderation.create(\n input=\"I want to kill them.\",\n)\n" + }, + "group": "moderations", + "name": "Create moderation", + "parameters": "{\n \"input\": \"I want to kill them.\"\n}\n", + "path": "create", + "response": "{\n \"id\": \"modr-5MWoLO\",\n \"model\": \"text-moderation-001\",\n \"results\": [\n {\n \"categories\": {\n \"hate\": false,\n \"hate/threatening\": true,\n \"self-harm\": false,\n \"sexual\": false,\n \"sexual/minors\": false,\n \"violence\": true,\n \"violence/graphic\": false\n },\n \"category_scores\": {\n \"hate\": 0.22714105248451233,\n \"hate/threatening\": 0.4132447838783264,\n \"self-harm\": 0.005232391878962517,\n \"sexual\": 0.01407341007143259,\n \"sexual/minors\": 0.0038522258400917053,\n \"violence\": 0.9223177433013916,\n \"violence/graphic\": 0.036865197122097015\n },\n \"flagged\": true\n }\n ]\n}\n" + } + } + } + }, + "components": { + "schemas": { + "ChatCompletionRequestMessage": { + "properties": { + "content": { + "description": "The contents of the message", + "type": "string" + }, + "name": { + "description": "The name of the user in a multi-user chat", + "type": "string" + }, + "role": { + "description": "The role of the author of this message.", + "enum": [ + "system", + "user", + "assistant" + ], + "type": "string" + } + }, + "required": [ + "role", + "content" + ], + "type": "object" + }, + "ChatCompletionResponseMessage": { + "properties": { + "content": { + "description": "The contents of the message", + "type": "string" + }, + "role": { + "description": "The role of the author of this message.", + "enum": [ + "system", + "user", + "assistant" + ], + "type": "string" + } + }, + "required": [ + "role", + "content" + ], + "type": "object" + }, + "CreateAnswerRequest": { + "additionalProperties": false, + "properties": { + "documents": { + "description": "List of documents from which the answer for the input `question` should be derived. If this is an empty list, the question will be answered based on the question-answer examples.\n\nYou should specify either `documents` or a `file`, but not both.\n", + "example": "['Japan is an island country in East Asia, located in the northwest Pacific Ocean.', 'Tokyo is the capital and most populous prefecture of Japan.']", + "items": { + "type": "string" + }, + "maxItems": 200, + "nullable": true, + "type": "array" + }, + "examples": { + "description": "List of (question, answer) pairs that will help steer the model towards the tone and answer format you'd like. We recommend adding 2 to 3 examples.", + "example": "[['What is the capital of Canada?', 'Ottawa'], ['Which province is Ottawa in?', 'Ontario']]", + "items": { + "items": { + "minLength": 1, + "type": "string" + }, + "maxItems": 2, + "minItems": 2, + "type": "array" + }, + "maxItems": 200, + "minItems": 1, + "type": "array" + }, + "examples_context": { + "description": "A text snippet containing the contextual information used to generate the answers for the `examples` you provide.", + "example": "Ottawa, Canada's capital, is located in the east of southern Ontario, near the city of Montréal and the U.S. border.", + "type": "string" + }, + "expand": { + "default": [], + "description": "If an object name is in the list, we provide the full information of the object; otherwise, we only provide the object ID. Currently we support `completion` and `file` objects for expansion.", + "items": {}, + "nullable": true, + "type": "array" + }, + "file": { + "description": "The ID of an uploaded file that contains documents to search over. See [upload file](/docs/api-reference/files/upload) for how to upload a file of the desired format and purpose.\n\nYou should specify either `documents` or a `file`, but not both.\n", + "nullable": true, + "type": "string" + }, + "logit_bias": { + "$ref": "#/components/schemas/CreateCompletionRequest/properties/logit_bias" + }, + "logprobs": { + "default": null, + "description": "Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response.\n\nThe maximum value for `logprobs` is 5. If you need more than this, please contact us through our [Help center](https://help.openai.com) and describe your use case.\n\nWhen `logprobs` is set, `completion` will be automatically added into `expand` to get the logprobs.\n", + "maximum": 5, + "minimum": 0, + "nullable": true, + "type": "integer" + }, + "max_rerank": { + "default": 200, + "description": "The maximum number of documents to be ranked by [Search](/docs/api-reference/searches/create) when using `file`. Setting it to a higher value leads to improved accuracy but with increased latency and cost.", + "nullable": true, + "type": "integer" + }, + "max_tokens": { + "default": 16, + "description": "The maximum number of tokens allowed for the generated answer", + "nullable": true, + "type": "integer" + }, + "model": { + "description": "ID of the model to use for completion. You can select one of `ada`, `babbage`, `curie`, or `davinci`.", + "type": "string" + }, + "n": { + "default": 1, + "description": "How many answers to generate for each question.", + "maximum": 10, + "minimum": 1, + "nullable": true, + "type": "integer" + }, + "question": { + "description": "Question to get answered.", + "example": "What is the capital of Japan?", + "minLength": 1, + "type": "string" + }, + "return_metadata": { + "$ref": "#/components/schemas/CreateSearchRequest/properties/return_metadata" + }, + "return_prompt": { + "default": false, + "description": "If set to `true`, the returned JSON will include a \"prompt\" field containing the final prompt that was used to request a completion. This is mainly useful for debugging purposes.", + "nullable": true, + "type": "boolean" + }, + "search_model": { + "default": "ada", + "description": "ID of the model to use for [Search](/docs/api-reference/searches/create). You can select one of `ada`, `babbage`, `curie`, or `davinci`.", + "nullable": true, + "type": "string" + }, + "stop": { + "default": null, + "description": "Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.\n", + "nullable": true, + "oneOf": [ + { + "default": "<|endoftext|>", + "example": "\n", + "type": "string" + }, + { + "items": { + "example": "[\"\\n\"]", + "type": "string" + }, + "maxItems": 4, + "minItems": 1, + "type": "array" + } + ] + }, + "temperature": { + "default": 0, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.", + "nullable": true, + "type": "number" + }, + "user": { + "$ref": "#/components/schemas/CreateCompletionRequest/properties/user" + } + }, + "required": [ + "model", + "question", + "examples", + "examples_context" + ], + "type": "object" + }, + "CreateAnswerResponse": { + "properties": { + "answers": { + "items": { + "type": "string" + }, + "type": "array" + }, + "completion": { + "type": "string" + }, + "model": { + "type": "string" + }, + "object": { + "type": "string" + }, + "search_model": { + "type": "string" + }, + "selected_documents": { + "items": { + "properties": { + "document": { + "type": "integer" + }, + "text": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + }, + "type": "object" + }, + "CreateChatCompletionRequest": { + "properties": { + "frequency_penalty": { + "default": 0, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.\n\n[See more information about frequency and presence penalties.](/docs/api-reference/parameter-details)\n", + "maximum": 2, + "minimum": -2, + "nullable": true, + "type": "number" + }, + "logit_bias": { + "default": null, + "description": "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a json object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n", + "nullable": true, + "type": "object", + "x-oaiTypeLabel": "map" + }, + "max_tokens": { + "default": "inf", + "description": "The maximum number of tokens allowed for the generated answer. By default, the number of tokens the model can return will be (4096 - prompt tokens).\n", + "type": "integer" + }, + "messages": { + "description": "The messages to generate chat completions for, in the [chat format](/docs/guides/chat/introduction).", + "items": { + "$ref": "#/components/schemas/ChatCompletionRequestMessage" + }, + "minItems": 1, + "type": "array" + }, + "model": { + "description": "ID of the model to use. Currently, only `gpt-3.5-turbo` and `gpt-3.5-turbo-0301` are supported.", + "type": "string" + }, + "n": { + "default": 1, + "description": "How many chat completion choices to generate for each input message.", + "example": 1, + "maximum": 128, + "minimum": 1, + "nullable": true, + "type": "integer" + }, + "presence_penalty": { + "default": 0, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n\n[See more information about frequency and presence penalties.](/docs/api-reference/parameter-details)\n", + "maximum": 2, + "minimum": -2, + "nullable": true, + "type": "number" + }, + "stop": { + "default": null, + "description": "Up to 4 sequences where the API will stop generating further tokens.\n", + "oneOf": [ + { + "nullable": true, + "type": "string" + }, + { + "items": { + "type": "string" + }, + "maxItems": 4, + "minItems": 1, + "type": "array" + } + ] + }, + "stream": { + "default": false, + "description": "If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message.\n", + "nullable": true, + "type": "boolean" + }, + "temperature": { + "default": 1, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n", + "example": 1, + "maximum": 2, + "minimum": 0, + "nullable": true, + "type": "number" + }, + "top_p": { + "default": 1, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n", + "example": 1, + "maximum": 1, + "minimum": 0, + "nullable": true, + "type": "number" + }, + "user": { + "$ref": "#/components/schemas/CreateCompletionRequest/properties/user" + } + }, + "required": [ + "model", + "messages" + ], + "type": "object" + }, + "CreateChatCompletionResponse": { + "properties": { + "choices": { + "items": { + "properties": { + "finish_reason": { + "type": "string" + }, + "index": { + "type": "integer" + }, + "message": { + "$ref": "#/components/schemas/ChatCompletionResponseMessage" + } + }, + "type": "object" + }, + "type": "array" + }, + "created": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "model": { + "type": "string" + }, + "object": { + "type": "string" + }, + "usage": { + "properties": { + "completion_tokens": { + "type": "integer" + }, + "prompt_tokens": { + "type": "integer" + }, + "total_tokens": { + "type": "integer" + } + }, + "required": [ + "prompt_tokens", + "completion_tokens", + "total_tokens" + ], + "type": "object" + } + }, + "required": [ + "id", + "object", + "created", + "model", + "choices" + ], + "type": "object" + }, + "CreateClassificationRequest": { + "additionalProperties": false, + "properties": { + "examples": { + "description": "A list of examples with labels, in the following format:\n\n`[[\"The movie is so interesting.\", \"Positive\"], [\"It is quite boring.\", \"Negative\"], ...]`\n\nAll the label strings will be normalized to be capitalized.\n\nYou should specify either `examples` or `file`, but not both.\n", + "example": "[['Do not see this film.', 'Negative'], ['Smart, provocative and blisteringly funny.', 'Positive']]", + "items": { + "items": { + "minLength": 1, + "type": "string" + }, + "maxItems": 2, + "minItems": 2, + "type": "array" + }, + "maxItems": 200, + "minItems": 2, + "nullable": true, + "type": "array" + }, + "expand": { + "$ref": "#/components/schemas/CreateAnswerRequest/properties/expand" + }, + "file": { + "description": "The ID of the uploaded file that contains training examples. See [upload file](/docs/api-reference/files/upload) for how to upload a file of the desired format and purpose.\n\nYou should specify either `examples` or `file`, but not both.\n", + "nullable": true, + "type": "string" + }, + "labels": { + "default": null, + "description": "The set of categories being classified. If not specified, candidate labels will be automatically collected from the examples you provide. All the label strings will be normalized to be capitalized.", + "example": [ + "Positive", + "Negative" + ], + "items": { + "type": "string" + }, + "maxItems": 200, + "minItems": 2, + "nullable": true, + "type": "array" + }, + "logit_bias": { + "$ref": "#/components/schemas/CreateCompletionRequest/properties/logit_bias" + }, + "logprobs": { + "$ref": "#/components/schemas/CreateAnswerRequest/properties/logprobs" + }, + "max_examples": { + "default": 200, + "description": "The maximum number of examples to be ranked by [Search](/docs/api-reference/searches/create) when using `file`. Setting it to a higher value leads to improved accuracy but with increased latency and cost.", + "nullable": true, + "type": "integer" + }, + "model": { + "$ref": "#/components/schemas/CreateCompletionRequest/properties/model" + }, + "query": { + "description": "Query to be classified.", + "example": "The plot is not very attractive.", + "minLength": 1, + "type": "string" + }, + "return_metadata": { + "$ref": "#/components/schemas/CreateSearchRequest/properties/return_metadata" + }, + "return_prompt": { + "$ref": "#/components/schemas/CreateAnswerRequest/properties/return_prompt" + }, + "search_model": { + "$ref": "#/components/schemas/CreateAnswerRequest/properties/search_model" + }, + "temperature": { + "default": 0, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.", + "example": 0, + "maximum": 2, + "minimum": 0, + "nullable": true, + "type": "number" + }, + "user": { + "$ref": "#/components/schemas/CreateCompletionRequest/properties/user" + } + }, + "required": [ + "model", + "query" + ], + "type": "object" + }, + "CreateClassificationResponse": { + "properties": { + "completion": { + "type": "string" + }, + "label": { + "type": "string" + }, + "model": { + "type": "string" + }, + "object": { + "type": "string" + }, + "search_model": { + "type": "string" + }, + "selected_examples": { + "items": { + "properties": { + "document": { + "type": "integer" + }, + "label": { + "type": "string" + }, + "text": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + }, + "type": "object" + }, + "CreateCompletionRequest": { + "properties": { + "best_of": { + "default": 1, + "description": "Generates `best_of` completions server-side and returns the \"best\" (the one with the highest log probability per token). Results cannot be streamed.\n\nWhen used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n", + "maximum": 20, + "minimum": 0, + "nullable": true, + "type": "integer" + }, + "echo": { + "default": false, + "description": "Echo back the prompt in addition to the completion\n", + "nullable": true, + "type": "boolean" + }, + "frequency_penalty": { + "default": 0, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.\n\n[See more information about frequency and presence penalties.](/docs/api-reference/parameter-details)\n", + "maximum": 2, + "minimum": -2, + "nullable": true, + "type": "number" + }, + "logit_bias": { + "default": null, + "description": "Modify the likelihood of specified tokens appearing in the completion.\n\nAccepts a json object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n\nAs an example, you can pass `{\"50256\": -100}` to prevent the <|endoftext|> token from being generated.\n", + "nullable": true, + "type": "object", + "x-oaiTypeLabel": "map" + }, + "logprobs": { + "default": null, + "description": "Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response.\n\nThe maximum value for `logprobs` is 5. If you need more than this, please contact us through our [Help center](https://help.openai.com) and describe your use case.\n", + "maximum": 5, + "minimum": 0, + "nullable": true, + "type": "integer" + }, + "max_tokens": { + "default": 16, + "description": "The maximum number of [tokens](/tokenizer) to generate in the completion.\n\nThe token count of your prompt plus `max_tokens` cannot exceed the model's context length. Most models have a context length of 2048 tokens (except for the newest models, which support 4096).\n", + "example": 16, + "minimum": 0, + "nullable": true, + "type": "integer" + }, + "model": { + "description": "ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them.", + "type": "string" + }, + "n": { + "default": 1, + "description": "How many completions to generate for each prompt.\n\n**Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.\n", + "example": 1, + "maximum": 128, + "minimum": 1, + "nullable": true, + "type": "integer" + }, + "presence_penalty": { + "default": 0, + "description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n\n[See more information about frequency and presence penalties.](/docs/api-reference/parameter-details)\n", + "maximum": 2, + "minimum": -2, + "nullable": true, + "type": "number" + }, + "prompt": { + "default": "<|endoftext|>", + "description": "The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.\n\nNote that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.\n", + "nullable": true, + "oneOf": [ + { + "default": "", + "example": "This is a test.", + "type": "string" + }, + { + "items": { + "default": "", + "example": "This is a test.", + "type": "string" + }, + "type": "array" + }, + { + "example": "[1212, 318, 257, 1332, 13]", + "items": { + "type": "integer" + }, + "minItems": 1, + "type": "array" + }, + { + "example": "[[1212, 318, 257, 1332, 13]]", + "items": { + "items": { + "type": "integer" + }, + "minItems": 1, + "type": "array" + }, + "minItems": 1, + "type": "array" + } + ] + }, + "stop": { + "default": null, + "description": "Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.\n", + "nullable": true, + "oneOf": [ + { + "default": "<|endoftext|>", + "example": "\n", + "nullable": true, + "type": "string" + }, + { + "items": { + "example": "[\"\\n\"]", + "type": "string" + }, + "maxItems": 4, + "minItems": 1, + "type": "array" + } + ] + }, + "stream": { + "default": false, + "description": "Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message.\n", + "nullable": true, + "type": "boolean" + }, + "suffix": { + "default": null, + "description": "The suffix that comes after a completion of inserted text.", + "example": "test.", + "nullable": true, + "type": "string" + }, + "temperature": { + "default": 1, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n", + "example": 1, + "maximum": 2, + "minimum": 0, + "nullable": true, + "type": "number" + }, + "top_p": { + "default": 1, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n", + "example": 1, + "maximum": 1, + "minimum": 0, + "nullable": true, + "type": "number" + }, + "user": { + "description": "A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\n", + "example": "user-1234", + "type": "string" + } + }, + "required": [ + "model" + ], + "type": "object" + }, + "CreateCompletionResponse": { + "properties": { + "choices": { + "items": { + "properties": { + "finish_reason": { + "type": "string" + }, + "index": { + "type": "integer" + }, + "logprobs": { + "nullable": true, + "properties": { + "text_offset": { + "items": { + "type": "integer" + }, + "type": "array" + }, + "token_logprobs": { + "items": { + "type": "number" + }, + "type": "array" + }, + "tokens": { + "items": { + "type": "string" + }, + "type": "array" + }, + "top_logprobs": { + "items": { + "type": "object" + }, + "type": "array" + } + }, + "type": "object" + }, + "text": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + }, + "created": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "model": { + "type": "string" + }, + "object": { + "type": "string" + }, + "usage": { + "properties": { + "completion_tokens": { + "type": "integer" + }, + "prompt_tokens": { + "type": "integer" + }, + "total_tokens": { + "type": "integer" + } + }, + "required": [ + "prompt_tokens", + "completion_tokens", + "total_tokens" + ], + "type": "object" + } + }, + "required": [ + "id", + "object", + "created", + "model", + "choices" + ], + "type": "object" + }, + "CreateEditRequest": { + "properties": { + "input": { + "default": "", + "description": "The input text to use as a starting point for the edit.", + "example": "What day of the wek is it?", + "nullable": true, + "type": "string" + }, + "instruction": { + "description": "The instruction that tells the model how to edit the prompt.", + "example": "Fix the spelling mistakes.", + "type": "string" + }, + "model": { + "description": "ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint.", + "type": "string" + }, + "n": { + "default": 1, + "description": "How many edits to generate for the input and instruction.", + "example": 1, + "maximum": 20, + "minimum": 1, + "nullable": true, + "type": "integer" + }, + "temperature": { + "default": 1, + "description": "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\n\nWe generally recommend altering this or `top_p` but not both.\n", + "example": 1, + "maximum": 2, + "minimum": 0, + "nullable": true, + "type": "number" + }, + "top_p": { + "default": 1, + "description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n\nWe generally recommend altering this or `temperature` but not both.\n", + "example": 1, + "maximum": 1, + "minimum": 0, + "nullable": true, + "type": "number" + } + }, + "required": [ + "model", + "instruction" + ], + "type": "object" + }, + "CreateEditResponse": { + "properties": { + "choices": { + "items": { + "properties": { + "finish_reason": { + "type": "string" + }, + "index": { + "type": "integer" + }, + "logprobs": { + "nullable": true, + "properties": { + "text_offset": { + "items": { + "type": "integer" + }, + "type": "array" + }, + "token_logprobs": { + "items": { + "type": "number" + }, + "type": "array" + }, + "tokens": { + "items": { + "type": "string" + }, + "type": "array" + }, + "top_logprobs": { + "items": { + "type": "object" + }, + "type": "array" + } + }, + "type": "object" + }, + "text": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + }, + "created": { + "type": "integer" + }, + "object": { + "type": "string" + }, + "usage": { + "properties": { + "completion_tokens": { + "type": "integer" + }, + "prompt_tokens": { + "type": "integer" + }, + "total_tokens": { + "type": "integer" + } + }, + "required": [ + "prompt_tokens", + "completion_tokens", + "total_tokens" + ], + "type": "object" + } + }, + "required": [ + "object", + "created", + "choices", + "usage" + ], + "type": "object" + }, + "CreateEmbeddingRequest": { + "additionalProperties": false, + "properties": { + "input": { + "description": "Input text to get embeddings for, encoded as a string or array of tokens. To get embeddings for multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed 8192 tokens in length.\n", + "example": "The quick brown fox jumped over the lazy dog", + "oneOf": [ + { + "default": "", + "example": "This is a test.", + "type": "string" + }, + { + "items": { + "default": "", + "example": "This is a test.", + "type": "string" + }, + "type": "array" + }, + { + "example": "[1212, 318, 257, 1332, 13]", + "items": { + "type": "integer" + }, + "minItems": 1, + "type": "array" + }, + { + "example": "[[1212, 318, 257, 1332, 13]]", + "items": { + "items": { + "type": "integer" + }, + "minItems": 1, + "type": "array" + }, + "minItems": 1, + "type": "array" + } + ] + }, + "model": { + "$ref": "#/components/schemas/CreateCompletionRequest/properties/model" + }, + "user": { + "$ref": "#/components/schemas/CreateCompletionRequest/properties/user" + } + }, + "required": [ + "model", + "input" + ], + "type": "object" + }, + "CreateEmbeddingResponse": { + "properties": { + "data": { + "items": { + "properties": { + "embedding": { + "items": { + "type": "number" + }, + "type": "array" + }, + "index": { + "type": "integer" + }, + "object": { + "type": "string" + } + }, + "required": [ + "index", + "object", + "embedding" + ], + "type": "object" + }, + "type": "array" + }, + "model": { + "type": "string" + }, + "object": { + "type": "string" + }, + "usage": { + "properties": { + "prompt_tokens": { + "type": "integer" + }, + "total_tokens": { + "type": "integer" + } + }, + "required": [ + "prompt_tokens", + "total_tokens" + ], + "type": "object" + } + }, + "required": [ + "object", + "model", + "data", + "usage" + ], + "type": "object" + }, + "CreateFileRequest": { + "additionalProperties": false, + "properties": { + "file": { + "description": "Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded.\n\nIf the `purpose` is set to \"fine-tune\", each line is a JSON record with \"prompt\" and \"completion\" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).\n", + "format": "binary", + "type": "string" + }, + "purpose": { + "description": "The intended purpose of the uploaded documents.\n\nUse \"fine-tune\" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.\n", + "type": "string" + } + }, + "required": [ + "file", + "purpose" + ], + "type": "object" + }, + "CreateFineTuneRequest": { + "properties": { + "batch_size": { + "default": null, + "description": "The batch size to use for training. The batch size is the number of\ntraining examples used to train a single forward and backward pass.\n\nBy default, the batch size will be dynamically configured to be\n~0.2% of the number of examples in the training set, capped at 256 -\nin general, we've found that larger batch sizes tend to work better\nfor larger datasets.\n", + "nullable": true, + "type": "integer" + }, + "classification_betas": { + "default": null, + "description": "If this is provided, we calculate F-beta scores at the specified\nbeta values. The F-beta score is a generalization of F-1 score.\nThis is only used for binary classification.\n\nWith a beta of 1 (i.e. the F-1 score), precision and recall are\ngiven the same weight. A larger beta score puts more weight on\nrecall and less on precision. A smaller beta score puts more weight\non precision and less on recall.\n", + "example": [ + 0.6, + 1, + 1.5, + 2 + ], + "items": { + "type": "number" + }, + "nullable": true, + "type": "array" + }, + "classification_n_classes": { + "default": null, + "description": "The number of classes in a classification task.\n\nThis parameter is required for multiclass classification.\n", + "nullable": true, + "type": "integer" + }, + "classification_positive_class": { + "default": null, + "description": "The positive class in binary classification.\n\nThis parameter is needed to generate precision, recall, and F1\nmetrics when doing binary classification.\n", + "nullable": true, + "type": "string" + }, + "compute_classification_metrics": { + "default": false, + "description": "If set, we calculate classification-specific metrics such as accuracy\nand F-1 score using the validation set at the end of every epoch.\nThese metrics can be viewed in the [results file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model).\n\nIn order to compute classification metrics, you must provide a\n`validation_file`. Additionally, you must\nspecify `classification_n_classes` for multiclass classification or\n`classification_positive_class` for binary classification.\n", + "nullable": true, + "type": "boolean" + }, + "learning_rate_multiplier": { + "default": null, + "description": "The learning rate multiplier to use for training.\nThe fine-tuning learning rate is the original learning rate used for\npretraining multiplied by this value.\n\nBy default, the learning rate multiplier is the 0.05, 0.1, or 0.2\ndepending on final `batch_size` (larger learning rates tend to\nperform better with larger batch sizes). We recommend experimenting\nwith values in the range 0.02 to 0.2 to see what produces the best\nresults.\n", + "nullable": true, + "type": "number" + }, + "model": { + "default": "curie", + "description": "The name of the base model to fine-tune. You can select one of \"ada\",\n\"babbage\", \"curie\", \"davinci\", or a fine-tuned model created after 2022-04-21.\nTo learn more about these models, see the\n[Models](https://platform.openai.com/docs/models) documentation.\n", + "nullable": true, + "type": "string" + }, + "n_epochs": { + "default": 4, + "description": "The number of epochs to train the model for. An epoch refers to one\nfull cycle through the training dataset.\n", + "nullable": true, + "type": "integer" + }, + "prompt_loss_weight": { + "default": 0.01, + "description": "The weight to use for loss on the prompt tokens. This controls how\nmuch the model tries to learn to generate the prompt (as compared\nto the completion which always has a weight of 1.0), and can add\na stabilizing effect to training when completions are short.\n\nIf prompts are extremely long (relative to completions), it may make\nsense to reduce this weight so as to avoid over-prioritizing\nlearning the prompt.\n", + "nullable": true, + "type": "number" + }, + "suffix": { + "default": null, + "description": "A string of up to 40 characters that will be added to your fine-tuned model name.\n\nFor example, a `suffix` of \"custom-model-name\" would produce a model name like `ada:ft-your-org:custom-model-name-2022-02-15-04-21-04`.\n", + "maxLength": 40, + "minLength": 1, + "nullable": true, + "type": "string" + }, + "training_file": { + "description": "The ID of an uploaded file that contains training data.\n\nSee [upload file](/docs/api-reference/files/upload) for how to upload a file.\n\nYour dataset must be formatted as a JSONL file, where each training\nexample is a JSON object with the keys \"prompt\" and \"completion\".\nAdditionally, you must upload your file with the purpose `fine-tune`.\n\nSee the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details.\n", + "example": "file-ajSREls59WBbvgSzJSVWxMCB", + "type": "string" + }, + "validation_file": { + "description": "The ID of an uploaded file that contains validation data.\n\nIf you provide this file, the data is used to generate validation\nmetrics periodically during fine-tuning. These metrics can be viewed in\nthe [fine-tuning results file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model).\nYour train and validation data should be mutually exclusive.\n\nYour dataset must be formatted as a JSONL file, where each validation\nexample is a JSON object with the keys \"prompt\" and \"completion\".\nAdditionally, you must upload your file with the purpose `fine-tune`.\n\nSee the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details.\n", + "example": "file-XjSREls59WBbvgSzJSVWxMCa", + "nullable": true, + "type": "string" + } + }, + "required": [ + "training_file" + ], + "type": "object" + }, + "CreateImageEditRequest": { + "properties": { + "image": { + "description": "The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask.", + "format": "binary", + "type": "string" + }, + "mask": { + "description": "An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.", + "format": "binary", + "type": "string" + }, + "n": { + "$ref": "#/components/schemas/CreateImageRequest/properties/n" + }, + "prompt": { + "description": "A text description of the desired image(s). The maximum length is 1000 characters.", + "example": "A cute baby sea otter wearing a beret", + "type": "string" + }, + "response_format": { + "$ref": "#/components/schemas/CreateImageRequest/properties/response_format" + }, + "size": { + "$ref": "#/components/schemas/CreateImageRequest/properties/size" + }, + "user": { + "$ref": "#/components/schemas/CreateCompletionRequest/properties/user" + } + }, + "required": [ + "prompt", + "image" + ], + "type": "object" + }, + "CreateImageRequest": { + "properties": { + "n": { + "default": 1, + "description": "The number of images to generate. Must be between 1 and 10.", + "example": 1, + "maximum": 10, + "minimum": 1, + "nullable": true, + "type": "integer" + }, + "prompt": { + "description": "A text description of the desired image(s). The maximum length is 1000 characters.", + "example": "A cute baby sea otter", + "type": "string" + }, + "response_format": { + "default": "url", + "description": "The format in which the generated images are returned. Must be one of `url` or `b64_json`.", + "enum": [ + "url", + "b64_json" + ], + "example": "url", + "nullable": true, + "type": "string" + }, + "size": { + "default": "1024x1024", + "description": "The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.", + "enum": [ + "256x256", + "512x512", + "1024x1024" + ], + "example": "1024x1024", + "nullable": true, + "type": "string" + }, + "user": { + "$ref": "#/components/schemas/CreateCompletionRequest/properties/user" + } + }, + "required": [ + "prompt" + ], + "type": "object" + }, + "CreateImageVariationRequest": { + "properties": { + "image": { + "description": "The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.", + "format": "binary", + "type": "string" + }, + "n": { + "$ref": "#/components/schemas/CreateImageRequest/properties/n" + }, + "response_format": { + "$ref": "#/components/schemas/CreateImageRequest/properties/response_format" + }, + "size": { + "$ref": "#/components/schemas/CreateImageRequest/properties/size" + }, + "user": { + "$ref": "#/components/schemas/CreateCompletionRequest/properties/user" + } + }, + "required": [ + "image" + ], + "type": "object" + }, + "CreateModerationRequest": { + "properties": { + "input": { + "description": "The input text to classify", + "oneOf": [ + { + "default": "", + "example": "I want to kill them.", + "type": "string" + }, + { + "items": { + "default": "", + "example": "I want to kill them.", + "type": "string" + }, + "type": "array" + } + ] + }, + "model": { + "default": "text-moderation-latest", + "description": "Two content moderations models are available: `text-moderation-stable` and `text-moderation-latest`.\n\nThe default is `text-moderation-latest` which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use `text-moderation-stable`, we will provide advanced notice before updating the model. Accuracy of `text-moderation-stable` may be slightly lower than for `text-moderation-latest`.\n", + "example": "text-moderation-stable", + "nullable": false, + "type": "string" + } + }, + "required": [ + "input" + ], + "type": "object" + }, + "CreateModerationResponse": { + "properties": { + "id": { + "type": "string" + }, + "model": { + "type": "string" + }, + "results": { + "items": { + "properties": { + "categories": { + "properties": { + "hate": { + "type": "boolean" + }, + "hate/threatening": { + "type": "boolean" + }, + "self-harm": { + "type": "boolean" + }, + "sexual": { + "type": "boolean" + }, + "sexual/minors": { + "type": "boolean" + }, + "violence": { + "type": "boolean" + }, + "violence/graphic": { + "type": "boolean" + } + }, + "required": [ + "hate", + "hate/threatening", + "self-harm", + "sexual", + "sexual/minors", + "violence", + "violence/graphic" + ], + "type": "object" + }, + "category_scores": { + "properties": { + "hate": { + "type": "number" + }, + "hate/threatening": { + "type": "number" + }, + "self-harm": { + "type": "number" + }, + "sexual": { + "type": "number" + }, + "sexual/minors": { + "type": "number" + }, + "violence": { + "type": "number" + }, + "violence/graphic": { + "type": "number" + } + }, + "required": [ + "hate", + "hate/threatening", + "self-harm", + "sexual", + "sexual/minors", + "violence", + "violence/graphic" + ], + "type": "object" + }, + "flagged": { + "type": "boolean" + } + }, + "required": [ + "flagged", + "categories", + "category_scores" + ], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "id", + "model", + "results" + ], + "type": "object" + }, + "CreateSearchRequest": { + "properties": { + "documents": { + "description": "Up to 200 documents to search over, provided as a list of strings.\n\nThe maximum document length (in tokens) is 2034 minus the number of tokens in the query.\n\nYou should specify either `documents` or a `file`, but not both.\n", + "example": "['White House', 'hospital', 'school']", + "items": { + "type": "string" + }, + "maxItems": 200, + "minItems": 1, + "nullable": true, + "type": "array" + }, + "file": { + "description": "The ID of an uploaded file that contains documents to search over.\n\nYou should specify either `documents` or a `file`, but not both.\n", + "nullable": true, + "type": "string" + }, + "max_rerank": { + "default": 200, + "description": "The maximum number of documents to be re-ranked and returned by search.\n\nThis flag only takes effect when `file` is set.\n", + "minimum": 1, + "nullable": true, + "type": "integer" + }, + "query": { + "description": "Query to search against the documents.", + "example": "the president", + "minLength": 1, + "type": "string" + }, + "return_metadata": { + "default": false, + "description": "A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a \"metadata\" field.\n\nThis flag only takes effect when `file` is set.\n", + "nullable": true, + "type": "boolean" + }, + "user": { + "$ref": "#/components/schemas/CreateCompletionRequest/properties/user" + } + }, + "required": [ + "query" + ], + "type": "object" + }, + "CreateSearchResponse": { + "properties": { + "data": { + "items": { + "properties": { + "document": { + "type": "integer" + }, + "object": { + "type": "string" + }, + "score": { + "type": "number" + } + }, + "type": "object" + }, + "type": "array" + }, + "model": { + "type": "string" + }, + "object": { + "type": "string" + } + }, + "type": "object" + }, + "CreateTranscriptionRequest": { + "additionalProperties": false, + "properties": { + "file": { + "description": "The audio file to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.\n", + "format": "binary", + "type": "string" + }, + "language": { + "description": "The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency.\n", + "type": "string" + }, + "model": { + "description": "ID of the model to use. Only `whisper-1` is currently available.\n", + "type": "string" + }, + "prompt": { + "description": "An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the audio language.\n", + "type": "string" + }, + "response_format": { + "default": "json", + "description": "The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.\n", + "type": "string" + }, + "temperature": { + "default": 0, + "description": "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n", + "type": "number" + } + }, + "required": [ + "file", + "model" + ], + "type": "object" + }, + "CreateTranscriptionResponse": { + "properties": { + "text": { + "type": "string" + } + }, + "required": [ + "text" + ], + "type": "object" + }, + "CreateTranslationRequest": { + "additionalProperties": false, + "properties": { + "file": { + "description": "The audio file to translate, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.\n", + "format": "binary", + "type": "string" + }, + "model": { + "description": "ID of the model to use. Only `whisper-1` is currently available.\n", + "type": "string" + }, + "prompt": { + "description": "An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in English.\n", + "type": "string" + }, + "response_format": { + "default": "json", + "description": "The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt.\n", + "type": "string" + }, + "temperature": { + "default": 0, + "description": "The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\n", + "type": "number" + } + }, + "required": [ + "file", + "model" + ], + "type": "object" + }, + "CreateTranslationResponse": { + "properties": { + "text": { + "type": "string" + } + }, + "required": [ + "text" + ], + "type": "object" + }, + "DeleteFileResponse": { + "properties": { + "deleted": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "object": { + "type": "string" + } + }, + "required": [ + "id", + "object", + "deleted" + ], + "type": "object" + }, + "DeleteModelResponse": { + "properties": { + "deleted": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "object": { + "type": "string" + } + }, + "required": [ + "id", + "object", + "deleted" + ], + "type": "object" + }, + "Engine": { + "properties": { + "created": { + "nullable": true, + "type": "integer" + }, + "id": { + "type": "string" + }, + "object": { + "type": "string" + }, + "ready": { + "type": "boolean" + } + }, + "required": [ + "id", + "object", + "created", + "ready" + ], + "title": "Engine" + }, + "FineTune": { + "properties": { + "created_at": { + "type": "integer" + }, + "events": { + "items": { + "$ref": "#/components/schemas/FineTuneEvent" + }, + "type": "array" + }, + "fine_tuned_model": { + "nullable": true, + "type": "string" + }, + "hyperparams": { + "type": "object" + }, + "id": { + "type": "string" + }, + "model": { + "type": "string" + }, + "object": { + "type": "string" + }, + "organization_id": { + "type": "string" + }, + "result_files": { + "items": { + "$ref": "#/components/schemas/OpenAIFile" + }, + "type": "array" + }, + "status": { + "type": "string" + }, + "training_files": { + "items": { + "$ref": "#/components/schemas/OpenAIFile" + }, + "type": "array" + }, + "updated_at": { + "type": "integer" + }, + "validation_files": { + "items": { + "$ref": "#/components/schemas/OpenAIFile" + }, + "type": "array" + } + }, + "required": [ + "id", + "object", + "created_at", + "updated_at", + "model", + "fine_tuned_model", + "organization_id", + "status", + "hyperparams", + "training_files", + "validation_files", + "result_files" + ], + "title": "FineTune" + }, + "FineTuneEvent": { + "properties": { + "created_at": { + "type": "integer" + }, + "level": { + "type": "string" + }, + "message": { + "type": "string" + }, + "object": { + "type": "string" + } + }, + "required": [ + "object", + "created_at", + "level", + "message" + ], + "title": "FineTuneEvent" + }, + "ImagesResponse": { + "properties": { + "created": { + "type": "integer" + }, + "data": { + "items": { + "properties": { + "b64_json": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "created", + "data" + ] + }, + "ListEnginesResponse": { + "properties": { + "data": { + "items": { + "$ref": "#/components/schemas/Engine" + }, + "type": "array" + }, + "object": { + "type": "string" + } + }, + "required": [ + "object", + "data" + ], + "type": "object" + }, + "ListFilesResponse": { + "properties": { + "data": { + "items": { + "$ref": "#/components/schemas/OpenAIFile" + }, + "type": "array" + }, + "object": { + "type": "string" + } + }, + "required": [ + "object", + "data" + ], + "type": "object" + }, + "ListFineTuneEventsResponse": { + "properties": { + "data": { + "items": { + "$ref": "#/components/schemas/FineTuneEvent" + }, + "type": "array" + }, + "object": { + "type": "string" + } + }, + "required": [ + "object", + "data" + ], + "type": "object" + }, + "ListFineTunesResponse": { + "properties": { + "data": { + "items": { + "$ref": "#/components/schemas/FineTune" + }, + "type": "array" + }, + "object": { + "type": "string" + } + }, + "required": [ + "object", + "data" + ], + "type": "object" + }, + "ListModelsResponse": { + "properties": { + "data": { + "items": { + "$ref": "#/components/schemas/Model" + }, + "type": "array" + }, + "object": { + "type": "string" + } + }, + "required": [ + "object", + "data" + ], + "type": "object" + }, + "Model": { + "properties": { + "created": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "object": { + "type": "string" + }, + "owned_by": { + "type": "string" + } + }, + "required": [ + "id", + "object", + "created", + "owned_by" + ], + "title": "Model" + }, + "OpenAIFile": { + "properties": { + "bytes": { + "type": "integer" + }, + "created_at": { + "type": "integer" + }, + "filename": { + "type": "string" + }, + "id": { + "type": "string" + }, + "object": { + "type": "string" + }, + "purpose": { + "type": "string" + }, + "status": { + "type": "string" + }, + "status_details": { + "nullable": true, + "type": "object" + } + }, + "required": [ + "id", + "object", + "bytes", + "created_at", + "filename", + "purpose" + ], + "title": "OpenAIFile" + } + } + }, + "x-oaiMeta": { + "groups": [ + { + "description": "List and describe the various models available in the API. You can refer to the [Models](/docs/models) documentation to understand what models are available and the differences between them.\n", + "id": "models", + "title": "Models" + }, + { + "description": "Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.\n", + "id": "completions", + "title": "Completions" + }, + { + "description": "Given a chat conversation, the model will return a chat completion response.\n", + "id": "chat", + "title": "Chat" + }, + { + "description": "Given a prompt and an instruction, the model will return an edited version of the prompt.\n", + "id": "edits", + "title": "Edits" + }, + { + "description": "Given a prompt and/or an input image, the model will generate a new image.\n\nRelated guide: [Image generation](/docs/guides/images)\n", + "id": "images", + "title": "Images" + }, + { + "description": "Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.\n\nRelated guide: [Embeddings](/docs/guides/embeddings)\n", + "id": "embeddings", + "title": "Embeddings" + }, + { + "description": "Learn how to turn audio into text.\n\nRelated guide: [Speech to text](/docs/guides/speech-to-text)\n", + "id": "audio", + "title": "Audio" + }, + { + "description": "Files are used to upload documents that can be used with features like [Fine-tuning](/docs/api-reference/fine-tunes).\n", + "id": "files", + "title": "Files" + }, + { + "description": "Manage fine-tuning jobs to tailor a model to your specific training data.\n\nRelated guide: [Fine-tune models](/docs/guides/fine-tuning)\n", + "id": "fine-tunes", + "title": "Fine-tunes" + }, + { + "description": "Given a input text, outputs if the model classifies it as violating OpenAI's content policy.\n\nRelated guide: [Moderations](/docs/guides/moderation)\n", + "id": "moderations", + "title": "Moderations" + }, + { + "description": "Given a query and a set of documents or labels, the model ranks each document based on its semantic similarity to the provided query.\n\nRelated guide: [Search](/docs/guides/search)\n", + "id": "searches", + "title": "Searches", + "warning": { + "message": "We’ve developed new methods with better performance. [Learn more](https://help.openai.com/en/articles/6272952-search-transition-guide).", + "title": "This endpoint is deprecated and will be removed on December 3rd, 2022" + } + }, + { + "description": "Given a query and a set of labeled examples, the model will predict the most likely label for the query. Useful as a drop-in replacement for any ML classification or text-to-label task.\n\nRelated guide: [Classification](/docs/guides/classifications)\n", + "id": "classifications", + "title": "Classifications", + "warning": { + "message": "We’ve developed new methods with better performance. [Learn more](https://help.openai.com/en/articles/6272941-classifications-transition-guide).", + "title": "This endpoint is deprecated and will be removed on December 3rd, 2022" + } + }, + { + "description": "Given a question, a set of documents, and some examples, the API generates an answer to the question based on the information in the set of documents. This is useful for question-answering applications on sources of truth, like company documentation or a knowledge base.\n\nRelated guide: [Question answering](/docs/guides/answers)\n", + "id": "answers", + "title": "Answers", + "warning": { + "message": "We’ve developed new methods with better performance. [Learn more](https://help.openai.com/en/articles/6233728-answers-transition-guide).", + "title": "This endpoint is deprecated and will be removed on December 3rd, 2022" + } + }, + { + "description": "These endpoints describe and provide access to the various engines available in the API.", + "id": "engines", + "title": "Engines", + "warning": { + "message": "Please use their replacement, [Models](/docs/api-reference/models), instead. [Learn more](https://help.openai.com/TODO).", + "title": "The Engines endpoints are deprecated." + } + } + ] + } + } \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml b/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml new file mode 100644 index 00000000000..73f52febcad --- /dev/null +++ b/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml @@ -0,0 +1,2485 @@ +interactions: +- request: + body: '{"properties": {"kind": "development", "server": {"managementPortalUri": + ["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"], + "type": "Azure API Management"}, "title": "Public cloud"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic environment create + Connection: + - keep-alive + Content-Length: + - '309' + Content-Type: + - application/json + ParameterSetName: + - -g -s --name --title --kind --server + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-22T17:34:52.812953Z"},"properties":{"title":"Public + cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '691' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:34:52 GMT + etag: + - 04001e85-0000-3300-0000-655e3bbc0000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"description": "CLI Test API", "kind": "rest", "title": + "CLI Test API"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api create + Connection: + - keep-alive + Content-Length: + - '88' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-name --description --kind --title + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100","name":"cli-test-api-100","systemData":{"createdAt":"2023-11-22T17:34:01.033101Z","lastModifiedAt":"2023-11-22T17:34:53.5142499Z"},"properties":{"title":"CLI + Test API","description":"CLI Test API","kind":"rest","lifecycleStage":"design","externalDocumentation":[],"contacts":[],"customProperties":{}}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '527' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:34:53 GMT + etag: + - 3f00d6a5-0000-3300-0000-655e3bbd0000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"title": "cli-test-2023-01-02"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api version create + Connection: + - keep-alive + Content-Length: + - '48' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-name --name --title + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-22T17:34:01.7581196Z","lastModifiedAt":"2023-11-22T17:34:54.3894085Z"},"properties":{"title":"cli-test-2023-01-02","lifecycleStage":"design"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '465' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:34:53 GMT + etag: + - 4d0040bb-0000-3300-0000-655e3bbe0000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"title": "OpenAPI"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api definition create + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-name --version --name --title + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi","name":"cli-test-openapi","systemData":{"createdAt":"2023-11-22T17:32:32.5795832Z","lastModifiedAt":"2023-11-22T17:34:55.0820634Z"},"properties":{"title":"OpenAPI","specification":{"name":"openapi","version":"3.0.0"}}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '509' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:34:54 GMT + etag: + - 00008000-0000-3300-0000-655e3bbf0000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"format": "inline", "specification": {"name": "openapi", "version": "3.0.0"}, + "value": "{\"openapi\": \"3.0.0\", \"info\": {\"title\": \"Cat Facts API\", + \"version\": \"1.0\"}, \"paths\": {\"/breeds\": {\"get\": {\"tags\": [\"Breeds\"], + \"summary\": \"Get a list of breeds\", \"description\": \"Returns a a list of + breeds\", \"operationId\": \"getBreeds\", \"parameters\": [{\"name\": \"limit\", + \"in\": \"query\", \"description\": \"limit the amount of results returned\", + \"required\": false, \"schema\": {\"type\": \"integer\", \"format\": \"int64\"}}], + \"responses\": {\"200\": {\"description\": \"successful operation\", \"content\": + {\"application/json\": {\"schema\": {\"type\": \"array\", \"items\": {\"$ref\": + \"#/components/schemas/Breed\"}}}}}}}}, \"/fact\": {\"get\": {\"tags\": [\"Facts\"], + \"summary\": \"Get Random Fact\", \"description\": \"Returns a random fact\", + \"operationId\": \"getRandomFact\", \"parameters\": [{\"name\": \"max_length\", + \"in\": \"query\", \"description\": \"maximum length of returned fact\", \"required\": + false, \"schema\": {\"type\": \"integer\", \"format\": \"int64\"}}], \"responses\": + {\"200\": {\"description\": \"successful operation\", \"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/CatFact\"}}}}, \"404\": {\"description\": + \"Fact not found\"}}}}, \"/facts\": {\"get\": {\"tags\": [\"Facts\"], \"summary\": + \"Get a list of facts\", \"description\": \"Returns a a list of facts\", \"operationId\": + \"getFacts\", \"parameters\": [{\"name\": \"max_length\", \"in\": \"query\", + \"description\": \"maximum length of returned fact\", \"required\": false, \"schema\": + {\"type\": \"integer\", \"format\": \"int64\"}}, {\"name\": \"limit\", \"in\": + \"query\", \"description\": \"limit the amount of results returned\", \"required\": + false, \"schema\": {\"type\": \"integer\", \"format\": \"int64\"}}], \"responses\": + {\"200\": {\"description\": \"successful operation\", \"content\": {\"application/json\": + {\"schema\": {\"type\": \"array\", \"items\": {\"$ref\": \"#/components/schemas/CatFact\"}}}}}}}}}, + \"components\": {\"schemas\": {\"Breed\": {\"title\": \"Breed model\", \"description\": + \"Breed\", \"properties\": {\"breed\": {\"title\": \"Breed\", \"description\": + \"Breed\", \"type\": \"string\", \"format\": \"string\"}, \"country\": {\"title\": + \"Country\", \"description\": \"Country\", \"type\": \"string\", \"format\": + \"string\"}, \"origin\": {\"title\": \"Origin\", \"description\": \"Origin\", + \"type\": \"string\", \"format\": \"string\"}, \"coat\": {\"title\": \"Coat\", + \"description\": \"Coat\", \"type\": \"string\", \"format\": \"string\"}, \"pattern\": + {\"title\": \"Pattern\", \"description\": \"Pattern\", \"type\": \"string\", + \"format\": \"string\"}}, \"type\": \"object\"}, \"CatFact\": {\"title\": \"CatFact + model\", \"description\": \"CatFact\", \"properties\": {\"fact\": {\"title\": + \"Fact\", \"description\": \"Fact\", \"type\": \"string\", \"format\": \"string\"}, + \"length\": {\"title\": \"Length\", \"description\": \"Length\", \"type\": \"integer\", + \"format\": \"int32\"}}, \"type\": \"object\"}}}}"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api definition import-specification + Connection: + - keep-alive + Content-Length: + - '3120' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-name --version --name --format --specification --file-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi/importSpecification?api-version=2024-03-01 + response: + body: + string: '' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 22 Nov 2023 17:34:55 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi/operationResults/b4eb2313-5b2b-44a3-9990-848626e5c10a?api-version=2024-03-01 + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api definition import-specification + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-name --version --name --format --specification --file-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi/operationResults/b4eb2313-5b2b-44a3-9990-848626e5c10a?api-version=2024-03-01 + response: + body: + string: '{"apiName":"default","apiVersion":"cli-test-2023-01-02","catalogName":"contosoeuap","provisioningState":"Succeeded","error":{"message":""}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '139' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:34:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api definition export-specification + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g -s --api-name --version --name --file-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi/exportSpecification?api-version=2024-03-01 + response: + body: + string: '{"format":"inline","value":"{\"openapi\": \"3.0.0\", \"info\": {\"title\": + \"Cat Facts API\", \"version\": \"1.0\"}, \"paths\": {\"/breeds\": {\"get\": + {\"tags\": [\"Breeds\"], \"summary\": \"Get a list of breeds\", \"description\": + \"Returns a a list of breeds\", \"operationId\": \"getBreeds\", \"parameters\": + [{\"name\": \"limit\", \"in\": \"query\", \"description\": \"limit the amount + of results returned\", \"required\": false, \"schema\": {\"type\": \"integer\", + \"format\": \"int64\"}}], \"responses\": {\"200\": {\"description\": \"successful + operation\", \"content\": {\"application/json\": {\"schema\": {\"type\": \"array\", + \"items\": {\"$ref\": \"#/components/schemas/Breed\"}}}}}}}}, \"/fact\": {\"get\": + {\"tags\": [\"Facts\"], \"summary\": \"Get Random Fact\", \"description\": + \"Returns a random fact\", \"operationId\": \"getRandomFact\", \"parameters\": + [{\"name\": \"max_length\", \"in\": \"query\", \"description\": \"maximum + length of returned fact\", \"required\": false, \"schema\": {\"type\": \"integer\", + \"format\": \"int64\"}}], \"responses\": {\"200\": {\"description\": \"successful + operation\", \"content\": {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/CatFact\"}}}}, + \"404\": {\"description\": \"Fact not found\"}}}}, \"/facts\": {\"get\": {\"tags\": + [\"Facts\"], \"summary\": \"Get a list of facts\", \"description\": \"Returns + a a list of facts\", \"operationId\": \"getFacts\", \"parameters\": [{\"name\": + \"max_length\", \"in\": \"query\", \"description\": \"maximum length of returned + fact\", \"required\": false, \"schema\": {\"type\": \"integer\", \"format\": + \"int64\"}}, {\"name\": \"limit\", \"in\": \"query\", \"description\": \"limit + the amount of results returned\", \"required\": false, \"schema\": {\"type\": + \"integer\", \"format\": \"int64\"}}], \"responses\": {\"200\": {\"description\": + \"successful operation\", \"content\": {\"application/json\": {\"schema\": + {\"type\": \"array\", \"items\": {\"$ref\": \"#/components/schemas/CatFact\"}}}}}}}}}, + \"components\": {\"schemas\": {\"Breed\": {\"title\": \"Breed model\", \"description\": + \"Breed\", \"properties\": {\"breed\": {\"title\": \"Breed\", \"description\": + \"Breed\", \"type\": \"string\", \"format\": \"string\"}, \"country\": {\"title\": + \"Country\", \"description\": \"Country\", \"type\": \"string\", \"format\": + \"string\"}, \"origin\": {\"title\": \"Origin\", \"description\": \"Origin\", + \"type\": \"string\", \"format\": \"string\"}, \"coat\": {\"title\": \"Coat\", + \"description\": \"Coat\", \"type\": \"string\", \"format\": \"string\"}, + \"pattern\": {\"title\": \"Pattern\", \"description\": \"Pattern\", \"type\": + \"string\", \"format\": \"string\"}}, \"type\": \"object\"}, \"CatFact\": + {\"title\": \"CatFact model\", \"description\": \"CatFact\", \"properties\": + {\"fact\": {\"title\": \"Fact\", \"description\": \"Fact\", \"type\": \"string\", + \"format\": \"string\"}, \"length\": {\"title\": \"Length\", \"description\": + \"Length\", \"type\": \"integer\", \"format\": \"int32\"}}, \"type\": \"object\"}}}}"}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '3059' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:34:57 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"definitionId": "/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi", + "description": "CLI Test Public cloud production deployment.", "environmentId": + "/workspaces/default/environments/cli-test-public", "server": {"runtimeUri": + ["https://api.contoso.com"]}, "title": "CLI Test Production deployment"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api deployment create + Connection: + - keep-alive + Content-Length: + - '365' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-name --name --title --description --environment-id --definition-id + --server + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/deployments/mock-deployment?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/deployments/production","name":"production","systemData":{"createdAt":"2023-11-22T17:34:05.7313342Z","lastModifiedAt":"2023-11-22T17:34:58.3840388Z"},"properties":{"title":"CLI + Test Production deployment","description":"CLI Test Public cloud production + deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '777' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:34:57 GMT + etag: + - 06005c30-0000-3300-0000-655e3bc20000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"schema": "{\"type\": \"string\", \"title\": \"CLI Test + First name\", \"pattern\": \"^[a-zA-Z0-9 ]+$\"}"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic metadata-schema create + Connection: + - keep-alive + Content-Length: + - '122' + Content-Type: + - application/json + ParameterSetName: + - -g -s --name --file-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchemas/cli-test-metadata-schema-1?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/metadataSchema","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchema/cli-test-metadata-schema-1","name":"cli-test-metadata-schema-1","systemData":{"createdAt":"2023-11-22T16:49:20.9590785Z","lastModifiedAt":"2023-11-22T17:34:59.0580864Z"},"properties":{"assignedTo":[],"schema":"{\"type\": + \"string\", \"title\": \"CLI Test First name\", \"pattern\": \"^[a-zA-Z0-9 + ]+$\"}"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '514' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:34:58 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"assignedTo": "api"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic metadata-schema export-metadata-schema + Connection: + - keep-alive + Content-Length: + - '21' + Content-Type: + - application/json + ParameterSetName: + - -g -s --assigned-to --file-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/exportMetadataSchema?api-version=2024-03-01 + response: + body: + string: '{"format":"json-schema","value":"{\"type\":\"object\",\"properties\":{\"title\":{\"description\":\"The + name of the API.\",\"type\":\"string\",\"maxLength\":50},\"summary\":{\"description\":\"Short + description of the API.\",\"type\":\"string\",\"maxLength\":200},\"description\":{\"description\":\"The + description of the API.\",\"type\":\"string\",\"maxLength\":1000},\"kind\":{\"description\":\"Kind + of API. For example, REST or GraphQL.\",\"type\":\"string\"},\"lifecycleStage\":{\"description\":\"Current + lifecycle stage of the API.\",\"type\":\"string\",\"enum\":[\"design\",\"development\",\"testing\",\"preview\",\"production\",\"deprecated\",\"retired\"]},\"termsOfService\":{\"description\":\"Terms + of service for the API.\",\"type\":\"object\",\"properties\":{\"url\":{\"description\":\"URL + pointing to the terms of service.\",\"type\":\"string\",\"maxLength\":200,\"format\":\"uri\"}}},\"license\":{\"description\":\"The + license information for the API.\",\"type\":\"object\",\"properties\":{\"name\":{\"description\":\"Name + of the license.\",\"type\":\"string\",\"maxLength\":50},\"url\":{\"description\":\"URL + pointing to the license details. The URL field is mutually exclusive of the + identifier field.\",\"type\":\"string\",\"maxLength\":200,\"format\":\"uri\"},\"identifier\":{\"description\":\"SPDX + license information for the API. The identifier field is mutually exclusive + of the URL field.\",\"type\":\"string\",\"maxLength\":200,\"format\":\"uri\"}}},\"externalDocumentation\":{\"description\":\"External + documentation\",\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"title\":{\"description\":\"Title + of the documentation.\",\"type\":\"string\",\"maxLength\":50},\"description\":{\"description\":\"Description + of the documentation.\",\"type\":\"string\",\"maxLength\":1000},\"url\":{\"description\":\"URL + pointing to the documentation.\",\"type\":\"string\",\"maxLength\":200,\"format\":\"uri\"}}},\"maxItems\":20},\"contacts\":{\"description\":\"Points + of contact for the API.\",\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"name\":{\"description\":\"Name + of the contact.\",\"type\":\"string\",\"maxLength\":100},\"url\":{\"description\":\"URL + for the contact.\",\"type\":\"string\",\"maxLength\":200,\"format\":\"uri\"},\"email\":{\"description\":\"Email + address for the contact.\",\"type\":\"string\",\"maxLength\":100,\"format\":\"email\"}}},\"maxItems\":10},\"customProperties\":{\"type\":\"object\",\"properties\":{\"compliance-status\":{\"type\":\"string\",\"title\":\"compliance-status\",\"oneOf\":[{\"const\":\"new\",\"description\":\"\"},{\"const\":\"pending\",\"description\":\"\"},{\"const\":\"solved\",\"description\":\"\"}]},\"approver\":{\"title\":\"approver\",\"type\":\"string\"},\"cost-center\":{\"title\":\"cost-center\",\"type\":\"string\"},\"ownership\":{\"title\":\"ownership\",\"type\":\"string\"},\"metadata-test-1\":{\"title\":\"metadata-test-1\",\"type\":\"string\"},\"metadata-test-2\":{\"title\":\"metadata-test-2\",\"type\":\"boolean\"}},\"unevaluatedProperties\":false,\"required\":[\"metadata-test-1\",\"metadata-test-2\"]}},\"required\":[\"title\",\"kind\"]}"}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '3154' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:34:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"assignedTo": "deployment"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic metadata-schema export-metadata-schema + Connection: + - keep-alive + Content-Length: + - '28' + Content-Type: + - application/json + ParameterSetName: + - -g -s --assigned-to --file-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/exportMetadataSchema?api-version=2024-03-01 + response: + body: + string: '{"format":"json-schema","value":"{\"type\":\"object\",\"properties\":{\"title\":{\"description\":\"The + name of the deployment.\",\"type\":\"string\",\"maxLength\":50},\"description\":{\"description\":\"The + description of the deployment.\",\"type\":\"string\",\"maxLength\":1000},\"environmentId\":{\"description\":\"The + service-scoped resource ID of the deployment environment.\",\"type\":\"string\"},\"definitionId\":{\"description\":\"The + service-scoped resource ID of the API definition.\",\"type\":\"string\"},\"server\":{\"description\":\"The + server information of the API deployment.\",\"type\":\"object\",\"properties\":{\"runtimeUri\":{\"description\":\"Base + runtime URIs for this deployment.\",\"type\":\"array\",\"items\":{\"type\":\"string\"},\"maxItems\":200}},\"required\":[\"runtimeUri\"]},\"customProperties\":{\"type\":\"object\",\"properties\":{},\"unevaluatedProperties\":false,\"required\":[]},\"recommended\":{\"description\":\"Indicates + if this is currently recommended deployment.\",\"type\":\"boolean\"}},\"required\":[\"title\",\"environmentId\",\"definitionId\",\"server\"]}"}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '1101' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:34:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"assignedTo": "environment"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic metadata-schema export-metadata-schema + Connection: + - keep-alive + Content-Length: + - '29' + Content-Type: + - application/json + ParameterSetName: + - -g -s --assigned-to --file-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/exportMetadataSchema?api-version=2024-03-01 + response: + body: + string: '{"format":"json-schema","value":"{\"type\":\"object\",\"properties\":{\"title\":{\"description\":\"The + name of the environment.\",\"type\":\"string\",\"maxLength\":50},\"kind\":{\"description\":\"Kind + of deployment environment.\",\"type\":\"string\"},\"description\":{\"description\":\"Description + of the environment.\",\"type\":\"string\",\"maxLength\":1000},\"server\":{\"description\":\"Server + information of the environment.\",\"type\":\"object\",\"properties\":{\"type\":{\"description\":\"Type + of the server that represents the environment.\",\"type\":\"string\"},\"managementPortalUri\":{\"description\":\"URIs + of the server''s management portal.\",\"type\":\"array\",\"items\":{\"type\":\"string\"},\"maxItems\":200}}},\"onboarding\":{\"description\":\"Onboarding + information for this environment.\",\"type\":\"object\",\"properties\":{\"instructions\":{\"description\":\"Instructions + how to onboard to the environment.\",\"type\":\"string\",\"maxLength\":1000},\"developerPortalUri\":{\"description\":\"Developer + portal URIs of the environment.\",\"type\":\"array\",\"items\":{\"type\":\"string\"},\"maxItems\":200}}},\"customProperties\":{\"type\":\"object\",\"properties\":{},\"unevaluatedProperties\":false,\"required\":[]}},\"required\":[\"title\",\"kind\"]}"}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '1272' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:35:01 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"description": "APIs for sampling from and fine-tuning + language models", "kind": "rest", "summary": "APIs for sampling from and fine-tuning + language models", "termsOfService": {}, "title": "cli-test-openai-api-01"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '231' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-location --environment-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01","name":"cli-test-openai-api-01","systemData":{"createdAt":"2023-11-22T17:35:03.182864Z","lastModifiedAt":"2023-11-22T17:35:03.1828641Z"},"properties":{"title":"cli-test-openai-api-01","summary":"APIs + for sampling from and fine-tuning language models","description":"APIs for + sampling from and fine-tuning language models","kind":"rest","lifecycleStage":"design","termsOfService":{},"externalDocumentation":[],"contacts":[],"customProperties":{}}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '678' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:35:02 GMT + etag: + - 3f000ca6-0000-3300-0000-655e3bc70000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"lifecycleStage": "design", "title": "1-2-0"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '62' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-location --environment-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0","name":"1-2-0","systemData":{"createdAt":"2023-11-22T17:35:03.7737195Z","lastModifiedAt":"2023-11-22T17:35:03.7737195Z"},"properties":{"title":"1-2-0","lifecycleStage":"design"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '429' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:35:03 GMT + etag: + - 4d0094bb-0000-3300-0000-655e3bc70000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"description": "APIs for sampling from and fine-tuning + language models", "title": "openapi"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '109' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-location --environment-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi","name":"openapi","systemData":{"createdAt":"2023-11-22T17:35:04.33803Z","lastModifiedAt":"2023-11-22T17:35:04.33803Z"},"properties":{"title":"openapi","description":"APIs + for sampling from and fine-tuning language models"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '497' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:35:04 GMT + etag: + - 00008200-0000-3300-0000-655e3bc80000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"format": "inline", "specification": {"name": "openapi", "version": "3-0-0"}, + "value": "{\"openapi\": \"3.0.0\", \"servers\": [{\"url\": \"https://api.openai.com/v1\"}], + \"info\": {\"description\": \"APIs for sampling from and fine-tuning language + models\", \"title\": \"CLI Test OpenAI API 01\", \"version\": \"1.2.0\", \"x-apisguru-categories\": + [\"machine_learning\"], \"x-logo\": {\"url\": \"https://learnodo-newtonic.com/wp-content/uploads/2020/04/Logo-of-OpenAI-768x161.jpg\"}, + \"x-origin\": [{\"format\": \"openapi\", \"url\": \"https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml\", + \"version\": \"3.0\"}], \"x-providerName\": \"openai.com\"}, \"tags\": [{\"description\": + \"The OpenAI REST API\", \"name\": \"OpenAI\"}], \"paths\": {\"/answers\": {\"post\": + {\"deprecated\": true, \"operationId\": \"createAnswer\", \"requestBody\": {\"content\": + {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/CreateAnswerRequest\"}}}, + \"required\": true}, \"responses\": {\"200\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/CreateAnswerResponse\"}}}, \"description\": + \"OK\"}}, \"summary\": \"Answers the specified question using the provided documents + and examples.\\n\\nThe endpoint first [searches](/docs/api-reference/searches) + over provided documents or files to find relevant context. The relevant context + is combined with the provided examples and question to create the prompt for + [completion](/docs/api-reference/completions).\\n\", \"tags\": [\"OpenAI\"], + \"x-oaiMeta\": {\"examples\": {\"curl\": \"curl https://api.openai.com/v1/answers + \\\\\\n -X POST \\\\\\n -H \\\"Authorization: Bearer YOUR_API_KEY\\\" \\\\\\n -H + ''Content-Type: application/json'' \\\\\\n -d ''{\\n \\\"documents\\\": + [\\\"Puppy A is happy.\\\", \\\"Puppy B is sad.\\\"],\\n \\\"question\\\": + \\\"which puppy is happy?\\\",\\n \\\"search_model\\\": \\\"ada\\\",\\n \\\"model\\\": + \\\"curie\\\",\\n \\\"examples_context\\\": \\\"In 2017, U.S. life expectancy + was 78.6 years.\\\",\\n \\\"examples\\\": [[\\\"What is human life expectancy + in the United States?\\\",\\\"78 years.\\\"]],\\n \\\"max_tokens\\\": 5,\\n \\\"stop\\\": + [\\\"\\\\n\\\", \\\"<|endoftext|>\\\"]\\n }''\\n\", \"node.js\": \"const { + Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst configuration + = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.createAnswer({\\n search_model: + \\\"ada\\\",\\n model: \\\"curie\\\",\\n question: \\\"which puppy is happy?\\\",\\n documents: + [\\\"Puppy A is happy.\\\", \\\"Puppy B is sad.\\\"],\\n examples_context: + \\\"In 2017, U.S. life expectancy was 78.6 years.\\\",\\n examples: [[\\\"What + is human life expectancy in the United States?\\\",\\\"78 years.\\\"]],\\n max_tokens: + 5,\\n stop: [\\\"\\\\n\\\", \\\"<|endoftext|>\\\"],\\n});\\n\", \"python\": + \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Answer.create(\\n search_model=\\\"ada\\\",\\n model=\\\"curie\\\",\\n question=\\\"which + puppy is happy?\\\",\\n documents=[\\\"Puppy A is happy.\\\", \\\"Puppy B is + sad.\\\"],\\n examples_context=\\\"In 2017, U.S. life expectancy was 78.6 years.\\\",\\n examples=[[\\\"What + is human life expectancy in the United States?\\\",\\\"78 years.\\\"]],\\n max_tokens=5,\\n stop=[\\\"\\\\n\\\", + \\\"<|endoftext|>\\\"],\\n)\\n\"}, \"group\": \"answers\", \"name\": \"Create + answer\", \"parameters\": \"{\\n \\\"documents\\\": [\\\"Puppy A is happy.\\\", + \\\"Puppy B is sad.\\\"],\\n \\\"question\\\": \\\"which puppy is happy?\\\",\\n \\\"search_model\\\": + \\\"ada\\\",\\n \\\"model\\\": \\\"curie\\\",\\n \\\"examples_context\\\": + \\\"In 2017, U.S. life expectancy was 78.6 years.\\\",\\n \\\"examples\\\": + [[\\\"What is human life expectancy in the United States?\\\",\\\"78 years.\\\"]],\\n \\\"max_tokens\\\": + 5,\\n \\\"stop\\\": [\\\"\\\\n\\\", \\\"<|endoftext|>\\\"]\\n}\\n\", \"path\": + \"create\", \"response\": \"{\\n \\\"answers\\\": [\\n \\\"puppy A.\\\"\\n ],\\n \\\"completion\\\": + \\\"cmpl-2euVa1kmKUuLpSX600M41125Mo9NI\\\",\\n \\\"model\\\": \\\"curie:2020-05-03\\\",\\n \\\"object\\\": + \\\"answer\\\",\\n \\\"search_model\\\": \\\"ada\\\",\\n \\\"selected_documents\\\": + [\\n {\\n \\\"document\\\": 0,\\n \\\"text\\\": \\\"Puppy A is + happy. \\\"\\n },\\n {\\n \\\"document\\\": 1,\\n \\\"text\\\": + \\\"Puppy B is sad. \\\"\\n }\\n ]\\n}\\n\"}}}, \"/audio/transcriptions\": + {\"post\": {\"operationId\": \"createTranscription\", \"requestBody\": {\"content\": + {\"multipart/form-data\": {\"schema\": {\"$ref\": \"#/components/schemas/CreateTranscriptionRequest\"}}}, + \"required\": true}, \"responses\": {\"200\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/CreateTranscriptionResponse\"}}}, + \"description\": \"OK\"}}, \"summary\": \"Transcribes audio into the input language.\", + \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"beta\": true, \"examples\": {\"curl\": + \"curl https://api.openai.com/v1/audio/transcriptions \\\\\\n -X POST \\\\\\n -H + ''Authorization: Bearer TOKEN'' \\\\\\n -H ''Content-Type: multipart/form-data'' + \\\\\\n -F file=@/path/to/file/audio.mp3 \\\\\\n -F model=whisper-1\\n\", + \"node\": \"const { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst + configuration = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst resp = await openai.createTranscription(\\n fs.createReadStream(\\\"audio.mp3\\\"),\\n \\\"whisper-1\\\"\\n);\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\naudio_file + = open(\\\"audio.mp3\\\", \\\"rb\\\")\\ntranscript = openai.Audio.transcribe(\\\"whisper-1\\\", + audio_file)\\n\"}, \"group\": \"audio\", \"name\": \"Create transcription\", + \"parameters\": \"{\\n \\\"file\\\": \\\"audio.mp3\\\",\\n \\\"model\\\": + \\\"whisper-1\\\"\\n}\\n\", \"path\": \"create\", \"response\": \"{\\n \\\"text\\\": + \\\"Imagine the wildest idea that you''ve ever had, and you''re curious about + how it might scale to something that''s a 100, a 1,000 times bigger. This is + a place where you can get to do that.\\\"\\n}\\n\"}}}, \"/audio/translations\": + {\"post\": {\"operationId\": \"createTranslation\", \"requestBody\": {\"content\": + {\"multipart/form-data\": {\"schema\": {\"$ref\": \"#/components/schemas/CreateTranslationRequest\"}}}, + \"required\": true}, \"responses\": {\"200\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/CreateTranslationResponse\"}}}, + \"description\": \"OK\"}}, \"summary\": \"Translates audio into into English.\", + \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"beta\": true, \"examples\": {\"curl\": + \"curl https://api.openai.com/v1/audio/translations \\\\\\n -X POST \\\\\\n -H + ''Authorization: Bearer TOKEN'' \\\\\\n -H ''Content-Type: multipart/form-data'' + \\\\\\n -F file=@/path/to/file/german.m4a \\\\\\n -F model=whisper-1\\n\", + \"node\": \"const { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst + configuration = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst resp = await openai.createTranslation(\\n fs.createReadStream(\\\"audio.mp3\\\"),\\n \\\"whisper-1\\\"\\n);\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\naudio_file + = open(\\\"german.m4a\\\", \\\"rb\\\")\\ntranscript = openai.Audio.translate(\\\"whisper-1\\\", + audio_file)\\n\"}, \"group\": \"audio\", \"name\": \"Create translation\", \"parameters\": + \"{\\n \\\"file\\\": \\\"german.m4a\\\",\\n \\\"model\\\": \\\"whisper-1\\\"\\n}\\n\", + \"path\": \"create\", \"response\": \"{\\n \\\"text\\\": \\\"Hello, my name + is Wolfgang and I come from Germany. Where are you heading today?\\\"\\n}\\n\"}}}, + \"/chat/completions\": {\"post\": {\"operationId\": \"createChatCompletion\", + \"requestBody\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": + \"#/components/schemas/CreateChatCompletionRequest\"}}}, \"required\": true}, + \"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": + \"#/components/schemas/CreateChatCompletionResponse\"}}}, \"description\": \"OK\"}}, + \"summary\": \"Creates a completion for the chat message\", \"tags\": [\"OpenAI\"], + \"x-oaiMeta\": {\"beta\": true, \"examples\": {\"curl\": \"curl https://api.openai.com/v1/chat/completions + \\\\\\n -H ''Content-Type: application/json'' \\\\\\n -H ''Authorization: + Bearer YOUR_API_KEY'' \\\\\\n -d ''{\\n \\\"model\\\": \\\"gpt-3.5-turbo\\\",\\n \\\"messages\\\": + [{\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"Hello!\\\"}]\\n}''\\n\", + \"node.js\": \"const { Configuration, OpenAIApi } = require(\\\"openai\\\");\\n\\nconst + configuration = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\n\\nconst completion = await openai.createChatCompletion({\\n model: + \\\"gpt-3.5-turbo\\\",\\n messages: [{role: \\\"user\\\", content: \\\"Hello + world\\\"}],\\n});\\nconsole.log(completion.data.choices[0].message);\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\n\\ncompletion + = openai.ChatCompletion.create(\\n model=\\\"gpt-3.5-turbo\\\",\\n messages=[\\n {\\\"role\\\": + \\\"user\\\", \\\"content\\\": \\\"Hello!\\\"}\\n ]\\n)\\n\\nprint(completion.choices[0].message)\\n\"}, + \"group\": \"chat\", \"name\": \"Create chat completion\", \"parameters\": \"{\\n \\\"model\\\": + \\\"gpt-3.5-turbo\\\",\\n \\\"messages\\\": [{\\\"role\\\": \\\"user\\\", \\\"content\\\": + \\\"Hello!\\\"}]\\n}\\n\", \"path\": \"create\", \"response\": \"{\\n \\\"id\\\": + \\\"chatcmpl-123\\\",\\n \\\"object\\\": \\\"chat.completion\\\",\\n \\\"created\\\": + 1677652288,\\n \\\"choices\\\": [{\\n \\\"index\\\": 0,\\n \\\"message\\\": + {\\n \\\"role\\\": \\\"assistant\\\",\\n \\\"content\\\": \\\"\\\\n\\\\nHello + there, how may I assist you today?\\\",\\n },\\n \\\"finish_reason\\\": + \\\"stop\\\"\\n }],\\n \\\"usage\\\": {\\n \\\"prompt_tokens\\\": 9,\\n \\\"completion_tokens\\\": + 12,\\n \\\"total_tokens\\\": 21\\n }\\n}\\n\"}}}, \"/classifications\": + {\"post\": {\"deprecated\": true, \"operationId\": \"createClassification\", + \"requestBody\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": + \"#/components/schemas/CreateClassificationRequest\"}}}, \"required\": true}, + \"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": + \"#/components/schemas/CreateClassificationResponse\"}}}, \"description\": \"OK\"}}, + \"summary\": \"Classifies the specified `query` using provided examples.\\n\\nThe + endpoint first [searches](/docs/api-reference/searches) over the labeled examples\\nto + select the ones most relevant for the particular query. Then, the relevant examples\\nare + combined with the query to construct a prompt to produce the final label via + the\\n[completions](/docs/api-reference/completions) endpoint.\\n\\nLabeled + examples can be provided via an uploaded `file`, or explicitly listed in the\\nrequest + using the `examples` parameter for quick tests and small scale use cases.\\n\", + \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": \"curl https://api.openai.com/v1/classifications + \\\\\\n -X POST \\\\\\n -H \\\"Authorization: Bearer YOUR_API_KEY\\\" \\\\\\n -H + ''Content-Type: application/json'' \\\\\\n -d ''{\\n \\\"examples\\\": [\\n [\\\"A + happy moment\\\", \\\"Positive\\\"],\\n [\\\"I am sad.\\\", \\\"Negative\\\"],\\n [\\\"I + am feeling awesome\\\", \\\"Positive\\\"]],\\n \\\"query\\\": \\\"It is a + raining day :(\\\",\\n \\\"search_model\\\": \\\"ada\\\",\\n \\\"model\\\": + \\\"curie\\\",\\n \\\"labels\\\":[\\\"Positive\\\", \\\"Negative\\\", \\\"Neutral\\\"]\\n }''\\n\", + \"node.js\": \"const { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst + configuration = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.createClassification({\\n search_model: + \\\"ada\\\",\\n model: \\\"curie\\\",\\n examples: [\\n [\\\"A happy moment\\\", + \\\"Positive\\\"],\\n [\\\"I am sad.\\\", \\\"Negative\\\"],\\n [\\\"I + am feeling awesome\\\", \\\"Positive\\\"]\\n ],\\n query:\\\"It is a raining + day :(\\\",\\n labels: [\\\"Positive\\\", \\\"Negative\\\", \\\"Neutral\\\"],\\n});\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Classification.create(\\n search_model=\\\"ada\\\",\\n model=\\\"curie\\\",\\n examples=[\\n [\\\"A + happy moment\\\", \\\"Positive\\\"],\\n [\\\"I am sad.\\\", \\\"Negative\\\"],\\n [\\\"I + am feeling awesome\\\", \\\"Positive\\\"]\\n ],\\n query=\\\"It is a raining + day :(\\\",\\n labels=[\\\"Positive\\\", \\\"Negative\\\", \\\"Neutral\\\"],\\n)\\n\"}, + \"group\": \"classifications\", \"name\": \"Create classification\", \"parameters\": + \"{\\n \\\"examples\\\": [\\n [\\\"A happy moment\\\", \\\"Positive\\\"],\\n [\\\"I + am sad.\\\", \\\"Negative\\\"],\\n [\\\"I am feeling awesome\\\", \\\"Positive\\\"]\\n ],\\n \\\"labels\\\": + [\\\"Positive\\\", \\\"Negative\\\", \\\"Neutral\\\"],\\n \\\"query\\\": \\\"It + is a raining day :(\\\",\\n \\\"search_model\\\": \\\"ada\\\",\\n \\\"model\\\": + \\\"curie\\\"\\n}\\n\", \"path\": \"create\", \"response\": \"{\\n \\\"completion\\\": + \\\"cmpl-2euN7lUVZ0d4RKbQqRV79IiiE6M1f\\\",\\n \\\"label\\\": \\\"Negative\\\",\\n \\\"model\\\": + \\\"curie:2020-05-03\\\",\\n \\\"object\\\": \\\"classification\\\",\\n \\\"search_model\\\": + \\\"ada\\\",\\n \\\"selected_examples\\\": [\\n {\\n \\\"document\\\": + 1,\\n \\\"label\\\": \\\"Negative\\\",\\n \\\"text\\\": \\\"I am sad.\\\"\\n },\\n {\\n \\\"document\\\": + 0,\\n \\\"label\\\": \\\"Positive\\\",\\n \\\"text\\\": \\\"A happy + moment\\\"\\n },\\n {\\n \\\"document\\\": 2,\\n \\\"label\\\": + \\\"Positive\\\",\\n \\\"text\\\": \\\"I am feeling awesome\\\"\\n }\\n ]\\n}\\n\"}}}, + \"/completions\": {\"post\": {\"operationId\": \"createCompletion\", \"requestBody\": + {\"content\": {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/CreateCompletionRequest\"}}}, + \"required\": true}, \"responses\": {\"200\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/CreateCompletionResponse\"}}}, + \"description\": \"OK\"}}, \"summary\": \"Creates a completion for the provided + prompt and parameters\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": + {\"curl\": \"curl https://api.openai.com/v1/completions \\\\\\n -H ''Content-Type: + application/json'' \\\\\\n -H ''Authorization: Bearer YOUR_API_KEY'' \\\\\\n -d + ''{\\n \\\"model\\\": \\\"VAR_model_id\\\",\\n \\\"prompt\\\": \\\"Say this + is a test\\\",\\n \\\"max_tokens\\\": 7,\\n \\\"temperature\\\": 0\\n}''\\n\", + \"node.js\": \"const { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst + configuration = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.createCompletion({\\n model: + \\\"VAR_model_id\\\",\\n prompt: \\\"Say this is a test\\\",\\n max_tokens: + 7,\\n temperature: 0,\\n});\\n\", \"python\": \"import os\\nimport openai\\nopenai.api_key + = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Completion.create(\\n model=\\\"VAR_model_id\\\",\\n prompt=\\\"Say + this is a test\\\",\\n max_tokens=7,\\n temperature=0\\n)\\n\"}, \"group\": + \"completions\", \"name\": \"Create completion\", \"parameters\": \"{\\n \\\"model\\\": + \\\"VAR_model_id\\\",\\n \\\"prompt\\\": \\\"Say this is a test\\\",\\n \\\"max_tokens\\\": + 7,\\n \\\"temperature\\\": 0,\\n \\\"top_p\\\": 1,\\n \\\"n\\\": 1,\\n \\\"stream\\\": + false,\\n \\\"logprobs\\\": null,\\n \\\"stop\\\": \\\"\\\\n\\\"\\n}\\n\", + \"path\": \"create\", \"response\": \"{\\n \\\"id\\\": \\\"cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7\\\",\\n \\\"object\\\": + \\\"text_completion\\\",\\n \\\"created\\\": 1589478378,\\n \\\"model\\\": + \\\"VAR_model_id\\\",\\n \\\"choices\\\": [\\n {\\n \\\"text\\\": \\\"\\\\n\\\\nThis + is indeed a test\\\",\\n \\\"index\\\": 0,\\n \\\"logprobs\\\": null,\\n \\\"finish_reason\\\": + \\\"length\\\"\\n }\\n ],\\n \\\"usage\\\": {\\n \\\"prompt_tokens\\\": + 5,\\n \\\"completion_tokens\\\": 7,\\n \\\"total_tokens\\\": 12\\n }\\n}\\n\"}}}, + \"/edits\": {\"post\": {\"operationId\": \"createEdit\", \"requestBody\": {\"content\": + {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/CreateEditRequest\"}}}, + \"required\": true}, \"responses\": {\"200\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/CreateEditResponse\"}}}, \"description\": + \"OK\"}}, \"summary\": \"Creates a new edit for the provided input, instruction, + and parameters.\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": + \"curl https://api.openai.com/v1/edits \\\\\\n -H ''Content-Type: application/json'' + \\\\\\n -H ''Authorization: Bearer YOUR_API_KEY'' \\\\\\n -d ''{\\n \\\"model\\\": + \\\"VAR_model_id\\\",\\n \\\"input\\\": \\\"What day of the wek is it?\\\",\\n \\\"instruction\\\": + \\\"Fix the spelling mistakes\\\"\\n}''\\n\", \"node.js\": \"const { Configuration, + OpenAIApi } = require(\\\"openai\\\");\\nconst configuration = new Configuration({\\n apiKey: + process.env.OPENAI_API_KEY,\\n});\\nconst openai = new OpenAIApi(configuration);\\nconst + response = await openai.createEdit({\\n model: \\\"VAR_model_id\\\",\\n input: + \\\"What day of the wek is it?\\\",\\n instruction: \\\"Fix the spelling mistakes\\\",\\n});\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Edit.create(\\n model=\\\"VAR_model_id\\\",\\n input=\\\"What + day of the wek is it?\\\",\\n instruction=\\\"Fix the spelling mistakes\\\"\\n)\\n\"}, + \"group\": \"edits\", \"name\": \"Create edit\", \"parameters\": \"{\\n \\\"model\\\": + \\\"VAR_model_id\\\",\\n \\\"input\\\": \\\"What day of the wek is it?\\\",\\n \\\"instruction\\\": + \\\"Fix the spelling mistakes\\\",\\n}\\n\", \"path\": \"create\", \"response\": + \"{\\n \\\"object\\\": \\\"edit\\\",\\n \\\"created\\\": 1589478378,\\n \\\"choices\\\": + [\\n {\\n \\\"text\\\": \\\"What day of the week is it?\\\",\\n \\\"index\\\": + 0,\\n }\\n ],\\n \\\"usage\\\": {\\n \\\"prompt_tokens\\\": 25,\\n \\\"completion_tokens\\\": + 32,\\n \\\"total_tokens\\\": 57\\n }\\n}\\n\"}}}, \"/embeddings\": {\"post\": + {\"operationId\": \"createEmbedding\", \"requestBody\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/CreateEmbeddingRequest\"}}}, + \"required\": true}, \"responses\": {\"200\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/CreateEmbeddingResponse\"}}}, + \"description\": \"OK\"}}, \"summary\": \"Creates an embedding vector representing + the input text.\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": + \"curl https://api.openai.com/v1/embeddings \\\\\\n -X POST \\\\\\n -H \\\"Authorization: + Bearer YOUR_API_KEY\\\" \\\\\\n -H \\\"Content-Type: application/json\\\" \\\\\\n -d + ''{\\\"input\\\": \\\"The food was delicious and the waiter...\\\",\\n \\\"model\\\": + \\\"text-embedding-ada-002\\\"}''\\n\", \"node.js\": \"const { Configuration, + OpenAIApi } = require(\\\"openai\\\");\\nconst configuration = new Configuration({\\n apiKey: + process.env.OPENAI_API_KEY,\\n});\\nconst openai = new OpenAIApi(configuration);\\nconst + response = await openai.createEmbedding({\\n model: \\\"text-embedding-ada-002\\\",\\n input: + \\\"The food was delicious and the waiter...\\\",\\n});\\n\", \"python\": \"import + os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Embedding.create(\\n model=\\\"text-embedding-ada-002\\\",\\n input=\\\"The + food was delicious and the waiter...\\\"\\n)\\n\"}, \"group\": \"embeddings\", + \"name\": \"Create embeddings\", \"parameters\": \"{\\n \\\"model\\\": \\\"text-embedding-ada-002\\\",\\n \\\"input\\\": + \\\"The food was delicious and the waiter...\\\"\\n}\\n\", \"path\": \"create\", + \"response\": \"{\\n \\\"object\\\": \\\"list\\\",\\n \\\"data\\\": [\\n {\\n \\\"object\\\": + \\\"embedding\\\",\\n \\\"embedding\\\": [\\n 0.0023064255,\\n -0.009327292,\\n .... + (1536 floats total for ada-002)\\n -0.0028842222,\\n ],\\n \\\"index\\\": + 0\\n }\\n ],\\n \\\"model\\\": \\\"text-embedding-ada-002\\\",\\n \\\"usage\\\": + {\\n \\\"prompt_tokens\\\": 8,\\n \\\"total_tokens\\\": 8\\n }\\n}\\n\"}}}, + \"/engines\": {\"get\": {\"deprecated\": true, \"operationId\": \"listEngines\", + \"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": + \"#/components/schemas/ListEnginesResponse\"}}}, \"description\": \"OK\"}}, + \"summary\": \"Lists the currently available (non-finetuned) models, and provides + basic information about each one such as the owner and availability.\", \"tags\": + [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": \"curl https://api.openai.com/v1/engines + \\\\\\n -H ''Authorization: Bearer YOUR_API_KEY''\\n\", \"node.js\": \"const + { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst configuration + = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.listEngines();\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Engine.list()\\n\"}, + \"group\": \"engines\", \"name\": \"List engines\", \"path\": \"list\", \"response\": + \"{\\n \\\"data\\\": [\\n {\\n \\\"id\\\": \\\"engine-id-0\\\",\\n \\\"object\\\": + \\\"engine\\\",\\n \\\"owner\\\": \\\"organization-owner\\\",\\n \\\"ready\\\": + true\\n },\\n {\\n \\\"id\\\": \\\"engine-id-2\\\",\\n \\\"object\\\": + \\\"engine\\\",\\n \\\"owner\\\": \\\"organization-owner\\\",\\n \\\"ready\\\": + true\\n },\\n {\\n \\\"id\\\": \\\"engine-id-3\\\",\\n \\\"object\\\": + \\\"engine\\\",\\n \\\"owner\\\": \\\"openai\\\",\\n \\\"ready\\\": + false\\n },\\n ],\\n \\\"object\\\": \\\"list\\\"\\n}\\n\"}}}, \"/engines/{engine_id}\": + {\"get\": {\"deprecated\": true, \"operationId\": \"retrieveEngine\", \"parameters\": + [{\"description\": \"The ID of the engine to use for this request\\n\", \"in\": + \"path\", \"name\": \"engine_id\", \"required\": true, \"schema\": {\"example\": + \"davinci\", \"type\": \"string\"}}], \"responses\": {\"200\": {\"content\": + {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/Engine\"}}}, + \"description\": \"OK\"}}, \"summary\": \"Retrieves a model instance, providing + basic information about it such as the owner and availability.\", \"tags\": + [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": \"curl https://api.openai.com/v1/engines/VAR_model_id + \\\\\\n -H ''Authorization: Bearer YOUR_API_KEY''\\n\", \"node.js\": \"const + { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst configuration + = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.retrieveEngine(\\\"VAR_model_id\\\");\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Engine.retrieve(\\\"VAR_model_id\\\")\\n\"}, + \"group\": \"engines\", \"name\": \"Retrieve engine\", \"path\": \"retrieve\", + \"response\": \"{\\n \\\"id\\\": \\\"VAR_model_id\\\",\\n \\\"object\\\": + \\\"engine\\\",\\n \\\"owner\\\": \\\"openai\\\",\\n \\\"ready\\\": true\\n}\\n\"}}}, + \"/engines/{engine_id}/search\": {\"post\": {\"deprecated\": true, \"operationId\": + \"createSearch\", \"parameters\": [{\"description\": \"The ID of the engine + to use for this request. You can select one of `ada`, `babbage`, `curie`, or + `davinci`.\", \"in\": \"path\", \"name\": \"engine_id\", \"required\": true, + \"schema\": {\"example\": \"davinci\", \"type\": \"string\"}}], \"requestBody\": + {\"content\": {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/CreateSearchRequest\"}}}, + \"required\": true}, \"responses\": {\"200\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/CreateSearchResponse\"}}}, \"description\": + \"OK\"}}, \"summary\": \"The search endpoint computes similarity scores between + provided query and documents. Documents can be passed directly to the API if + there are no more than 200 of them.\\n\\nTo go beyond the 200 document limit, + documents can be processed offline and then used for efficient retrieval at + query time. When `file` is set, the search endpoint searches over all the documents + in the given file and returns up to the `max_rerank` number of documents. These + documents will be returned along with their search scores.\\n\\nThe similarity + score is a positive score that usually ranges from 0 to 300 (but can sometimes + go higher), where a score above 200 usually means the document is semantically + similar to the query.\\n\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": + {\"curl\": \"curl https://api.openai.com/v1/engines/davinci/search \\\\\\n -H + \\\"Content-Type: application/json\\\" \\\\\\n -H ''Authorization: Bearer YOUR_API_KEY'' + \\\\\\n -d ''{\\n \\\"documents\\\": [\\\"White House\\\", \\\"hospital\\\", + \\\"school\\\"],\\n \\\"query\\\": \\\"the president\\\"\\n}''\\n\", \"node.js\": + \"const { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst configuration + = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.createSearch(\\\"davinci\\\", + {\\n documents: [\\\"White House\\\", \\\"hospital\\\", \\\"school\\\"],\\n query: + \\\"the president\\\",\\n});\\n\", \"python\": \"import os\\nimport openai\\nopenai.api_key + = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Engine(\\\"davinci\\\").search(\\n documents=[\\\"White + House\\\", \\\"hospital\\\", \\\"school\\\"],\\n query=\\\"the president\\\"\\n)\\n\"}, + \"group\": \"searches\", \"name\": \"Create search\", \"parameters\": \"{\\n \\\"documents\\\": + [\\n \\\"White House\\\",\\n \\\"hospital\\\",\\n \\\"school\\\"\\n ],\\n \\\"query\\\": + \\\"the president\\\"\\n}\\n\", \"path\": \"create\", \"response\": \"{\\n \\\"data\\\": + [\\n {\\n \\\"document\\\": 0,\\n \\\"object\\\": \\\"search_result\\\",\\n \\\"score\\\": + 215.412\\n },\\n {\\n \\\"document\\\": 1,\\n \\\"object\\\": + \\\"search_result\\\",\\n \\\"score\\\": 40.316\\n },\\n {\\n \\\"document\\\": + 2,\\n \\\"object\\\": \\\"search_result\\\",\\n \\\"score\\\": 55.226\\n }\\n ],\\n \\\"object\\\": + \\\"list\\\"\\n}\\n\"}}}, \"/files\": {\"get\": {\"operationId\": \"listFiles\", + \"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": + \"#/components/schemas/ListFilesResponse\"}}}, \"description\": \"OK\"}}, \"summary\": + \"Returns a list of files that belong to the user''s organization.\", \"tags\": + [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": \"curl https://api.openai.com/v1/files + \\\\\\n -H ''Authorization: Bearer YOUR_API_KEY''\\n\", \"node.js\": \"const + { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst configuration + = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.listFiles();\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.File.list()\\n\"}, + \"group\": \"files\", \"name\": \"List files\", \"path\": \"list\", \"response\": + \"{\\n \\\"data\\\": [\\n {\\n \\\"id\\\": \\\"file-ccdDZrC3iZVNiQVeEA6Z66wf\\\",\\n \\\"object\\\": + \\\"file\\\",\\n \\\"bytes\\\": 175,\\n \\\"created_at\\\": 1613677385,\\n \\\"filename\\\": + \\\"train.jsonl\\\",\\n \\\"purpose\\\": \\\"search\\\"\\n },\\n {\\n \\\"id\\\": + \\\"file-XjGxS3KTG0uNmNOK362iJua3\\\",\\n \\\"object\\\": \\\"file\\\",\\n \\\"bytes\\\": + 140,\\n \\\"created_at\\\": 1613779121,\\n \\\"filename\\\": \\\"puppy.jsonl\\\",\\n \\\"purpose\\\": + \\\"search\\\"\\n }\\n ],\\n \\\"object\\\": \\\"list\\\"\\n}\\n\"}}, \"post\": + {\"operationId\": \"createFile\", \"requestBody\": {\"content\": {\"multipart/form-data\": + {\"schema\": {\"$ref\": \"#/components/schemas/CreateFileRequest\"}}}, \"required\": + true}, \"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": + {\"$ref\": \"#/components/schemas/OpenAIFile\"}}}, \"description\": \"OK\"}}, + \"summary\": \"Upload a file that contains document(s) to be used across various + endpoints/features. Currently, the size of all the files uploaded by one organization + can be up to 1 GB. Please contact us if you need to increase the storage limit.\\n\", + \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": \"curl https://api.openai.com/v1/files + \\\\\\n -H \\\"Authorization: Bearer YOUR_API_KEY\\\" \\\\\\n -F purpose=\\\"fine-tune\\\" + \\\\\\n -F file=''@mydata.jsonl''\\n\", \"node.js\": \"const fs = require(\\\"fs\\\");\\nconst + { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst configuration + = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.createFile(\\n fs.createReadStream(\\\"mydata.jsonl\\\"),\\n \\\"fine-tune\\\"\\n);\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.File.create(\\n file=open(\\\"mydata.jsonl\\\", + \\\"rb\\\"),\\n purpose=''fine-tune''\\n)\\n\"}, \"group\": \"files\", \"name\": + \"Upload file\", \"path\": \"upload\", \"response\": \"{\\n \\\"id\\\": \\\"file-XjGxS3KTG0uNmNOK362iJua3\\\",\\n \\\"object\\\": + \\\"file\\\",\\n \\\"bytes\\\": 140,\\n \\\"created_at\\\": 1613779121,\\n \\\"filename\\\": + \\\"mydata.jsonl\\\",\\n \\\"purpose\\\": \\\"fine-tune\\\"\\n}\\n\"}}}, \"/files/{file_id}\": + {\"delete\": {\"operationId\": \"deleteFile\", \"parameters\": [{\"description\": + \"The ID of the file to use for this request\", \"in\": \"path\", \"name\": + \"file_id\", \"required\": true, \"schema\": {\"type\": \"string\"}}], \"responses\": + {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/DeleteFileResponse\"}}}, + \"description\": \"OK\"}}, \"summary\": \"Delete a file.\", \"tags\": [\"OpenAI\"], + \"x-oaiMeta\": {\"examples\": {\"curl\": \"curl https://api.openai.com/v1/files/file-XjGxS3KTG0uNmNOK362iJua3 + \\\\\\n -X DELETE \\\\\\n -H ''Authorization: Bearer YOUR_API_KEY''\\n\", + \"node.js\": \"const { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst + configuration = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.deleteFile(\\\"file-XjGxS3KTG0uNmNOK362iJua3\\\");\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.File.delete(\\\"file-XjGxS3KTG0uNmNOK362iJua3\\\")\\n\"}, + \"group\": \"files\", \"name\": \"Delete file\", \"path\": \"delete\", \"response\": + \"{\\n \\\"id\\\": \\\"file-XjGxS3KTG0uNmNOK362iJua3\\\",\\n \\\"object\\\": + \\\"file\\\",\\n \\\"deleted\\\": true\\n}\\n\"}}, \"get\": {\"operationId\": + \"retrieveFile\", \"parameters\": [{\"description\": \"The ID of the file to + use for this request\", \"in\": \"path\", \"name\": \"file_id\", \"required\": + true, \"schema\": {\"type\": \"string\"}}], \"responses\": {\"200\": {\"content\": + {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/OpenAIFile\"}}}, + \"description\": \"OK\"}}, \"summary\": \"Returns information about a specific + file.\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": \"curl + https://api.openai.com/v1/files/file-XjGxS3KTG0uNmNOK362iJua3 \\\\\\n -H ''Authorization: + Bearer YOUR_API_KEY''\\n\", \"node.js\": \"const { Configuration, OpenAIApi + } = require(\\\"openai\\\");\\nconst configuration = new Configuration({\\n apiKey: + process.env.OPENAI_API_KEY,\\n});\\nconst openai = new OpenAIApi(configuration);\\nconst + response = await openai.retrieveFile(\\\"file-XjGxS3KTG0uNmNOK362iJua3\\\");\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.File.retrieve(\\\"file-XjGxS3KTG0uNmNOK362iJua3\\\")\\n\"}, + \"group\": \"files\", \"name\": \"Retrieve file\", \"path\": \"retrieve\", \"response\": + \"{\\n \\\"id\\\": \\\"file-XjGxS3KTG0uNmNOK362iJua3\\\",\\n \\\"object\\\": + \\\"file\\\",\\n \\\"bytes\\\": 140,\\n \\\"created_at\\\": 1613779657,\\n \\\"filename\\\": + \\\"mydata.jsonl\\\",\\n \\\"purpose\\\": \\\"fine-tune\\\"\\n}\\n\"}}}, \"/files/{file_id}/content\": + {\"get\": {\"operationId\": \"downloadFile\", \"parameters\": [{\"description\": + \"The ID of the file to use for this request\", \"in\": \"path\", \"name\": + \"file_id\", \"required\": true, \"schema\": {\"type\": \"string\"}}], \"responses\": + {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"type\": \"string\"}}}, + \"description\": \"OK\"}}, \"summary\": \"Returns the contents of the specified + file\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": \"curl + https://api.openai.com/v1/files/file-XjGxS3KTG0uNmNOK362iJua3/content \\\\\\n -H + ''Authorization: Bearer YOUR_API_KEY'' > file.jsonl\\n\", \"node.js\": \"const + { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst configuration + = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.downloadFile(\\\"file-XjGxS3KTG0uNmNOK362iJua3\\\");\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\ncontent + = openai.File.download(\\\"file-XjGxS3KTG0uNmNOK362iJua3\\\")\\n\"}, \"group\": + \"files\", \"name\": \"Retrieve file content\", \"path\": \"retrieve-content\"}}}, + \"/fine-tunes\": {\"get\": {\"operationId\": \"listFineTunes\", \"responses\": + {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/ListFineTunesResponse\"}}}, + \"description\": \"OK\"}}, \"summary\": \"List your organization''s fine-tuning + jobs\\n\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": + \"curl https://api.openai.com/v1/fine-tunes \\\\\\n -H ''Authorization: Bearer + YOUR_API_KEY''\\n\", \"node.js\": \"const { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst + configuration = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.listFineTunes();\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.FineTune.list()\\n\"}, + \"group\": \"fine-tunes\", \"name\": \"List fine-tunes\", \"path\": \"list\", + \"response\": \"{\\n \\\"object\\\": \\\"list\\\",\\n \\\"data\\\": [\\n {\\n \\\"id\\\": + \\\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\\\",\\n \\\"object\\\": \\\"fine-tune\\\",\\n \\\"model\\\": + \\\"curie\\\",\\n \\\"created_at\\\": 1614807352,\\n \\\"fine_tuned_model\\\": + null,\\n \\\"hyperparams\\\": { ... },\\n \\\"organization_id\\\": + \\\"org-...\\\",\\n \\\"result_files\\\": [],\\n \\\"status\\\": \\\"pending\\\",\\n \\\"validation_files\\\": + [],\\n \\\"training_files\\\": [ { ... } ],\\n \\\"updated_at\\\": + 1614807352,\\n },\\n { ... },\\n { ... }\\n ]\\n}\\n\"}}, \"post\": + {\"operationId\": \"createFineTune\", \"requestBody\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/CreateFineTuneRequest\"}}}, \"required\": + true}, \"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": + {\"$ref\": \"#/components/schemas/FineTune\"}}}, \"description\": \"OK\"}}, + \"summary\": \"Creates a job that fine-tunes a specified model from a given + dataset.\\n\\nResponse includes details of the enqueued job including job status + and the name of the fine-tuned models once complete.\\n\\n[Learn more about + Fine-tuning](/docs/guides/fine-tuning)\\n\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": + {\"examples\": {\"curl\": \"curl https://api.openai.com/v1/fine-tunes \\\\\\n -X + POST \\\\\\n -H \\\"Content-Type: application/json\\\" \\\\\\n -H \\\"Authorization: + Bearer YOUR_API_KEY\\\" \\\\\\n -d ''{\\n \\\"training_file\\\": \\\"file-XGinujblHPwGLSztz8cPS8XY\\\"\\n}''\\n\", + \"node.js\": \"const { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst + configuration = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.createFineTune({\\n training_file: + \\\"file-XGinujblHPwGLSztz8cPS8XY\\\",\\n});\\n\", \"python\": \"import os\\nimport + openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.FineTune.create(training_file=\\\"file-XGinujblHPwGLSztz8cPS8XY\\\")\\n\"}, + \"group\": \"fine-tunes\", \"name\": \"Create fine-tune\", \"path\": \"create\", + \"response\": \"{\\n \\\"id\\\": \\\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\\\",\\n \\\"object\\\": + \\\"fine-tune\\\",\\n \\\"model\\\": \\\"curie\\\",\\n \\\"created_at\\\": + 1614807352,\\n \\\"events\\\": [\\n {\\n \\\"object\\\": \\\"fine-tune-event\\\",\\n \\\"created_at\\\": + 1614807352,\\n \\\"level\\\": \\\"info\\\",\\n \\\"message\\\": \\\"Job + enqueued. Waiting for jobs ahead to complete. Queue number: 0.\\\"\\n }\\n ],\\n \\\"fine_tuned_model\\\": + null,\\n \\\"hyperparams\\\": {\\n \\\"batch_size\\\": 4,\\n \\\"learning_rate_multiplier\\\": + 0.1,\\n \\\"n_epochs\\\": 4,\\n \\\"prompt_loss_weight\\\": 0.1,\\n },\\n \\\"organization_id\\\": + \\\"org-...\\\",\\n \\\"result_files\\\": [],\\n \\\"status\\\": \\\"pending\\\",\\n \\\"validation_files\\\": + [],\\n \\\"training_files\\\": [\\n {\\n \\\"id\\\": \\\"file-XGinujblHPwGLSztz8cPS8XY\\\",\\n \\\"object\\\": + \\\"file\\\",\\n \\\"bytes\\\": 1547276,\\n \\\"created_at\\\": 1610062281,\\n \\\"filename\\\": + \\\"my-data-train.jsonl\\\",\\n \\\"purpose\\\": \\\"fine-tune-train\\\"\\n }\\n ],\\n \\\"updated_at\\\": + 1614807352,\\n}\\n\"}}}, \"/fine-tunes/{fine_tune_id}\": {\"get\": {\"operationId\": + \"retrieveFineTune\", \"parameters\": [{\"description\": \"The ID of the fine-tune + job\\n\", \"in\": \"path\", \"name\": \"fine_tune_id\", \"required\": true, + \"schema\": {\"example\": \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\", \"type\": \"string\"}}], + \"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": + \"#/components/schemas/FineTune\"}}}, \"description\": \"OK\"}}, \"summary\": + \"Gets info about the fine-tune job.\\n\\n[Learn more about Fine-tuning](/docs/guides/fine-tuning)\\n\", + \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": \"curl https://api.openai.com/v1/fine-tunes/ft-AF1WoRqd3aJAHsqc9NY7iL8F + \\\\\\n -H \\\"Authorization: Bearer YOUR_API_KEY\\\"\\n\", \"node.js\": \"const + { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst configuration + = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.retrieveFineTune(\\\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\\\");\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.FineTune.retrieve(id=\\\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\\\")\\n\"}, + \"group\": \"fine-tunes\", \"name\": \"Retrieve fine-tune\", \"path\": \"retrieve\", + \"response\": \"{\\n \\\"id\\\": \\\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\\\",\\n \\\"object\\\": + \\\"fine-tune\\\",\\n \\\"model\\\": \\\"curie\\\",\\n \\\"created_at\\\": + 1614807352,\\n \\\"events\\\": [\\n {\\n \\\"object\\\": \\\"fine-tune-event\\\",\\n \\\"created_at\\\": + 1614807352,\\n \\\"level\\\": \\\"info\\\",\\n \\\"message\\\": \\\"Job + enqueued. Waiting for jobs ahead to complete. Queue number: 0.\\\"\\n },\\n {\\n \\\"object\\\": + \\\"fine-tune-event\\\",\\n \\\"created_at\\\": 1614807356,\\n \\\"level\\\": + \\\"info\\\",\\n \\\"message\\\": \\\"Job started.\\\"\\n },\\n {\\n \\\"object\\\": + \\\"fine-tune-event\\\",\\n \\\"created_at\\\": 1614807861,\\n \\\"level\\\": + \\\"info\\\",\\n \\\"message\\\": \\\"Uploaded snapshot: curie:ft-acmeco-2021-03-03-21-44-20.\\\"\\n },\\n {\\n \\\"object\\\": + \\\"fine-tune-event\\\",\\n \\\"created_at\\\": 1614807864,\\n \\\"level\\\": + \\\"info\\\",\\n \\\"message\\\": \\\"Uploaded result files: file-QQm6ZpqdNwAaVC3aSz5sWwLT.\\\"\\n },\\n {\\n \\\"object\\\": + \\\"fine-tune-event\\\",\\n \\\"created_at\\\": 1614807864,\\n \\\"level\\\": + \\\"info\\\",\\n \\\"message\\\": \\\"Job succeeded.\\\"\\n }\\n ],\\n \\\"fine_tuned_model\\\": + \\\"curie:ft-acmeco-2021-03-03-21-44-20\\\",\\n \\\"hyperparams\\\": {\\n \\\"batch_size\\\": + 4,\\n \\\"learning_rate_multiplier\\\": 0.1,\\n \\\"n_epochs\\\": 4,\\n \\\"prompt_loss_weight\\\": + 0.1,\\n },\\n \\\"organization_id\\\": \\\"org-...\\\",\\n \\\"result_files\\\": + [\\n {\\n \\\"id\\\": \\\"file-QQm6ZpqdNwAaVC3aSz5sWwLT\\\",\\n \\\"object\\\": + \\\"file\\\",\\n \\\"bytes\\\": 81509,\\n \\\"created_at\\\": 1614807863,\\n \\\"filename\\\": + \\\"compiled_results.csv\\\",\\n \\\"purpose\\\": \\\"fine-tune-results\\\"\\n }\\n ],\\n \\\"status\\\": + \\\"succeeded\\\",\\n \\\"validation_files\\\": [],\\n \\\"training_files\\\": + [\\n {\\n \\\"id\\\": \\\"file-XGinujblHPwGLSztz8cPS8XY\\\",\\n \\\"object\\\": + \\\"file\\\",\\n \\\"bytes\\\": 1547276,\\n \\\"created_at\\\": 1610062281,\\n \\\"filename\\\": + \\\"my-data-train.jsonl\\\",\\n \\\"purpose\\\": \\\"fine-tune-train\\\"\\n }\\n ],\\n \\\"updated_at\\\": + 1614807865,\\n}\\n\"}}}, \"/fine-tunes/{fine_tune_id}/cancel\": {\"post\": {\"operationId\": + \"cancelFineTune\", \"parameters\": [{\"description\": \"The ID of the fine-tune + job to cancel\\n\", \"in\": \"path\", \"name\": \"fine_tune_id\", \"required\": + true, \"schema\": {\"example\": \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\", \"type\": \"string\"}}], + \"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": + \"#/components/schemas/FineTune\"}}}, \"description\": \"OK\"}}, \"summary\": + \"Immediately cancel a fine-tune job.\\n\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": + {\"examples\": {\"curl\": \"curl https://api.openai.com/v1/fine-tunes/ft-AF1WoRqd3aJAHsqc9NY7iL8F/cancel + \\\\\\n -X POST \\\\\\n -H \\\"Authorization: Bearer YOUR_API_KEY\\\"\\n\", + \"node.js\": \"const { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst + configuration = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.cancelFineTune(\\\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\\\");\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.FineTune.cancel(id=\\\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\\\")\\n\"}, + \"group\": \"fine-tunes\", \"name\": \"Cancel fine-tune\", \"path\": \"cancel\", + \"response\": \"{\\n \\\"id\\\": \\\"ft-xhrpBbvVUzYGo8oUO1FY4nI7\\\",\\n \\\"object\\\": + \\\"fine-tune\\\",\\n \\\"model\\\": \\\"curie\\\",\\n \\\"created_at\\\": + 1614807770,\\n \\\"events\\\": [ { ... } ],\\n \\\"fine_tuned_model\\\": null,\\n \\\"hyperparams\\\": + { ... },\\n \\\"organization_id\\\": \\\"org-...\\\",\\n \\\"result_files\\\": + [],\\n \\\"status\\\": \\\"cancelled\\\",\\n \\\"validation_files\\\": [],\\n \\\"training_files\\\": + [\\n {\\n \\\"id\\\": \\\"file-XGinujblHPwGLSztz8cPS8XY\\\",\\n \\\"object\\\": + \\\"file\\\",\\n \\\"bytes\\\": 1547276,\\n \\\"created_at\\\": 1610062281,\\n \\\"filename\\\": + \\\"my-data-train.jsonl\\\",\\n \\\"purpose\\\": \\\"fine-tune-train\\\"\\n }\\n ],\\n \\\"updated_at\\\": + 1614807789,\\n}\\n\"}}}, \"/fine-tunes/{fine_tune_id}/events\": {\"get\": {\"operationId\": + \"listFineTuneEvents\", \"parameters\": [{\"description\": \"The ID of the fine-tune + job to get events for.\\n\", \"in\": \"path\", \"name\": \"fine_tune_id\", \"required\": + true, \"schema\": {\"example\": \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\", \"type\": \"string\"}}, + {\"description\": \"Whether to stream events for the fine-tune job. If set to + true,\\nevents will be sent as data-only\\n[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)\\nas + they become available. The stream will terminate with a\\n`data: [DONE]` message + when the job is finished (succeeded, cancelled,\\nor failed).\\n\\nIf set to + false, only events generated so far will be returned.\\n\", \"in\": \"query\", + \"name\": \"stream\", \"required\": false, \"schema\": {\"default\": false, + \"type\": \"boolean\"}}], \"responses\": {\"200\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/ListFineTuneEventsResponse\"}}}, + \"description\": \"OK\"}}, \"summary\": \"Get fine-grained status updates for + a fine-tune job.\\n\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": + {\"curl\": \"curl https://api.openai.com/v1/fine-tunes/ft-AF1WoRqd3aJAHsqc9NY7iL8F/events + \\\\\\n -H \\\"Authorization: Bearer YOUR_API_KEY\\\"\\n\", \"node.js\": \"const + { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst configuration + = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.listFineTuneEvents(\\\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\\\");\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.FineTune.list_events(id=\\\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\\\")\\n\"}, + \"group\": \"fine-tunes\", \"name\": \"List fine-tune events\", \"path\": \"events\", + \"response\": \"{\\n \\\"object\\\": \\\"list\\\",\\n \\\"data\\\": [\\n {\\n \\\"object\\\": + \\\"fine-tune-event\\\",\\n \\\"created_at\\\": 1614807352,\\n \\\"level\\\": + \\\"info\\\",\\n \\\"message\\\": \\\"Job enqueued. Waiting for jobs ahead + to complete. Queue number: 0.\\\"\\n },\\n {\\n \\\"object\\\": \\\"fine-tune-event\\\",\\n \\\"created_at\\\": + 1614807356,\\n \\\"level\\\": \\\"info\\\",\\n \\\"message\\\": \\\"Job + started.\\\"\\n },\\n {\\n \\\"object\\\": \\\"fine-tune-event\\\",\\n \\\"created_at\\\": + 1614807861,\\n \\\"level\\\": \\\"info\\\",\\n \\\"message\\\": \\\"Uploaded + snapshot: curie:ft-acmeco-2021-03-03-21-44-20.\\\"\\n },\\n {\\n \\\"object\\\": + \\\"fine-tune-event\\\",\\n \\\"created_at\\\": 1614807864,\\n \\\"level\\\": + \\\"info\\\",\\n \\\"message\\\": \\\"Uploaded result files: file-QQm6ZpqdNwAaVC3aSz5sWwLT.\\\"\\n },\\n {\\n \\\"object\\\": + \\\"fine-tune-event\\\",\\n \\\"created_at\\\": 1614807864,\\n \\\"level\\\": + \\\"info\\\",\\n \\\"message\\\": \\\"Job succeeded.\\\"\\n }\\n ]\\n}\\n\"}}}, + \"/images/edits\": {\"post\": {\"operationId\": \"createImageEdit\", \"requestBody\": + {\"content\": {\"multipart/form-data\": {\"schema\": {\"$ref\": \"#/components/schemas/CreateImageEditRequest\"}}}, + \"required\": true}, \"responses\": {\"200\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/ImagesResponse\"}}}, \"description\": + \"OK\"}}, \"summary\": \"Creates an edited or extended image given an original + image and a prompt.\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"beta\": true, + \"examples\": {\"curl\": \"curl https://api.openai.com/v1/images/edits \\\\\\n -H + ''Authorization: Bearer YOUR_API_KEY'' \\\\\\n -F image=''@otter.png'' \\\\\\n -F + mask=''@mask.png'' \\\\\\n -F prompt=\\\"A cute baby sea otter wearing a beret\\\" + \\\\\\n -F n=2 \\\\\\n -F size=\\\"1024x1024\\\"\\n\", \"node.js\": \"const + { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst configuration + = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.createImageEdit(\\n fs.createReadStream(\\\"otter.png\\\"),\\n fs.createReadStream(\\\"mask.png\\\"),\\n \\\"A + cute baby sea otter wearing a beret\\\",\\n 2,\\n \\\"1024x1024\\\"\\n);\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Image.create_edit(\\n image=open(\\\"otter.png\\\", + \\\"rb\\\"),\\n mask=open(\\\"mask.png\\\", \\\"rb\\\"),\\n prompt=\\\"A cute + baby sea otter wearing a beret\\\",\\n n=2,\\n size=\\\"1024x1024\\\"\\n)\\n\"}, + \"group\": \"images\", \"name\": \"Create image edit\", \"path\": \"create-edit\", + \"response\": \"{\\n \\\"created\\\": 1589478378,\\n \\\"data\\\": [\\n {\\n \\\"url\\\": + \\\"https://...\\\"\\n },\\n {\\n \\\"url\\\": \\\"https://...\\\"\\n }\\n ]\\n}\\n\"}}}, + \"/images/generations\": {\"post\": {\"operationId\": \"createImage\", \"requestBody\": + {\"content\": {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/CreateImageRequest\"}}}, + \"required\": true}, \"responses\": {\"200\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/ImagesResponse\"}}}, \"description\": + \"OK\"}}, \"summary\": \"Creates an image given a prompt.\", \"tags\": [\"OpenAI\"], + \"x-oaiMeta\": {\"beta\": true, \"examples\": {\"curl\": \"curl https://api.openai.com/v1/images/generations + \\\\\\n -H ''Content-Type: application/json'' \\\\\\n -H ''Authorization: + Bearer YOUR_API_KEY'' \\\\\\n -d ''{\\n \\\"prompt\\\": \\\"A cute baby sea + otter\\\",\\n \\\"n\\\": 2,\\n \\\"size\\\": \\\"1024x1024\\\"\\n}''\\n\", + \"node.js\": \"const { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst + configuration = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.createImage({\\n prompt: + \\\"A cute baby sea otter\\\",\\n n: 2,\\n size: \\\"1024x1024\\\",\\n});\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Image.create(\\n prompt=\\\"A + cute baby sea otter\\\",\\n n=2,\\n size=\\\"1024x1024\\\"\\n)\\n\"}, \"group\": + \"images\", \"name\": \"Create image\", \"parameters\": \"{\\n \\\"prompt\\\": + \\\"A cute baby sea otter\\\",\\n \\\"n\\\": 2,\\n \\\"size\\\": \\\"1024x1024\\\"\\n}\\n\", + \"path\": \"create\", \"response\": \"{\\n \\\"created\\\": 1589478378,\\n \\\"data\\\": + [\\n {\\n \\\"url\\\": \\\"https://...\\\"\\n },\\n {\\n \\\"url\\\": + \\\"https://...\\\"\\n }\\n ]\\n}\\n\"}}}, \"/images/variations\": {\"post\": + {\"operationId\": \"createImageVariation\", \"requestBody\": {\"content\": {\"multipart/form-data\": + {\"schema\": {\"$ref\": \"#/components/schemas/CreateImageVariationRequest\"}}}, + \"required\": true}, \"responses\": {\"200\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/ImagesResponse\"}}}, \"description\": + \"OK\"}}, \"summary\": \"Creates a variation of a given image.\", \"tags\": + [\"OpenAI\"], \"x-oaiMeta\": {\"beta\": true, \"examples\": {\"curl\": \"curl + https://api.openai.com/v1/images/variations \\\\\\n -H ''Authorization: Bearer + YOUR_API_KEY'' \\\\\\n -F image=''@otter.png'' \\\\\\n -F n=2 \\\\\\n -F + size=\\\"1024x1024\\\"\\n\", \"node.js\": \"const { Configuration, OpenAIApi + } = require(\\\"openai\\\");\\nconst configuration = new Configuration({\\n apiKey: + process.env.OPENAI_API_KEY,\\n});\\nconst openai = new OpenAIApi(configuration);\\nconst + response = await openai.createImageVariation(\\n fs.createReadStream(\\\"otter.png\\\"),\\n 2,\\n \\\"1024x1024\\\"\\n);\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Image.create_variation(\\n image=open(\\\"otter.png\\\", + \\\"rb\\\"),\\n n=2,\\n size=\\\"1024x1024\\\"\\n)\\n\"}, \"group\": \"images\", + \"name\": \"Create image variation\", \"path\": \"create-variation\", \"response\": + \"{\\n \\\"created\\\": 1589478378,\\n \\\"data\\\": [\\n {\\n \\\"url\\\": + \\\"https://...\\\"\\n },\\n {\\n \\\"url\\\": \\\"https://...\\\"\\n }\\n ]\\n}\\n\"}}}, + \"/models\": {\"get\": {\"operationId\": \"listModels\", \"responses\": {\"200\": + {\"content\": {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/ListModelsResponse\"}}}, + \"description\": \"OK\"}}, \"summary\": \"Lists the currently available models, + and provides basic information about each one such as the owner and availability.\", + \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": \"curl https://api.openai.com/v1/models + \\\\\\n -H ''Authorization: Bearer YOUR_API_KEY''\\n\", \"node.js\": \"const + { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst configuration + = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.listModels();\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Model.list()\\n\"}, + \"group\": \"models\", \"name\": \"List models\", \"path\": \"list\", \"response\": + \"{\\n \\\"data\\\": [\\n {\\n \\\"id\\\": \\\"model-id-0\\\",\\n \\\"object\\\": + \\\"model\\\",\\n \\\"owned_by\\\": \\\"organization-owner\\\",\\n \\\"permission\\\": + [...]\\n },\\n {\\n \\\"id\\\": \\\"model-id-1\\\",\\n \\\"object\\\": + \\\"model\\\",\\n \\\"owned_by\\\": \\\"organization-owner\\\",\\n \\\"permission\\\": + [...]\\n },\\n {\\n \\\"id\\\": \\\"model-id-2\\\",\\n \\\"object\\\": + \\\"model\\\",\\n \\\"owned_by\\\": \\\"openai\\\",\\n \\\"permission\\\": + [...]\\n },\\n ],\\n \\\"object\\\": \\\"list\\\"\\n}\\n\"}}}, \"/models/{model}\": + {\"delete\": {\"operationId\": \"deleteModel\", \"parameters\": [{\"description\": + \"The model to delete\", \"in\": \"path\", \"name\": \"model\", \"required\": + true, \"schema\": {\"example\": \"curie:ft-acmeco-2021-03-03-21-44-20\", \"type\": + \"string\"}}], \"responses\": {\"200\": {\"content\": {\"application/json\": + {\"schema\": {\"$ref\": \"#/components/schemas/DeleteModelResponse\"}}}, \"description\": + \"OK\"}}, \"summary\": \"Delete a fine-tuned model. You must have the Owner + role in your organization.\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": + {\"curl\": \"curl https://api.openai.com/v1/models/curie:ft-acmeco-2021-03-03-21-44-20 + \\\\\\n -X DELETE \\\\\\n -H \\\"Authorization: Bearer YOUR_API_KEY\\\"\\n\", + \"node.js\": \"const { Configuration, OpenAIApi } = require(\\\"openai\\\");\\nconst + configuration = new Configuration({\\n apiKey: process.env.OPENAI_API_KEY,\\n});\\nconst + openai = new OpenAIApi(configuration);\\nconst response = await openai.deleteModel(''curie:ft-acmeco-2021-03-03-21-44-20'');\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Model.delete(\\\"curie:ft-acmeco-2021-03-03-21-44-20\\\")\\n\"}, + \"group\": \"fine-tunes\", \"name\": \"Delete fine-tune model\", \"path\": \"delete-model\", + \"response\": \"{\\n \\\"id\\\": \\\"curie:ft-acmeco-2021-03-03-21-44-20\\\",\\n \\\"object\\\": + \\\"model\\\",\\n \\\"deleted\\\": true\\n}\\n\"}}, \"get\": {\"operationId\": + \"retrieveModel\", \"parameters\": [{\"description\": \"The ID of the model + to use for this request\", \"in\": \"path\", \"name\": \"model\", \"required\": + true, \"schema\": {\"example\": \"text-davinci-001\", \"type\": \"string\"}}], + \"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": + \"#/components/schemas/Model\"}}}, \"description\": \"OK\"}}, \"summary\": \"Retrieves + a model instance, providing basic information about the model such as the owner + and permissioning.\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": + {\"curl\": \"curl https://api.openai.com/v1/models/VAR_model_id \\\\\\n -H + ''Authorization: Bearer YOUR_API_KEY''\\n\", \"node.js\": \"const { Configuration, + OpenAIApi } = require(\\\"openai\\\");\\nconst configuration = new Configuration({\\n apiKey: + process.env.OPENAI_API_KEY,\\n});\\nconst openai = new OpenAIApi(configuration);\\nconst + response = await openai.retrieveModel(\\\"VAR_model_id\\\");\\n\", \"python\": + \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Model.retrieve(\\\"VAR_model_id\\\")\\n\"}, + \"group\": \"models\", \"name\": \"Retrieve model\", \"path\": \"retrieve\", + \"response\": \"{\\n \\\"id\\\": \\\"VAR_model_id\\\",\\n \\\"object\\\": + \\\"model\\\",\\n \\\"owned_by\\\": \\\"openai\\\",\\n \\\"permission\\\": + [...]\\n}\\n\"}}}, \"/moderations\": {\"post\": {\"operationId\": \"createModeration\", + \"requestBody\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": + \"#/components/schemas/CreateModerationRequest\"}}}, \"required\": true}, \"responses\": + {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/CreateModerationResponse\"}}}, + \"description\": \"OK\"}}, \"summary\": \"Classifies if text violates OpenAI''s + Content Policy\", \"tags\": [\"OpenAI\"], \"x-oaiMeta\": {\"examples\": {\"curl\": + \"curl https://api.openai.com/v1/moderations \\\\\\n -H ''Content-Type: application/json'' + \\\\\\n -H ''Authorization: Bearer YOUR_API_KEY'' \\\\\\n -d ''{\\n \\\"input\\\": + \\\"I want to kill them.\\\"\\n}''\\n\", \"node.js\": \"const { Configuration, + OpenAIApi } = require(\\\"openai\\\");\\nconst configuration = new Configuration({\\n apiKey: + process.env.OPENAI_API_KEY,\\n});\\nconst openai = new OpenAIApi(configuration);\\nconst + response = await openai.createModeration({\\n input: \\\"I want to kill them.\\\",\\n});\\n\", + \"python\": \"import os\\nimport openai\\nopenai.api_key = os.getenv(\\\"OPENAI_API_KEY\\\")\\nopenai.Moderation.create(\\n input=\\\"I + want to kill them.\\\",\\n)\\n\"}, \"group\": \"moderations\", \"name\": \"Create + moderation\", \"parameters\": \"{\\n \\\"input\\\": \\\"I want to kill them.\\\"\\n}\\n\", + \"path\": \"create\", \"response\": \"{\\n \\\"id\\\": \\\"modr-5MWoLO\\\",\\n \\\"model\\\": + \\\"text-moderation-001\\\",\\n \\\"results\\\": [\\n {\\n \\\"categories\\\": + {\\n \\\"hate\\\": false,\\n \\\"hate/threatening\\\": true,\\n \\\"self-harm\\\": + false,\\n \\\"sexual\\\": false,\\n \\\"sexual/minors\\\": false,\\n \\\"violence\\\": + true,\\n \\\"violence/graphic\\\": false\\n },\\n \\\"category_scores\\\": + {\\n \\\"hate\\\": 0.22714105248451233,\\n \\\"hate/threatening\\\": + 0.4132447838783264,\\n \\\"self-harm\\\": 0.005232391878962517,\\n \\\"sexual\\\": + 0.01407341007143259,\\n \\\"sexual/minors\\\": 0.0038522258400917053,\\n \\\"violence\\\": + 0.9223177433013916,\\n \\\"violence/graphic\\\": 0.036865197122097015\\n },\\n \\\"flagged\\\": + true\\n }\\n ]\\n}\\n\"}}}}, \"components\": {\"schemas\": {\"ChatCompletionRequestMessage\": + {\"properties\": {\"content\": {\"description\": \"The contents of the message\", + \"type\": \"string\"}, \"name\": {\"description\": \"The name of the user in + a multi-user chat\", \"type\": \"string\"}, \"role\": {\"description\": \"The + role of the author of this message.\", \"enum\": [\"system\", \"user\", \"assistant\"], + \"type\": \"string\"}}, \"required\": [\"role\", \"content\"], \"type\": \"object\"}, + \"ChatCompletionResponseMessage\": {\"properties\": {\"content\": {\"description\": + \"The contents of the message\", \"type\": \"string\"}, \"role\": {\"description\": + \"The role of the author of this message.\", \"enum\": [\"system\", \"user\", + \"assistant\"], \"type\": \"string\"}}, \"required\": [\"role\", \"content\"], + \"type\": \"object\"}, \"CreateAnswerRequest\": {\"additionalProperties\": false, + \"properties\": {\"documents\": {\"description\": \"List of documents from which + the answer for the input `question` should be derived. If this is an empty list, + the question will be answered based on the question-answer examples.\\n\\nYou + should specify either `documents` or a `file`, but not both.\\n\", \"example\": + \"[''Japan is an island country in East Asia, located in the northwest Pacific + Ocean.'', ''Tokyo is the capital and most populous prefecture of Japan.'']\", + \"items\": {\"type\": \"string\"}, \"maxItems\": 200, \"nullable\": true, \"type\": + \"array\"}, \"examples\": {\"description\": \"List of (question, answer) pairs + that will help steer the model towards the tone and answer format you''d like. + We recommend adding 2 to 3 examples.\", \"example\": \"[[''What is the capital + of Canada?'', ''Ottawa''], [''Which province is Ottawa in?'', ''Ontario'']]\", + \"items\": {\"items\": {\"minLength\": 1, \"type\": \"string\"}, \"maxItems\": + 2, \"minItems\": 2, \"type\": \"array\"}, \"maxItems\": 200, \"minItems\": 1, + \"type\": \"array\"}, \"examples_context\": {\"description\": \"A text snippet + containing the contextual information used to generate the answers for the `examples` + you provide.\", \"example\": \"Ottawa, Canada''s capital, is located in the + east of southern Ontario, near the city of Montr\\u00e9al and the U.S. border.\", + \"type\": \"string\"}, \"expand\": {\"default\": [], \"description\": \"If an + object name is in the list, we provide the full information of the object; otherwise, + we only provide the object ID. Currently we support `completion` and `file` + objects for expansion.\", \"items\": {}, \"nullable\": true, \"type\": \"array\"}, + \"file\": {\"description\": \"The ID of an uploaded file that contains documents + to search over. See [upload file](/docs/api-reference/files/upload) for how + to upload a file of the desired format and purpose.\\n\\nYou should specify + either `documents` or a `file`, but not both.\\n\", \"nullable\": true, \"type\": + \"string\"}, \"logit_bias\": {\"$ref\": \"#/components/schemas/CreateCompletionRequest/properties/logit_bias\"}, + \"logprobs\": {\"default\": null, \"description\": \"Include the log probabilities + on the `logprobs` most likely tokens, as well the chosen tokens. For example, + if `logprobs` is 5, the API will return a list of the 5 most likely tokens. + The API will always return the `logprob` of the sampled token, so there may + be up to `logprobs+1` elements in the response.\\n\\nThe maximum value for `logprobs` + is 5. If you need more than this, please contact us through our [Help center](https://help.openai.com) + and describe your use case.\\n\\nWhen `logprobs` is set, `completion` will be + automatically added into `expand` to get the logprobs.\\n\", \"maximum\": 5, + \"minimum\": 0, \"nullable\": true, \"type\": \"integer\"}, \"max_rerank\": + {\"default\": 200, \"description\": \"The maximum number of documents to be + ranked by [Search](/docs/api-reference/searches/create) when using `file`. Setting + it to a higher value leads to improved accuracy but with increased latency and + cost.\", \"nullable\": true, \"type\": \"integer\"}, \"max_tokens\": {\"default\": + 16, \"description\": \"The maximum number of tokens allowed for the generated + answer\", \"nullable\": true, \"type\": \"integer\"}, \"model\": {\"description\": + \"ID of the model to use for completion. You can select one of `ada`, `babbage`, + `curie`, or `davinci`.\", \"type\": \"string\"}, \"n\": {\"default\": 1, \"description\": + \"How many answers to generate for each question.\", \"maximum\": 10, \"minimum\": + 1, \"nullable\": true, \"type\": \"integer\"}, \"question\": {\"description\": + \"Question to get answered.\", \"example\": \"What is the capital of Japan?\", + \"minLength\": 1, \"type\": \"string\"}, \"return_metadata\": {\"$ref\": \"#/components/schemas/CreateSearchRequest/properties/return_metadata\"}, + \"return_prompt\": {\"default\": false, \"description\": \"If set to `true`, + the returned JSON will include a \\\"prompt\\\" field containing the final prompt + that was used to request a completion. This is mainly useful for debugging purposes.\", + \"nullable\": true, \"type\": \"boolean\"}, \"search_model\": {\"default\": + \"ada\", \"description\": \"ID of the model to use for [Search](/docs/api-reference/searches/create). + You can select one of `ada`, `babbage`, `curie`, or `davinci`.\", \"nullable\": + true, \"type\": \"string\"}, \"stop\": {\"default\": null, \"description\": + \"Up to 4 sequences where the API will stop generating further tokens. The returned + text will not contain the stop sequence.\\n\", \"nullable\": true, \"oneOf\": + [{\"default\": \"<|endoftext|>\", \"example\": \"\\n\", \"type\": \"string\"}, + {\"items\": {\"example\": \"[\\\"\\\\n\\\"]\", \"type\": \"string\"}, \"maxItems\": + 4, \"minItems\": 1, \"type\": \"array\"}]}, \"temperature\": {\"default\": 0, + \"description\": \"What sampling temperature to use, between 0 and 2. Higher + values like 0.8 will make the output more random, while lower values like 0.2 + will make it more focused and deterministic.\", \"nullable\": true, \"type\": + \"number\"}, \"user\": {\"$ref\": \"#/components/schemas/CreateCompletionRequest/properties/user\"}}, + \"required\": [\"model\", \"question\", \"examples\", \"examples_context\"], + \"type\": \"object\"}, \"CreateAnswerResponse\": {\"properties\": {\"answers\": + {\"items\": {\"type\": \"string\"}, \"type\": \"array\"}, \"completion\": {\"type\": + \"string\"}, \"model\": {\"type\": \"string\"}, \"object\": {\"type\": \"string\"}, + \"search_model\": {\"type\": \"string\"}, \"selected_documents\": {\"items\": + {\"properties\": {\"document\": {\"type\": \"integer\"}, \"text\": {\"type\": + \"string\"}}, \"type\": \"object\"}, \"type\": \"array\"}}, \"type\": \"object\"}, + \"CreateChatCompletionRequest\": {\"properties\": {\"frequency_penalty\": {\"default\": + 0, \"description\": \"Number between -2.0 and 2.0. Positive values penalize + new tokens based on their existing frequency in the text so far, decreasing + the model''s likelihood to repeat the same line verbatim.\\n\\n[See more information + about frequency and presence penalties.](/docs/api-reference/parameter-details)\\n\", + \"maximum\": 2, \"minimum\": -2, \"nullable\": true, \"type\": \"number\"}, + \"logit_bias\": {\"default\": null, \"description\": \"Modify the likelihood + of specified tokens appearing in the completion.\\n\\nAccepts a json object + that maps tokens (specified by their token ID in the tokenizer) to an associated + bias value from -100 to 100. Mathematically, the bias is added to the logits + generated by the model prior to sampling. The exact effect will vary per model, + but values between -1 and 1 should decrease or increase likelihood of selection; + values like -100 or 100 should result in a ban or exclusive selection of the + relevant token.\\n\", \"nullable\": true, \"type\": \"object\", \"x-oaiTypeLabel\": + \"map\"}, \"max_tokens\": {\"default\": \"inf\", \"description\": \"The maximum + number of tokens allowed for the generated answer. By default, the number of + tokens the model can return will be (4096 - prompt tokens).\\n\", \"type\": + \"integer\"}, \"messages\": {\"description\": \"The messages to generate chat + completions for, in the [chat format](/docs/guides/chat/introduction).\", \"items\": + {\"$ref\": \"#/components/schemas/ChatCompletionRequestMessage\"}, \"minItems\": + 1, \"type\": \"array\"}, \"model\": {\"description\": \"ID of the model to use. + Currently, only `gpt-3.5-turbo` and `gpt-3.5-turbo-0301` are supported.\", \"type\": + \"string\"}, \"n\": {\"default\": 1, \"description\": \"How many chat completion + choices to generate for each input message.\", \"example\": 1, \"maximum\": + 128, \"minimum\": 1, \"nullable\": true, \"type\": \"integer\"}, \"presence_penalty\": + {\"default\": 0, \"description\": \"Number between -2.0 and 2.0. Positive values + penalize new tokens based on whether they appear in the text so far, increasing + the model''s likelihood to talk about new topics.\\n\\n[See more information + about frequency and presence penalties.](/docs/api-reference/parameter-details)\\n\", + \"maximum\": 2, \"minimum\": -2, \"nullable\": true, \"type\": \"number\"}, + \"stop\": {\"default\": null, \"description\": \"Up to 4 sequences where the + API will stop generating further tokens.\\n\", \"oneOf\": [{\"nullable\": true, + \"type\": \"string\"}, {\"items\": {\"type\": \"string\"}, \"maxItems\": 4, + \"minItems\": 1, \"type\": \"array\"}]}, \"stream\": {\"default\": false, \"description\": + \"If set, partial message deltas will be sent, like in ChatGPT. Tokens will + be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + as they become available, with the stream terminated by a `data: [DONE]` message.\\n\", + \"nullable\": true, \"type\": \"boolean\"}, \"temperature\": {\"default\": 1, + \"description\": \"What sampling temperature to use, between 0 and 2. Higher + values like 0.8 will make the output more random, while lower values like 0.2 + will make it more focused and deterministic.\\n\\nWe generally recommend altering + this or `top_p` but not both.\\n\", \"example\": 1, \"maximum\": 2, \"minimum\": + 0, \"nullable\": true, \"type\": \"number\"}, \"top_p\": {\"default\": 1, \"description\": + \"An alternative to sampling with temperature, called nucleus sampling, where + the model considers the results of the tokens with top_p probability mass. So + 0.1 means only the tokens comprising the top 10% probability mass are considered.\\n\\nWe + generally recommend altering this or `temperature` but not both.\\n\", \"example\": + 1, \"maximum\": 1, \"minimum\": 0, \"nullable\": true, \"type\": \"number\"}, + \"user\": {\"$ref\": \"#/components/schemas/CreateCompletionRequest/properties/user\"}}, + \"required\": [\"model\", \"messages\"], \"type\": \"object\"}, \"CreateChatCompletionResponse\": + {\"properties\": {\"choices\": {\"items\": {\"properties\": {\"finish_reason\": + {\"type\": \"string\"}, \"index\": {\"type\": \"integer\"}, \"message\": {\"$ref\": + \"#/components/schemas/ChatCompletionResponseMessage\"}}, \"type\": \"object\"}, + \"type\": \"array\"}, \"created\": {\"type\": \"integer\"}, \"id\": {\"type\": + \"string\"}, \"model\": {\"type\": \"string\"}, \"object\": {\"type\": \"string\"}, + \"usage\": {\"properties\": {\"completion_tokens\": {\"type\": \"integer\"}, + \"prompt_tokens\": {\"type\": \"integer\"}, \"total_tokens\": {\"type\": \"integer\"}}, + \"required\": [\"prompt_tokens\", \"completion_tokens\", \"total_tokens\"], + \"type\": \"object\"}}, \"required\": [\"id\", \"object\", \"created\", \"model\", + \"choices\"], \"type\": \"object\"}, \"CreateClassificationRequest\": {\"additionalProperties\": + false, \"properties\": {\"examples\": {\"description\": \"A list of examples + with labels, in the following format:\\n\\n`[[\\\"The movie is so interesting.\\\", + \\\"Positive\\\"], [\\\"It is quite boring.\\\", \\\"Negative\\\"], ...]`\\n\\nAll + the label strings will be normalized to be capitalized.\\n\\nYou should specify + either `examples` or `file`, but not both.\\n\", \"example\": \"[[''Do not see + this film.'', ''Negative''], [''Smart, provocative and blisteringly funny.'', + ''Positive'']]\", \"items\": {\"items\": {\"minLength\": 1, \"type\": \"string\"}, + \"maxItems\": 2, \"minItems\": 2, \"type\": \"array\"}, \"maxItems\": 200, \"minItems\": + 2, \"nullable\": true, \"type\": \"array\"}, \"expand\": {\"$ref\": \"#/components/schemas/CreateAnswerRequest/properties/expand\"}, + \"file\": {\"description\": \"The ID of the uploaded file that contains training + examples. See [upload file](/docs/api-reference/files/upload) for how to upload + a file of the desired format and purpose.\\n\\nYou should specify either `examples` + or `file`, but not both.\\n\", \"nullable\": true, \"type\": \"string\"}, \"labels\": + {\"default\": null, \"description\": \"The set of categories being classified. + If not specified, candidate labels will be automatically collected from the + examples you provide. All the label strings will be normalized to be capitalized.\", + \"example\": [\"Positive\", \"Negative\"], \"items\": {\"type\": \"string\"}, + \"maxItems\": 200, \"minItems\": 2, \"nullable\": true, \"type\": \"array\"}, + \"logit_bias\": {\"$ref\": \"#/components/schemas/CreateCompletionRequest/properties/logit_bias\"}, + \"logprobs\": {\"$ref\": \"#/components/schemas/CreateAnswerRequest/properties/logprobs\"}, + \"max_examples\": {\"default\": 200, \"description\": \"The maximum number of + examples to be ranked by [Search](/docs/api-reference/searches/create) when + using `file`. Setting it to a higher value leads to improved accuracy but with + increased latency and cost.\", \"nullable\": true, \"type\": \"integer\"}, \"model\": + {\"$ref\": \"#/components/schemas/CreateCompletionRequest/properties/model\"}, + \"query\": {\"description\": \"Query to be classified.\", \"example\": \"The + plot is not very attractive.\", \"minLength\": 1, \"type\": \"string\"}, \"return_metadata\": + {\"$ref\": \"#/components/schemas/CreateSearchRequest/properties/return_metadata\"}, + \"return_prompt\": {\"$ref\": \"#/components/schemas/CreateAnswerRequest/properties/return_prompt\"}, + \"search_model\": {\"$ref\": \"#/components/schemas/CreateAnswerRequest/properties/search_model\"}, + \"temperature\": {\"default\": 0, \"description\": \"What sampling temperature + to use, between 0 and 2. Higher values like 0.8 will make the output more random, + while lower values like 0.2 will make it more focused and deterministic.\", + \"example\": 0, \"maximum\": 2, \"minimum\": 0, \"nullable\": true, \"type\": + \"number\"}, \"user\": {\"$ref\": \"#/components/schemas/CreateCompletionRequest/properties/user\"}}, + \"required\": [\"model\", \"query\"], \"type\": \"object\"}, \"CreateClassificationResponse\": + {\"properties\": {\"completion\": {\"type\": \"string\"}, \"label\": {\"type\": + \"string\"}, \"model\": {\"type\": \"string\"}, \"object\": {\"type\": \"string\"}, + \"search_model\": {\"type\": \"string\"}, \"selected_examples\": {\"items\": + {\"properties\": {\"document\": {\"type\": \"integer\"}, \"label\": {\"type\": + \"string\"}, \"text\": {\"type\": \"string\"}}, \"type\": \"object\"}, \"type\": + \"array\"}}, \"type\": \"object\"}, \"CreateCompletionRequest\": {\"properties\": + {\"best_of\": {\"default\": 1, \"description\": \"Generates `best_of` completions + server-side and returns the \\\"best\\\" (the one with the highest log probability + per token). Results cannot be streamed.\\n\\nWhen used with `n`, `best_of` controls + the number of candidate completions and `n` specifies how many to return \\u2013 + `best_of` must be greater than `n`.\\n\\n**Note:** Because this parameter generates + many completions, it can quickly consume your token quota. Use carefully and + ensure that you have reasonable settings for `max_tokens` and `stop`.\\n\", + \"maximum\": 20, \"minimum\": 0, \"nullable\": true, \"type\": \"integer\"}, + \"echo\": {\"default\": false, \"description\": \"Echo back the prompt in addition + to the completion\\n\", \"nullable\": true, \"type\": \"boolean\"}, \"frequency_penalty\": + {\"default\": 0, \"description\": \"Number between -2.0 and 2.0. Positive values + penalize new tokens based on their existing frequency in the text so far, decreasing + the model''s likelihood to repeat the same line verbatim.\\n\\n[See more information + about frequency and presence penalties.](/docs/api-reference/parameter-details)\\n\", + \"maximum\": 2, \"minimum\": -2, \"nullable\": true, \"type\": \"number\"}, + \"logit_bias\": {\"default\": null, \"description\": \"Modify the likelihood + of specified tokens appearing in the completion.\\n\\nAccepts a json object + that maps tokens (specified by their token ID in the GPT tokenizer) to an associated + bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) + (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, + the bias is added to the logits generated by the model prior to sampling. The + exact effect will vary per model, but values between -1 and 1 should decrease + or increase likelihood of selection; values like -100 or 100 should result in + a ban or exclusive selection of the relevant token.\\n\\nAs an example, you + can pass `{\\\"50256\\\": -100}` to prevent the <|endoftext|> token from being + generated.\\n\", \"nullable\": true, \"type\": \"object\", \"x-oaiTypeLabel\": + \"map\"}, \"logprobs\": {\"default\": null, \"description\": \"Include the log + probabilities on the `logprobs` most likely tokens, as well the chosen tokens. + For example, if `logprobs` is 5, the API will return a list of the 5 most likely + tokens. The API will always return the `logprob` of the sampled token, so there + may be up to `logprobs+1` elements in the response.\\n\\nThe maximum value for + `logprobs` is 5. If you need more than this, please contact us through our [Help + center](https://help.openai.com) and describe your use case.\\n\", \"maximum\": + 5, \"minimum\": 0, \"nullable\": true, \"type\": \"integer\"}, \"max_tokens\": + {\"default\": 16, \"description\": \"The maximum number of [tokens](/tokenizer) + to generate in the completion.\\n\\nThe token count of your prompt plus `max_tokens` + cannot exceed the model''s context length. Most models have a context length + of 2048 tokens (except for the newest models, which support 4096).\\n\", \"example\": + 16, \"minimum\": 0, \"nullable\": true, \"type\": \"integer\"}, \"model\": {\"description\": + \"ID of the model to use. You can use the [List models](/docs/api-reference/models/list) + API to see all of your available models, or see our [Model overview](/docs/models/overview) + for descriptions of them.\", \"type\": \"string\"}, \"n\": {\"default\": 1, + \"description\": \"How many completions to generate for each prompt.\\n\\n**Note:** + Because this parameter generates many completions, it can quickly consume your + token quota. Use carefully and ensure that you have reasonable settings for + `max_tokens` and `stop`.\\n\", \"example\": 1, \"maximum\": 128, \"minimum\": + 1, \"nullable\": true, \"type\": \"integer\"}, \"presence_penalty\": {\"default\": + 0, \"description\": \"Number between -2.0 and 2.0. Positive values penalize + new tokens based on whether they appear in the text so far, increasing the model''s + likelihood to talk about new topics.\\n\\n[See more information about frequency + and presence penalties.](/docs/api-reference/parameter-details)\\n\", \"maximum\": + 2, \"minimum\": -2, \"nullable\": true, \"type\": \"number\"}, \"prompt\": {\"default\": + \"<|endoftext|>\", \"description\": \"The prompt(s) to generate completions + for, encoded as a string, array of strings, array of tokens, or array of token + arrays.\\n\\nNote that <|endoftext|> is the document separator that the model + sees during training, so if a prompt is not specified the model will generate + as if from the beginning of a new document.\\n\", \"nullable\": true, \"oneOf\": + [{\"default\": \"\", \"example\": \"This is a test.\", \"type\": \"string\"}, + {\"items\": {\"default\": \"\", \"example\": \"This is a test.\", \"type\": + \"string\"}, \"type\": \"array\"}, {\"example\": \"[1212, 318, 257, 1332, 13]\", + \"items\": {\"type\": \"integer\"}, \"minItems\": 1, \"type\": \"array\"}, {\"example\": + \"[[1212, 318, 257, 1332, 13]]\", \"items\": {\"items\": {\"type\": \"integer\"}, + \"minItems\": 1, \"type\": \"array\"}, \"minItems\": 1, \"type\": \"array\"}]}, + \"stop\": {\"default\": null, \"description\": \"Up to 4 sequences where the + API will stop generating further tokens. The returned text will not contain + the stop sequence.\\n\", \"nullable\": true, \"oneOf\": [{\"default\": \"<|endoftext|>\", + \"example\": \"\\n\", \"nullable\": true, \"type\": \"string\"}, {\"items\": + {\"example\": \"[\\\"\\\\n\\\"]\", \"type\": \"string\"}, \"maxItems\": 4, \"minItems\": + 1, \"type\": \"array\"}]}, \"stream\": {\"default\": false, \"description\": + \"Whether to stream back partial progress. If set, tokens will be sent as data-only + [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + as they become available, with the stream terminated by a `data: [DONE]` message.\\n\", + \"nullable\": true, \"type\": \"boolean\"}, \"suffix\": {\"default\": null, + \"description\": \"The suffix that comes after a completion of inserted text.\", + \"example\": \"test.\", \"nullable\": true, \"type\": \"string\"}, \"temperature\": + {\"default\": 1, \"description\": \"What sampling temperature to use, between + 0 and 2. Higher values like 0.8 will make the output more random, while lower + values like 0.2 will make it more focused and deterministic.\\n\\nWe generally + recommend altering this or `top_p` but not both.\\n\", \"example\": 1, \"maximum\": + 2, \"minimum\": 0, \"nullable\": true, \"type\": \"number\"}, \"top_p\": {\"default\": + 1, \"description\": \"An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens with top_p probability + mass. So 0.1 means only the tokens comprising the top 10% probability mass are + considered.\\n\\nWe generally recommend altering this or `temperature` but not + both.\\n\", \"example\": 1, \"maximum\": 1, \"minimum\": 0, \"nullable\": true, + \"type\": \"number\"}, \"user\": {\"description\": \"A unique identifier representing + your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids).\\n\", + \"example\": \"user-1234\", \"type\": \"string\"}}, \"required\": [\"model\"], + \"type\": \"object\"}, \"CreateCompletionResponse\": {\"properties\": {\"choices\": + {\"items\": {\"properties\": {\"finish_reason\": {\"type\": \"string\"}, \"index\": + {\"type\": \"integer\"}, \"logprobs\": {\"nullable\": true, \"properties\": + {\"text_offset\": {\"items\": {\"type\": \"integer\"}, \"type\": \"array\"}, + \"token_logprobs\": {\"items\": {\"type\": \"number\"}, \"type\": \"array\"}, + \"tokens\": {\"items\": {\"type\": \"string\"}, \"type\": \"array\"}, \"top_logprobs\": + {\"items\": {\"type\": \"object\"}, \"type\": \"array\"}}, \"type\": \"object\"}, + \"text\": {\"type\": \"string\"}}, \"type\": \"object\"}, \"type\": \"array\"}, + \"created\": {\"type\": \"integer\"}, \"id\": {\"type\": \"string\"}, \"model\": + {\"type\": \"string\"}, \"object\": {\"type\": \"string\"}, \"usage\": {\"properties\": + {\"completion_tokens\": {\"type\": \"integer\"}, \"prompt_tokens\": {\"type\": + \"integer\"}, \"total_tokens\": {\"type\": \"integer\"}}, \"required\": [\"prompt_tokens\", + \"completion_tokens\", \"total_tokens\"], \"type\": \"object\"}}, \"required\": + [\"id\", \"object\", \"created\", \"model\", \"choices\"], \"type\": \"object\"}, + \"CreateEditRequest\": {\"properties\": {\"input\": {\"default\": \"\", \"description\": + \"The input text to use as a starting point for the edit.\", \"example\": \"What + day of the wek is it?\", \"nullable\": true, \"type\": \"string\"}, \"instruction\": + {\"description\": \"The instruction that tells the model how to edit the prompt.\", + \"example\": \"Fix the spelling mistakes.\", \"type\": \"string\"}, \"model\": + {\"description\": \"ID of the model to use. You can use the `text-davinci-edit-001` + or `code-davinci-edit-001` model with this endpoint.\", \"type\": \"string\"}, + \"n\": {\"default\": 1, \"description\": \"How many edits to generate for the + input and instruction.\", \"example\": 1, \"maximum\": 20, \"minimum\": 1, \"nullable\": + true, \"type\": \"integer\"}, \"temperature\": {\"default\": 1, \"description\": + \"What sampling temperature to use, between 0 and 2. Higher values like 0.8 + will make the output more random, while lower values like 0.2 will make it more + focused and deterministic.\\n\\nWe generally recommend altering this or `top_p` + but not both.\\n\", \"example\": 1, \"maximum\": 2, \"minimum\": 0, \"nullable\": + true, \"type\": \"number\"}, \"top_p\": {\"default\": 1, \"description\": \"An + alternative to sampling with temperature, called nucleus sampling, where the + model considers the results of the tokens with top_p probability mass. So 0.1 + means only the tokens comprising the top 10% probability mass are considered.\\n\\nWe + generally recommend altering this or `temperature` but not both.\\n\", \"example\": + 1, \"maximum\": 1, \"minimum\": 0, \"nullable\": true, \"type\": \"number\"}}, + \"required\": [\"model\", \"instruction\"], \"type\": \"object\"}, \"CreateEditResponse\": + {\"properties\": {\"choices\": {\"items\": {\"properties\": {\"finish_reason\": + {\"type\": \"string\"}, \"index\": {\"type\": \"integer\"}, \"logprobs\": {\"nullable\": + true, \"properties\": {\"text_offset\": {\"items\": {\"type\": \"integer\"}, + \"type\": \"array\"}, \"token_logprobs\": {\"items\": {\"type\": \"number\"}, + \"type\": \"array\"}, \"tokens\": {\"items\": {\"type\": \"string\"}, \"type\": + \"array\"}, \"top_logprobs\": {\"items\": {\"type\": \"object\"}, \"type\": + \"array\"}}, \"type\": \"object\"}, \"text\": {\"type\": \"string\"}}, \"type\": + \"object\"}, \"type\": \"array\"}, \"created\": {\"type\": \"integer\"}, \"object\": + {\"type\": \"string\"}, \"usage\": {\"properties\": {\"completion_tokens\": + {\"type\": \"integer\"}, \"prompt_tokens\": {\"type\": \"integer\"}, \"total_tokens\": + {\"type\": \"integer\"}}, \"required\": [\"prompt_tokens\", \"completion_tokens\", + \"total_tokens\"], \"type\": \"object\"}}, \"required\": [\"object\", \"created\", + \"choices\", \"usage\"], \"type\": \"object\"}, \"CreateEmbeddingRequest\": + {\"additionalProperties\": false, \"properties\": {\"input\": {\"description\": + \"Input text to get embeddings for, encoded as a string or array of tokens. + To get embeddings for multiple inputs in a single request, pass an array of + strings or array of token arrays. Each input must not exceed 8192 tokens in + length.\\n\", \"example\": \"The quick brown fox jumped over the lazy dog\", + \"oneOf\": [{\"default\": \"\", \"example\": \"This is a test.\", \"type\": + \"string\"}, {\"items\": {\"default\": \"\", \"example\": \"This is a test.\", + \"type\": \"string\"}, \"type\": \"array\"}, {\"example\": \"[1212, 318, 257, + 1332, 13]\", \"items\": {\"type\": \"integer\"}, \"minItems\": 1, \"type\": + \"array\"}, {\"example\": \"[[1212, 318, 257, 1332, 13]]\", \"items\": {\"items\": + {\"type\": \"integer\"}, \"minItems\": 1, \"type\": \"array\"}, \"minItems\": + 1, \"type\": \"array\"}]}, \"model\": {\"$ref\": \"#/components/schemas/CreateCompletionRequest/properties/model\"}, + \"user\": {\"$ref\": \"#/components/schemas/CreateCompletionRequest/properties/user\"}}, + \"required\": [\"model\", \"input\"], \"type\": \"object\"}, \"CreateEmbeddingResponse\": + {\"properties\": {\"data\": {\"items\": {\"properties\": {\"embedding\": {\"items\": + {\"type\": \"number\"}, \"type\": \"array\"}, \"index\": {\"type\": \"integer\"}, + \"object\": {\"type\": \"string\"}}, \"required\": [\"index\", \"object\", \"embedding\"], + \"type\": \"object\"}, \"type\": \"array\"}, \"model\": {\"type\": \"string\"}, + \"object\": {\"type\": \"string\"}, \"usage\": {\"properties\": {\"prompt_tokens\": + {\"type\": \"integer\"}, \"total_tokens\": {\"type\": \"integer\"}}, \"required\": + [\"prompt_tokens\", \"total_tokens\"], \"type\": \"object\"}}, \"required\": + [\"object\", \"model\", \"data\", \"usage\"], \"type\": \"object\"}, \"CreateFileRequest\": + {\"additionalProperties\": false, \"properties\": {\"file\": {\"description\": + \"Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file + to be uploaded.\\n\\nIf the `purpose` is set to \\\"fine-tune\\\", each line + is a JSON record with \\\"prompt\\\" and \\\"completion\\\" fields representing + your [training examples](/docs/guides/fine-tuning/prepare-training-data).\\n\", + \"format\": \"binary\", \"type\": \"string\"}, \"purpose\": {\"description\": + \"The intended purpose of the uploaded documents.\\n\\nUse \\\"fine-tune\\\" + for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate + the format of the uploaded file.\\n\", \"type\": \"string\"}}, \"required\": + [\"file\", \"purpose\"], \"type\": \"object\"}, \"CreateFineTuneRequest\": {\"properties\": + {\"batch_size\": {\"default\": null, \"description\": \"The batch size to use + for training. The batch size is the number of\\ntraining examples used to train + a single forward and backward pass.\\n\\nBy default, the batch size will be + dynamically configured to be\\n~0.2% of the number of examples in the training + set, capped at 256 -\\nin general, we''ve found that larger batch sizes tend + to work better\\nfor larger datasets.\\n\", \"nullable\": true, \"type\": \"integer\"}, + \"classification_betas\": {\"default\": null, \"description\": \"If this is + provided, we calculate F-beta scores at the specified\\nbeta values. The F-beta + score is a generalization of F-1 score.\\nThis is only used for binary classification.\\n\\nWith + a beta of 1 (i.e. the F-1 score), precision and recall are\\ngiven the same + weight. A larger beta score puts more weight on\\nrecall and less on precision. + A smaller beta score puts more weight\\non precision and less on recall.\\n\", + \"example\": [0.6, 1, 1.5, 2], \"items\": {\"type\": \"number\"}, \"nullable\": + true, \"type\": \"array\"}, \"classification_n_classes\": {\"default\": null, + \"description\": \"The number of classes in a classification task.\\n\\nThis + parameter is required for multiclass classification.\\n\", \"nullable\": true, + \"type\": \"integer\"}, \"classification_positive_class\": {\"default\": null, + \"description\": \"The positive class in binary classification.\\n\\nThis parameter + is needed to generate precision, recall, and F1\\nmetrics when doing binary + classification.\\n\", \"nullable\": true, \"type\": \"string\"}, \"compute_classification_metrics\": + {\"default\": false, \"description\": \"If set, we calculate classification-specific + metrics such as accuracy\\nand F-1 score using the validation set at the end + of every epoch.\\nThese metrics can be viewed in the [results file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model).\\n\\nIn + order to compute classification metrics, you must provide a\\n`validation_file`. + Additionally, you must\\nspecify `classification_n_classes` for multiclass classification + or\\n`classification_positive_class` for binary classification.\\n\", \"nullable\": + true, \"type\": \"boolean\"}, \"learning_rate_multiplier\": {\"default\": null, + \"description\": \"The learning rate multiplier to use for training.\\nThe fine-tuning + learning rate is the original learning rate used for\\npretraining multiplied + by this value.\\n\\nBy default, the learning rate multiplier is the 0.05, 0.1, + or 0.2\\ndepending on final `batch_size` (larger learning rates tend to\\nperform + better with larger batch sizes). We recommend experimenting\\nwith values in + the range 0.02 to 0.2 to see what produces the best\\nresults.\\n\", \"nullable\": + true, \"type\": \"number\"}, \"model\": {\"default\": \"curie\", \"description\": + \"The name of the base model to fine-tune. You can select one of \\\"ada\\\",\\n\\\"babbage\\\", + \\\"curie\\\", \\\"davinci\\\", or a fine-tuned model created after 2022-04-21.\\nTo + learn more about these models, see the\\n[Models](https://platform.openai.com/docs/models) + documentation.\\n\", \"nullable\": true, \"type\": \"string\"}, \"n_epochs\": + {\"default\": 4, \"description\": \"The number of epochs to train the model + for. An epoch refers to one\\nfull cycle through the training dataset.\\n\", + \"nullable\": true, \"type\": \"integer\"}, \"prompt_loss_weight\": {\"default\": + 0.01, \"description\": \"The weight to use for loss on the prompt tokens. This + controls how\\nmuch the model tries to learn to generate the prompt (as compared\\nto + the completion which always has a weight of 1.0), and can add\\na stabilizing + effect to training when completions are short.\\n\\nIf prompts are extremely + long (relative to completions), it may make\\nsense to reduce this weight so + as to avoid over-prioritizing\\nlearning the prompt.\\n\", \"nullable\": true, + \"type\": \"number\"}, \"suffix\": {\"default\": null, \"description\": \"A + string of up to 40 characters that will be added to your fine-tuned model name.\\n\\nFor + example, a `suffix` of \\\"custom-model-name\\\" would produce a model name + like `ada:ft-your-org:custom-model-name-2022-02-15-04-21-04`.\\n\", \"maxLength\": + 40, \"minLength\": 1, \"nullable\": true, \"type\": \"string\"}, \"training_file\": + {\"description\": \"The ID of an uploaded file that contains training data.\\n\\nSee + [upload file](/docs/api-reference/files/upload) for how to upload a file.\\n\\nYour + dataset must be formatted as a JSONL file, where each training\\nexample is + a JSON object with the keys \\\"prompt\\\" and \\\"completion\\\".\\nAdditionally, + you must upload your file with the purpose `fine-tune`.\\n\\nSee the [fine-tuning + guide](/docs/guides/fine-tuning/creating-training-data) for more details.\\n\", + \"example\": \"file-ajSREls59WBbvgSzJSVWxMCB\", \"type\": \"string\"}, \"validation_file\": + {\"description\": \"The ID of an uploaded file that contains validation data.\\n\\nIf + you provide this file, the data is used to generate validation\\nmetrics periodically + during fine-tuning. These metrics can be viewed in\\nthe [fine-tuning results + file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model).\\nYour train + and validation data should be mutually exclusive.\\n\\nYour dataset must be + formatted as a JSONL file, where each validation\\nexample is a JSON object + with the keys \\\"prompt\\\" and \\\"completion\\\".\\nAdditionally, you must + upload your file with the purpose `fine-tune`.\\n\\nSee the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) + for more details.\\n\", \"example\": \"file-XjSREls59WBbvgSzJSVWxMCa\", \"nullable\": + true, \"type\": \"string\"}}, \"required\": [\"training_file\"], \"type\": \"object\"}, + \"CreateImageEditRequest\": {\"properties\": {\"image\": {\"description\": \"The + image to edit. Must be a valid PNG file, less than 4MB, and square. If mask + is not provided, image must have transparency, which will be used as the mask.\", + \"format\": \"binary\", \"type\": \"string\"}, \"mask\": {\"description\": \"An + additional image whose fully transparent areas (e.g. where alpha is zero) indicate + where `image` should be edited. Must be a valid PNG file, less than 4MB, and + have the same dimensions as `image`.\", \"format\": \"binary\", \"type\": \"string\"}, + \"n\": {\"$ref\": \"#/components/schemas/CreateImageRequest/properties/n\"}, + \"prompt\": {\"description\": \"A text description of the desired image(s). + The maximum length is 1000 characters.\", \"example\": \"A cute baby sea otter + wearing a beret\", \"type\": \"string\"}, \"response_format\": {\"$ref\": \"#/components/schemas/CreateImageRequest/properties/response_format\"}, + \"size\": {\"$ref\": \"#/components/schemas/CreateImageRequest/properties/size\"}, + \"user\": {\"$ref\": \"#/components/schemas/CreateCompletionRequest/properties/user\"}}, + \"required\": [\"prompt\", \"image\"], \"type\": \"object\"}, \"CreateImageRequest\": + {\"properties\": {\"n\": {\"default\": 1, \"description\": \"The number of images + to generate. Must be between 1 and 10.\", \"example\": 1, \"maximum\": 10, \"minimum\": + 1, \"nullable\": true, \"type\": \"integer\"}, \"prompt\": {\"description\": + \"A text description of the desired image(s). The maximum length is 1000 characters.\", + \"example\": \"A cute baby sea otter\", \"type\": \"string\"}, \"response_format\": + {\"default\": \"url\", \"description\": \"The format in which the generated + images are returned. Must be one of `url` or `b64_json`.\", \"enum\": [\"url\", + \"b64_json\"], \"example\": \"url\", \"nullable\": true, \"type\": \"string\"}, + \"size\": {\"default\": \"1024x1024\", \"description\": \"The size of the generated + images. Must be one of `256x256`, `512x512`, or `1024x1024`.\", \"enum\": [\"256x256\", + \"512x512\", \"1024x1024\"], \"example\": \"1024x1024\", \"nullable\": true, + \"type\": \"string\"}, \"user\": {\"$ref\": \"#/components/schemas/CreateCompletionRequest/properties/user\"}}, + \"required\": [\"prompt\"], \"type\": \"object\"}, \"CreateImageVariationRequest\": + {\"properties\": {\"image\": {\"description\": \"The image to use as the basis + for the variation(s). Must be a valid PNG file, less than 4MB, and square.\", + \"format\": \"binary\", \"type\": \"string\"}, \"n\": {\"$ref\": \"#/components/schemas/CreateImageRequest/properties/n\"}, + \"response_format\": {\"$ref\": \"#/components/schemas/CreateImageRequest/properties/response_format\"}, + \"size\": {\"$ref\": \"#/components/schemas/CreateImageRequest/properties/size\"}, + \"user\": {\"$ref\": \"#/components/schemas/CreateCompletionRequest/properties/user\"}}, + \"required\": [\"image\"], \"type\": \"object\"}, \"CreateModerationRequest\": + {\"properties\": {\"input\": {\"description\": \"The input text to classify\", + \"oneOf\": [{\"default\": \"\", \"example\": \"I want to kill them.\", \"type\": + \"string\"}, {\"items\": {\"default\": \"\", \"example\": \"I want to kill them.\", + \"type\": \"string\"}, \"type\": \"array\"}]}, \"model\": {\"default\": \"text-moderation-latest\", + \"description\": \"Two content moderations models are available: `text-moderation-stable` + and `text-moderation-latest`.\\n\\nThe default is `text-moderation-latest` which + will be automatically upgraded over time. This ensures you are always using + our most accurate model. If you use `text-moderation-stable`, we will provide + advanced notice before updating the model. Accuracy of `text-moderation-stable` + may be slightly lower than for `text-moderation-latest`.\\n\", \"example\": + \"text-moderation-stable\", \"nullable\": false, \"type\": \"string\"}}, \"required\": + [\"input\"], \"type\": \"object\"}, \"CreateModerationResponse\": {\"properties\": + {\"id\": {\"type\": \"string\"}, \"model\": {\"type\": \"string\"}, \"results\": + {\"items\": {\"properties\": {\"categories\": {\"properties\": {\"hate\": {\"type\": + \"boolean\"}, \"hate/threatening\": {\"type\": \"boolean\"}, \"self-harm\": + {\"type\": \"boolean\"}, \"sexual\": {\"type\": \"boolean\"}, \"sexual/minors\": + {\"type\": \"boolean\"}, \"violence\": {\"type\": \"boolean\"}, \"violence/graphic\": + {\"type\": \"boolean\"}}, \"required\": [\"hate\", \"hate/threatening\", \"self-harm\", + \"sexual\", \"sexual/minors\", \"violence\", \"violence/graphic\"], \"type\": + \"object\"}, \"category_scores\": {\"properties\": {\"hate\": {\"type\": \"number\"}, + \"hate/threatening\": {\"type\": \"number\"}, \"self-harm\": {\"type\": \"number\"}, + \"sexual\": {\"type\": \"number\"}, \"sexual/minors\": {\"type\": \"number\"}, + \"violence\": {\"type\": \"number\"}, \"violence/graphic\": {\"type\": \"number\"}}, + \"required\": [\"hate\", \"hate/threatening\", \"self-harm\", \"sexual\", \"sexual/minors\", + \"violence\", \"violence/graphic\"], \"type\": \"object\"}, \"flagged\": {\"type\": + \"boolean\"}}, \"required\": [\"flagged\", \"categories\", \"category_scores\"], + \"type\": \"object\"}, \"type\": \"array\"}}, \"required\": [\"id\", \"model\", + \"results\"], \"type\": \"object\"}, \"CreateSearchRequest\": {\"properties\": + {\"documents\": {\"description\": \"Up to 200 documents to search over, provided + as a list of strings.\\n\\nThe maximum document length (in tokens) is 2034 minus + the number of tokens in the query.\\n\\nYou should specify either `documents` + or a `file`, but not both.\\n\", \"example\": \"[''White House'', ''hospital'', + ''school'']\", \"items\": {\"type\": \"string\"}, \"maxItems\": 200, \"minItems\": + 1, \"nullable\": true, \"type\": \"array\"}, \"file\": {\"description\": \"The + ID of an uploaded file that contains documents to search over.\\n\\nYou should + specify either `documents` or a `file`, but not both.\\n\", \"nullable\": true, + \"type\": \"string\"}, \"max_rerank\": {\"default\": 200, \"description\": \"The + maximum number of documents to be re-ranked and returned by search.\\n\\nThis + flag only takes effect when `file` is set.\\n\", \"minimum\": 1, \"nullable\": + true, \"type\": \"integer\"}, \"query\": {\"description\": \"Query to search + against the documents.\", \"example\": \"the president\", \"minLength\": 1, + \"type\": \"string\"}, \"return_metadata\": {\"default\": false, \"description\": + \"A special boolean flag for showing metadata. If set to `true`, each document + entry in the returned JSON will contain a \\\"metadata\\\" field.\\n\\nThis + flag only takes effect when `file` is set.\\n\", \"nullable\": true, \"type\": + \"boolean\"}, \"user\": {\"$ref\": \"#/components/schemas/CreateCompletionRequest/properties/user\"}}, + \"required\": [\"query\"], \"type\": \"object\"}, \"CreateSearchResponse\": + {\"properties\": {\"data\": {\"items\": {\"properties\": {\"document\": {\"type\": + \"integer\"}, \"object\": {\"type\": \"string\"}, \"score\": {\"type\": \"number\"}}, + \"type\": \"object\"}, \"type\": \"array\"}, \"model\": {\"type\": \"string\"}, + \"object\": {\"type\": \"string\"}}, \"type\": \"object\"}, \"CreateTranscriptionRequest\": + {\"additionalProperties\": false, \"properties\": {\"file\": {\"description\": + \"The audio file to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, + m4a, wav, or webm.\\n\", \"format\": \"binary\", \"type\": \"string\"}, \"language\": + {\"description\": \"The language of the input audio. Supplying the input language + in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format + will improve accuracy and latency.\\n\", \"type\": \"string\"}, \"model\": {\"description\": + \"ID of the model to use. Only `whisper-1` is currently available.\\n\", \"type\": + \"string\"}, \"prompt\": {\"description\": \"An optional text to guide the model''s + style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) + should match the audio language.\\n\", \"type\": \"string\"}, \"response_format\": + {\"default\": \"json\", \"description\": \"The format of the transcript output, + in one of these options: json, text, srt, verbose_json, or vtt.\\n\", \"type\": + \"string\"}, \"temperature\": {\"default\": 0, \"description\": \"The sampling + temperature, between 0 and 1. Higher values like 0.8 will make the output more + random, while lower values like 0.2 will make it more focused and deterministic. + If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) + to automatically increase the temperature until certain thresholds are hit.\\n\", + \"type\": \"number\"}}, \"required\": [\"file\", \"model\"], \"type\": \"object\"}, + \"CreateTranscriptionResponse\": {\"properties\": {\"text\": {\"type\": \"string\"}}, + \"required\": [\"text\"], \"type\": \"object\"}, \"CreateTranslationRequest\": + {\"additionalProperties\": false, \"properties\": {\"file\": {\"description\": + \"The audio file to translate, in one of these formats: mp3, mp4, mpeg, mpga, + m4a, wav, or webm.\\n\", \"format\": \"binary\", \"type\": \"string\"}, \"model\": + {\"description\": \"ID of the model to use. Only `whisper-1` is currently available.\\n\", + \"type\": \"string\"}, \"prompt\": {\"description\": \"An optional text to guide + the model''s style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) + should be in English.\\n\", \"type\": \"string\"}, \"response_format\": {\"default\": + \"json\", \"description\": \"The format of the transcript output, in one of + these options: json, text, srt, verbose_json, or vtt.\\n\", \"type\": \"string\"}, + \"temperature\": {\"default\": 0, \"description\": \"The sampling temperature, + between 0 and 1. Higher values like 0.8 will make the output more random, while + lower values like 0.2 will make it more focused and deterministic. If set to + 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) + to automatically increase the temperature until certain thresholds are hit.\\n\", + \"type\": \"number\"}}, \"required\": [\"file\", \"model\"], \"type\": \"object\"}, + \"CreateTranslationResponse\": {\"properties\": {\"text\": {\"type\": \"string\"}}, + \"required\": [\"text\"], \"type\": \"object\"}, \"DeleteFileResponse\": {\"properties\": + {\"deleted\": {\"type\": \"boolean\"}, \"id\": {\"type\": \"string\"}, \"object\": + {\"type\": \"string\"}}, \"required\": [\"id\", \"object\", \"deleted\"], \"type\": + \"object\"}, \"DeleteModelResponse\": {\"properties\": {\"deleted\": {\"type\": + \"boolean\"}, \"id\": {\"type\": \"string\"}, \"object\": {\"type\": \"string\"}}, + \"required\": [\"id\", \"object\", \"deleted\"], \"type\": \"object\"}, \"Engine\": + {\"properties\": {\"created\": {\"nullable\": true, \"type\": \"integer\"}, + \"id\": {\"type\": \"string\"}, \"object\": {\"type\": \"string\"}, \"ready\": + {\"type\": \"boolean\"}}, \"required\": [\"id\", \"object\", \"created\", \"ready\"], + \"title\": \"Engine\"}, \"FineTune\": {\"properties\": {\"created_at\": {\"type\": + \"integer\"}, \"events\": {\"items\": {\"$ref\": \"#/components/schemas/FineTuneEvent\"}, + \"type\": \"array\"}, \"fine_tuned_model\": {\"nullable\": true, \"type\": \"string\"}, + \"hyperparams\": {\"type\": \"object\"}, \"id\": {\"type\": \"string\"}, \"model\": + {\"type\": \"string\"}, \"object\": {\"type\": \"string\"}, \"organization_id\": + {\"type\": \"string\"}, \"result_files\": {\"items\": {\"$ref\": \"#/components/schemas/OpenAIFile\"}, + \"type\": \"array\"}, \"status\": {\"type\": \"string\"}, \"training_files\": + {\"items\": {\"$ref\": \"#/components/schemas/OpenAIFile\"}, \"type\": \"array\"}, + \"updated_at\": {\"type\": \"integer\"}, \"validation_files\": {\"items\": {\"$ref\": + \"#/components/schemas/OpenAIFile\"}, \"type\": \"array\"}}, \"required\": [\"id\", + \"object\", \"created_at\", \"updated_at\", \"model\", \"fine_tuned_model\", + \"organization_id\", \"status\", \"hyperparams\", \"training_files\", \"validation_files\", + \"result_files\"], \"title\": \"FineTune\"}, \"FineTuneEvent\": {\"properties\": + {\"created_at\": {\"type\": \"integer\"}, \"level\": {\"type\": \"string\"}, + \"message\": {\"type\": \"string\"}, \"object\": {\"type\": \"string\"}}, \"required\": + [\"object\", \"created_at\", \"level\", \"message\"], \"title\": \"FineTuneEvent\"}, + \"ImagesResponse\": {\"properties\": {\"created\": {\"type\": \"integer\"}, + \"data\": {\"items\": {\"properties\": {\"b64_json\": {\"type\": \"string\"}, + \"url\": {\"type\": \"string\"}}, \"type\": \"object\"}, \"type\": \"array\"}}, + \"required\": [\"created\", \"data\"]}, \"ListEnginesResponse\": {\"properties\": + {\"data\": {\"items\": {\"$ref\": \"#/components/schemas/Engine\"}, \"type\": + \"array\"}, \"object\": {\"type\": \"string\"}}, \"required\": [\"object\", + \"data\"], \"type\": \"object\"}, \"ListFilesResponse\": {\"properties\": {\"data\": + {\"items\": {\"$ref\": \"#/components/schemas/OpenAIFile\"}, \"type\": \"array\"}, + \"object\": {\"type\": \"string\"}}, \"required\": [\"object\", \"data\"], \"type\": + \"object\"}, \"ListFineTuneEventsResponse\": {\"properties\": {\"data\": {\"items\": + {\"$ref\": \"#/components/schemas/FineTuneEvent\"}, \"type\": \"array\"}, \"object\": + {\"type\": \"string\"}}, \"required\": [\"object\", \"data\"], \"type\": \"object\"}, + \"ListFineTunesResponse\": {\"properties\": {\"data\": {\"items\": {\"$ref\": + \"#/components/schemas/FineTune\"}, \"type\": \"array\"}, \"object\": {\"type\": + \"string\"}}, \"required\": [\"object\", \"data\"], \"type\": \"object\"}, \"ListModelsResponse\": + {\"properties\": {\"data\": {\"items\": {\"$ref\": \"#/components/schemas/Model\"}, + \"type\": \"array\"}, \"object\": {\"type\": \"string\"}}, \"required\": [\"object\", + \"data\"], \"type\": \"object\"}, \"Model\": {\"properties\": {\"created\": + {\"type\": \"integer\"}, \"id\": {\"type\": \"string\"}, \"object\": {\"type\": + \"string\"}, \"owned_by\": {\"type\": \"string\"}}, \"required\": [\"id\", \"object\", + \"created\", \"owned_by\"], \"title\": \"Model\"}, \"OpenAIFile\": {\"properties\": + {\"bytes\": {\"type\": \"integer\"}, \"created_at\": {\"type\": \"integer\"}, + \"filename\": {\"type\": \"string\"}, \"id\": {\"type\": \"string\"}, \"object\": + {\"type\": \"string\"}, \"purpose\": {\"type\": \"string\"}, \"status\": {\"type\": + \"string\"}, \"status_details\": {\"nullable\": true, \"type\": \"object\"}}, + \"required\": [\"id\", \"object\", \"bytes\", \"created_at\", \"filename\", + \"purpose\"], \"title\": \"OpenAIFile\"}}}, \"x-oaiMeta\": {\"groups\": [{\"description\": + \"List and describe the various models available in the API. You can refer to + the [Models](/docs/models) documentation to understand what models are available + and the differences between them.\\n\", \"id\": \"models\", \"title\": \"Models\"}, + {\"description\": \"Given a prompt, the model will return one or more predicted + completions, and can also return the probabilities of alternative tokens at + each position.\\n\", \"id\": \"completions\", \"title\": \"Completions\"}, {\"description\": + \"Given a chat conversation, the model will return a chat completion response.\\n\", + \"id\": \"chat\", \"title\": \"Chat\"}, {\"description\": \"Given a prompt and + an instruction, the model will return an edited version of the prompt.\\n\", + \"id\": \"edits\", \"title\": \"Edits\"}, {\"description\": \"Given a prompt + and/or an input image, the model will generate a new image.\\n\\nRelated guide: + [Image generation](/docs/guides/images)\\n\", \"id\": \"images\", \"title\": + \"Images\"}, {\"description\": \"Get a vector representation of a given input + that can be easily consumed by machine learning models and algorithms.\\n\\nRelated + guide: [Embeddings](/docs/guides/embeddings)\\n\", \"id\": \"embeddings\", \"title\": + \"Embeddings\"}, {\"description\": \"Learn how to turn audio into text.\\n\\nRelated + guide: [Speech to text](/docs/guides/speech-to-text)\\n\", \"id\": \"audio\", + \"title\": \"Audio\"}, {\"description\": \"Files are used to upload documents + that can be used with features like [Fine-tuning](/docs/api-reference/fine-tunes).\\n\", + \"id\": \"files\", \"title\": \"Files\"}, {\"description\": \"Manage fine-tuning + jobs to tailor a model to your specific training data.\\n\\nRelated guide: [Fine-tune + models](/docs/guides/fine-tuning)\\n\", \"id\": \"fine-tunes\", \"title\": \"Fine-tunes\"}, + {\"description\": \"Given a input text, outputs if the model classifies it as + violating OpenAI''s content policy.\\n\\nRelated guide: [Moderations](/docs/guides/moderation)\\n\", + \"id\": \"moderations\", \"title\": \"Moderations\"}, {\"description\": \"Given + a query and a set of documents or labels, the model ranks each document based + on its semantic similarity to the provided query.\\n\\nRelated guide: [Search](/docs/guides/search)\\n\", + \"id\": \"searches\", \"title\": \"Searches\", \"warning\": {\"message\": \"We\\u2019ve + developed new methods with better performance. [Learn more](https://help.openai.com/en/articles/6272952-search-transition-guide).\", + \"title\": \"This endpoint is deprecated and will be removed on December 3rd, + 2022\"}}, {\"description\": \"Given a query and a set of labeled examples, the + model will predict the most likely label for the query. Useful as a drop-in + replacement for any ML classification or text-to-label task.\\n\\nRelated guide: + [Classification](/docs/guides/classifications)\\n\", \"id\": \"classifications\", + \"title\": \"Classifications\", \"warning\": {\"message\": \"We\\u2019ve developed + new methods with better performance. [Learn more](https://help.openai.com/en/articles/6272941-classifications-transition-guide).\", + \"title\": \"This endpoint is deprecated and will be removed on December 3rd, + 2022\"}}, {\"description\": \"Given a question, a set of documents, and some + examples, the API generates an answer to the question based on the information + in the set of documents. This is useful for question-answering applications + on sources of truth, like company documentation or a knowledge base.\\n\\nRelated + guide: [Question answering](/docs/guides/answers)\\n\", \"id\": \"answers\", + \"title\": \"Answers\", \"warning\": {\"message\": \"We\\u2019ve developed new + methods with better performance. [Learn more](https://help.openai.com/en/articles/6233728-answers-transition-guide).\", + \"title\": \"This endpoint is deprecated and will be removed on December 3rd, + 2022\"}}, {\"description\": \"These endpoints describe and provide access to + the various engines available in the API.\", \"id\": \"engines\", \"title\": + \"Engines\", \"warning\": {\"message\": \"Please use their replacement, [Models](/docs/api-reference/models), + instead. [Learn more](https://help.openai.com/TODO).\", \"title\": \"The Engines + endpoints are deprecated.\"}}]}}"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '112971' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-location --environment-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi/importSpecification?api-version=2024-03-01 + response: + body: + string: '' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 22 Nov 2023 17:35:04 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi/operationResults/07c6ccd6-cdf9-4789-b740-90e79dd9df80?api-version=2024-03-01 + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-location --environment-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi/operationResults/07c6ccd6-cdf9-4789-b740-90e79dd9df80?api-version=2024-03-01 + response: + body: + string: '{"apiName":"default","apiVersion":"1-2-0","catalogName":"contosoeuap","provisioningState":"InProgress","error":{"message":""}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '126' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:35:04 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-location --environment-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-22T17:34:52.812953Z"},"properties":{"title":"Public + cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '691' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:35:05 GMT + etag: + - 04001e85-0000-3300-0000-655e3bbc0000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"definitionId": "/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi", + "description": "clitestopenaiapi01deployment", "environmentId": "/workspaces/default/environments/cli-test-public", + "server": {"runtimeUri": ["https://api.openai.com/v1"]}, "state": "active", + "title": "clitestopenaiapi01deployment"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api register + Connection: + - keep-alive + Content-Length: + - '351' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-location --environment-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/deployments/mock-deployment?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/deployments/clitestopenaiapi01deployment","name":"clitestopenaiapi01deployment","systemData":{"createdAt":"2023-11-22T17:35:06.7806676Z","lastModifiedAt":"2023-11-22T17:35:06.7806676Z"},"properties":{"title":"clitestopenaiapi01deployment","description":"clitestopenaiapi01deployment","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi","server":{"runtimeUri":["https://api.openai.com/v1"]},"customProperties":{},"recommended":false}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '786' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 22 Nov 2023 17:35:06 GMT + etag: + - 06006730-0000-3300-0000-655e3bca0000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +version: 1 diff --git a/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py b/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py index a7a42cd669d..5bbae6dba57 100644 --- a/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py +++ b/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py @@ -6,8 +6,134 @@ # -------------------------------------------------------------------------------------------- from azure.cli.testsdk import * +import unittest class ApicExtensionScenario(ScenarioTest): - # TODO: add tests here - pass + + @unittest.skip('Test account does not have permissions to create service') + def test_apic_scenarios(self): + + # create service - TODO in future. Use fixed service for now + + #parameters for common use + from datetime import datetime + self.kwargs.update({ + 'resource_group': 'api-center-test', + 'service_name': 'contosoeuap', + 'api_name': 'cli-test-api-100', + 'api_version': 'cli-test-2023-01-02', + 'api_definition_name': 'cli-test-openapi' + }) + + # create environment + import json + server_details = { + "type": "Azure API Management", + "managementPortalUri": [ + "management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service" + ] + } + self.kwargs.update({ + 'server_details': server_details, + 'environment_name': 'cli-test-public' + }) + self.cmd('az apic environment create -g {resource_group} -s {service_name} --name {environment_name} --title "Public cloud" --kind "development" --server "{server_details}"') + + # create api + self.cmd('az apic api create -g {resource_group} -s {service_name} --api-name {api_name} --description "CLI Test API" --kind rest --title "CLI Test API"') + + # create api version + self.cmd('az apic api version create -g {resource_group} -s {service_name} --api-name {api_name} --name {api_version} --title {api_version}') + + # create api definition + self.cmd('az apic api definition create -g {resource_group} -s {service_name} --api-name {api_name} --version {api_version} --name {api_definition_name} --title "OpenAPI" ') + + # import specification + import os + TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + templateFile = os.path.join( + TEST_DIR, + "data", + "import_spec_payload.json", + ) + specification_details = '{"name":"openapi","version":"3.0.0"}' + self.kwargs.update({ + 'templateFile': templateFile, + 'specification_details': specification_details + }) + self.cmd('az apic api definition import-specification -g {resource_group} -s {service_name} --api-name {api_name} --version {api_version} --name {api_definition_name} --format inline --specification {specification_details} --file-name "{templateFile}"') + + # export specification + templateOutputFile = os.path.join( + TEST_DIR, + "data", + "exported_spec.json", + ) + self.kwargs.update({ + 'templateFile': templateOutputFile + }) + self.cmd('az apic api definition export-specification -g {resource_group} -s {service_name} --api-name {api_name} --version {api_version} --name {api_definition_name} --file-name "{templateFile}"') + + # create deployment + environment_id = "/workspaces/default/environments/"+self.kwargs['environment_name'] + definition_id = "/workspaces/default/apis/"+self.kwargs['api_name']+"/versions/"+self.kwargs['api_version']+"/definitions/"+self.kwargs['api_definition_name'] + server = {"runtime-uri": ["https://api.contoso.com"]} + self.kwargs.update({ + 'environment_id': environment_id, + 'definition_id' : definition_id, + 'deployment_name': 'production', + 'server': server, + }) + self.cmd('az apic api deployment create -g {resource_group} -s {service_name} --api-name {api_name} --name {deployment_name} --title "CLI Test Production deployment" --description "CLI Test Public cloud production deployment." --environment-id {environment_id} --definition-id {definition_id} --server "{server}"') + + # create metadata schema + templateInputSchemaFile = os.path.join( + TEST_DIR, + "data", + "import_metadataschema_input.json", + ) + self.kwargs.update({ + 'schemaName': 'cli-test-metadata-schema-1', + 'templateFile': templateInputSchemaFile + + }) + self.cmd('az apic metadata-schema create -g {resource_group} -s {service_name} --name {schemaName} --file-name "{templateFile}"') + + # export metadata schema + templateOutputApiSchemaFile = os.path.join( + TEST_DIR, + "data", + "exported_md_schema_api.json", + ) + templateOutputDeploymentSchemaFile = os.path.join( + TEST_DIR, + "data", + "exported_md_schema_deployment.json", + ) + templateOutputEnvSchemaFile = os.path.join( + TEST_DIR, + "data", + "exported_md_schema_env.json", + ) + self.kwargs.update({ + 'templateFileApi': templateOutputApiSchemaFile, + 'templateFileDeployment': templateOutputDeploymentSchemaFile, + 'templateFileEnvironment': templateOutputEnvSchemaFile + }) + self.cmd('az apic metadata-schema export-metadata-schema -g {resource_group} -s {service_name} --assigned-to api --file-name "{templateFileApi}"') + self.cmd('az apic metadata-schema export-metadata-schema -g {resource_group} -s {service_name} --assigned-to deployment --file-name "{templateFileDeployment}"') + self.cmd('az apic metadata-schema export-metadata-schema -g {resource_group} -s {service_name} --assigned-to environment --file-name "{templateFileEnvironment}"') + + # register api - quick add + templateQuickAddFile = os.path.join( + TEST_DIR, + "data", + "register_quickadd_openai_spec.json", + ) + self.kwargs.update({ + 'templateFile': templateQuickAddFile, + 'environment_name': self.kwargs['environment_name'] + }) + self.cmd('az apic api register -g {resource_group} -s {service_name} --api-location "{templateFile}" --environment-name {environment_name}') + From dd5ee3e00b5593a059287f4d7a783b4621c86670 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Thu, 23 Nov 2023 17:40:41 -0600 Subject: [PATCH 13/27] update metadata schema and additional tests --- .../azext_apic_extension/commands.py | 2 + .../azext_apic_extension/custom.py | 50 +- .../data/register_quickadd_openai_spec.json | 2 +- .../recordings/test_apic_scenarios.yaml | 1326 +++++++++++++++-- .../tests/latest/test_apic_extension.py | 147 +- 5 files changed, 1408 insertions(+), 119 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/commands.py b/src/apic-extension/azext_apic_extension/commands.py index 44a491ea520..500feeec4ee 100644 --- a/src/apic-extension/azext_apic_extension/commands.py +++ b/src/apic-extension/azext_apic_extension/commands.py @@ -13,6 +13,7 @@ from .custom import ExportSpecificationExtension from .custom import ExportMetadataSchemaExtension from .custom import CreateMetadataSchemaExtension +from .custom import UpdateMetadataSchemaExtension def load_command_table(self, _): # pylint: disable=unused-argument with self.command_group('apic api definition') as g: @@ -21,6 +22,7 @@ def load_command_table(self, _): # pylint: disable=unused-argument with self.command_group('apic metadata-schema') as g: self.command_table['apic metadata-schema create'] = CreateMetadataSchemaExtension(loader=self) + self.command_table['apic metadata-schema update'] = UpdateMetadataSchemaExtension(loader=self) self.command_table['apic metadata-schema export-metadata-schema'] = ExportMetadataSchemaExtension(loader=self) with self.command_group('apic api') as g: diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index d944d0f1f27..09ba4739667 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -13,6 +13,7 @@ from .aaz.latest.apic.api.definition import ImportSpecification from .aaz.latest.apic.api.definition import ExportSpecification from .aaz.latest.apic.metadata_schema import Create +from .aaz.latest.apic.metadata_schema import Update from .aaz.latest.apic.metadata_schema import ExportMetadataSchema from azure.cli.core.aaz import * @@ -161,6 +162,45 @@ def pre_operations(self): # Reassign the values to self.args self.ctx.args.schema = value +class UpdateMetadataSchemaExtension(Update): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.source_profile = AAZStrArg( + options=["--file-name"], + help='Name of the file from that contains the metadata schema.', + required=False, + registered=True + ) + return args_schema + + def pre_operations(self): + args = self.ctx.args + + data = None + value = args.schema + + # Load the JSON file + if args.source_profile: + rawdata = open(str(args.source_profile), 'rb').read() + result = chardet.detect(rawdata) + encoding = result['encoding'] + + if os.stat(str(args.source_profile)).st_size == 0: + raise ValueError('Metadtata schema file is empty. Please provide a valid metadata schema file.') + + with open(str(args.source_profile), 'r', encoding=encoding) as f: + data = json.load(f) + if data: + value = json.dumps(data) + + # If any of the fields are None, get them from self.args + if value is None: + logger.error('Please provide the schema to update the metadata schema through --schema option or through --file-name option via a file.') + + # Reassign the values to self.args + self.ctx.args.schema = value + class ExportMetadataSchemaExtension(ExportMetadataSchema): @classmethod @@ -219,7 +259,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n # Load the JSON file if api_location: - #TODO Confirm its a file and not link + #TODO Future Confirm its a file and not link rawdata = open(str(api_location), 'rb').read() result = chardet.detect(rawdata) @@ -305,7 +345,6 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n # Create API ------------------------------------------------------------------------------------- - from .aaz.latest.apic.api import Create as CreateAPI api_args = { @@ -326,9 +365,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n print("API was created successfully") - # Create API Version ----------------------------------------------------------------------------- - from .aaz.latest.apic.api.version import Create as CreateAPIVersion api_version_args = { @@ -345,9 +382,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n print("API version was created successfully") - # Create API Definition ----------------------------------------------------------------------------- - from .aaz.latest.apic.api.definition import Create as CreateAPIDefinition api_definition_args = { @@ -365,9 +400,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n print("API definition was created successfully") - # Import Specification ----------------------------------------------------------------------------- - from azure.cli.core.commands import LongRunningOperation # uses customized ImportSpecificationExtension class @@ -395,7 +428,6 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n # Create API Deployment ----------------------------------------------------------------------------- - from .aaz.latest.apic.api.deployment import Create as CreateAPIDeployment from .aaz.latest.apic.environment import Show as GetEnvironment from datetime import datetime diff --git a/src/apic-extension/azext_apic_extension/tests/latest/data/register_quickadd_openai_spec.json b/src/apic-extension/azext_apic_extension/tests/latest/data/register_quickadd_openai_spec.json index b4565cb5c08..b3139e6acfc 100644 --- a/src/apic-extension/azext_apic_extension/tests/latest/data/register_quickadd_openai_spec.json +++ b/src/apic-extension/azext_apic_extension/tests/latest/data/register_quickadd_openai_spec.json @@ -7,7 +7,7 @@ ], "info": { "description": "APIs for sampling from and fine-tuning language models", - "title": "CLI Test OpenAI API 01", + "title": "CLI Test OpenAI API 100", "version": "1.2.0", "x-apisguru-categories": [ "machine_learning" diff --git a/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml b/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml index 73f52febcad..e1c65f2ee1a 100644 --- a/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml +++ b/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml @@ -1,7 +1,7 @@ interactions: - request: body: '{"properties": {"kind": "development", "server": {"managementPortalUri": - ["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"], + ["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service-0"], "type": "Azure API Management"}, "title": "Public cloud"}}' headers: Accept: @@ -13,7 +13,7 @@ interactions: Connection: - keep-alive Content-Length: - - '309' + - '311' Content-Type: - application/json ParameterSetName: @@ -24,21 +24,21 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-22T17:34:52.812953Z"},"properties":{"title":"Public - cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}' + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-23T23:38:55.7280282Z"},"properties":{"title":"Public + cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service-0"]},"customProperties":{}}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '691' + - '694' content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:34:52 GMT + - Thu, 23 Nov 2023 23:38:54 GMT etag: - - 04001e85-0000-3300-0000-655e3bbc0000 + - 05006f4b-0000-3300-0000-655fe28f0000 expires: - '-1' pragma: @@ -61,44 +61,98 @@ interactions: code: 200 message: OK - request: - body: '{"properties": {"description": "CLI Test API", "kind": "rest", "title": - "CLI Test API"}}' + body: null headers: Accept: - application/json Accept-Encoding: - gzip, deflate CommandName: - - apic api create + - apic environment update + Connection: + - keep-alive + ParameterSetName: + - -g -s --name --title --kind --server + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-23T23:38:55.7280282Z"},"properties":{"title":"Public + cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service-0"]},"customProperties":{}}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '694' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:38:55 GMT + etag: + - 05006f4b-0000-3300-0000-655fe28f0000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"customProperties": {}, "kind": "development", "server": + {"managementPortalUri": ["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"], + "type": "Azure API Management"}, "title": "Public cloud"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic environment update Connection: - keep-alive Content-Length: - - '88' + - '333' Content-Type: - application/json ParameterSetName: - - -g -s --api-name --description --kind --title + - -g -s --name --title --kind --server User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100","name":"cli-test-api-100","systemData":{"createdAt":"2023-11-22T17:34:01.033101Z","lastModifiedAt":"2023-11-22T17:34:53.5142499Z"},"properties":{"title":"CLI - Test API","description":"CLI Test API","kind":"rest","lifecycleStage":"design","externalDocumentation":[],"contacts":[],"customProperties":{}}}' + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-23T23:38:56.6775124Z"},"properties":{"title":"Public + cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '527' + - '692' content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:34:53 GMT + - Thu, 23 Nov 2023 23:38:55 GMT etag: - - 3f00d6a5-0000-3300-0000-655e3bbd0000 + - 0500704b-0000-3300-0000-655fe2900000 expires: - '-1' pragma: @@ -121,42 +175,176 @@ interactions: code: 200 message: OK - request: - body: '{"properties": {"title": "cli-test-2023-01-02"}}' + body: null headers: Accept: - application/json Accept-Encoding: - gzip, deflate CommandName: - - apic api version create + - apic environment show + Connection: + - keep-alive + ParameterSetName: + - -g -s --name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-23T23:38:56.6775124Z"},"properties":{"title":"Public + cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '692' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:38:56 GMT + etag: + - 0500704b-0000-3300-0000-655fe2900000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic environment list + Connection: + - keep-alive + ParameterSetName: + - -g -s + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments?api-version=2024-03-01 + response: + body: + string: '{"value":[{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/metadata-test-env","name":"metadata-test-env","systemData":{"createdAt":"2023-08-02T15:06:50.5631147Z","lastModifiedAt":"2023-09-05T14:11:02.7886448Z"},"properties":{"title":"Metadata + test env","server":{"type":"azure-api-management","managementPortalUri":[]},"onboarding":{"developerPortalUri":[]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/production","name":"production","systemData":{"createdAt":"2023-08-28T20:40:54.4152308Z","lastModifiedAt":"2023-08-28T20:40:54.4152526Z"},"properties":{"title":"Contoso + Europe Azure API Management","description":"The primary Azure API Management + service for the European division of Contoso.","server":{"type":"Azure API + Management","managementPortalUri":["https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"onboarding":{"instructions":"Sign + in or sign up in the specified developer portal to request API access. You + must complete the internal privacy training for your account to be approved.","developerPortalUri":["https://developer.contoso.com"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/test-env-for-depl","name":"test-env-for-depl","systemData":{"createdAt":"2023-08-30T14:28:25.8546451Z","lastModifiedAt":"2023-11-14T22:54:17.5088956Z"},"properties":{"title":"Contoso + Europe Azure API Management","kind":"production","description":"The primary + Azure API Management service for the European division of Contoso.","server":{"type":"Azure + API Management","managementPortalUri":["https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"onboarding":{"instructions":"Sign + in or sign up in the specified developer portal to request API access. You + must complete the internal privacy training for your account to be approved.","developerPortalUri":["https://developer.contoso.com"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/apim-test","name":"apim-test","systemData":{"createdAt":"2023-11-01T14:39:10.2346949Z","lastModifiedAt":"2023-11-14T23:09:47.5310688Z"},"properties":{"title":"Contoso + Europe Azure API Management","kind":"production","description":"The primary + Azure API Management service for the European division of Contoso.","server":{"type":"Azure + API Management","managementPortalUri":["https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"onboarding":{"instructions":"Sign + in or sign up in the specified developer portal to request API access. You + must complete the internal privacy training for your account to be approved.","developerPortalUri":["https://developer.contoso.com"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/apim","name":"apim","systemData":{"createdAt":"2023-11-09T01:37:33.3789162Z","lastModifiedAt":"2023-11-14T23:09:41.5126901Z"},"properties":{"title":"Contoso + Europe Azure API Management","kind":"production","description":"The primary + Azure API Management service for the European division of Contoso.","server":{"type":"Azure + API Management","managementPortalUri":["https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"onboarding":{"instructions":"Sign + in or sign up in the specified developer portal to request API access. You + must complete the internal privacy training for your account to be approved.","developerPortalUri":["https://developer.contoso.com"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/public","name":"public","systemData":{"createdAt":"2023-11-14T21:49:10.918597Z","lastModifiedAt":"2023-11-22T15:49:31.2162878Z"},"properties":{"title":"Public + cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/apim-ignite23","name":"apim-ignite23","systemData":{"createdAt":"2023-11-15T18:21:12.5751434Z","lastModifiedAt":"2023-11-15T18:21:12.5751436Z"},"properties":{"title":"Ignite + 2023 Azure API Management","kind":"production","description":"The primary + Azure API Management service for European division of Contoso","server":{"type":"azure-api-management","managementPortalUri":["https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service"]},"onboarding":{"instructions":"Sign + in or sign up","developerPortalUri":["https://developer.abcd.com"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/public-2","name":"public-2","systemData":{"createdAt":"2023-11-20T20:46:43.0550419Z","lastModifiedAt":"2023-11-20T20:46:43.0550789Z"},"properties":{"title":"Public + cloud","kind":"development","customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/public-3","name":"public-3","systemData":{"createdAt":"2023-11-20T20:52:17.473183Z","lastModifiedAt":"2023-11-23T22:09:43.7311785Z"},"properties":{"title":"Public + cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/testpublic","name":"testpublic","systemData":{"createdAt":"2023-11-22T15:50:59.2415397Z","lastModifiedAt":"2023-11-22T16:50:42.7816893Z"},"properties":{"title":"Public + cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-23T23:38:56.6775124Z"},"properties":{"title":"Public + cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}]}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '8805' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:38:57 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"description": "CLI Test API 0", "kind": "rest", "title": + "CLI Test API 0"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api create Connection: - keep-alive Content-Length: - - '48' + - '92' Content-Type: - application/json ParameterSetName: - - -g -s --api-name --name --title + - -g -s --api-name --description --kind --title User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-22T17:34:01.7581196Z","lastModifiedAt":"2023-11-22T17:34:54.3894085Z"},"properties":{"title":"cli-test-2023-01-02","lifecycleStage":"design"}}' + string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102","name":"cli-test-api-102","systemData":{"createdAt":"2023-11-23T23:38:58.5936277Z","lastModifiedAt":"2023-11-23T23:38:58.5936278Z"},"properties":{"title":"CLI + Test API 0","description":"CLI Test API 0","kind":"rest","lifecycleStage":"design","externalDocumentation":[],"contacts":[],"customProperties":{}}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '465' + - '532' content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:34:53 GMT + - Thu, 23 Nov 2023 23:38:58 GMT etag: - - 4d0040bb-0000-3300-0000-655e3bbe0000 + - 4900911b-0000-3300-0000-655fe2920000 expires: - '-1' pragma: @@ -179,42 +367,709 @@ interactions: code: 200 message: OK - request: - body: '{"properties": {"title": "OpenAPI"}}' + body: null headers: Accept: - application/json Accept-Encoding: - gzip, deflate CommandName: - - apic api definition create + - apic api show + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102","name":"cli-test-api-102","systemData":{"createdAt":"2023-11-23T23:38:58.5936277Z","lastModifiedAt":"2023-11-23T23:38:58.5936278Z"},"properties":{"title":"CLI + Test API 0","description":"CLI Test API 0","kind":"rest","lifecycleStage":"design","externalDocumentation":[],"contacts":[],"customProperties":{}}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '532' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:38:58 GMT + etag: + - 4900911b-0000-3300-0000-655fe2920000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api list + Connection: + - keep-alive + ParameterSetName: + - -g -s + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis?api-version=2024-03-01 + response: + body: + string: "{\"value\":[{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/petstore-api\",\"name\":\"petstore-api\",\"systemData\":{\"createdAt\":\"2023-11-08T18:57:32.3783991Z\",\"lastModifiedAt\":\"2023-11-08T18:57:32.3784001Z\"},\"properties\":{\"title\":\"Petstore-Api\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cat-facts-api\",\"name\":\"cat-facts-api\",\"systemData\":{\"createdAt\":\"2023-11-08T18:58:24.8668354Z\",\"lastModifiedAt\":\"2023-11-21T21:13:08.617789Z\"},\"properties\":{\"title\":\"cat-facts-api\",\"summary\":\"API + Description\",\"description\":\"API Description\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{},\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/ensight-servicereports\",\"name\":\"ensight-servicereports\",\"systemData\":{\"createdAt\":\"2023-11-10T22:24:10.4970866Z\",\"lastModifiedAt\":\"2023-11-10T22:24:10.4971093Z\"},\"properties\":{\"title\":\"ensight-servicereports\",\"description\":\"**ENSIGHT + Servicereports API** verf\xFCgt \xFCber den prim\xE4ren Endpunkt [Get Servicereports](https://dev-core-base-apim.developer.azure-api.net/api-details#api=ENSIGHT-API-Servicereportsv1&operation=GlobalServiceProtocol) + mithilfe dessen Servicereports - Dokumentationen von Betriebs- und Instandhaltungsmassnahmen + von Kraftwerken f\xFCr erneuerbare Energien - in Form des Globalen Service + Protokolls (GSP, engl. 'Global Service Protocol') abgefragt werden k\xF6nnen. + Derzeit stehen die Servicereports folgender Dienstleister f\xFCr Betriebs- + und Instandhaltungsmassnahmen zur Verf\xFCgung:\\r\\n- CWS Connected Wind + Services GmbH (seit --/----),\\r\\n- EnBW Energie Baden-W\xFCrttemberg AG + (seit 12/2019),\\r\\n- Nordex Energy GmbH (seit 11/2017),\\r\\n- Siemens Gamesa + Renewable Energy AG (seit 12/2019), und\\r\\n- Vestas Deutschland GmbH (seit + 07/2016).\\r\\n*Stand: 03. August 2022*\\r\\n\\r\\nDas Globale Service Protokoll + ist ein Teil der technischen Richtlinie f\xFCr Erzeugungseinheiten, die zum + 01.01.2014 von der FGW F\xF6rdergesellschaft Windenergie und andere Erneuerbare + Energien e.V. herausgegeben wurde. Ziel des GSP ist 'die Bereitstellung eines + einheitlichen elektronischen Datenformates, welches die Kommunikation verschiedener + an der Instandhaltung von erneuerbaren Energieanlagen beteiligter Akteure + erm\xF6glicht'.\\r\\n\\r\\nDie Entit\xE4tstypen aus dem Entity Data Model + der Globalen Service Protokolle sowie deren Eigenschaften werden \xFCber den + Endpunkt [Get Metadata](https://dev-core-base-apim.developer.azure-api.net/api-details#api=ENSIGHT-API-Servicereportsv1&operation=metadata) + im XML-Format bereitgestellt.\\r\\n### Datenquellen\\r\\nDie Daten f\xFCr + Betrieb- und Instandhaltungsmassnahmen werden von den entsprechenden Dienstleistern + bezogen, wobei sich die Quellformate wie folgt unterscheiden:\\r\\n- CWS Connected + Wind Services GmbH via REST API,\\r\\n- EnBW Energie Baden-W\xFCrttemberg + AG via SAP,\\r\\n- Nordex Energy GmbH via *.pdf,\\r\\n- Siemens Gamesa Renewable + Energy AG via *.xlsx, und\\r\\n- Vestas Deutschland GmbH via *.xml.\\r\\n### + OData\\r\\nBei ENSIGHT Servicereports ist die OData-Funktionalit\xE4t gegeben. + Hierdurch k\xF6nnen die im Folgenden aufgef\xFChrten Optionen sowie vergleichende + und logische Operatoren f\xFCr eine Abfrage spezifiziert werden.\\r\\n\\r\\n**Optionen**\\r\\n\\r\\n- + *apply*,\\r\\n- *count*,\\r\\n- *filter*,\\r\\n- *orderby*,\\r\\n- *select*,\\r\\n- + *skip*, und\\r\\n- *top*.\\r\\n\\r\\n**Vergleichsoperatoren**\\r\\n\\r\\n- + *eq*,\\r\\n- *ne*,\\r\\n- *gt*,\\r\\n- *lt*,\\r\\n- *ge*, und\\r\\n- *le*.\\r\\n\\r\\nWeitere + Informationen zu Vergleichsoperatoren werden hier von Microsoft angeboten: + [Comparison Operators](https://docs.microsoft.com/en-us/azure/search/search-query-odata-comparison-operators)\\r\\n\\r\\n**Logische + Operatoren**\\r\\n\\r\\n- *and*,\\r\\n- *or*, und\\r\\n- *not*.\\r\\n\\r\\nWeitere + Informationen zu logischen Operatoren werden hier von Microsoft angeboten: + [Logical Operators](https://docs.microsoft.com/en-us/azure/search/search-query-odata-logical-operators)\\r\\n\\r\\n\\r\\nBeispielhafte + Anwendungen von OData-Abfragen werden hier von Microsoft aufgef\xFChrt: [Query + Options Overview](https://docs.microsoft.com/en-us/odata/concepts/queryoptions-overview).\\r\\nDie + Optionen k\xF6nnen der Abfrage entweder als Parameter oder direkt \xFCber + die URL hinzugef\xFCgt werden, wie es hier von Microsoft beschrieben wird: + [URL Query](https://docs.microsoft.com/en-us/odata/concepts/url-components).\\r\\nWeitere, + umf\xE4ngliche Informationen zu OData sind hier in der Dokumentation zu finden: + [OData Documentation](https://www.odata.org/documentation/)\\r\\n\\r\\n*F\xFCr + den Umgang mit Daten im OData-Kontext bedarf es folgendes Format: ISO 8601. + Besipiel: 2019-06-03T00:00:00Z.*\\r\\n\\r\\n**Beispiele f\xFCr ENSIGHT Servicereports**\\r\\n\\r\\n*Anzahl + der Servicereports nach Dienstleister*\\r\\n\\r\\n [URL]?$apply=groupby((workOrder/contractor/name), + aggregate(id with countdistinct as total))\\r\\n\\r\\n*Anzahl der Servicereports + nach Windpark*\\r\\n\\r\\n [URL]?$apply=groupby((powerPlant/id), aggregate(id + with countdistinct as total))\\r\\n\\r\\n*Name und Beschreibung des Vestas-Servicereports + 55636522*\\r\\n\\r\\n [URL]?$filter=gspInfo/documentId eq 'VESTAS_55636522'&$select=workReport/items/name,workReport/items/longDescription\\r\\n\\r\\n*Materialverbrauch + des Nordex-Serviceberichts 600180286*\\r\\n\\r\\n [URL]?$filter=gspInfo/documentId + eq 'NORDEX_600180286'&$select=workReport/items/materials\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/customer-issue\",\"name\":\"customer-issue\",\"systemData\":{\"createdAt\":\"2023-11-11T00:29:24.954375Z\",\"lastModifiedAt\":\"2023-11-11T00:29:24.9543769Z\"},\"properties\":{\"title\":\"customer-issue\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/swagger_arpi_test\",\"name\":\"swagger_arpi_test\",\"systemData\":{\"createdAt\":\"2023-11-14T18:50:27.2999397Z\",\"lastModifiedAt\":\"2023-11-14T18:50:27.2999398Z\"},\"properties\":{\"title\":\"Swagger + Arpi Test\",\"summary\":\"A sample Arpi API that uses a petstore as an example + to demonstrate features in the OpenAPI 3.0 specification\",\"description\":\"A + sample Arpi API that uses a petstore as an example to demonstrate features + in the OpenAPI 3.0 specification\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{\"url\":\"http://swagger.io/terms/\"},\"license\":{\"name\":\"Apache + 2.0\",\"url\":\"https://www.apache.org/licenses/LICENSE-2.0.html\"},\"externalDocumentation\":[],\"contacts\":[{\"name\":\"Arpi + Swagger API Team\",\"url\":\"http://swagger.io\",\"email\":\"arpiapiteam@swagger.io\"}],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/swagger_arpi_test_2\",\"name\":\"swagger_arpi_test_2\",\"systemData\":{\"createdAt\":\"2023-11-14T18:51:10.5761684Z\",\"lastModifiedAt\":\"2023-11-14T18:51:10.5761685Z\"},\"properties\":{\"title\":\"Swagger + Arpi Test 2\",\"summary\":\"A sample Arpi API that uses a petstore as an example + to demonstrate features in the OpenAPI 3.0 specification\",\"description\":\"A + sample Arpi API that uses a petstore as an example to demonstrate features + in the OpenAPI 3.0 specification\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{\"url\":\"http://swagger.io/terms/\"},\"license\":{\"name\":\"Apache + 2.0\",\"url\":\"https://www.apache.org/licenses/LICENSE-2.0.html\"},\"externalDocumentation\":[],\"contacts\":[{\"name\":\"Arpi + Swagger API Team\",\"url\":\"http://swagger.io\",\"email\":\"arpiapiteam@swagger.io\"}],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/uber-api\",\"name\":\"uber-api\",\"systemData\":{\"createdAt\":\"2023-11-14T20:32:01.6772075Z\",\"lastModifiedAt\":\"2023-11-14T20:36:19.4958358Z\"},\"properties\":{\"title\":\"Uber + API\",\"summary\":\"Move your app forward with the Uber API\",\"description\":\"Move + your app forward with the Uber API\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{},\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/swagger-petstore\",\"name\":\"swagger-petstore\",\"systemData\":{\"createdAt\":\"2023-11-15T00:39:28.4314069Z\",\"lastModifiedAt\":\"2023-11-15T00:39:28.4314279Z\"},\"properties\":{\"title\":\"swagger-petstore\",\"description\":\"This + is a sample server Petstore server. You can find out more about Swagger at + [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). + \ For this sample, you can use the api key `special-key` to test the authorization + filters.\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/femeji-openai-test\",\"name\":\"femeji-openai-test\",\"systemData\":{\"createdAt\":\"2023-11-15T18:23:02.5833933Z\",\"lastModifiedAt\":\"2023-11-15T18:24:32.7488369Z\"},\"properties\":{\"title\":\"femeji-openai-test\",\"summary\":\"Ignite + 2023: openAI summarize reviews API\",\"description\":\"Ignite 2023: openAI + summarize reviews API\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{},\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102\",\"name\":\"cli-test-api-102\",\"systemData\":{\"createdAt\":\"2023-11-23T23:38:58.5936277Z\",\"lastModifiedAt\":\"2023-11-23T23:38:58.5936278Z\"},\"properties\":{\"title\":\"CLI + Test API 0\",\"description\":\"CLI Test API 0\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}}]}" + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '10935' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:38:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"title": "cli-test-2023-01-02"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api version create Connection: - keep-alive Content-Length: - - '36' + - '48' Content-Type: - application/json ParameterSetName: - - -g -s --api-name --version --name --title + - -g -s --api-name --name --title + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-23T23:39:00.4074868Z","lastModifiedAt":"2023-11-23T23:39:00.4074868Z"},"properties":{"title":"cli-test-2023-01-02","lifecycleStage":"design"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '465' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:38:59 GMT + etag: + - 5d00134b-0000-3300-0000-655fe2940000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api version update + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-name --name --title + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-23T23:39:00.4074868Z","lastModifiedAt":"2023-11-23T23:39:00.4074868Z"},"properties":{"title":"cli-test-2023-01-02","lifecycleStage":"design"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '465' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:00 GMT + etag: + - 5d00134b-0000-3300-0000-655fe2940000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"lifecycleStage": "design", "title": "CLI Test API Version + 0"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api version update + Connection: + - keep-alive + Content-Length: + - '79' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-name --name --title + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-23T23:39:00.4074868Z","lastModifiedAt":"2023-11-23T23:39:01.3160351Z"},"properties":{"title":"CLI + Test API Version 0","lifecycleStage":"design"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '468' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:01 GMT + etag: + - 5d002d4b-0000-3300-0000-655fe2950000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api version show + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-name --name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-23T23:39:00.4074868Z","lastModifiedAt":"2023-11-23T23:39:01.3160351Z"},"properties":{"title":"CLI + Test API Version 0","lifecycleStage":"design"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '468' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:01 GMT + etag: + - 5d002d4b-0000-3300-0000-655fe2950000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api version list + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions?api-version=2024-03-01 + response: + body: + string: '{"value":[{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-23T23:39:00.4074868Z","lastModifiedAt":"2023-11-23T23:39:01.3160351Z"},"properties":{"title":"CLI + Test API Version 0","lifecycleStage":"design"}}]}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '480' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:02 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"title": "OpenAPI"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api definition create + Connection: + - keep-alive + Content-Length: + - '36' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-name --version --name --title + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","name":"cli-test-openapi","systemData":{"createdAt":"2023-11-23T23:22:11.3530106Z","lastModifiedAt":"2023-11-23T23:39:03.207786Z"},"properties":{"title":"OpenAPI","specification":{"name":"openapi","version":"3.0.0"}}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '508' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:02 GMT + etag: + - 0000c600-0000-3300-0000-655fe2970000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api definition update + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-name --version --name --title + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","name":"cli-test-openapi","systemData":{"createdAt":"2023-11-23T23:22:11.3530106Z","lastModifiedAt":"2023-11-23T23:39:03.207786Z"},"properties":{"title":"OpenAPI","specification":{"name":"openapi","version":"3.0.0"}}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '508' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:03 GMT + etag: + - 0000c600-0000-3300-0000-655fe2970000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"title": "CLI Test API Definition 0"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api definition update + Connection: + - keep-alive + Content-Length: + - '54' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-name --version --name --title + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","name":"cli-test-openapi","systemData":{"createdAt":"2023-11-23T23:22:11.3530106Z","lastModifiedAt":"2023-11-23T23:39:04.1298296Z"},"properties":{"title":"CLI + Test API Definition 0","specification":{"name":"openapi","version":"3.0.0"}}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '527' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:03 GMT + etag: + - 0000c700-0000-3300-0000-655fe2980000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api definition show + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-name --version --name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","name":"cli-test-openapi","systemData":{"createdAt":"2023-11-23T23:22:11.3530106Z","lastModifiedAt":"2023-11-23T23:39:04.1298296Z"},"properties":{"title":"CLI + Test API Definition 0","specification":{"name":"openapi","version":"3.0.0"}}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '527' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:04 GMT + etag: + - 0000c700-0000-3300-0000-655fe2980000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api definition list + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-name --version User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi?api-version=2024-03-01 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi","name":"cli-test-openapi","systemData":{"createdAt":"2023-11-22T17:32:32.5795832Z","lastModifiedAt":"2023-11-22T17:34:55.0820634Z"},"properties":{"title":"OpenAPI","specification":{"name":"openapi","version":"3.0.0"}}}' + string: '{"value":[{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","name":"cli-test-openapi","systemData":{"createdAt":"2023-11-23T23:22:11.3530106Z","lastModifiedAt":"2023-11-23T23:39:04.1298296Z"},"properties":{"title":"CLI + Test API Definition 0","specification":{"name":"openapi","version":"3.0.0"}}}]}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '509' + - '539' content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:34:54 GMT - etag: - - 00008000-0000-3300-0000-655e3bbf0000 + - Thu, 23 Nov 2023 23:39:04 GMT expires: - '-1' pragma: @@ -229,8 +1084,6 @@ interactions: - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1198' x-powered-by: - ASP.NET status: @@ -293,7 +1146,7 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi/importSpecification?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi/importSpecification?api-version=2024-03-01 response: body: string: '' @@ -305,11 +1158,11 @@ interactions: content-length: - '0' date: - - Wed, 22 Nov 2023 17:34:55 GMT + - Thu, 23 Nov 2023 23:39:05 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi/operationResults/b4eb2313-5b2b-44a3-9990-848626e5c10a?api-version=2024-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi/operationResults/4096e2a5-b305-4e83-b214-d62b27a172c2?api-version=2024-03-01 pragma: - no-cache server: @@ -341,7 +1194,7 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi/operationResults/b4eb2313-5b2b-44a3-9990-848626e5c10a?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi/operationResults/4096e2a5-b305-4e83-b214-d62b27a172c2?api-version=2024-03-01 response: body: string: '{"apiName":"default","apiVersion":"cli-test-2023-01-02","catalogName":"contosoeuap","provisioningState":"Succeeded","error":{"message":""}}' @@ -355,7 +1208,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:34:55 GMT + - Thu, 23 Nov 2023 23:39:06 GMT expires: - '-1' pragma: @@ -393,7 +1246,7 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi/exportSpecification?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi/exportSpecification?api-version=2024-03-01 response: body: string: '{"format":"inline","value":"{\"openapi\": \"3.0.0\", \"info\": {\"title\": @@ -444,7 +1297,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:34:57 GMT + - Thu, 23 Nov 2023 23:39:06 GMT expires: - '-1' pragma: @@ -467,7 +1320,7 @@ interactions: code: 200 message: OK - request: - body: '{"properties": {"definitionId": "/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi", + body: '{"properties": {"definitionId": "/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi", "description": "CLI Test Public cloud production deployment.", "environmentId": "/workspaces/default/environments/cli-test-public", "server": {"runtimeUri": ["https://api.contoso.com"]}, "title": "CLI Test Production deployment"}}' @@ -490,12 +1343,12 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/deployments/mock-deployment?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/mock-deployment?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-100/deployments/production","name":"production","systemData":{"createdAt":"2023-11-22T17:34:05.7313342Z","lastModifiedAt":"2023-11-22T17:34:58.3840388Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/production","name":"production","systemData":{"createdAt":"2023-11-23T23:39:08.5478416Z","lastModifiedAt":"2023-11-23T23:39:08.5478416Z"},"properties":{"title":"CLI Test Production deployment","description":"CLI Test Public cloud production - deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-100/versions/cli-test-2023-01-02/definitions/cli-test-openapi","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' + deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 @@ -506,9 +1359,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:34:57 GMT + - Thu, 23 Nov 2023 23:39:08 GMT etag: - - 06005c30-0000-3300-0000-655e3bc20000 + - 0700768e-0000-3300-0000-655fe29c0000 expires: - '-1' pragma: @@ -524,7 +1377,230 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api deployment show + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-name --name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/mock-deployment?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/production","name":"production","systemData":{"createdAt":"2023-11-23T23:39:08.5478416Z","lastModifiedAt":"2023-11-23T23:39:08.5478416Z"},"properties":{"title":"CLI + Test Production deployment","description":"CLI Test Public cloud production + deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '777' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:08 GMT + etag: + - 0700768e-0000-3300-0000-655fe29c0000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api deployment update + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-name --name --title + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/mock-deployment?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/production","name":"production","systemData":{"createdAt":"2023-11-23T23:39:08.5478416Z","lastModifiedAt":"2023-11-23T23:39:08.5478416Z"},"properties":{"title":"CLI + Test Production deployment","description":"CLI Test Public cloud production + deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '777' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:09 GMT + etag: + - 0700768e-0000-3300-0000-655fe29c0000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: '{"properties": {"customProperties": {}, "definitionId": "/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi", + "description": "CLI Test Public cloud production deployment.", "environmentId": + "/workspaces/default/environments/cli-test-public", "server": {"runtimeUri": + ["https://api.contoso.com"]}, "title": "CLI Test Production deployment update"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api deployment update + Connection: + - keep-alive + Content-Length: + - '396' + Content-Type: + - application/json + ParameterSetName: + - -g -s --api-name --name --title + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/mock-deployment?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/production","name":"production","systemData":{"createdAt":"2023-11-23T23:39:08.5478416Z","lastModifiedAt":"2023-11-23T23:39:10.0281119Z"},"properties":{"title":"CLI + Test Production deployment update","description":"CLI Test Public cloud production + deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '784' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:09 GMT + etag: + - 07007e8e-0000-3300-0000-655fe29e0000 + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic api deployment list + Connection: + - keep-alive + ParameterSetName: + - -g -s --api-name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments?api-version=2024-03-01 + response: + body: + string: '{"value":[{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/production","name":"production","systemData":{"createdAt":"2023-11-23T23:39:08.5478416Z","lastModifiedAt":"2023-11-23T23:39:10.0281119Z"},"properties":{"title":"CLI + Test Production deployment update","description":"CLI Test Public cloud production + deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}]}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '796' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:10 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff x-powered-by: - ASP.NET status: @@ -554,7 +1630,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchemas/cli-test-metadata-schema-1?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/metadataSchema","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchema/cli-test-metadata-schema-1","name":"cli-test-metadata-schema-1","systemData":{"createdAt":"2023-11-22T16:49:20.9590785Z","lastModifiedAt":"2023-11-22T17:34:59.0580864Z"},"properties":{"assignedTo":[],"schema":"{\"type\": + string: '{"type":"Microsoft.ApiCenter/services/metadataSchema","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchema/cli-test-metadata-schema-1","name":"cli-test-metadata-schema-1","systemData":{"createdAt":"2023-11-23T23:38:10.2395175Z","lastModifiedAt":"2023-11-23T23:39:12.1707537Z"},"properties":{"assignedTo":[],"schema":"{\"type\": \"string\", \"title\": \"CLI Test First name\", \"pattern\": \"^[a-zA-Z0-9 ]+$\"}"}}' headers: @@ -567,7 +1643,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:34:58 GMT + - Thu, 23 Nov 2023 23:39:11 GMT expires: - '-1' pragma: @@ -583,7 +1659,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' x-powered-by: - ASP.NET status: @@ -644,7 +1720,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:34:59 GMT + - Thu, 23 Nov 2023 23:39:12 GMT expires: - '-1' pragma: @@ -707,7 +1783,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:34:59 GMT + - Thu, 23 Nov 2023 23:39:12 GMT expires: - '-1' pragma: @@ -772,7 +1848,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:35:01 GMT + - Thu, 23 Nov 2023 23:39:14 GMT expires: - '-1' pragma: @@ -794,10 +1870,62 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - apic metadata-schema show + Connection: + - keep-alive + ParameterSetName: + - -g -s --name + User-Agent: + - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchemas/cli-test-metadata-schema-1?api-version=2024-03-01 + response: + body: + string: '{"type":"Microsoft.ApiCenter/services/metadataSchema","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchema/cli-test-metadata-schema-1","name":"cli-test-metadata-schema-1","systemData":{"createdAt":"2023-11-23T23:38:10.2395175Z","lastModifiedAt":"2023-11-23T23:39:12.1707537Z"},"properties":{"assignedTo":[],"schema":"{\"type\": + \"string\", \"title\": \"CLI Test First name\", \"pattern\": \"^[a-zA-Z0-9 + ]+$\"}"}}' + headers: + api-supported-versions: + - 2023-07-01-preview, 2024-03-01 + cache-control: + - no-cache + content-length: + - '514' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 23 Nov 2023 23:39:14 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK - request: body: '{"properties": {"description": "APIs for sampling from and fine-tuning language models", "kind": "rest", "summary": "APIs for sampling from and fine-tuning - language models", "termsOfService": {}, "title": "cli-test-openai-api-01"}}' + language models", "termsOfService": {}, "title": "cli-test-openai-api-100"}}' headers: Accept: - application/json @@ -808,7 +1936,7 @@ interactions: Connection: - keep-alive Content-Length: - - '231' + - '232' Content-Type: - application/json ParameterSetName: @@ -816,10 +1944,10 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01","name":"cli-test-openai-api-01","systemData":{"createdAt":"2023-11-22T17:35:03.182864Z","lastModifiedAt":"2023-11-22T17:35:03.1828641Z"},"properties":{"title":"cli-test-openai-api-01","summary":"APIs + string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100","name":"cli-test-openai-api-100","systemData":{"createdAt":"2023-11-23T23:39:15.907503Z","lastModifiedAt":"2023-11-23T23:39:15.9075031Z"},"properties":{"title":"cli-test-openai-api-100","summary":"APIs for sampling from and fine-tuning language models","description":"APIs for sampling from and fine-tuning language models","kind":"rest","lifecycleStage":"design","termsOfService":{},"externalDocumentation":[],"contacts":[],"customProperties":{}}}' headers: @@ -828,13 +1956,13 @@ interactions: cache-control: - no-cache content-length: - - '678' + - '681' content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:35:02 GMT + - Thu, 23 Nov 2023 23:39:15 GMT etag: - - 3f000ca6-0000-3300-0000-655e3bc70000 + - 4900e91b-0000-3300-0000-655fe2a30000 expires: - '-1' pragma: @@ -876,23 +2004,23 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0","name":"1-2-0","systemData":{"createdAt":"2023-11-22T17:35:03.7737195Z","lastModifiedAt":"2023-11-22T17:35:03.7737195Z"},"properties":{"title":"1-2-0","lifecycleStage":"design"}}' + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0","name":"1-2-0","systemData":{"createdAt":"2023-11-23T23:39:16.4231969Z","lastModifiedAt":"2023-11-23T23:39:16.4231969Z"},"properties":{"title":"1-2-0","lifecycleStage":"design"}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '429' + - '430' content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:35:03 GMT + - Thu, 23 Nov 2023 23:39:15 GMT etag: - - 4d0094bb-0000-3300-0000-655e3bc70000 + - 5d00f74b-0000-3300-0000-655fe2a40000 expires: - '-1' pragma: @@ -908,7 +2036,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' x-powered-by: - ASP.NET status: @@ -935,10 +2063,10 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi","name":"openapi","systemData":{"createdAt":"2023-11-22T17:35:04.33803Z","lastModifiedAt":"2023-11-22T17:35:04.33803Z"},"properties":{"title":"openapi","description":"APIs + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi","name":"openapi","systemData":{"createdAt":"2023-11-23T23:39:16.872308Z","lastModifiedAt":"2023-11-23T23:39:16.872308Z"},"properties":{"title":"openapi","description":"APIs for sampling from and fine-tuning language models"}}' headers: api-supported-versions: @@ -946,13 +2074,13 @@ interactions: cache-control: - no-cache content-length: - - '497' + - '500' content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:35:04 GMT + - Thu, 23 Nov 2023 23:39:16 GMT etag: - - 00008200-0000-3300-0000-655e3bc80000 + - 0000c900-0000-3300-0000-655fe2a40000 expires: - '-1' pragma: @@ -968,7 +2096,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' x-powered-by: - ASP.NET status: @@ -978,7 +2106,7 @@ interactions: body: '{"format": "inline", "specification": {"name": "openapi", "version": "3-0-0"}, "value": "{\"openapi\": \"3.0.0\", \"servers\": [{\"url\": \"https://api.openai.com/v1\"}], \"info\": {\"description\": \"APIs for sampling from and fine-tuning language - models\", \"title\": \"CLI Test OpenAI API 01\", \"version\": \"1.2.0\", \"x-apisguru-categories\": + models\", \"title\": \"CLI Test OpenAI API 100\", \"version\": \"1.2.0\", \"x-apisguru-categories\": [\"machine_learning\"], \"x-logo\": {\"url\": \"https://learnodo-newtonic.com/wp-content/uploads/2020/04/Logo-of-OpenAI-768x161.jpg\"}, \"x-origin\": [{\"format\": \"openapi\", \"url\": \"https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml\", \"version\": \"3.0\"}], \"x-providerName\": \"openai.com\"}, \"tags\": [{\"description\": @@ -2278,7 +3406,7 @@ interactions: Connection: - keep-alive Content-Length: - - '112971' + - '112972' Content-Type: - application/json ParameterSetName: @@ -2286,7 +3414,7 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi/importSpecification?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi/importSpecification?api-version=2024-03-01 response: body: string: '' @@ -2298,11 +3426,11 @@ interactions: content-length: - '0' date: - - Wed, 22 Nov 2023 17:35:04 GMT + - Thu, 23 Nov 2023 23:39:17 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi/operationResults/07c6ccd6-cdf9-4789-b740-90e79dd9df80?api-version=2024-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi/operationResults/fdb530d3-5cee-4d91-a761-e3da08de1ade?api-version=2024-03-01 pragma: - no-cache server: @@ -2334,7 +3462,7 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi/operationResults/07c6ccd6-cdf9-4789-b740-90e79dd9df80?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi/operationResults/fdb530d3-5cee-4d91-a761-e3da08de1ade?api-version=2024-03-01 response: body: string: '{"apiName":"default","apiVersion":"1-2-0","catalogName":"contosoeuap","provisioningState":"InProgress","error":{"message":""}}' @@ -2348,7 +3476,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:35:04 GMT + - Thu, 23 Nov 2023 23:39:17 GMT expires: - '-1' pragma: @@ -2387,7 +3515,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-22T17:34:52.812953Z"},"properties":{"title":"Public + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-23T23:38:56.6775124Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}' headers: api-supported-versions: @@ -2395,13 +3523,13 @@ interactions: cache-control: - no-cache content-length: - - '691' + - '692' content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:35:05 GMT + - Thu, 23 Nov 2023 23:39:18 GMT etag: - - 04001e85-0000-3300-0000-655e3bbc0000 + - 0500704b-0000-3300-0000-655fe2900000 expires: - '-1' pragma: @@ -2422,10 +3550,10 @@ interactions: code: 200 message: OK - request: - body: '{"properties": {"definitionId": "/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi", - "description": "clitestopenaiapi01deployment", "environmentId": "/workspaces/default/environments/cli-test-public", + body: '{"properties": {"definitionId": "/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi", + "description": "clitestopenaiapi100deployment", "environmentId": "/workspaces/default/environments/cli-test-public", "server": {"runtimeUri": ["https://api.openai.com/v1"]}, "state": "active", - "title": "clitestopenaiapi01deployment"}}' + "title": "clitestopenaiapi100deployment"}}' headers: Accept: - application/json @@ -2436,7 +3564,7 @@ interactions: Connection: - keep-alive Content-Length: - - '351' + - '354' Content-Type: - application/json ParameterSetName: @@ -2444,23 +3572,23 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/deployments/mock-deployment?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/deployments/mock-deployment?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-01/deployments/clitestopenaiapi01deployment","name":"clitestopenaiapi01deployment","systemData":{"createdAt":"2023-11-22T17:35:06.7806676Z","lastModifiedAt":"2023-11-22T17:35:06.7806676Z"},"properties":{"title":"clitestopenaiapi01deployment","description":"clitestopenaiapi01deployment","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-openai-api-01/versions/1-2-0/definitions/openapi","server":{"runtimeUri":["https://api.openai.com/v1"]},"customProperties":{},"recommended":false}}' + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/deployments/clitestopenaiapi100deployment","name":"clitestopenaiapi100deployment","systemData":{"createdAt":"2023-11-23T23:39:19.3972298Z","lastModifiedAt":"2023-11-23T23:39:19.3972298Z"},"properties":{"title":"clitestopenaiapi100deployment","description":"clitestopenaiapi100deployment","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi","server":{"runtimeUri":["https://api.openai.com/v1"]},"customProperties":{},"recommended":false}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '786' + - '792' content-type: - application/json; charset=utf-8 date: - - Wed, 22 Nov 2023 17:35:06 GMT + - Thu, 23 Nov 2023 23:39:18 GMT etag: - - 06006730-0000-3300-0000-655e3bca0000 + - 0700868e-0000-3300-0000-655fe2a70000 expires: - '-1' pragma: diff --git a/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py b/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py index 5bbae6dba57..764ea579cd5 100644 --- a/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py +++ b/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py @@ -21,34 +21,128 @@ def test_apic_scenarios(self): self.kwargs.update({ 'resource_group': 'api-center-test', 'service_name': 'contosoeuap', - 'api_name': 'cli-test-api-100', + 'api_name': 'cli-test-api-102', 'api_version': 'cli-test-2023-01-02', 'api_definition_name': 'cli-test-openapi' }) + # ------------------------------------------- Environment ------------------------------------------- # create environment - import json server_details = { "type": "Azure API Management", "managementPortalUri": [ - "management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service" + "management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service-0" ] } self.kwargs.update({ 'server_details': server_details, 'environment_name': 'cli-test-public' }) - self.cmd('az apic environment create -g {resource_group} -s {service_name} --name {environment_name} --title "Public cloud" --kind "development" --server "{server_details}"') + self.cmd('az apic environment create -g {resource_group} -s {service_name} --name {environment_name} --title "Public cloud" --kind "development" --server "{server_details}"', + checks=[ + self.check('name', self.kwargs['environment_name']), + self.check('title', 'Public cloud'), + self.check('kind', 'development')]) - # create api - self.cmd('az apic api create -g {resource_group} -s {service_name} --api-name {api_name} --description "CLI Test API" --kind rest --title "CLI Test API"') + # update environment + server_details = { + "type": "Azure API Management", + "managementPortalUri": [ + "management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service" + ] + } + self.kwargs.update({ + 'server_details': server_details, + }) + self.cmd('az apic environment update -g {resource_group} -s {service_name} --name {environment_name} --title "Public cloud" --kind "development" --server "{server_details}"', + checks=[ + self.check('name', self.kwargs['environment_name']), + self.check('title', 'Public cloud'), + self.check('kind', 'development'), + self.check('server', self.kwargs['server_details'])]) + + # show environment + self.cmd('az apic environment show -g {resource_group} -s {service_name} --name {environment_name}', + checks=[ + self.check('name', self.kwargs['environment_name']), + self.check('title', 'Public cloud'), + self.check('kind', 'development')]) + # list environment + list_env_reult = self.cmd('az apic environment list -g {resource_group} -s {service_name}') + + # ------------------------------------------- API ------------------------------------------- + # create api + self.kwargs.update({ + 'api_description': "CLI Test API 0", + 'api_title': "CLI Test API 0" + }) + self.cmd('az apic api create -g {resource_group} -s {service_name} --api-name {api_name} --description "{api_description}" --kind rest --title "{api_title}"', + checks=[ + self.check('name', self.kwargs['api_name']), + self.check('title', self.kwargs['api_title']), + self.check('description', self.kwargs['api_description']), + self.check('kind', 'rest')]) + + # show api + self.cmd('az apic api show -g {resource_group} -s {service_name} --api-name {api_name}', + checks=[ + self.check('name', self.kwargs['api_name']), + self.check('title', self.kwargs['api_title']), + self.check('description', self.kwargs['api_description']), + self.check('kind', 'rest')]) + + # list api + list_api_result = self.cmd('az apic api list -g {resource_group} -s {service_name}') + + + # ------------------------------------------- API Version ------------------------------------------- # create api version self.cmd('az apic api version create -g {resource_group} -s {service_name} --api-name {api_name} --name {api_version} --title {api_version}') + # update api version + self.kwargs.update({ + 'api_version_title_update': "CLI Test API Version 0" + }) + self.cmd('az apic api version update -g {resource_group} -s {service_name} --api-name {api_name} --name {api_version} --title "{api_version_title_update}"', + checks=[ + self.check('name', self.kwargs['api_version']), + self.check('title', self.kwargs['api_version_title_update'])]) + + # show api version + self.cmd('az apic api version show -g {resource_group} -s {service_name} --api-name {api_name} --name {api_version}', + checks=[ + self.check('name', self.kwargs['api_version']), + self.check('title', self.kwargs['api_version_title_update'])]) + + # list api version + list_api_version_result = self.cmd('az apic api version list -g {resource_group} -s {service_name} --api-name {api_name}') + + + # ------------------------------------------- API Definition ------------------------------------------- + # create api definition self.cmd('az apic api definition create -g {resource_group} -s {service_name} --api-name {api_name} --version {api_version} --name {api_definition_name} --title "OpenAPI" ') + # update api definition + self.kwargs.update({ + 'api_definition_title_update': "CLI Test API Definition 0" + }) + self.cmd('az apic api definition update -g {resource_group} -s {service_name} --api-name {api_name} --version {api_version} --name {api_definition_name} --title "{api_definition_title_update}"', + checks=[ + self.check('name', self.kwargs['api_definition_name']), + self.check('title', self.kwargs['api_definition_title_update'])]) + + # show api definition + self.cmd('az apic api definition show -g {resource_group} -s {service_name} --api-name {api_name} --version {api_version} --name {api_definition_name}', + checks=[ + self.check('name', self.kwargs['api_definition_name']), + self.check('title', self.kwargs['api_definition_title_update'])]) + + # list api definition + list_api_definition_result = self.cmd('az apic api definition list -g {resource_group} -s {service_name} --api-name {api_name} --version {api_version}') + + #------------------------------------------------ Import Specification ------------------------------------------- # import specification import os TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) @@ -75,6 +169,8 @@ def test_apic_scenarios(self): }) self.cmd('az apic api definition export-specification -g {resource_group} -s {service_name} --api-name {api_name} --version {api_version} --name {api_definition_name} --file-name "{templateFile}"') + # ------------------------------------------- Deployment ------------------------------------------- + # create deployment environment_id = "/workspaces/default/environments/"+self.kwargs['environment_name'] definition_id = "/workspaces/default/apis/"+self.kwargs['api_name']+"/versions/"+self.kwargs['api_version']+"/definitions/"+self.kwargs['api_definition_name'] @@ -85,8 +181,30 @@ def test_apic_scenarios(self): 'deployment_name': 'production', 'server': server, }) - self.cmd('az apic api deployment create -g {resource_group} -s {service_name} --api-name {api_name} --name {deployment_name} --title "CLI Test Production deployment" --description "CLI Test Public cloud production deployment." --environment-id {environment_id} --definition-id {definition_id} --server "{server}"') - + self.cmd('az apic api deployment create -g {resource_group} -s {service_name} --api-name {api_name} --name {deployment_name} --title "CLI Test Production deployment" --description "CLI Test Public cloud production deployment." --environment-id {environment_id} --definition-id {definition_id} --server "{server}"', + checks=[ + self.check('name', self.kwargs['deployment_name']), + self.check('title', 'CLI Test Production deployment'), + self.check('description', 'CLI Test Public cloud production deployment.')]) + + # show deployment + self.cmd('az apic api deployment show -g {resource_group} -s {service_name} --api-name {api_name} --name {deployment_name}', + checks=[ + self.check('name', self.kwargs['deployment_name'])]) + + # update deployment + self.kwargs.update({ + 'deployment_title_update': 'CLI Test Production deployment update' + }) + self.cmd('az apic api deployment update -g {resource_group} -s {service_name} --api-name {api_name} --name {deployment_name} --title "{deployment_title_update}"', + checks=[ + self.check('name', self.kwargs['deployment_name']), + self.check('title', self.kwargs['deployment_title_update'])]) + + # list deployment + list_deployment_result = self.cmd('az apic api deployment list -g {resource_group} -s {service_name} --api-name {api_name}') + + # ------------------------------------------- Metadata Schema ------------------------------------------- # create metadata schema templateInputSchemaFile = os.path.join( TEST_DIR, @@ -125,6 +243,16 @@ def test_apic_scenarios(self): self.cmd('az apic metadata-schema export-metadata-schema -g {resource_group} -s {service_name} --assigned-to deployment --file-name "{templateFileDeployment}"') self.cmd('az apic metadata-schema export-metadata-schema -g {resource_group} -s {service_name} --assigned-to environment --file-name "{templateFileEnvironment}"') + # show metadata schema + self.kwargs.update({ + 'schemaName': 'cli-test-metadata-schema-1' + }) + self.cmd('az apic metadata-schema show -g {resource_group} -s {service_name} --name {schemaName}', + checks=[ + self.check('name', self.kwargs['schemaName'])]) + + + # ------------------------------------------- Quick Add ------------------------------------------- # register api - quick add templateQuickAddFile = os.path.join( TEST_DIR, @@ -135,5 +263,4 @@ def test_apic_scenarios(self): 'templateFile': templateQuickAddFile, 'environment_name': self.kwargs['environment_name'] }) - self.cmd('az apic api register -g {resource_group} -s {service_name} --api-location "{templateFile}" --environment-name {environment_name}') - + self.cmd('az apic api register -g {resource_group} -s {service_name} --api-location "{templateFile}" --environment-name {environment_name}') \ No newline at end of file From 8437ff0e57bd0b72644bc0608b8a5d8aecba6d55 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Thu, 23 Nov 2023 22:40:35 -0600 Subject: [PATCH 14/27] improve code style --- .../azext_apic_extension/_params.py | 49 +- .../azext_apic_extension/commands.py | 5 +- .../azext_apic_extension/custom.py | 86 ++- .../tests/latest/data/exported_spec.json | 180 +---- .../latest/data/import_spec_payload.json | 37 +- .../data/register_quickadd_openai_spec.json | 2 +- .../recordings/test_apic_scenarios.yaml | 622 ++++++++---------- .../tests/latest/test_apic_extension.py | 8 +- 8 files changed, 402 insertions(+), 587 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/_params.py b/src/apic-extension/azext_apic_extension/_params.py index 10bcd3f76c5..28eea16d61a 100644 --- a/src/apic-extension/azext_apic_extension/_params.py +++ b/src/apic-extension/azext_apic_extension/_params.py @@ -12,27 +12,28 @@ def load_arguments(self, _): # pylint: disable=unused-argument with self.argument_context("apic api register") as c: - c.argument( - "api_location", - options_list=['--api-location', '-l'], - help="Specification file", - required=True, - ), - c.argument( - "resource_group", - options_list=['--resource-group', '-g'], - help="Resource group name", - required=True, - ), - c.argument( - "service_name", - options_list=['--service', '-s'], - help="Service name", - required=True, - ), - c.argument( - "environment_name", - options_list=['--environment-name', '-e'], - help="Environemnt name", - required=False, - ) \ No newline at end of file + c.argument( + "api_location", + options_list=['--api-location', '-l'], + help="Specification file", + required=True, + ) + c.argument( + "resource_group", + options_list=['--resource-group', '-g'], + help="Resource group name", + required=True, + ) + c.argument( + "service_name", + options_list=['--service', '-s'], + help="Service name", + required=True, + ) + c.argument( + "environment_name", + options_list=['--environment-name', '-e'], + help="Environemnt name", + required=False, + ) + \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/commands.py b/src/apic-extension/azext_apic_extension/commands.py index 500feeec4ee..e871aa7271d 100644 --- a/src/apic-extension/azext_apic_extension/commands.py +++ b/src/apic-extension/azext_apic_extension/commands.py @@ -19,11 +19,10 @@ def load_command_table(self, _): # pylint: disable=unused-argument with self.command_group('apic api definition') as g: self.command_table['apic api definition import-specification'] = ImportSpecificationExtension(loader=self) self.command_table['apic api definition export-specification'] = ExportSpecificationExtension(loader=self) - with self.command_group('apic metadata-schema') as g: self.command_table['apic metadata-schema create'] = CreateMetadataSchemaExtension(loader=self) self.command_table['apic metadata-schema update'] = UpdateMetadataSchemaExtension(loader=self) self.command_table['apic metadata-schema export-metadata-schema'] = ExportMetadataSchemaExtension(loader=self) - with self.command_group('apic api') as g: - g.custom_command("register", "register_apic") \ No newline at end of file + g.custom_command("register", "register_apic") + \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index 09ba4739667..c9d160a706f 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -8,23 +8,19 @@ # pylint: disable=too-many-lines # pylint: disable=too-many-statements +import os +import sys +import json +import requests from knack.log import get_logger - +import chardet +from azure.cli.core.aaz import * from .aaz.latest.apic.api.definition import ImportSpecification from .aaz.latest.apic.api.definition import ExportSpecification from .aaz.latest.apic.metadata_schema import Create from .aaz.latest.apic.metadata_schema import Update from .aaz.latest.apic.metadata_schema import ExportMetadataSchema -from azure.cli.core.aaz import * -from urllib.parse import urlparse, urlunparse -import json -import sys -import requests -import os -import chardet - - logger = get_logger(__name__) class ImportSpecificationExtension(ImportSpecification): @@ -42,7 +38,6 @@ def _build_arguments_schema(cls, *args, **kwargs): def pre_operations(self): args = self.ctx.args - data = None value = None @@ -56,11 +51,11 @@ def pre_operations(self): data = json.load(f) if data: value = json.dumps(data) - + # If any of the fields are None, get them from self.args if value is None: value = args.value - + # Reassign the values to self.args args.value = value @@ -90,10 +85,10 @@ def _output(self, *args, **kwargs): if result: print('Results found. Exporting to', arguments.source_profile) - + response_format = result['format'] exportedResults = result['value'] - + if response_format == 'link': print('Fetching specification from:', exportedResults) getReponse = requests.get(exportedResults) @@ -101,7 +96,7 @@ def _output(self, *args, **kwargs): exportedResults = getReponse.content.decode() else: logger.error('Error while fetching the results from the link. Status code: %s', getReponse.status_code) - + if arguments.source_profile: try: self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) @@ -120,7 +115,7 @@ def writeResultsToFile(self, results, file_name): if isinstance(results, str): results = json.loads(results) json.dump(results, f, indent=4, separators=(',', ':')) - else: + else: f.write(results) class CreateMetadataSchemaExtension(Create): @@ -134,10 +129,9 @@ def _build_arguments_schema(cls, *args, **kwargs): registered=True ) return args_schema - + def pre_operations(self): args = self.ctx.args - data = None value = args.schema @@ -154,10 +148,10 @@ def pre_operations(self): data = json.load(f) if data: value = json.dumps(data) - + # If any of the fields are None, get them from self.args if value is None: - logger.error('Please provide the schema to create the metadata schema through --schema option or through --file-name option via a file.') + logger.error('Please provide the schema to create the metadata schema through --schema option or through --file-name option via a file.') # Reassign the values to self.args self.ctx.args.schema = value @@ -173,10 +167,9 @@ def _build_arguments_schema(cls, *args, **kwargs): registered=True ) return args_schema - + def pre_operations(self): args = self.ctx.args - data = None value = args.schema @@ -193,16 +186,16 @@ def pre_operations(self): data = json.load(f) if data: value = json.dumps(data) - + # If any of the fields are None, get them from self.args if value is None: - logger.error('Please provide the schema to update the metadata schema through --schema option or through --file-name option via a file.') + logger.error('Please provide the schema to update the metadata schema through --schema option or through --file-name option via a file.') # Reassign the values to self.args self.ctx.args.schema = value class ExportMetadataSchemaExtension(ExportMetadataSchema): - + @classmethod def _build_arguments_schema(cls, *args, **kwargs): args_schema = super()._build_arguments_schema(*args, **kwargs) @@ -213,17 +206,17 @@ def _build_arguments_schema(cls, *args, **kwargs): registered=True ) return args_schema - + def _output(self, *args, **kwargs): result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) arguments = self.ctx.args if result: print('Results found. Exporting to', arguments.source_profile) - + response_format = result['format'] exportedResults = result['value'] - + if response_format == 'link': print('Fetching metadata from:', exportedResults) getReponse = requests.get(exportedResults) @@ -231,7 +224,7 @@ def _output(self, *args, **kwargs): exportedResults = getReponse.content.decode() else: logger.error('Error while fetching the results from the link. Status code: %s', getReponse.status_code) - + if arguments.source_profile: try: self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) @@ -250,7 +243,7 @@ def writeResultsToFile(self, results, file_name): if isinstance(results, str): results = json.loads(results) json.dump(results, f, indent=4, separators=(',', ':')) - else: + else: f.write(results) # Quick Import @@ -276,8 +269,6 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n logger.error('Could not load json file') return - value_dict = json.loads(value) - # Check if the first field is 'swagger', 'openapi', or something else and get the definition name and version first_key, first_value = list(data.items())[0] if first_key in ['swagger', 'openapi']: @@ -289,7 +280,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n extracted_definition_version = 'v1' extracted_api_kind = 'rest' #TODO how to determine other kinds - enum={"graphql": "graphql", "grpc": "grpc", "rest": "rest", "soap": "soap", "webhook": "webhook", "websocket": "websocket"} - + # Create API and Create API Version info = data['info'] if info: @@ -339,14 +330,14 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n extracted_api_external_documentation = {'description': extracted_api_external_documentation_description, 'title': extracted_api_external_documentation_title, 'url': extracted_api_external_documentation_url} else: extracted_api_external_documentation = None - + #TODO: Create API - custom-properties # - "The custom metadata defined for API catalog entities. #1 - + # Create API ------------------------------------------------------------------------------------- from .aaz.latest.apic.api import Create as CreateAPI - + api_args = { 'api_name': extracted_api_name, 'resource_group': resource_group, @@ -361,9 +352,10 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n 'external_documentation': extracted_api_external_documentation, 'description': extracted_api_description, } - createAPIResults = CreateAPI(cli_ctx=cmd.cli_ctx)(command_args=api_args) + + CreateAPI(cli_ctx=cmd.cli_ctx)(command_args=api_args) print("API was created successfully") - + # Create API Version ----------------------------------------------------------------------------- from .aaz.latest.apic.api.version import Create as CreateAPIVersion @@ -378,7 +370,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n 'title' : extracted_api_version_title } - createAPIVersionResults = CreateAPIVersion(cli_ctx=cmd.cli_ctx)(command_args=api_version_args) + CreateAPIVersion(cli_ctx=cmd.cli_ctx)(command_args=api_version_args) print("API version was created successfully") @@ -396,7 +388,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n 'description' : extracted_api_description, #TODO Extract from spec } - createAPIDefinitionResults = CreateAPIDefinition(cli_ctx=cmd.cli_ctx)(command_args=api_definition_args) + CreateAPIDefinition(cli_ctx=cmd.cli_ctx)(command_args=api_definition_args) print("API definition was created successfully") @@ -405,7 +397,6 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n # uses customized ImportSpecificationExtension class specification_details = {'name':extracted_definition_name,'version':extracted_definition_version} - format = 'inline' #TODO format - Link - what if the link is just pasted in the value? #TODO format - inline - what if spec is just pasted in the value? #TODO - other non json spec formats @@ -426,16 +417,14 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n importAPISpecificationResults_Polled = LongRunningOperation(cmd.cli_ctx)(importAPISpecificationResults) print("API specification was imported successfully") - # Create API Deployment ----------------------------------------------------------------------------- from .aaz.latest.apic.api.deployment import Create as CreateAPIDeployment from .aaz.latest.apic.environment import Show as GetEnvironment - from datetime import datetime environment_id = None if environment_name: # GET Environment ID - + environment_args = { 'resource_group': resource_group, 'service_name': service_name, @@ -444,13 +433,12 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n } getEnvironmentResults = GetEnvironment(cli_ctx=cmd.cli_ctx)(command_args=environment_args) - environment_id = getEnvironmentResults['id'] + environment_id = getEnvironmentResults['id'] # full envId, extract actual envId if to be used later servers = data.get('servers') if environment_id and servers: for server in servers: - default_deployment_title = (extracted_api_name + "deployment").replace("-", "") extracted_deployment_name = server.get('name', default_deployment_title).replace(" ", "-") extracted_deployment_title = server.get('title', default_deployment_title).replace(" ", "-") @@ -479,5 +467,5 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n # TODO custom properties } - createAPIDeploymentResults = CreateAPIDeployment(cli_ctx=cmd.cli_ctx)(command_args=api_deployment_args) - print("API deployment was created successfully") \ No newline at end of file + CreateAPIDeployment(cli_ctx=cmd.cli_ctx)(command_args=api_deployment_args) + print("API deployment was created successfully") diff --git a/src/apic-extension/azext_apic_extension/tests/latest/data/exported_spec.json b/src/apic-extension/azext_apic_extension/tests/latest/data/exported_spec.json index 921483e2a9c..f4ac2c2048f 100644 --- a/src/apic-extension/azext_apic_extension/tests/latest/data/exported_spec.json +++ b/src/apic-extension/azext_apic_extension/tests/latest/data/exported_spec.json @@ -1,123 +1,29 @@ { "openapi":"3.0.0", "info":{ - "title":"Cat Facts API", - "version":"1.0" + "title":"Sample API 101", + "description":"API description in Markdown. 101", + "version":"1.0.0" }, + "servers":[ + { + "url":"http://api.example.com/v1" + } + ], "paths":{ - "/breeds":{ - "get":{ - "tags":[ - "Breeds" - ], - "summary":"Get a list of breeds", - "description":"Returns a a list of breeds", - "operationId":"getBreeds", - "parameters":[ - { - "name":"limit", - "in":"query", - "description":"limit the amount of results returned", - "required":false, - "schema":{ - "type":"integer", - "format":"int64" - } - } - ], - "responses":{ - "200":{ - "description":"successful operation", - "content":{ - "application/json":{ - "schema":{ - "type":"array", - "items":{ - "$ref":"#/components/schemas/Breed" - } - } - } - } - } - } - } - }, - "/fact":{ - "get":{ - "tags":[ - "Facts" - ], - "summary":"Get Random Fact", - "description":"Returns a random fact", - "operationId":"getRandomFact", - "parameters":[ - { - "name":"max_length", - "in":"query", - "description":"maximum length of returned fact", - "required":false, - "schema":{ - "type":"integer", - "format":"int64" - } - } - ], - "responses":{ - "200":{ - "description":"successful operation", - "content":{ - "application/json":{ - "schema":{ - "$ref":"#/components/schemas/CatFact" - } - } - } - }, - "404":{ - "description":"Fact not found" - } - } - } - }, - "/facts":{ + "/users":{ "get":{ - "tags":[ - "Facts" - ], - "summary":"Get a list of facts", - "description":"Returns a a list of facts", - "operationId":"getFacts", - "parameters":[ - { - "name":"max_length", - "in":"query", - "description":"maximum length of returned fact", - "required":false, - "schema":{ - "type":"integer", - "format":"int64" - } - }, - { - "name":"limit", - "in":"query", - "description":"limit the amount of results returned", - "required":false, - "schema":{ - "type":"integer", - "format":"int64" - } - } - ], + "summary":"Returns a list of users.", + "description":"Optional extended description in Markdown.", "responses":{ "200":{ - "description":"successful operation", + "description":"A JSON array of user names", "content":{ "application/json":{ "schema":{ "type":"array", "items":{ - "$ref":"#/components/schemas/CatFact" + "type":"string" } } } @@ -126,65 +32,5 @@ } } } - }, - "components":{ - "schemas":{ - "Breed":{ - "title":"Breed model", - "description":"Breed", - "properties":{ - "breed":{ - "title":"Breed", - "description":"Breed", - "type":"string", - "format":"string" - }, - "country":{ - "title":"Country", - "description":"Country", - "type":"string", - "format":"string" - }, - "origin":{ - "title":"Origin", - "description":"Origin", - "type":"string", - "format":"string" - }, - "coat":{ - "title":"Coat", - "description":"Coat", - "type":"string", - "format":"string" - }, - "pattern":{ - "title":"Pattern", - "description":"Pattern", - "type":"string", - "format":"string" - } - }, - "type":"object" - }, - "CatFact":{ - "title":"CatFact model", - "description":"CatFact", - "properties":{ - "fact":{ - "title":"Fact", - "description":"Fact", - "type":"string", - "format":"string" - }, - "length":{ - "title":"Length", - "description":"Length", - "type":"integer", - "format":"int32" - } - }, - "type":"object" - } - } } } \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/tests/latest/data/import_spec_payload.json b/src/apic-extension/azext_apic_extension/tests/latest/data/import_spec_payload.json index 30ae9b007f2..3046e59b93f 100644 --- a/src/apic-extension/azext_apic_extension/tests/latest/data/import_spec_payload.json +++ b/src/apic-extension/azext_apic_extension/tests/latest/data/import_spec_payload.json @@ -1 +1,36 @@ -{"openapi": "3.0.0", "info": {"title": "Cat Facts API", "version": "1.0"}, "paths": {"/breeds": {"get": {"tags": ["Breeds"], "summary": "Get a list of breeds", "description": "Returns a a list of breeds", "operationId": "getBreeds", "parameters": [{"name": "limit", "in": "query", "description": "limit the amount of results returned", "required": false, "schema": {"type": "integer", "format": "int64"}}], "responses": {"200": {"description": "successful operation", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/Breed"}}}}}}}}, "/fact": {"get": {"tags": ["Facts"], "summary": "Get Random Fact", "description": "Returns a random fact", "operationId": "getRandomFact", "parameters": [{"name": "max_length", "in": "query", "description": "maximum length of returned fact", "required": false, "schema": {"type": "integer", "format": "int64"}}], "responses": {"200": {"description": "successful operation", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CatFact"}}}}, "404": {"description": "Fact not found"}}}}, "/facts": {"get": {"tags": ["Facts"], "summary": "Get a list of facts", "description": "Returns a a list of facts", "operationId": "getFacts", "parameters": [{"name": "max_length", "in": "query", "description": "maximum length of returned fact", "required": false, "schema": {"type": "integer", "format": "int64"}}, {"name": "limit", "in": "query", "description": "limit the amount of results returned", "required": false, "schema": {"type": "integer", "format": "int64"}}], "responses": {"200": {"description": "successful operation", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/CatFact"}}}}}}}}}, "components": {"schemas": {"Breed": {"title": "Breed model", "description": "Breed", "properties": {"breed": {"title": "Breed", "description": "Breed", "type": "string", "format": "string"}, "country": {"title": "Country", "description": "Country", "type": "string", "format": "string"}, "origin": {"title": "Origin", "description": "Origin", "type": "string", "format": "string"}, "coat": {"title": "Coat", "description": "Coat", "type": "string", "format": "string"}, "pattern": {"title": "Pattern", "description": "Pattern", "type": "string", "format": "string"}}, "type": "object"}, "CatFact": {"title": "CatFact model", "description": "CatFact", "properties": {"fact": {"title": "Fact", "description": "Fact", "type": "string", "format": "string"}, "length": {"title": "Length", "description": "Length", "type": "integer", "format": "int32"}}, "type": "object"}}}} \ No newline at end of file +{ + "openapi": "3.0.0", + "info": { + "title": "Sample API 101", + "description": "API description in Markdown. 101", + "version": "1.0.0" + }, + "servers": [ + { + "url": "http://api.example.com/v1" + } + ], + "paths": { + "/users": { + "get": { + "summary": "Returns a list of users.", + "description": "Optional extended description in Markdown.", + "responses": { + "200": { + "description": "A JSON array of user names", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/tests/latest/data/register_quickadd_openai_spec.json b/src/apic-extension/azext_apic_extension/tests/latest/data/register_quickadd_openai_spec.json index b3139e6acfc..503709fa43b 100644 --- a/src/apic-extension/azext_apic_extension/tests/latest/data/register_quickadd_openai_spec.json +++ b/src/apic-extension/azext_apic_extension/tests/latest/data/register_quickadd_openai_spec.json @@ -7,7 +7,7 @@ ], "info": { "description": "APIs for sampling from and fine-tuning language models", - "title": "CLI Test OpenAI API 100", + "title": "CLI Test OpenAI API 105", "version": "1.2.0", "x-apisguru-categories": [ "machine_learning" diff --git a/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml b/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml index e1c65f2ee1a..a49cf2a7335 100644 --- a/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml +++ b/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml @@ -24,7 +24,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-23T23:38:55.7280282Z"},"properties":{"title":"Public + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-24T04:36:43.7848756Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service-0"]},"customProperties":{}}}' headers: api-supported-versions: @@ -36,9 +36,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:38:54 GMT + - Fri, 24 Nov 2023 04:36:43 GMT etag: - - 05006f4b-0000-3300-0000-655fe28f0000 + - 05002e6e-0000-3300-0000-6560285b0000 expires: - '-1' pragma: @@ -54,7 +54,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' x-powered-by: - ASP.NET status: @@ -79,7 +79,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-23T23:38:55.7280282Z"},"properties":{"title":"Public + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-24T04:36:43.7848756Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service-0"]},"customProperties":{}}}' headers: api-supported-versions: @@ -91,9 +91,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:38:55 GMT + - Fri, 24 Nov 2023 04:36:43 GMT etag: - - 05006f4b-0000-3300-0000-655fe28f0000 + - 05002e6e-0000-3300-0000-6560285b0000 expires: - '-1' pragma: @@ -138,7 +138,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-23T23:38:56.6775124Z"},"properties":{"title":"Public + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-24T04:36:44.6605067Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}' headers: api-supported-versions: @@ -150,9 +150,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:38:55 GMT + - Fri, 24 Nov 2023 04:36:43 GMT etag: - - 0500704b-0000-3300-0000-655fe2900000 + - 05002f6e-0000-3300-0000-6560285c0000 expires: - '-1' pragma: @@ -193,7 +193,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-23T23:38:56.6775124Z"},"properties":{"title":"Public + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-24T04:36:44.6605067Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}' headers: api-supported-versions: @@ -205,9 +205,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:38:56 GMT + - Fri, 24 Nov 2023 04:36:44 GMT etag: - - 0500704b-0000-3300-0000-655fe2900000 + - 05002f6e-0000-3300-0000-6560285c0000 expires: - '-1' pragma: @@ -274,7 +274,7 @@ interactions: in or sign up","developerPortalUri":["https://developer.abcd.com"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/public-2","name":"public-2","systemData":{"createdAt":"2023-11-20T20:46:43.0550419Z","lastModifiedAt":"2023-11-20T20:46:43.0550789Z"},"properties":{"title":"Public cloud","kind":"development","customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/public-3","name":"public-3","systemData":{"createdAt":"2023-11-20T20:52:17.473183Z","lastModifiedAt":"2023-11-23T22:09:43.7311785Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/testpublic","name":"testpublic","systemData":{"createdAt":"2023-11-22T15:50:59.2415397Z","lastModifiedAt":"2023-11-22T16:50:42.7816893Z"},"properties":{"title":"Public - cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-23T23:38:56.6775124Z"},"properties":{"title":"Public + cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-24T04:36:44.6605067Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}]}' headers: api-supported-versions: @@ -286,7 +286,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:38:57 GMT + - Fri, 24 Nov 2023 04:36:45 GMT expires: - '-1' pragma: @@ -307,8 +307,8 @@ interactions: code: 200 message: OK - request: - body: '{"properties": {"description": "CLI Test API 0", "kind": "rest", "title": - "CLI Test API 0"}}' + body: '{"properties": {"description": "CLI Test API 106", "kind": "rest", "title": + "CLI Test API 106"}}' headers: Accept: - application/json @@ -319,7 +319,7 @@ interactions: Connection: - keep-alive Content-Length: - - '92' + - '96' Content-Type: - application/json ParameterSetName: @@ -327,24 +327,24 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102","name":"cli-test-api-102","systemData":{"createdAt":"2023-11-23T23:38:58.5936277Z","lastModifiedAt":"2023-11-23T23:38:58.5936278Z"},"properties":{"title":"CLI - Test API 0","description":"CLI Test API 0","kind":"rest","lifecycleStage":"design","externalDocumentation":[],"contacts":[],"customProperties":{}}}' + string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106","name":"cli-test-api-106","systemData":{"createdAt":"2023-11-24T04:36:46.6151158Z","lastModifiedAt":"2023-11-24T04:36:46.6151159Z"},"properties":{"title":"CLI + Test API 106","description":"CLI Test API 106","kind":"rest","lifecycleStage":"design","externalDocumentation":[],"contacts":[],"customProperties":{}}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '532' + - '536' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:38:58 GMT + - Fri, 24 Nov 2023 04:36:46 GMT etag: - - 4900911b-0000-3300-0000-655fe2920000 + - 4a005e91-0000-3300-0000-6560285e0000 expires: - '-1' pragma: @@ -360,7 +360,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' x-powered-by: - ASP.NET status: @@ -382,24 +382,24 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102","name":"cli-test-api-102","systemData":{"createdAt":"2023-11-23T23:38:58.5936277Z","lastModifiedAt":"2023-11-23T23:38:58.5936278Z"},"properties":{"title":"CLI - Test API 0","description":"CLI Test API 0","kind":"rest","lifecycleStage":"design","externalDocumentation":[],"contacts":[],"customProperties":{}}}' + string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106","name":"cli-test-api-106","systemData":{"createdAt":"2023-11-24T04:36:46.6151158Z","lastModifiedAt":"2023-11-24T04:36:46.6151159Z"},"properties":{"title":"CLI + Test API 106","description":"CLI Test API 106","kind":"rest","lifecycleStage":"design","externalDocumentation":[],"contacts":[],"customProperties":{}}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '532' + - '536' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:38:58 GMT + - Fri, 24 Nov 2023 04:36:46 GMT etag: - - 4900911b-0000-3300-0000-655fe2920000 + - 4a005e91-0000-3300-0000-6560285e0000 expires: - '-1' pragma: @@ -438,8 +438,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis?api-version=2024-03-01 response: body: - string: "{\"value\":[{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/petstore-api\",\"name\":\"petstore-api\",\"systemData\":{\"createdAt\":\"2023-11-08T18:57:32.3783991Z\",\"lastModifiedAt\":\"2023-11-08T18:57:32.3784001Z\"},\"properties\":{\"title\":\"Petstore-Api\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cat-facts-api\",\"name\":\"cat-facts-api\",\"systemData\":{\"createdAt\":\"2023-11-08T18:58:24.8668354Z\",\"lastModifiedAt\":\"2023-11-21T21:13:08.617789Z\"},\"properties\":{\"title\":\"cat-facts-api\",\"summary\":\"API - Description\",\"description\":\"API Description\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{},\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/ensight-servicereports\",\"name\":\"ensight-servicereports\",\"systemData\":{\"createdAt\":\"2023-11-10T22:24:10.4970866Z\",\"lastModifiedAt\":\"2023-11-10T22:24:10.4971093Z\"},\"properties\":{\"title\":\"ensight-servicereports\",\"description\":\"**ENSIGHT + string: "{\"value\":[{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/petstore-api\",\"name\":\"petstore-api\",\"systemData\":{\"createdAt\":\"2023-11-08T18:57:32.3783991Z\",\"lastModifiedAt\":\"2023-11-08T18:57:32.3784001Z\"},\"properties\":{\"title\":\"Petstore-Api\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/ensight-servicereports\",\"name\":\"ensight-servicereports\",\"systemData\":{\"createdAt\":\"2023-11-10T22:24:10.4970866Z\",\"lastModifiedAt\":\"2023-11-10T22:24:10.4971093Z\"},\"properties\":{\"title\":\"ensight-servicereports\",\"description\":\"**ENSIGHT Servicereports API** verf\xFCgt \xFCber den prim\xE4ren Endpunkt [Get Servicereports](https://dev-core-base-apim.developer.azure-api.net/api-details#api=ENSIGHT-API-Servicereportsv1&operation=GlobalServiceProtocol) mithilfe dessen Servicereports - Dokumentationen von Betriebs- und Instandhaltungsmassnahmen von Kraftwerken f\xFCr erneuerbare Energien - in Form des Globalen Service @@ -510,19 +509,23 @@ interactions: \ For this sample, you can use the api key `special-key` to test the authorization filters.\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/femeji-openai-test\",\"name\":\"femeji-openai-test\",\"systemData\":{\"createdAt\":\"2023-11-15T18:23:02.5833933Z\",\"lastModifiedAt\":\"2023-11-15T18:24:32.7488369Z\"},\"properties\":{\"title\":\"femeji-openai-test\",\"summary\":\"Ignite 2023: openAI summarize reviews API\",\"description\":\"Ignite 2023: openAI - summarize reviews API\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{},\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102\",\"name\":\"cli-test-api-102\",\"systemData\":{\"createdAt\":\"2023-11-23T23:38:58.5936277Z\",\"lastModifiedAt\":\"2023-11-23T23:38:58.5936278Z\"},\"properties\":{\"title\":\"CLI - Test API 0\",\"description\":\"CLI Test API 0\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}}]}" + summarize reviews API\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{},\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/echo-api-10\",\"name\":\"echo-api-10\",\"systemData\":{\"createdAt\":\"2023-11-24T04:09:30.5042234Z\",\"lastModifiedAt\":\"2023-11-24T04:09:30.5042235Z\"},\"properties\":{\"title\":\"Echo + API\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100\",\"name\":\"cli-test-openai-api-100\",\"systemData\":{\"createdAt\":\"2023-11-24T04:18:06.6293674Z\",\"lastModifiedAt\":\"2023-11-24T04:22:28.1864979Z\"},\"properties\":{\"title\":\"cli-test-openai-api-100\",\"summary\":\"APIs + for sampling from and fine-tuning language models\",\"description\":\"APIs + for sampling from and fine-tuning language models\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{},\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-104\",\"name\":\"cli-test-api-104\",\"systemData\":{\"createdAt\":\"2023-11-24T04:22:10.1136578Z\",\"lastModifiedAt\":\"2023-11-24T04:35:33.5876506Z\"},\"properties\":{\"title\":\"CLI + Test API 105\",\"description\":\"CLI Test API 105\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106\",\"name\":\"cli-test-api-106\",\"systemData\":{\"createdAt\":\"2023-11-24T04:36:46.6151158Z\",\"lastModifiedAt\":\"2023-11-24T04:36:46.6151159Z\"},\"properties\":{\"title\":\"CLI + Test API 106\",\"description\":\"CLI Test API 106\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}}]}" headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '10935' + - '12071' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:38:59 GMT + - Fri, 24 Nov 2023 04:36:47 GMT expires: - '-1' pragma: @@ -562,10 +565,10 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-23T23:39:00.4074868Z","lastModifiedAt":"2023-11-23T23:39:00.4074868Z"},"properties":{"title":"cli-test-2023-01-02","lifecycleStage":"design"}}' + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-24T04:36:48.5019943Z","lastModifiedAt":"2023-11-24T04:36:48.5019943Z"},"properties":{"title":"cli-test-2023-01-02","lifecycleStage":"design"}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 @@ -576,9 +579,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:38:59 GMT + - Fri, 24 Nov 2023 04:36:47 GMT etag: - - 5d00134b-0000-3300-0000-655fe2940000 + - 5f00ebcc-0000-3300-0000-656028600000 expires: - '-1' pragma: @@ -594,7 +597,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' x-powered-by: - ASP.NET status: @@ -616,10 +619,10 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-23T23:39:00.4074868Z","lastModifiedAt":"2023-11-23T23:39:00.4074868Z"},"properties":{"title":"cli-test-2023-01-02","lifecycleStage":"design"}}' + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-24T04:36:48.5019943Z","lastModifiedAt":"2023-11-24T04:36:48.5019943Z"},"properties":{"title":"cli-test-2023-01-02","lifecycleStage":"design"}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 @@ -630,9 +633,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:00 GMT + - Fri, 24 Nov 2023 04:36:48 GMT etag: - - 5d00134b-0000-3300-0000-655fe2940000 + - 5f00ebcc-0000-3300-0000-656028600000 expires: - '-1' pragma: @@ -673,10 +676,10 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-23T23:39:00.4074868Z","lastModifiedAt":"2023-11-23T23:39:01.3160351Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-24T04:36:48.5019943Z","lastModifiedAt":"2023-11-24T04:36:49.4205098Z"},"properties":{"title":"CLI Test API Version 0","lifecycleStage":"design"}}' headers: api-supported-versions: @@ -688,9 +691,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:01 GMT + - Fri, 24 Nov 2023 04:36:48 GMT etag: - - 5d002d4b-0000-3300-0000-655fe2950000 + - 5f00fbcc-0000-3300-0000-656028610000 expires: - '-1' pragma: @@ -706,7 +709,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1197' x-powered-by: - ASP.NET status: @@ -728,10 +731,10 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-23T23:39:00.4074868Z","lastModifiedAt":"2023-11-23T23:39:01.3160351Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-24T04:36:48.5019943Z","lastModifiedAt":"2023-11-24T04:36:49.4205098Z"},"properties":{"title":"CLI Test API Version 0","lifecycleStage":"design"}}' headers: api-supported-versions: @@ -743,9 +746,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:01 GMT + - Fri, 24 Nov 2023 04:36:49 GMT etag: - - 5d002d4b-0000-3300-0000-655fe2950000 + - 5f00fbcc-0000-3300-0000-656028610000 expires: - '-1' pragma: @@ -781,10 +784,10 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions?api-version=2024-03-01 response: body: - string: '{"value":[{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-23T23:39:00.4074868Z","lastModifiedAt":"2023-11-23T23:39:01.3160351Z"},"properties":{"title":"CLI + string: '{"value":[{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-24T04:36:48.5019943Z","lastModifiedAt":"2023-11-24T04:36:49.4205098Z"},"properties":{"title":"CLI Test API Version 0","lifecycleStage":"design"}}]}' headers: api-supported-versions: @@ -796,7 +799,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:02 GMT + - Fri, 24 Nov 2023 04:36:49 GMT expires: - '-1' pragma: @@ -836,23 +839,23 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","name":"cli-test-openapi","systemData":{"createdAt":"2023-11-23T23:22:11.3530106Z","lastModifiedAt":"2023-11-23T23:39:03.207786Z"},"properties":{"title":"OpenAPI","specification":{"name":"openapi","version":"3.0.0"}}}' + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-24T04:36:51.2266973Z"},"properties":{"title":"OpenAPI"}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '508' + - '464' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:02 GMT + - Fri, 24 Nov 2023 04:36:50 GMT etag: - - 0000c600-0000-3300-0000-655fe2970000 + - 0000ee00-0000-3300-0000-656028630000 expires: - '-1' pragma: @@ -868,7 +871,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' x-powered-by: - ASP.NET status: @@ -890,23 +893,23 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","name":"cli-test-openapi","systemData":{"createdAt":"2023-11-23T23:22:11.3530106Z","lastModifiedAt":"2023-11-23T23:39:03.207786Z"},"properties":{"title":"OpenAPI","specification":{"name":"openapi","version":"3.0.0"}}}' + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-24T04:36:51.2266973Z"},"properties":{"title":"OpenAPI"}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '508' + - '464' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:03 GMT + - Fri, 24 Nov 2023 04:36:51 GMT etag: - - 0000c600-0000-3300-0000-655fe2970000 + - 0000ee00-0000-3300-0000-656028630000 expires: - '-1' pragma: @@ -946,24 +949,24 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","name":"cli-test-openapi","systemData":{"createdAt":"2023-11-23T23:22:11.3530106Z","lastModifiedAt":"2023-11-23T23:39:04.1298296Z"},"properties":{"title":"CLI - Test API Definition 0","specification":{"name":"openapi","version":"3.0.0"}}}' + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-24T04:36:52.1899192Z"},"properties":{"title":"CLI + Test API Definition 0"}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '527' + - '482' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:03 GMT + - Fri, 24 Nov 2023 04:36:51 GMT etag: - - 0000c700-0000-3300-0000-655fe2980000 + - 0000ef00-0000-3300-0000-656028640000 expires: - '-1' pragma: @@ -979,7 +982,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' x-powered-by: - ASP.NET status: @@ -1001,24 +1004,24 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","name":"cli-test-openapi","systemData":{"createdAt":"2023-11-23T23:22:11.3530106Z","lastModifiedAt":"2023-11-23T23:39:04.1298296Z"},"properties":{"title":"CLI - Test API Definition 0","specification":{"name":"openapi","version":"3.0.0"}}}' + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-24T04:36:52.1899192Z"},"properties":{"title":"CLI + Test API Definition 0"}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '527' + - '482' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:04 GMT + - Fri, 24 Nov 2023 04:36:52 GMT etag: - - 0000c700-0000-3300-0000-655fe2980000 + - 0000ef00-0000-3300-0000-656028640000 expires: - '-1' pragma: @@ -1054,22 +1057,22 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions?api-version=2024-03-01 response: body: - string: '{"value":[{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","name":"cli-test-openapi","systemData":{"createdAt":"2023-11-23T23:22:11.3530106Z","lastModifiedAt":"2023-11-23T23:39:04.1298296Z"},"properties":{"title":"CLI - Test API Definition 0","specification":{"name":"openapi","version":"3.0.0"}}}]}' + string: '{"value":[{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-24T04:36:52.1899192Z"},"properties":{"title":"CLI + Test API Definition 0"}}]}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '539' + - '494' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:04 GMT + - Fri, 24 Nov 2023 04:36:53 GMT expires: - '-1' pragma: @@ -1091,43 +1094,13 @@ interactions: message: OK - request: body: '{"format": "inline", "specification": {"name": "openapi", "version": "3.0.0"}, - "value": "{\"openapi\": \"3.0.0\", \"info\": {\"title\": \"Cat Facts API\", - \"version\": \"1.0\"}, \"paths\": {\"/breeds\": {\"get\": {\"tags\": [\"Breeds\"], - \"summary\": \"Get a list of breeds\", \"description\": \"Returns a a list of - breeds\", \"operationId\": \"getBreeds\", \"parameters\": [{\"name\": \"limit\", - \"in\": \"query\", \"description\": \"limit the amount of results returned\", - \"required\": false, \"schema\": {\"type\": \"integer\", \"format\": \"int64\"}}], - \"responses\": {\"200\": {\"description\": \"successful operation\", \"content\": - {\"application/json\": {\"schema\": {\"type\": \"array\", \"items\": {\"$ref\": - \"#/components/schemas/Breed\"}}}}}}}}, \"/fact\": {\"get\": {\"tags\": [\"Facts\"], - \"summary\": \"Get Random Fact\", \"description\": \"Returns a random fact\", - \"operationId\": \"getRandomFact\", \"parameters\": [{\"name\": \"max_length\", - \"in\": \"query\", \"description\": \"maximum length of returned fact\", \"required\": - false, \"schema\": {\"type\": \"integer\", \"format\": \"int64\"}}], \"responses\": - {\"200\": {\"description\": \"successful operation\", \"content\": {\"application/json\": - {\"schema\": {\"$ref\": \"#/components/schemas/CatFact\"}}}}, \"404\": {\"description\": - \"Fact not found\"}}}}, \"/facts\": {\"get\": {\"tags\": [\"Facts\"], \"summary\": - \"Get a list of facts\", \"description\": \"Returns a a list of facts\", \"operationId\": - \"getFacts\", \"parameters\": [{\"name\": \"max_length\", \"in\": \"query\", - \"description\": \"maximum length of returned fact\", \"required\": false, \"schema\": - {\"type\": \"integer\", \"format\": \"int64\"}}, {\"name\": \"limit\", \"in\": - \"query\", \"description\": \"limit the amount of results returned\", \"required\": - false, \"schema\": {\"type\": \"integer\", \"format\": \"int64\"}}], \"responses\": - {\"200\": {\"description\": \"successful operation\", \"content\": {\"application/json\": - {\"schema\": {\"type\": \"array\", \"items\": {\"$ref\": \"#/components/schemas/CatFact\"}}}}}}}}}, - \"components\": {\"schemas\": {\"Breed\": {\"title\": \"Breed model\", \"description\": - \"Breed\", \"properties\": {\"breed\": {\"title\": \"Breed\", \"description\": - \"Breed\", \"type\": \"string\", \"format\": \"string\"}, \"country\": {\"title\": - \"Country\", \"description\": \"Country\", \"type\": \"string\", \"format\": - \"string\"}, \"origin\": {\"title\": \"Origin\", \"description\": \"Origin\", - \"type\": \"string\", \"format\": \"string\"}, \"coat\": {\"title\": \"Coat\", - \"description\": \"Coat\", \"type\": \"string\", \"format\": \"string\"}, \"pattern\": - {\"title\": \"Pattern\", \"description\": \"Pattern\", \"type\": \"string\", - \"format\": \"string\"}}, \"type\": \"object\"}, \"CatFact\": {\"title\": \"CatFact - model\", \"description\": \"CatFact\", \"properties\": {\"fact\": {\"title\": - \"Fact\", \"description\": \"Fact\", \"type\": \"string\", \"format\": \"string\"}, - \"length\": {\"title\": \"Length\", \"description\": \"Length\", \"type\": \"integer\", - \"format\": \"int32\"}}, \"type\": \"object\"}}}}"}' + "value": "{\"openapi\": \"3.0.0\", \"info\": {\"title\": \"Sample API 101\", + \"description\": \"API description in Markdown. 101\", \"version\": \"1.0.0\"}, + \"servers\": [{\"url\": \"http://api.example.com/v1\"}], \"paths\": {\"/users\": + {\"get\": {\"summary\": \"Returns a list of users.\", \"description\": \"Optional + extended description in Markdown.\", \"responses\": {\"200\": {\"description\": + \"A JSON array of user names\", \"content\": {\"application/json\": {\"schema\": + {\"type\": \"array\", \"items\": {\"type\": \"string\"}}}}}}}}}}"}' headers: Accept: - '*/*' @@ -1138,7 +1111,7 @@ interactions: Connection: - keep-alive Content-Length: - - '3120' + - '626' Content-Type: - application/json ParameterSetName: @@ -1146,7 +1119,7 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi/importSpecification?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106/importSpecification?api-version=2024-03-01 response: body: string: '' @@ -1158,21 +1131,23 @@ interactions: content-length: - '0' date: - - Thu, 23 Nov 2023 23:39:05 GMT + - Fri, 24 Nov 2023 04:36:53 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi/operationResults/4096e2a5-b305-4e83-b214-d62b27a172c2?api-version=2024-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106/operationResults/43b92c63-7922-4466-a416-c90000de9394?api-version=2024-03-01 pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' + x-msedge-ref: + - 'Ref A: 0316F8152CAB499B8A4BEF786C95D1C5 Ref B: SN4AA2022304011 Ref C: 2023-11-24T04:36:53Z' x-powered-by: - ASP.NET status: @@ -1194,7 +1169,7 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi/operationResults/4096e2a5-b305-4e83-b214-d62b27a172c2?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106/operationResults/43b92c63-7922-4466-a416-c90000de9394?api-version=2024-03-01 response: body: string: '{"apiName":"default","apiVersion":"cli-test-2023-01-02","catalogName":"contosoeuap","provisioningState":"Succeeded","error":{"message":""}}' @@ -1208,21 +1183,21 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:06 GMT + - Fri, 24 Nov 2023 04:36:54 GMT expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: 82E7424910474AACB9573AD62213A1D6 Ref B: SN4AA2022304011 Ref C: 2023-11-24T04:36:54Z' x-powered-by: - ASP.NET status: @@ -1246,81 +1221,50 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi/exportSpecification?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106/exportSpecification?api-version=2024-03-01 response: body: string: '{"format":"inline","value":"{\"openapi\": \"3.0.0\", \"info\": {\"title\": - \"Cat Facts API\", \"version\": \"1.0\"}, \"paths\": {\"/breeds\": {\"get\": - {\"tags\": [\"Breeds\"], \"summary\": \"Get a list of breeds\", \"description\": - \"Returns a a list of breeds\", \"operationId\": \"getBreeds\", \"parameters\": - [{\"name\": \"limit\", \"in\": \"query\", \"description\": \"limit the amount - of results returned\", \"required\": false, \"schema\": {\"type\": \"integer\", - \"format\": \"int64\"}}], \"responses\": {\"200\": {\"description\": \"successful - operation\", \"content\": {\"application/json\": {\"schema\": {\"type\": \"array\", - \"items\": {\"$ref\": \"#/components/schemas/Breed\"}}}}}}}}, \"/fact\": {\"get\": - {\"tags\": [\"Facts\"], \"summary\": \"Get Random Fact\", \"description\": - \"Returns a random fact\", \"operationId\": \"getRandomFact\", \"parameters\": - [{\"name\": \"max_length\", \"in\": \"query\", \"description\": \"maximum - length of returned fact\", \"required\": false, \"schema\": {\"type\": \"integer\", - \"format\": \"int64\"}}], \"responses\": {\"200\": {\"description\": \"successful - operation\", \"content\": {\"application/json\": {\"schema\": {\"$ref\": \"#/components/schemas/CatFact\"}}}}, - \"404\": {\"description\": \"Fact not found\"}}}}, \"/facts\": {\"get\": {\"tags\": - [\"Facts\"], \"summary\": \"Get a list of facts\", \"description\": \"Returns - a a list of facts\", \"operationId\": \"getFacts\", \"parameters\": [{\"name\": - \"max_length\", \"in\": \"query\", \"description\": \"maximum length of returned - fact\", \"required\": false, \"schema\": {\"type\": \"integer\", \"format\": - \"int64\"}}, {\"name\": \"limit\", \"in\": \"query\", \"description\": \"limit - the amount of results returned\", \"required\": false, \"schema\": {\"type\": - \"integer\", \"format\": \"int64\"}}], \"responses\": {\"200\": {\"description\": - \"successful operation\", \"content\": {\"application/json\": {\"schema\": - {\"type\": \"array\", \"items\": {\"$ref\": \"#/components/schemas/CatFact\"}}}}}}}}}, - \"components\": {\"schemas\": {\"Breed\": {\"title\": \"Breed model\", \"description\": - \"Breed\", \"properties\": {\"breed\": {\"title\": \"Breed\", \"description\": - \"Breed\", \"type\": \"string\", \"format\": \"string\"}, \"country\": {\"title\": - \"Country\", \"description\": \"Country\", \"type\": \"string\", \"format\": - \"string\"}, \"origin\": {\"title\": \"Origin\", \"description\": \"Origin\", - \"type\": \"string\", \"format\": \"string\"}, \"coat\": {\"title\": \"Coat\", - \"description\": \"Coat\", \"type\": \"string\", \"format\": \"string\"}, - \"pattern\": {\"title\": \"Pattern\", \"description\": \"Pattern\", \"type\": - \"string\", \"format\": \"string\"}}, \"type\": \"object\"}, \"CatFact\": - {\"title\": \"CatFact model\", \"description\": \"CatFact\", \"properties\": - {\"fact\": {\"title\": \"Fact\", \"description\": \"Fact\", \"type\": \"string\", - \"format\": \"string\"}, \"length\": {\"title\": \"Length\", \"description\": - \"Length\", \"type\": \"integer\", \"format\": \"int32\"}}, \"type\": \"object\"}}}}"}' + \"Sample API 101\", \"description\": \"API description in Markdown. 101\", + \"version\": \"1.0.0\"}, \"servers\": [{\"url\": \"http://api.example.com/v1\"}], + \"paths\": {\"/users\": {\"get\": {\"summary\": \"Returns a list of users.\", + \"description\": \"Optional extended description in Markdown.\", \"responses\": + {\"200\": {\"description\": \"A JSON array of user names\", \"content\": {\"application/json\": + {\"schema\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}}}}}}}}}}"}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '3059' + - '565' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:06 GMT + - Fri, 24 Nov 2023 04:36:54 GMT expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' + x-msedge-ref: + - 'Ref A: 0D433DD64083445D9419A4F8307AA489 Ref B: SN4AA2022302027 Ref C: 2023-11-24T04:36:55Z' x-powered-by: - ASP.NET status: code: 200 message: OK - request: - body: '{"properties": {"definitionId": "/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi", + body: '{"properties": {"definitionId": "/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106", "description": "CLI Test Public cloud production deployment.", "environmentId": "/workspaces/default/environments/cli-test-public", "server": {"runtimeUri": ["https://api.contoso.com"]}, "title": "CLI Test Production deployment"}}' @@ -1334,7 +1278,7 @@ interactions: Connection: - keep-alive Content-Length: - - '365' + - '369' Content-Type: - application/json ParameterSetName: @@ -1343,41 +1287,41 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/mock-deployment?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/mock-deployment?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/production","name":"production","systemData":{"createdAt":"2023-11-23T23:39:08.5478416Z","lastModifiedAt":"2023-11-23T23:39:08.5478416Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-24T04:36:56.0382948Z","lastModifiedAt":"2023-11-24T04:36:56.0382948Z"},"properties":{"title":"CLI Test Production deployment","description":"CLI Test Public cloud production - deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' + deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '777' + - '781' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:08 GMT + - Fri, 24 Nov 2023 04:36:55 GMT etag: - - 0700768e-0000-3300-0000-655fe29c0000 + - 0700a8c1-0000-3300-0000-656028680000 expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' + x-msedge-ref: + - 'Ref A: CDE05808D9264C56A875AADFC849B8A8 Ref B: SN4AA2022302021 Ref C: 2023-11-24T04:36:55Z' x-powered-by: - ASP.NET status: @@ -1399,39 +1343,39 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/mock-deployment?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/mock-deployment?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/production","name":"production","systemData":{"createdAt":"2023-11-23T23:39:08.5478416Z","lastModifiedAt":"2023-11-23T23:39:08.5478416Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-24T04:36:56.0382948Z","lastModifiedAt":"2023-11-24T04:36:56.0382948Z"},"properties":{"title":"CLI Test Production deployment","description":"CLI Test Public cloud production - deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' + deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '777' + - '781' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:08 GMT + - Fri, 24 Nov 2023 04:36:56 GMT etag: - - 0700768e-0000-3300-0000-655fe29c0000 + - 0700a8c1-0000-3300-0000-656028680000 expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: 84CAFA11780C41AFA7C3918459133078 Ref B: SN4AA2022303051 Ref C: 2023-11-24T04:36:56Z' x-powered-by: - ASP.NET status: @@ -1453,46 +1397,46 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/mock-deployment?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/mock-deployment?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/production","name":"production","systemData":{"createdAt":"2023-11-23T23:39:08.5478416Z","lastModifiedAt":"2023-11-23T23:39:08.5478416Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-24T04:36:56.0382948Z","lastModifiedAt":"2023-11-24T04:36:56.0382948Z"},"properties":{"title":"CLI Test Production deployment","description":"CLI Test Public cloud production - deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' + deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '777' + - '781' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:09 GMT + - Fri, 24 Nov 2023 04:36:56 GMT etag: - - 0700768e-0000-3300-0000-655fe29c0000 + - 0700a8c1-0000-3300-0000-656028680000 expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: D1779482FF044BE5B9CFB56D67E3A231 Ref B: SN4AA2022302053 Ref C: 2023-11-24T04:36:56Z' x-powered-by: - ASP.NET status: code: 200 message: OK - request: - body: '{"properties": {"customProperties": {}, "definitionId": "/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi", + body: '{"properties": {"customProperties": {}, "definitionId": "/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106", "description": "CLI Test Public cloud production deployment.", "environmentId": "/workspaces/default/environments/cli-test-public", "server": {"runtimeUri": ["https://api.contoso.com"]}, "title": "CLI Test Production deployment update"}}' @@ -1506,7 +1450,7 @@ interactions: Connection: - keep-alive Content-Length: - - '396' + - '400' Content-Type: - application/json ParameterSetName: @@ -1514,41 +1458,41 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/mock-deployment?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/mock-deployment?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/production","name":"production","systemData":{"createdAt":"2023-11-23T23:39:08.5478416Z","lastModifiedAt":"2023-11-23T23:39:10.0281119Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-24T04:36:56.0382948Z","lastModifiedAt":"2023-11-24T04:36:57.6537983Z"},"properties":{"title":"CLI Test Production deployment update","description":"CLI Test Public cloud production - deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' + deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '784' + - '788' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:09 GMT + - Fri, 24 Nov 2023 04:36:57 GMT etag: - - 07007e8e-0000-3300-0000-655fe29e0000 + - 0700a9c1-0000-3300-0000-656028690000 expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' + x-msedge-ref: + - 'Ref A: 92FEE29544D34854B34C07F3ECF6E3DB Ref B: SN4AA2022302053 Ref C: 2023-11-24T04:36:57Z' x-powered-by: - ASP.NET status: @@ -1570,37 +1514,37 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments?api-version=2024-03-01 response: body: - string: '{"value":[{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-102/deployments/production","name":"production","systemData":{"createdAt":"2023-11-23T23:39:08.5478416Z","lastModifiedAt":"2023-11-23T23:39:10.0281119Z"},"properties":{"title":"CLI + string: '{"value":[{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-24T04:36:56.0382948Z","lastModifiedAt":"2023-11-24T04:36:57.6537983Z"},"properties":{"title":"CLI Test Production deployment update","description":"CLI Test Public cloud production - deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-102/versions/cli-test-2023-01-02/definitions/cli-test-openapi","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}]}' + deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}]}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '796' + - '800' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:10 GMT + - Fri, 24 Nov 2023 04:36:57 GMT expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: 0657D851BD5A4E969EDE5F00D936C3F4 Ref B: SN4AA2022302047 Ref C: 2023-11-24T04:36:57Z' x-powered-by: - ASP.NET status: @@ -1630,7 +1574,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchemas/cli-test-metadata-schema-1?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/metadataSchema","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchema/cli-test-metadata-schema-1","name":"cli-test-metadata-schema-1","systemData":{"createdAt":"2023-11-23T23:38:10.2395175Z","lastModifiedAt":"2023-11-23T23:39:12.1707537Z"},"properties":{"assignedTo":[],"schema":"{\"type\": + string: '{"type":"Microsoft.ApiCenter/services/metadataSchema","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchema/cli-test-metadata-schema-1","name":"cli-test-metadata-schema-1","systemData":{"createdAt":"2023-11-24T04:18:02.4538124Z","lastModifiedAt":"2023-11-24T04:36:58.7877708Z"},"properties":{"assignedTo":[],"schema":"{\"type\": \"string\", \"title\": \"CLI Test First name\", \"pattern\": \"^[a-zA-Z0-9 ]+$\"}"}}' headers: @@ -1643,23 +1587,23 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:11 GMT + - Fri, 24 Nov 2023 04:36:58 GMT expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' + x-msedge-ref: + - 'Ref A: B6A4C820FF9C4946817B83D04ED5C0A7 Ref B: DM2AA1091213025 Ref C: 2023-11-24T04:36:58Z' x-powered-by: - ASP.NET status: @@ -1720,23 +1664,23 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:12 GMT + - Fri, 24 Nov 2023 04:36:59 GMT expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' + x-msedge-ref: + - 'Ref A: 55E267E228BD4BF8BF4484E4CCF82A1A Ref B: SN4AA2022304049 Ref C: 2023-11-24T04:36:59Z' x-powered-by: - ASP.NET status: @@ -1783,23 +1727,23 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:12 GMT + - Fri, 24 Nov 2023 04:36:59 GMT expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' + x-msedge-ref: + - 'Ref A: 8014F0F7A36546358A45E76F2E144CA1 Ref B: SN4AA2022304039 Ref C: 2023-11-24T04:36:59Z' x-powered-by: - ASP.NET status: @@ -1848,23 +1792,23 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:14 GMT + - Fri, 24 Nov 2023 04:37:00 GMT expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' + x-msedge-ref: + - 'Ref A: B59CF175EED4423BA60C50674536BCDA Ref B: SN4AA2022304021 Ref C: 2023-11-24T04:37:00Z' x-powered-by: - ASP.NET status: @@ -1889,7 +1833,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchemas/cli-test-metadata-schema-1?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/metadataSchema","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchema/cli-test-metadata-schema-1","name":"cli-test-metadata-schema-1","systemData":{"createdAt":"2023-11-23T23:38:10.2395175Z","lastModifiedAt":"2023-11-23T23:39:12.1707537Z"},"properties":{"assignedTo":[],"schema":"{\"type\": + string: '{"type":"Microsoft.ApiCenter/services/metadataSchema","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchema/cli-test-metadata-schema-1","name":"cli-test-metadata-schema-1","systemData":{"createdAt":"2023-11-24T04:18:02.4538124Z","lastModifiedAt":"2023-11-24T04:36:58.7877708Z"},"properties":{"assignedTo":[],"schema":"{\"type\": \"string\", \"title\": \"CLI Test First name\", \"pattern\": \"^[a-zA-Z0-9 ]+$\"}"}}' headers: @@ -1902,21 +1846,21 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:14 GMT + - Fri, 24 Nov 2023 04:37:00 GMT expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: 47D8D33BD5774E768B5D6BD1598BB802 Ref B: DM2AA1091214051 Ref C: 2023-11-24T04:37:01Z' x-powered-by: - ASP.NET status: @@ -1925,7 +1869,7 @@ interactions: - request: body: '{"properties": {"description": "APIs for sampling from and fine-tuning language models", "kind": "rest", "summary": "APIs for sampling from and fine-tuning - language models", "termsOfService": {}, "title": "cli-test-openai-api-100"}}' + language models", "termsOfService": {}, "title": "cli-test-openai-api-105"}}' headers: Accept: - application/json @@ -1944,10 +1888,10 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100","name":"cli-test-openai-api-100","systemData":{"createdAt":"2023-11-23T23:39:15.907503Z","lastModifiedAt":"2023-11-23T23:39:15.9075031Z"},"properties":{"title":"cli-test-openai-api-100","summary":"APIs + string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105","name":"cli-test-openai-api-105","systemData":{"createdAt":"2023-11-24T04:37:02.4875811Z","lastModifiedAt":"2023-11-24T04:37:02.4875811Z"},"properties":{"title":"cli-test-openai-api-105","summary":"APIs for sampling from and fine-tuning language models","description":"APIs for sampling from and fine-tuning language models","kind":"rest","lifecycleStage":"design","termsOfService":{},"externalDocumentation":[],"contacts":[],"customProperties":{}}}' headers: @@ -1956,29 +1900,29 @@ interactions: cache-control: - no-cache content-length: - - '681' + - '682' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:15 GMT + - Fri, 24 Nov 2023 04:37:02 GMT etag: - - 4900e91b-0000-3300-0000-655fe2a30000 + - 4a00b091-0000-3300-0000-6560286e0000 expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' + x-msedge-ref: + - 'Ref A: EAC894D813BF44CCA7B557AF7B109A47 Ref B: DM2AA1091211019 Ref C: 2023-11-24T04:37:02Z' x-powered-by: - ASP.NET status: @@ -2004,10 +1948,10 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0","name":"1-2-0","systemData":{"createdAt":"2023-11-23T23:39:16.4231969Z","lastModifiedAt":"2023-11-23T23:39:16.4231969Z"},"properties":{"title":"1-2-0","lifecycleStage":"design"}}' + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0","name":"1-2-0","systemData":{"createdAt":"2023-11-24T04:37:03.0013841Z","lastModifiedAt":"2023-11-24T04:37:03.0013841Z"},"properties":{"title":"1-2-0","lifecycleStage":"design"}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 @@ -2018,25 +1962,25 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:15 GMT + - Fri, 24 Nov 2023 04:37:02 GMT etag: - - 5d00f74b-0000-3300-0000-655fe2a40000 + - 5f0085cd-0000-3300-0000-6560286f0000 expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' + x-msedge-ref: + - 'Ref A: 1A0FFCD2E9354CAA85FEB982313680B1 Ref B: SN4AA2022302037 Ref C: 2023-11-24T04:37:02Z' x-powered-by: - ASP.NET status: @@ -2063,10 +2007,10 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi","name":"openapi","systemData":{"createdAt":"2023-11-23T23:39:16.872308Z","lastModifiedAt":"2023-11-23T23:39:16.872308Z"},"properties":{"title":"openapi","description":"APIs + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi","name":"openapi","systemData":{"createdAt":"2023-11-24T04:37:03.5685003Z","lastModifiedAt":"2023-11-24T04:37:03.5685003Z"},"properties":{"title":"openapi","description":"APIs for sampling from and fine-tuning language models"}}' headers: api-supported-versions: @@ -2074,29 +2018,29 @@ interactions: cache-control: - no-cache content-length: - - '500' + - '502' content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:16 GMT + - Fri, 24 Nov 2023 04:37:03 GMT etag: - - 0000c900-0000-3300-0000-655fe2a40000 + - 0000f100-0000-3300-0000-6560286f0000 expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' + x-msedge-ref: + - 'Ref A: 07C1FE707ABA4CFF8F7C1155CA44E146 Ref B: DM2AA1091212025 Ref C: 2023-11-24T04:37:03Z' x-powered-by: - ASP.NET status: @@ -2106,7 +2050,7 @@ interactions: body: '{"format": "inline", "specification": {"name": "openapi", "version": "3-0-0"}, "value": "{\"openapi\": \"3.0.0\", \"servers\": [{\"url\": \"https://api.openai.com/v1\"}], \"info\": {\"description\": \"APIs for sampling from and fine-tuning language - models\", \"title\": \"CLI Test OpenAI API 100\", \"version\": \"1.2.0\", \"x-apisguru-categories\": + models\", \"title\": \"CLI Test OpenAI API 105\", \"version\": \"1.2.0\", \"x-apisguru-categories\": [\"machine_learning\"], \"x-logo\": {\"url\": \"https://learnodo-newtonic.com/wp-content/uploads/2020/04/Logo-of-OpenAI-768x161.jpg\"}, \"x-origin\": [{\"format\": \"openapi\", \"url\": \"https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml\", \"version\": \"3.0\"}], \"x-providerName\": \"openai.com\"}, \"tags\": [{\"description\": @@ -3414,7 +3358,7 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi/importSpecification?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi/importSpecification?api-version=2024-03-01 response: body: string: '' @@ -3426,21 +3370,23 @@ interactions: content-length: - '0' date: - - Thu, 23 Nov 2023 23:39:17 GMT + - Fri, 24 Nov 2023 04:37:04 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi/operationResults/fdb530d3-5cee-4d91-a761-e3da08de1ade?api-version=2024-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi/operationResults/7852d102-9119-4187-a8e9-2b8afd78c41b?api-version=2024-03-01 pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' + x-msedge-ref: + - 'Ref A: D756DCCF6F8B426CB412D11F597F842A Ref B: SN4AA2022305049 Ref C: 2023-11-24T04:37:04Z' x-powered-by: - ASP.NET status: @@ -3462,7 +3408,7 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi/operationResults/fdb530d3-5cee-4d91-a761-e3da08de1ade?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi/operationResults/7852d102-9119-4187-a8e9-2b8afd78c41b?api-version=2024-03-01 response: body: string: '{"apiName":"default","apiVersion":"1-2-0","catalogName":"contosoeuap","provisioningState":"InProgress","error":{"message":""}}' @@ -3476,21 +3422,21 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:17 GMT + - Fri, 24 Nov 2023 04:37:04 GMT expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: A91FBAD5B64A40BEA70ADE2A6DE3C7F9 Ref B: SN4AA2022305049 Ref C: 2023-11-24T04:37:04Z' x-powered-by: - ASP.NET status: @@ -3515,7 +3461,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-23T23:38:56.6775124Z"},"properties":{"title":"Public + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-24T04:36:44.6605067Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}' headers: api-supported-versions: @@ -3527,33 +3473,33 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:18 GMT + - Fri, 24 Nov 2023 04:37:05 GMT etag: - - 0500704b-0000-3300-0000-655fe2900000 + - 05002f6e-0000-3300-0000-6560285c0000 expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: 3281AC3BD0BD488AABBBDAD3CF09B258 Ref B: DM2AA1091212039 Ref C: 2023-11-24T04:37:05Z' x-powered-by: - ASP.NET status: code: 200 message: OK - request: - body: '{"properties": {"definitionId": "/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi", - "description": "clitestopenaiapi100deployment", "environmentId": "/workspaces/default/environments/cli-test-public", + body: '{"properties": {"definitionId": "/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi", + "description": "clitestopenaiapi105deployment", "environmentId": "/workspaces/default/environments/cli-test-public", "server": {"runtimeUri": ["https://api.openai.com/v1"]}, "state": "active", - "title": "clitestopenaiapi100deployment"}}' + "title": "clitestopenaiapi105deployment"}}' headers: Accept: - application/json @@ -3572,10 +3518,10 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/deployments/mock-deployment?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/deployments/mock-deployment?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100/deployments/clitestopenaiapi100deployment","name":"clitestopenaiapi100deployment","systemData":{"createdAt":"2023-11-23T23:39:19.3972298Z","lastModifiedAt":"2023-11-23T23:39:19.3972298Z"},"properties":{"title":"clitestopenaiapi100deployment","description":"clitestopenaiapi100deployment","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-openai-api-100/versions/1-2-0/definitions/openapi","server":{"runtimeUri":["https://api.openai.com/v1"]},"customProperties":{},"recommended":false}}' + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/deployments/clitestopenaiapi105deployment","name":"clitestopenaiapi105deployment","systemData":{"createdAt":"2023-11-24T04:37:06.0766871Z","lastModifiedAt":"2023-11-24T04:37:06.0766871Z"},"properties":{"title":"clitestopenaiapi105deployment","description":"clitestopenaiapi105deployment","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi","server":{"runtimeUri":["https://api.openai.com/v1"]},"customProperties":{},"recommended":false}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 @@ -3586,25 +3532,25 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 23 Nov 2023 23:39:18 GMT + - Fri, 24 Nov 2023 04:37:05 GMT etag: - - 0700868e-0000-3300-0000-655fe2a70000 + - 0700afc1-0000-3300-0000-656028720000 expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' + x-msedge-ref: + - 'Ref A: 336A05B8E49E4C768EB3825B17C631C4 Ref B: SN4AA2022304053 Ref C: 2023-11-24T04:37:05Z' x-powered-by: - ASP.NET status: diff --git a/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py b/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py index 764ea579cd5..607f28638cf 100644 --- a/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py +++ b/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py @@ -21,9 +21,9 @@ def test_apic_scenarios(self): self.kwargs.update({ 'resource_group': 'api-center-test', 'service_name': 'contosoeuap', - 'api_name': 'cli-test-api-102', + 'api_name': 'cli-test-api-106', 'api_version': 'cli-test-2023-01-02', - 'api_definition_name': 'cli-test-openapi' + 'api_definition_name': 'cli-test-openapi-106', }) # ------------------------------------------- Environment ------------------------------------------- @@ -74,8 +74,8 @@ def test_apic_scenarios(self): # ------------------------------------------- API ------------------------------------------- # create api self.kwargs.update({ - 'api_description': "CLI Test API 0", - 'api_title': "CLI Test API 0" + 'api_description': "CLI Test API 106", + 'api_title': "CLI Test API 106" }) self.cmd('az apic api create -g {resource_group} -s {service_name} --api-name {api_name} --description "{api_description}" --kind rest --title "{api_title}"', checks=[ From ace20d6451e6c330bfda193828f0e735bd7e39e9 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Sun, 26 Nov 2023 22:08:37 -0600 Subject: [PATCH 15/27] fix local linting issues --- .../azext_apic_extension/commands.py | 3 +- .../azext_apic_extension/custom.py | 76 ++++++++++--------- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/commands.py b/src/apic-extension/azext_apic_extension/commands.py index e871aa7271d..10f131c96d3 100644 --- a/src/apic-extension/azext_apic_extension/commands.py +++ b/src/apic-extension/azext_apic_extension/commands.py @@ -23,6 +23,5 @@ def load_command_table(self, _): # pylint: disable=unused-argument self.command_table['apic metadata-schema create'] = CreateMetadataSchemaExtension(loader=self) self.command_table['apic metadata-schema update'] = UpdateMetadataSchemaExtension(loader=self) self.command_table['apic metadata-schema export-metadata-schema'] = ExportMetadataSchemaExtension(loader=self) - with self.command_group('apic api') as g: + with self.command_group('apic api') as g: g.custom_command("register", "register_apic") - \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index c9d160a706f..deb0e8f42de 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -7,6 +7,8 @@ # pylint: disable=too-many-lines # pylint: disable=too-many-statements +# pylint: disable=line-too-long +# pylint: disable=too-many-locals import os import sys @@ -14,7 +16,7 @@ import requests from knack.log import get_logger import chardet -from azure.cli.core.aaz import * +from azure.cli.core.aaz._arg import AAZStrArg from .aaz.latest.apic.api.definition import ImportSpecification from .aaz.latest.apic.api.definition import ExportSpecification from .aaz.latest.apic.metadata_schema import Create @@ -43,9 +45,10 @@ def pre_operations(self): # Load the JSON file if args.source_profile: - rawdata = open(str(args.source_profile), 'rb').read() - result = chardet.detect(rawdata) - encoding = result['encoding'] + with open(str(args.source_profile), 'rb') as f: + data = f.read() + result = chardet.detect(data) + encoding = result['encoding'] with open(str(args.source_profile), 'r', encoding=encoding) as f: data = json.load(f) @@ -64,7 +67,8 @@ def pre_operations(self): value_size_bytes = sys.getsizeof(args.value) value_size_mb = value_size_bytes / (1024 * 1024) # Convert bytes to megabytes if value_size_mb > 3: - logger.error('The size of "value" is greater than 3 MB. Please use --format "url" to import the specification from a URL for size greater than 3 mb.') + logger.error('The size of "value" is greater than 3 MB. ' + 'Please use --format "url" to import the specification from a URL for size greater than 3 mb.') class ExportSpecificationExtension(ExportSpecification): @@ -91,17 +95,18 @@ def _output(self, *args, **kwargs): if response_format == 'link': print('Fetching specification from:', exportedResults) - getReponse = requests.get(exportedResults) + getReponse = requests.get(exportedResults, timeout=10) if getReponse.status_code == 200: exportedResults = getReponse.content.decode() else: - logger.error('Error while fetching the results from the link. Status code: %s', getReponse.status_code) + logger.error('Error while fetching the results from the link.' + 'Status code: %s', getReponse.status_code) if arguments.source_profile: try: self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) print('Results exported to', arguments.source_profile) - except Exception as e: + except Exception as e: # pylint: disable=broad-except logger.error('Error while writing the results to the file. Error: %s', e) else: logger.error('Please provide the --file-name to exports the results to.') @@ -110,7 +115,7 @@ def _output(self, *args, **kwargs): def writeResultsToFile(self, results, file_name): if file_name: - with open(file_name, 'w') as f: + with open(file_name, 'w', encoding='utf-8') as f: if os.path.splitext(file_name)[1] == '.json': if isinstance(results, str): results = json.loads(results) @@ -137,9 +142,10 @@ def pre_operations(self): # Load the JSON file if args.source_profile: - rawdata = open(str(args.source_profile), 'rb').read() - result = chardet.detect(rawdata) - encoding = result['encoding'] + with open(str(args.source_profile), 'rb') as f: + data = f.read() + result = chardet.detect(data) + encoding = result['encoding'] if os.stat(str(args.source_profile)).st_size == 0: raise ValueError('Metadtata schema file is empty. Please provide a valid metadata schema file.') @@ -151,7 +157,8 @@ def pre_operations(self): # If any of the fields are None, get them from self.args if value is None: - logger.error('Please provide the schema to create the metadata schema through --schema option or through --file-name option via a file.') + logger.error('Please provide the schema to create the metadata schema' + 'through --schema option or through --file-name option via a file.') # Reassign the values to self.args self.ctx.args.schema = value @@ -175,9 +182,10 @@ def pre_operations(self): # Load the JSON file if args.source_profile: - rawdata = open(str(args.source_profile), 'rb').read() - result = chardet.detect(rawdata) - encoding = result['encoding'] + with open(str(args.source_profile), 'rb') as f: + rawdata = f.read() + result = chardet.detect(rawdata) + encoding = result['encoding'] if os.stat(str(args.source_profile)).st_size == 0: raise ValueError('Metadtata schema file is empty. Please provide a valid metadata schema file.') @@ -189,7 +197,8 @@ def pre_operations(self): # If any of the fields are None, get them from self.args if value is None: - logger.error('Please provide the schema to update the metadata schema through --schema option or through --file-name option via a file.') + logger.error('Please provide the schema to update the metadata schema ' + 'through --schema option or through --file-name option via a file.') # Reassign the values to self.args self.ctx.args.schema = value @@ -219,7 +228,7 @@ def _output(self, *args, **kwargs): if response_format == 'link': print('Fetching metadata from:', exportedResults) - getReponse = requests.get(exportedResults) + getReponse = requests.get(exportedResults, timeout=10) if getReponse.status_code == 200: exportedResults = getReponse.content.decode() else: @@ -229,7 +238,7 @@ def _output(self, *args, **kwargs): try: self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) print('Results exported to', arguments.source_profile) - except Exception as e: + except Exception as e: # pylint: disable=broad-except logger.error('Error while writing the results to the file. Error: %s', e) else: logger.error('Please provide the --file-name to exports the results to.') @@ -238,7 +247,7 @@ def _output(self, *args, **kwargs): def writeResultsToFile(self, results, file_name): if file_name: - with open(file_name, 'w') as f: + with open(file_name, 'w', encoding='utf-8') as f: if os.path.splitext(file_name)[1] == '.json': if isinstance(results, str): results = json.loads(results) @@ -253,10 +262,10 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n if api_location: #TODO Future Confirm its a file and not link - - rawdata = open(str(api_location), 'rb').read() - result = chardet.detect(rawdata) - encoding = result['encoding'] + with open(str(api_location), 'rb') as f: + rawdata = f.read() + result = chardet.detect(rawdata) + encoding = result['encoding'] # TODO - read other file types later with open(str(api_location), 'r', encoding=encoding) as f: @@ -304,11 +313,11 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n contacts = None # Create API - Get the license details from info in spec - license = info.get('license') - if license: - extracted_api_license_identifier = license.get('identifier') - extracted_api_license_name = license.get('name') - extracted_api_license_url = license.get('url') + licenseDetails = info.get('license') + if licenseDetails: + extracted_api_license_identifier = licenseDetails.get('identifier') + extracted_api_license_name = licenseDetails.get('name') + extracted_api_license_url = licenseDetails.get('url') extracted_api_license = {'identifier': extracted_api_license_identifier, 'name': extracted_api_license_name, 'url': extracted_api_license_url} else: extracted_api_license = None @@ -334,7 +343,6 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n #TODO: Create API - custom-properties # - "The custom metadata defined for API catalog entities. #1 - # Create API ------------------------------------------------------------------------------------- from .aaz.latest.apic.api import Create as CreateAPI @@ -356,10 +364,9 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n CreateAPI(cli_ctx=cmd.cli_ctx)(command_args=api_args) print("API was created successfully") - # Create API Version ----------------------------------------------------------------------------- from .aaz.latest.apic.api.version import Create as CreateAPIVersion - + api_version_args = { 'api_name': extracted_api_name, 'resource_group': resource_group, @@ -373,7 +380,6 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n CreateAPIVersion(cli_ctx=cmd.cli_ctx)(command_args=api_version_args) print("API version was created successfully") - # Create API Definition ----------------------------------------------------------------------------- from .aaz.latest.apic.api.definition import Create as CreateAPIDefinition @@ -391,7 +397,6 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n CreateAPIDefinition(cli_ctx=cmd.cli_ctx)(command_args=api_definition_args) print("API definition was created successfully") - # Import Specification ----------------------------------------------------------------------------- from azure.cli.core.commands import LongRunningOperation @@ -414,7 +419,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n } importAPISpecificationResults = ImportSpecificationExtension(cli_ctx=cmd.cli_ctx)(command_args=api_specification_args) - importAPISpecificationResults_Polled = LongRunningOperation(cmd.cli_ctx)(importAPISpecificationResults) + LongRunningOperation(cmd.cli_ctx)(importAPISpecificationResults) print("API specification was imported successfully") # Create API Deployment ----------------------------------------------------------------------------- @@ -424,7 +429,6 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n environment_id = None if environment_name: # GET Environment ID - environment_args = { 'resource_group': resource_group, 'service_name': service_name, From adba54c7cd061fec62af2f580f31797cfe90db90 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Sun, 26 Nov 2023 22:17:13 -0600 Subject: [PATCH 16/27] remove default from update --- .../azext_apic_extension/aaz/latest/apic/api/_update.py | 1 - .../aaz/latest/apic/api/definition/_update.py | 1 - .../aaz/latest/apic/api/deployment/_update.py | 1 - .../azext_apic_extension/aaz/latest/apic/api/version/_update.py | 1 - .../azext_apic_extension/aaz/latest/apic/environment/_update.py | 1 - 5 files changed, 5 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_update.py index ceed393a2b4..bec77541160 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_update.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/_update.py @@ -74,7 +74,6 @@ def _build_arguments_schema(cls, *args, **kwargs): help="The name of the workspace.", required=True, id_part="child_name_1", - default="default", fmt=AAZStrArgFormat( max_length=90, min_length=1, diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_update.py index 5c7eb09440b..f56031b5794 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_update.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/definition/_update.py @@ -94,7 +94,6 @@ def _build_arguments_schema(cls, *args, **kwargs): help="The name of the workspace.", required=True, id_part="child_name_1", - default="default", fmt=AAZStrArgFormat( max_length=90, min_length=1, diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_update.py index 0a129bf05be..5d7975177c9 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_update.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/deployment/_update.py @@ -84,7 +84,6 @@ def _build_arguments_schema(cls, *args, **kwargs): help="The name of the workspace.", required=True, id_part="child_name_1", - default="default", fmt=AAZStrArgFormat( max_length=90, min_length=1, diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_update.py index b9cce88e3ca..9af4e2602cd 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_update.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/api/version/_update.py @@ -84,7 +84,6 @@ def _build_arguments_schema(cls, *args, **kwargs): help="The name of the workspace.", required=True, id_part="child_name_1", - default="default", fmt=AAZStrArgFormat( max_length=90, min_length=1, diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_update.py index a03722c27d2..f10e33f301e 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_update.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/environment/_update.py @@ -74,7 +74,6 @@ def _build_arguments_schema(cls, *args, **kwargs): help="The name of the workspace.", required=True, id_part="child_name_1", - default="default", fmt=AAZStrArgFormat( max_length=90, min_length=1, From 3e684eceb074c5ba0a76377956a5dfeaec9f00af Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 27 Nov 2023 18:42:36 -0600 Subject: [PATCH 17/27] style flake corrections --- .../azext_apic_extension/_params.py | 3 +- .../azext_apic_extension/custom.py | 52 +++++++++++-------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/_params.py b/src/apic-extension/azext_apic_extension/_params.py index 28eea16d61a..fc9e0657f2b 100644 --- a/src/apic-extension/azext_apic_extension/_params.py +++ b/src/apic-extension/azext_apic_extension/_params.py @@ -35,5 +35,4 @@ def load_arguments(self, _): # pylint: disable=unused-argument options_list=['--environment-name', '-e'], help="Environemnt name", required=False, - ) - \ No newline at end of file + ) \ No newline at end of file diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index deb0e8f42de..2f727569ab1 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -27,6 +27,7 @@ class ImportSpecificationExtension(ImportSpecification): + @classmethod def _build_arguments_schema(cls, *args, **kwargs): args_schema = super()._build_arguments_schema(*args, **kwargs) @@ -70,6 +71,7 @@ def pre_operations(self): logger.error('The size of "value" is greater than 3 MB. ' 'Please use --format "url" to import the specification from a URL for size greater than 3 mb.') + class ExportSpecificationExtension(ExportSpecification): @classmethod @@ -106,7 +108,7 @@ def _output(self, *args, **kwargs): try: self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) print('Results exported to', arguments.source_profile) - except Exception as e: # pylint: disable=broad-except + except Exception as e: # pylint: disable=broad-except logger.error('Error while writing the results to the file. Error: %s', e) else: logger.error('Please provide the --file-name to exports the results to.') @@ -123,6 +125,7 @@ def writeResultsToFile(self, results, file_name): else: f.write(results) + class CreateMetadataSchemaExtension(Create): @classmethod def _build_arguments_schema(cls, *args, **kwargs): @@ -163,6 +166,7 @@ def pre_operations(self): # Reassign the values to self.args self.ctx.args.schema = value + class UpdateMetadataSchemaExtension(Update): @classmethod def _build_arguments_schema(cls, *args, **kwargs): @@ -203,6 +207,7 @@ def pre_operations(self): # Reassign the values to self.args self.ctx.args.schema = value + class ExportMetadataSchemaExtension(ExportMetadataSchema): @classmethod @@ -238,7 +243,7 @@ def _output(self, *args, **kwargs): try: self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) print('Results exported to', arguments.source_profile) - except Exception as e: # pylint: disable=broad-except + except Exception as e: # pylint: disable=broad-except logger.error('Error while writing the results to the file. Error: %s', e) else: logger.error('Please provide the --file-name to exports the results to.') @@ -255,13 +260,14 @@ def writeResultsToFile(self, results, file_name): else: f.write(results) + # Quick Import def register_apic(cmd, api_location, resource_group, service_name, environment_name=None): # Load the JSON file if api_location: - #TODO Future Confirm its a file and not link + # TODO Future Confirm its a file and not link with open(str(api_location), 'rb') as f: rawdata = f.read() result = chardet.detect(rawdata) @@ -288,7 +294,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n extracted_definition_name = 'default' extracted_definition_version = 'v1' extracted_api_kind = 'rest' - #TODO how to determine other kinds - enum={"graphql": "graphql", "grpc": "grpc", "rest": "rest", "soap": "soap", "webhook": "webhook", "websocket": "websocket"} + # TODO how to determine other kinds - enum={"graphql": "graphql", "grpc": "grpc", "rest": "rest", "soap": "soap", "webhook": "webhook", "websocket": "websocket"} # Create API and Create API Version info = data['info'] @@ -300,7 +306,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n extracted_api_title = info.get('title', 'API Title').replace(" ", "-").lower() extracted_api_version = info.get('version', 'v1').replace(".", "-").lower() extracted_api_version_title = info.get('version', 'v1').replace(".", "-").lower() - #TODO -Create API Version lifecycle_stage + # TODO -Create API Version lifecycle_stage # Create API - Get the contact details from info in spec contact = info.get('contact') @@ -340,8 +346,8 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n else: extracted_api_external_documentation = None - #TODO: Create API - custom-properties - # - "The custom metadata defined for API catalog entities. #1 + # TODO: Create API - custom-properties + # "The custom metadata defined for API catalog entities. #1 # Create API ------------------------------------------------------------------------------------- from .aaz.latest.apic.api import Create as CreateAPI @@ -351,7 +357,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n 'resource_group': resource_group, 'service_name': service_name, 'workspace_name': 'default', - 'title' : extracted_api_title, + 'title': extracted_api_title, 'summary': extracted_api_summary, 'kind': extracted_api_kind, 'contacts': contacts, @@ -359,7 +365,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n 'terms_of_service': extracted_api_terms_of_service, 'external_documentation': extracted_api_external_documentation, 'description': extracted_api_description, - } + } CreateAPI(cli_ctx=cmd.cli_ctx)(command_args=api_args) print("API was created successfully") @@ -373,8 +379,8 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n 'service_name': service_name, 'version_name': extracted_api_version, 'workspace_name': 'default', - 'lifecycle_stage': 'design', #TODO: Extract from spec or not pass. was it required? - 'title' : extracted_api_version_title + 'lifecycle_stage': 'design', # TODO: Extract from spec or not pass. was it required? + 'title': extracted_api_version_title } CreateAPIVersion(cli_ctx=cmd.cli_ctx)(command_args=api_version_args) @@ -390,8 +396,8 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n 'version_name': extracted_api_version, 'workspace_name': 'default', 'definition_name': extracted_definition_name, - 'title' : extracted_definition_name, #TODO Extract from spec - 'description' : extracted_api_description, #TODO Extract from spec + 'title': extracted_definition_name, # TODO Extract from spec + 'description': extracted_api_description, # TODO Extract from spec } CreateAPIDefinition(cli_ctx=cmd.cli_ctx)(command_args=api_definition_args) @@ -402,9 +408,9 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n # uses customized ImportSpecificationExtension class specification_details = {'name':extracted_definition_name,'version':extracted_definition_version} - #TODO format - Link - what if the link is just pasted in the value? - #TODO format - inline - what if spec is just pasted in the value? - #TODO - other non json spec formats + # TODO format - Link - what if the link is just pasted in the value? + # TODO format - inline - what if spec is just pasted in the value? + # TODO - other non json spec formats api_specification_args = { 'resource_group': resource_group, @@ -414,8 +420,8 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n 'version_name': extracted_api_version, 'definition_name': extracted_definition_name, 'format': 'inline', - 'specification': specification_details, #TODO write the correct spec object - 'source_profile' : api_location + 'specification': specification_details, # TODO write the correct spec object + 'source_profile': api_location } importAPISpecificationResults = ImportSpecificationExtension(cli_ctx=cmd.cli_ctx)(command_args=api_specification_args) @@ -461,13 +467,13 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n 'service_name': service_name, 'workspace_name': 'default', 'api_name': extracted_api_name, - 'deployment_name' : extracted_deployment_name, - 'description' : extracted_deployment_description, - 'title' : extracted_deployment_title, + 'deployment_name': extracted_deployment_name, + 'description': extracted_deployment_description, + 'title': extracted_deployment_title, 'definition_id': extracted_definition_id, 'environment_id': extracted_environment_id, - 'server' : extracted_server, - 'state' : extracted_state + 'server': extracted_server, + 'state': extracted_state # TODO custom properties } From 83fae12d5843ce382c03fe54472dc87b765df412 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 27 Nov 2023 18:49:54 -0600 Subject: [PATCH 18/27] remove default ws value from workspace update --- .../aaz/latest/apic/service/__init__.py | 1 - .../latest/apic/service/_import_from_apim.py | 186 ------------------ .../aaz/latest/apic/workspace/_update.py | 1 - 3 files changed, 188 deletions(-) delete mode 100644 src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_import_from_apim.py diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py index 7c7b1c75784..c401f439385 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/__init__.py @@ -11,7 +11,6 @@ from .__cmd_group import * from ._create import * from ._delete import * -from ._import_from_apim import * from ._list import * from ._show import * from ._update import * diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_import_from_apim.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_import_from_apim.py deleted file mode 100644 index 14fa49c2a63..00000000000 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/service/_import_from_apim.py +++ /dev/null @@ -1,186 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -# Code generated by aaz-dev-tools -# -------------------------------------------------------------------------------------------- - -# pylint: skip-file -# flake8: noqa - -from azure.cli.core.aaz import * - - -@register_command( - "apic service import-from-apim", -) -class ImportFromApim(AAZCommand): - """Imports from APIM instance. - """ - - _aaz_info = { - "version": "2024-03-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.apicenter/services/{}/importfromapim", "2024-03-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _args_schema = None - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - if cls._args_schema is not None: - return cls._args_schema - cls._args_schema = super()._build_arguments_schema(*args, **kwargs) - - # define Arg Group "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.service_name = AAZStrArg( - options=["--service-name"], - help="The name of Azure API Center service.", - required=True, - id_part="name", - fmt=AAZStrArgFormat( - max_length=90, - min_length=1, - ), - ) - - # define Arg Group "Payload" - - _args_schema = cls._args_schema - _args_schema.source_resource_ids = AAZListArg( - options=["--source-resource-ids"], - arg_group="Payload", - ) - - source_resource_ids = cls._args_schema.source_resource_ids - source_resource_ids.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.ImportFromAPIM(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class ImportFromAPIM(AAZHttpOperation): - CLIENT_TYPE = "MgmtClient" - - def __call__(self, *args, **kwargs): - request = self.make_request() - session = self.client.send_request(request=request, stream=False, **kwargs) - if session.http_response.status_code in [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/importFromApim", - **self.url_parameters - ) - - @property - def method(self): - return "POST" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "serviceName", self.ctx.args.service_name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2024-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Content-Type", "application/json", - ), - } - return parameters - - @property - def content(self): - _content_value, _builder = self.new_content_builder( - self.ctx.args, - typ=AAZObjectType, - typ_kwargs={"flags": {"required": True, "client_flatten": True}} - ) - _builder.set_prop("sourceResourceIds", AAZListType, ".source_resource_ids") - - source_resource_ids = _builder.get(".sourceResourceIds") - if source_resource_ids is not None: - source_resource_ids.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200(self, session): - pass - - -class _ImportFromApimHelper: - """Helper class for ImportFromApim""" - - -__all__ = ["ImportFromApim"] diff --git a/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_update.py b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_update.py index 5604e2364e3..89affd800c9 100644 --- a/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_update.py +++ b/src/apic-extension/azext_apic_extension/aaz/latest/apic/workspace/_update.py @@ -64,7 +64,6 @@ def _build_arguments_schema(cls, *args, **kwargs): help="The name of the workspace.", required=True, id_part="child_name_1", - default="default", fmt=AAZStrArgFormat( max_length=90, min_length=1, From 0f77828c4999253a8de34a9a17e3c5ea13a949d1 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 27 Nov 2023 19:09:11 -0600 Subject: [PATCH 19/27] Added help for api register command --- .../azext_apic_extension/_help.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/apic-extension/azext_apic_extension/_help.py b/src/apic-extension/azext_apic_extension/_help.py index 126d5d00714..0c119c564c5 100644 --- a/src/apic-extension/azext_apic_extension/_help.py +++ b/src/apic-extension/azext_apic_extension/_help.py @@ -9,3 +9,25 @@ # pylint: disable=too-many-lines from knack.help_files import helps # pylint: disable=unused-import + +helps['apic api register'] = """ + type: command + short-summary: Single Command for registering api, api version, api definition, import spec, create deployment provided a spec file. + parameters: + - name: --api-location -l + type: string + short-summary: Location of spec file . + - name: --resource-group -g + type: string + short-summary: Resource group name. + - name: --service -s + type: string + short-summary: APICenter Catalog or Service name. + - name: --environment-name -e + type: string + short-summary: Name of environment created before. + examples: + - name: Register api by providing spec file. + text: | + az apic api register -g api-center-test -s contosoeuap --api-location "examples/cli-examples/spec-examples/openai.json" --environment-name public +""" \ No newline at end of file From 22e8b3f6b354f65d4b2ba4522d90832c51019f4b Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 27 Nov 2023 19:26:19 -0600 Subject: [PATCH 20/27] Add APIC Seevice name in global fille --- src/service_name.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/service_name.json b/src/service_name.json index 0ef9770fb6a..492b87269fd 100644 --- a/src/service_name.json +++ b/src/service_name.json @@ -39,6 +39,11 @@ "AzureServiceName": "Azure Operator Service Manager", "URL": "https://learn.microsoft.com/azure/operator-service-manager" }, + { + "Command": "az apic", + "AzureServiceName": "ApiCenter Services", + "URL": "https://learn.microsoft.com/en-us/azure/api-center" + }, { "Command": "az appservice", "AzureServiceName": "App Services", From a1c1e99983da6820f5d68462428a3509d2dc32ff Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 27 Nov 2023 23:01:19 -0600 Subject: [PATCH 21/27] fx flake style error --- src/apic-extension/azext_apic_extension/_params.py | 4 ++-- src/apic-extension/azext_apic_extension/commands.py | 1 + src/apic-extension/azext_apic_extension/custom.py | 11 +++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/_params.py b/src/apic-extension/azext_apic_extension/_params.py index fc9e0657f2b..3ac94ef8195 100644 --- a/src/apic-extension/azext_apic_extension/_params.py +++ b/src/apic-extension/azext_apic_extension/_params.py @@ -34,5 +34,5 @@ def load_arguments(self, _): # pylint: disable=unused-argument "environment_name", options_list=['--environment-name', '-e'], help="Environemnt name", - required=False, - ) \ No newline at end of file + required=False + ) diff --git a/src/apic-extension/azext_apic_extension/commands.py b/src/apic-extension/azext_apic_extension/commands.py index 10f131c96d3..c4ea801b8de 100644 --- a/src/apic-extension/azext_apic_extension/commands.py +++ b/src/apic-extension/azext_apic_extension/commands.py @@ -15,6 +15,7 @@ from .custom import CreateMetadataSchemaExtension from .custom import UpdateMetadataSchemaExtension + def load_command_table(self, _): # pylint: disable=unused-argument with self.command_group('apic api definition') as g: self.command_table['apic api definition import-specification'] = ImportSpecificationExtension(loader=self) diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index 2f727569ab1..575fb4191d4 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -25,9 +25,8 @@ logger = get_logger(__name__) -class ImportSpecificationExtension(ImportSpecification): - +class ImportSpecificationExtension(ImportSpecification): @classmethod def _build_arguments_schema(cls, *args, **kwargs): args_schema = super()._build_arguments_schema(*args, **kwargs) @@ -289,7 +288,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n if first_key in ['swagger', 'openapi']: extracted_definition_name = 'openapi' extracted_definition_version = first_value.replace(".", "-").lower() - extracted_api_kind = 'rest' #TODO + extracted_api_kind = 'rest' # TODO determine kind from spec else: extracted_definition_name = 'default' extracted_definition_version = 'v1' @@ -407,7 +406,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n from azure.cli.core.commands import LongRunningOperation # uses customized ImportSpecificationExtension class - specification_details = {'name':extracted_definition_name,'version':extracted_definition_version} + specification_details = {'name': extracted_definition_name, 'version': extracted_definition_version} # TODO format - Link - what if the link is just pasted in the value? # TODO format - inline - what if spec is just pasted in the value? # TODO - other non json spec formats @@ -420,7 +419,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n 'version_name': extracted_api_version, 'definition_name': extracted_definition_name, 'format': 'inline', - 'specification': specification_details, # TODO write the correct spec object + 'specification': specification_details, # TODO write the correct spec object 'source_profile': api_location } @@ -453,7 +452,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n extracted_deployment_name = server.get('name', default_deployment_title).replace(" ", "-") extracted_deployment_title = server.get('title', default_deployment_title).replace(" ", "-") extracted_deployment_description = server.get('description', default_deployment_title) - extracted_definition_id = '/workspaces/default/apis/'+ extracted_api_name +'/versions/'+ extracted_api_version +'/definitions/'+ extracted_definition_name + extracted_definition_id = '/workspaces/default/apis/' + extracted_api_name + '/versions/' + extracted_api_version + '/definitions/' + extracted_definition_name extracted_environment_id = '/workspaces/default/environments/' + environment_name extracted_state = server.get('state', 'active') From 5e13cd3f1f909892e0fd74847b36e63d4fd8434b Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 27 Nov 2023 23:33:52 -0600 Subject: [PATCH 22/27] add readme for extension --- src/apic-extension/README.md | 289 ++++++++++++++++++++++++++++++++++- 1 file changed, 285 insertions(+), 4 deletions(-) diff --git a/src/apic-extension/README.md b/src/apic-extension/README.md index 161a557951d..7dcf7e0f413 100644 --- a/src/apic-extension/README.md +++ b/src/apic-extension/README.md @@ -1,5 +1,286 @@ -# Azure CLI ApicExtension Extension # -This is an extension to Azure CLI to manage ApicExtension resources. +# Azure CLI alertsmanagement Extension -## How to use ## -Please add commands usage here. \ No newline at end of file +This extension can help create and manage APICenter Resources + +### How to use +Install this extension using the below CLI command +``` +az extension add --name apic-extension +``` + +### Alert Processing Rule +APICenter documentation: https://learn.microsoft.com/en-us/azure/api-center/ + +List Service Examples +``` +az apic service show --resource-group api-center-test +``` +``` +az apic service show -g api-center-test +``` + +Show service Examples +``` +az apic service show --resource-group api-center-test --service-name contosoeuap +``` +``` +az apic service show -g api-center-test -s contosoeuap +``` + +Delete Service Examples +``` +az apic service delete --resource-group api-center-test --service-name contosoeuap +``` +``` +az apic service delete --resource-group arpi-test-rg1 -s apictestcli3 +``` + +Show Workspace Example +``` +Az apic workspace show -g api-center-test -s contosoeuap --name devdiv +``` + +Create API Examples +``` +az apic api create -g api-center-test -s contosoeuap --name echo-api --title "Echo API" --kind "rest" +``` +``` +az apic api create --resource-group api-center-test --service-name contosoeuap --api-name echo-api2 --description "CLI Test" --kind rest --title "Echo API" +``` + +Update API Examples +``` +az apic api update -g api-center-test -s contosoeuap --name echo-api --summary "Basic REST API service" -w default +``` +``` +az apic api update --resource-group api-center-test -s contosoeuap --name echo-api --summary "Basic REST API service" --workspace-name default +``` + +LIST Api Example +``` +az apic api list --resource-group api-center-test --service-name contosoeuap +``` +``` +az apic api list -g api-center-test -s contosoeuap +``` + +SHOW Api Examples +``` +az apic api show -g api-center-test -s contosoeuap --name echo-api +``` +``` +az apic api show --resource-group api-center-test --service-name contosoeuap -w default --api echo-api +``` + +Delete API Examples +``` +az apic api delete -g api-center-test -s contosoeuap --name echo-api +``` +``` +az apic api delete --resource-group contoso-resources --service-name contosoeuap --name echo-api +``` + +CREATE Api Version Examples +``` +az apic api version create -g api-center-test -s contosoeuap --api-name echo-api --name 2023-01-01 --title "2023-01-01" +``` +``` +az apic api version create --resource-group api-center-test --service-name contosoeuap --api-name echo-api --name 2023-01-01 --title "2023-01-01" +``` + +UPDATE Api Version Examples +``` +Az apic api version update -g api-center-test -s contosoeuap --api-name echo-api --name 2023-01-01 --title "2023-01-01" -w default +``` +``` +az apic api version update --resource-group api-center-test --service-name contosoeuap --api-name echo-api --name 2023-01-01 --title "2023-01-01" --workspace-name default +``` + +LIST Api Version Examples +``` +az apic api version list -g api-center-test -s contosoeuap --api-name echo-api +``` +``` +az apic api version list --resource-group api-center-test --service-name contosoeuap --api-name echo-api +``` + +SHOW Api Version Example +``` +az apic api version show -g api-center-test -s contosoeuap --api-name echo-api --name 2023-01-01 +``` +``` +az apic api version show --resource-group api-center-test --service-name contosoeuap --api-name echo-api --name 2023-01-01 +``` + +DELETE Api Version Example +``` +az apic api version delete -g api-center-test -s contosoeuap --api-name echo-api --name 2023-01-01 +``` +``` +az apic api version delete --resource-group api-center-test --service-name contosoeuap --api-name echo-api --name 2023-01-01 +``` + +CREATE API Definition Example +``` +az apic api definition create -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi" --title "OpenAPI" +``` + +UPDATE API Definition Example +``` +az apic api definition update -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi" --title "OpenAPI" -w default +``` + +SHOW API Definition Example +``` +az apic api definition show -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi" +``` + +LIST API Definition Example +``` +az apic api definition list -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 +``` + +DELETE API Definition Example +``` +az apic api definition delete -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi" +``` + +IMPORT Specification Examples +Import Specification inline option +``` +az apic api definition import-specification -g api-center-test -s contosoeuap --api-name echo-api --version-name 2023-01-01 --definition-name openapi--format "inline" --value '{"openapi":"3.0.1","info":{"title":"httpbin.org","description":"API Management facade for a very handy and free online HTTP tool.","version":"1.0"}}' --specification '{"name":"openapi","version":"3.0.0"}' +``` + +Import Specification Inline option where spec is provided by sending a file +``` +az apic api definition import-specification -g api-center-test -s contosoeuap --api-name echo-api --version-name 2023-01-01 --definition-name openapi --format inline --specification '{"name":"openapi","version":"3.0.0"}' --file-name C:\Users\arpishah\examples\cli-examples\spec-examples\cat-facts-api.json +``` + +Import Specification Link option where spec is provided via a link +``` +az apic api definition import-specification -g api-center-test -s contosoeuap - --api-name echo-api --version-name 2023-01-01 --definition-name openapi --format "link" --value https://alzaslonaztest.blob.core.windows.net/arpitestblobs/cat-facts-api.json --specification '{"name":"openapi","version":"3.0.0"}' +``` + +Export Specification Examples +Export Spec to a file +``` +az apic api definition export-specification -g api-center-test -s contosoeuap --api-name echo-api-10 --version-name 2023-11-08 --definition-name arpitest4 --file-name C:\Users\arpishah\examples\cli-examples\exported-results\exported-spec-inline.json +``` + +CREATE Api Deployment + +``` +az apic api deployment create -g api-center-test -s contosoeuap --name production --title "Production deployment" --description "Public cloud production deployment." --api echo-api --server C:/Users/arpishah/examples/cli-examples/payload-examples/deplcreate.json --environment-id "/workspaces/default/environments/production" --definition-id "/workspaces/default/apis/echo-api/versions/2023-01-01/definitions/openapi" +where examples/deplcreate.json contains +{"runtime-uri": ["https://api.contoso.com"]} +``` + +UPDATE Api Deployment +``` +az apic api deployment update -g api-center-test -s contosoeuap --name production --title "Production deployment 10" --api echo-api –w default +``` + +LIST Api Deployment +``` +az apic api deployment list -g api-center-test -s contosoeuap --api-name echo-api +``` + +SHOW Api Deployment +``` +az apic api deployment show -g api-center-test -s contosoeuap --name production --api-name echo-api +``` + +DELETE Api Deployment +``` +Az apic api deployment delete -g api-center-test -s contosoeuap --name production --api-name echo-api +``` + +CREATE Environment +``` +az apic environment create -g api-center-test -s contosoeuap --name public-3 --title "Public cloud" --kind "development" --server "C:\Users\arpishah\examples\cli-examples\payload-examples\envcreate1.json" +Where envcreate1.json contains +{ + "type": "Azure API Management", + "managementPortalUri": [ + "management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service" + ] +} +``` + +UPDATE Environment +``` +az apic environment update -g api-center-test -s contosoeuap --name public --title "Public cloud" -w default +``` + +LIST Environment +``` +az apic environment list -g api-center-test -s contosoeuap +``` + +SHOW Environment +``` +az apic environment show -g api-center-test -s contosoeuap --name public +``` + +DELETE Environment +``` +az apic environment delete -g api-center-test -s contosoeuap --name public +``` + +CREATE Metadata Schema +``` +az apic metadata-schema create --resource-group api-center-test --service-name contosoeuap --name "test1" --file-name "C:\Users\arpishah\examples\cli-examples\payload-examples\schemacreate.json" +Where schemacreate.json contains metadata schema +{ + "type": "string", + "title": "First name", + "pattern": "^[a-zA-Z0-9 ]+$" +} +``` + +UPDATE Metadata Schema +``` +az apic metadata-schema update --resource-group api-center-test --service-name contosoeuap --name "test1" --file-name "C:\Users\arpishah\examples\cli-examples\payload-examples\schemaupdate.json" +Where schemaupdate.json contains metadata schema +{ + "type": "string", + "title": "Last name", + "pattern": "^[a-zA-Z0-9 ]+$" +} +``` + +LIST Metadata Schema +``` +az apic metadata-schema list -g api-center-test -s contosoeuap +``` + +SHOW Metadata Schema +``` +az apic metadata-schema show --resource-group api-center-test --service-name contosoeuap --name "test1" +``` + +DELETE Metadata Schema +``` +az apic metadata-schema delete --resource-group api-center-test --service-name contosoeuap --name "test1" +``` + +EXPORT Metadata Schema +EXPORT Metadata Schema assigned to an API +``` +az apic metadata-schema export-metadata-schema -g api-center-test -s contosoeuap --assigned-to api --file-name C:\Users\arpishah\examples\cli-examples\exported-results\exported-schema-3.json +``` + +EXPORT Metadata Schema assigned to a Deployment +``` +az apic metadata-schema export-metadata-schema -g api-center-test -s contosoeuap --assigned-to deployment --file-name C:\Users\arpishah\examples\cli-examples\exported-results\exported-schema-5.json +``` + +EXPORT Metadata Schema assigned to an Environment +``` +az apic metadata-schema export-metadata-schema -g api-center-test -s contosoeuap --assigned-to environment --file-name C:\Users\arpishah\examples\cli-examples\exported-results\exported-schema-6.json +``` + +Register API or Quick Add +``` +az apic api register -g api-center-test -s contosoeuap --api-location "C:/Users/arpishah/examples/cli-examples/spec-examples/openai.json" --environment-name public +``` \ No newline at end of file From e6af95fab9e28f4f87905b3d7676dfb3352843f4 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 27 Nov 2023 23:37:46 -0600 Subject: [PATCH 23/27] update title of readme --- src/apic-extension/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apic-extension/README.md b/src/apic-extension/README.md index 7dcf7e0f413..ff1185bf41a 100644 --- a/src/apic-extension/README.md +++ b/src/apic-extension/README.md @@ -1,4 +1,4 @@ -# Azure CLI alertsmanagement Extension +# Azure CLI aPICenter Extension This extension can help create and manage APICenter Resources @@ -8,7 +8,7 @@ Install this extension using the below CLI command az extension add --name apic-extension ``` -### Alert Processing Rule +### API Center Extension Info APICenter documentation: https://learn.microsoft.com/en-us/azure/api-center/ List Service Examples From acec15565dab10c153b99c4e47f812624eab0e0a Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Mon, 27 Nov 2023 23:45:24 -0600 Subject: [PATCH 24/27] one more linter error --- src/apic-extension/azext_apic_extension/_help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apic-extension/azext_apic_extension/_help.py b/src/apic-extension/azext_apic_extension/_help.py index 0c119c564c5..b6bd068b769 100644 --- a/src/apic-extension/azext_apic_extension/_help.py +++ b/src/apic-extension/azext_apic_extension/_help.py @@ -30,4 +30,4 @@ - name: Register api by providing spec file. text: | az apic api register -g api-center-test -s contosoeuap --api-location "examples/cli-examples/spec-examples/openai.json" --environment-name public -""" \ No newline at end of file +""" From ca2baa3a39c537a5f26a38ac16fc066fd7aac16e Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Tue, 28 Nov 2023 18:39:19 -0600 Subject: [PATCH 25/27] updated log line and tests --- src/apic-extension/README.md | 2 +- .../azext_apic_extension/custom.py | 2 +- .../recordings/test_apic_scenarios.yaml | 351 +++++++++--------- .../tests/latest/test_apic_extension.py | 8 +- 4 files changed, 172 insertions(+), 191 deletions(-) diff --git a/src/apic-extension/README.md b/src/apic-extension/README.md index ff1185bf41a..a3c17e2279e 100644 --- a/src/apic-extension/README.md +++ b/src/apic-extension/README.md @@ -1,4 +1,4 @@ -# Azure CLI aPICenter Extension +# Azure CLI APICenter Extension This extension can help create and manage APICenter Resources diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index 575fb4191d4..39b6513d9da 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -106,7 +106,7 @@ def _output(self, *args, **kwargs): if arguments.source_profile: try: self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) - print('Results exported to', arguments.source_profile) + logger.info('Results exported to %s', arguments.source_profile) except Exception as e: # pylint: disable=broad-except logger.error('Error while writing the results to the file. Error: %s', e) else: diff --git a/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml b/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml index a49cf2a7335..29c2eda87bd 100644 --- a/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml +++ b/src/apic-extension/azext_apic_extension/tests/latest/recordings/test_apic_scenarios.yaml @@ -24,7 +24,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-24T04:36:43.7848756Z"},"properties":{"title":"Public + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-29T00:37:19.1988805Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service-0"]},"customProperties":{}}}' headers: api-supported-versions: @@ -36,9 +36,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:43 GMT + - Wed, 29 Nov 2023 00:37:18 GMT etag: - - 05002e6e-0000-3300-0000-6560285b0000 + - 0800317f-0000-3300-0000-656687bf0000 expires: - '-1' pragma: @@ -54,7 +54,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' x-powered-by: - ASP.NET status: @@ -72,14 +72,14 @@ interactions: Connection: - keep-alive ParameterSetName: - - -g -s --name --title --kind --server + - -g -s --name --title --kind --server -w User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-24T04:36:43.7848756Z"},"properties":{"title":"Public + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-29T00:37:19.1988805Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service-0"]},"customProperties":{}}}' headers: api-supported-versions: @@ -91,9 +91,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:43 GMT + - Wed, 29 Nov 2023 00:37:19 GMT etag: - - 05002e6e-0000-3300-0000-6560285b0000 + - 0800317f-0000-3300-0000-656687bf0000 expires: - '-1' pragma: @@ -131,14 +131,14 @@ interactions: Content-Type: - application/json ParameterSetName: - - -g -s --name --title --kind --server + - -g -s --name --title --kind --server -w User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-24T04:36:44.6605067Z"},"properties":{"title":"Public + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-29T00:37:20.325193Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}' headers: api-supported-versions: @@ -146,13 +146,13 @@ interactions: cache-control: - no-cache content-length: - - '692' + - '691' content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:43 GMT + - Wed, 29 Nov 2023 00:37:19 GMT etag: - - 05002f6e-0000-3300-0000-6560285c0000 + - 0800337f-0000-3300-0000-656687c00000 expires: - '-1' pragma: @@ -193,7 +193,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-24T04:36:44.6605067Z"},"properties":{"title":"Public + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-29T00:37:20.325193Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}' headers: api-supported-versions: @@ -201,13 +201,13 @@ interactions: cache-control: - no-cache content-length: - - '692' + - '691' content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:44 GMT + - Wed, 29 Nov 2023 00:37:20 GMT etag: - - 05002f6e-0000-3300-0000-6560285c0000 + - 0800337f-0000-3300-0000-656687c00000 expires: - '-1' pragma: @@ -267,14 +267,13 @@ interactions: Azure API Management service for the European division of Contoso.","server":{"type":"Azure API Management","managementPortalUri":["https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"onboarding":{"instructions":"Sign in or sign up in the specified developer portal to request API access. You - must complete the internal privacy training for your account to be approved.","developerPortalUri":["https://developer.contoso.com"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/public","name":"public","systemData":{"createdAt":"2023-11-14T21:49:10.918597Z","lastModifiedAt":"2023-11-22T15:49:31.2162878Z"},"properties":{"title":"Public - cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/apim-ignite23","name":"apim-ignite23","systemData":{"createdAt":"2023-11-15T18:21:12.5751434Z","lastModifiedAt":"2023-11-15T18:21:12.5751436Z"},"properties":{"title":"Ignite + must complete the internal privacy training for your account to be approved.","developerPortalUri":["https://developer.contoso.com"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/apim-ignite23","name":"apim-ignite23","systemData":{"createdAt":"2023-11-15T18:21:12.5751434Z","lastModifiedAt":"2023-11-15T18:21:12.5751436Z"},"properties":{"title":"Ignite 2023 Azure API Management","kind":"production","description":"The primary Azure API Management service for European division of Contoso","server":{"type":"azure-api-management","managementPortalUri":["https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service"]},"onboarding":{"instructions":"Sign in or sign up","developerPortalUri":["https://developer.abcd.com"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/public-2","name":"public-2","systemData":{"createdAt":"2023-11-20T20:46:43.0550419Z","lastModifiedAt":"2023-11-20T20:46:43.0550789Z"},"properties":{"title":"Public - cloud","kind":"development","customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/public-3","name":"public-3","systemData":{"createdAt":"2023-11-20T20:52:17.473183Z","lastModifiedAt":"2023-11-23T22:09:43.7311785Z"},"properties":{"title":"Public + cloud","kind":"development","customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/public-3","name":"public-3","systemData":{"createdAt":"2023-11-20T20:52:17.473183Z","lastModifiedAt":"2023-11-28T04:46:03.372605Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/testpublic","name":"testpublic","systemData":{"createdAt":"2023-11-22T15:50:59.2415397Z","lastModifiedAt":"2023-11-22T16:50:42.7816893Z"},"properties":{"title":"Public - cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-24T04:36:44.6605067Z"},"properties":{"title":"Public + cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}},{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-29T00:37:20.325193Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}]}' headers: api-supported-versions: @@ -282,11 +281,11 @@ interactions: cache-control: - no-cache content-length: - - '8805' + - '8128' content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:45 GMT + - Wed, 29 Nov 2023 00:37:21 GMT expires: - '-1' pragma: @@ -330,7 +329,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106","name":"cli-test-api-106","systemData":{"createdAt":"2023-11-24T04:36:46.6151158Z","lastModifiedAt":"2023-11-24T04:36:46.6151159Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106","name":"cli-test-api-106","systemData":{"createdAt":"2023-11-29T00:37:22.3456411Z","lastModifiedAt":"2023-11-29T00:37:22.3456422Z"},"properties":{"title":"CLI Test API 106","description":"CLI Test API 106","kind":"rest","lifecycleStage":"design","externalDocumentation":[],"contacts":[],"customProperties":{}}}' headers: api-supported-versions: @@ -342,9 +341,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:46 GMT + - Wed, 29 Nov 2023 00:37:22 GMT etag: - - 4a005e91-0000-3300-0000-6560285e0000 + - 6e003e49-0000-3300-0000-656687c20000 expires: - '-1' pragma: @@ -360,7 +359,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' x-powered-by: - ASP.NET status: @@ -385,7 +384,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106","name":"cli-test-api-106","systemData":{"createdAt":"2023-11-24T04:36:46.6151158Z","lastModifiedAt":"2023-11-24T04:36:46.6151159Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106","name":"cli-test-api-106","systemData":{"createdAt":"2023-11-29T00:37:22.3456411Z","lastModifiedAt":"2023-11-29T00:37:22.3456422Z"},"properties":{"title":"CLI Test API 106","description":"CLI Test API 106","kind":"rest","lifecycleStage":"design","externalDocumentation":[],"contacts":[],"customProperties":{}}}' headers: api-supported-versions: @@ -397,9 +396,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:46 GMT + - Wed, 29 Nov 2023 00:37:22 GMT etag: - - 4a005e91-0000-3300-0000-6560285e0000 + - 6e003e49-0000-3300-0000-656687c20000 expires: - '-1' pragma: @@ -438,7 +437,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis?api-version=2024-03-01 response: body: - string: "{\"value\":[{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/petstore-api\",\"name\":\"petstore-api\",\"systemData\":{\"createdAt\":\"2023-11-08T18:57:32.3783991Z\",\"lastModifiedAt\":\"2023-11-08T18:57:32.3784001Z\"},\"properties\":{\"title\":\"Petstore-Api\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/ensight-servicereports\",\"name\":\"ensight-servicereports\",\"systemData\":{\"createdAt\":\"2023-11-10T22:24:10.4970866Z\",\"lastModifiedAt\":\"2023-11-10T22:24:10.4971093Z\"},\"properties\":{\"title\":\"ensight-servicereports\",\"description\":\"**ENSIGHT + string: "{\"value\":[{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/petstore-api\",\"name\":\"petstore-api\",\"systemData\":{\"createdAt\":\"2023-11-08T18:57:32.3783991Z\",\"lastModifiedAt\":\"2023-11-28T21:20:33.549201Z\"},\"properties\":{\"title\":\"Petstore-Api\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{\"metadata-test-2\":true,\"metadata-test-1\":\"abc\"}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/ensight-servicereports\",\"name\":\"ensight-servicereports\",\"systemData\":{\"createdAt\":\"2023-11-10T22:24:10.4970866Z\",\"lastModifiedAt\":\"2023-11-10T22:24:10.4971093Z\"},\"properties\":{\"title\":\"ensight-servicereports\",\"description\":\"**ENSIGHT Servicereports API** verf\xFCgt \xFCber den prim\xE4ren Endpunkt [Get Servicereports](https://dev-core-base-apim.developer.azure-api.net/api-details#api=ENSIGHT-API-Servicereportsv1&operation=GlobalServiceProtocol) mithilfe dessen Servicereports - Dokumentationen von Betriebs- und Instandhaltungsmassnahmen von Kraftwerken f\xFCr erneuerbare Energien - in Form des Globalen Service @@ -489,31 +488,13 @@ interactions: with countdistinct as total))\\r\\n\\r\\n*Name und Beschreibung des Vestas-Servicereports 55636522*\\r\\n\\r\\n [URL]?$filter=gspInfo/documentId eq 'VESTAS_55636522'&$select=workReport/items/name,workReport/items/longDescription\\r\\n\\r\\n*Materialverbrauch des Nordex-Serviceberichts 600180286*\\r\\n\\r\\n [URL]?$filter=gspInfo/documentId - eq 'NORDEX_600180286'&$select=workReport/items/materials\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/customer-issue\",\"name\":\"customer-issue\",\"systemData\":{\"createdAt\":\"2023-11-11T00:29:24.954375Z\",\"lastModifiedAt\":\"2023-11-11T00:29:24.9543769Z\"},\"properties\":{\"title\":\"customer-issue\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/swagger_arpi_test\",\"name\":\"swagger_arpi_test\",\"systemData\":{\"createdAt\":\"2023-11-14T18:50:27.2999397Z\",\"lastModifiedAt\":\"2023-11-14T18:50:27.2999398Z\"},\"properties\":{\"title\":\"Swagger - Arpi Test\",\"summary\":\"A sample Arpi API that uses a petstore as an example - to demonstrate features in the OpenAPI 3.0 specification\",\"description\":\"A - sample Arpi API that uses a petstore as an example to demonstrate features - in the OpenAPI 3.0 specification\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{\"url\":\"http://swagger.io/terms/\"},\"license\":{\"name\":\"Apache - 2.0\",\"url\":\"https://www.apache.org/licenses/LICENSE-2.0.html\"},\"externalDocumentation\":[],\"contacts\":[{\"name\":\"Arpi - Swagger API Team\",\"url\":\"http://swagger.io\",\"email\":\"arpiapiteam@swagger.io\"}],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/swagger_arpi_test_2\",\"name\":\"swagger_arpi_test_2\",\"systemData\":{\"createdAt\":\"2023-11-14T18:51:10.5761684Z\",\"lastModifiedAt\":\"2023-11-14T18:51:10.5761685Z\"},\"properties\":{\"title\":\"Swagger - Arpi Test 2\",\"summary\":\"A sample Arpi API that uses a petstore as an example - to demonstrate features in the OpenAPI 3.0 specification\",\"description\":\"A - sample Arpi API that uses a petstore as an example to demonstrate features - in the OpenAPI 3.0 specification\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{\"url\":\"http://swagger.io/terms/\"},\"license\":{\"name\":\"Apache - 2.0\",\"url\":\"https://www.apache.org/licenses/LICENSE-2.0.html\"},\"externalDocumentation\":[],\"contacts\":[{\"name\":\"Arpi - Swagger API Team\",\"url\":\"http://swagger.io\",\"email\":\"arpiapiteam@swagger.io\"}],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/uber-api\",\"name\":\"uber-api\",\"systemData\":{\"createdAt\":\"2023-11-14T20:32:01.6772075Z\",\"lastModifiedAt\":\"2023-11-14T20:36:19.4958358Z\"},\"properties\":{\"title\":\"Uber + eq 'NORDEX_600180286'&$select=workReport/items/materials\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/customer-issue\",\"name\":\"customer-issue\",\"systemData\":{\"createdAt\":\"2023-11-11T00:29:24.954375Z\",\"lastModifiedAt\":\"2023-11-11T00:29:24.9543769Z\"},\"properties\":{\"title\":\"customer-issue\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/uber-api\",\"name\":\"uber-api\",\"systemData\":{\"createdAt\":\"2023-11-14T20:32:01.6772075Z\",\"lastModifiedAt\":\"2023-11-14T20:36:19.4958358Z\"},\"properties\":{\"title\":\"Uber API\",\"summary\":\"Move your app forward with the Uber API\",\"description\":\"Move your app forward with the Uber API\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{},\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/swagger-petstore\",\"name\":\"swagger-petstore\",\"systemData\":{\"createdAt\":\"2023-11-15T00:39:28.4314069Z\",\"lastModifiedAt\":\"2023-11-15T00:39:28.4314279Z\"},\"properties\":{\"title\":\"swagger-petstore\",\"description\":\"This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). \ For this sample, you can use the api key `special-key` to test the authorization - filters.\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/femeji-openai-test\",\"name\":\"femeji-openai-test\",\"systemData\":{\"createdAt\":\"2023-11-15T18:23:02.5833933Z\",\"lastModifiedAt\":\"2023-11-15T18:24:32.7488369Z\"},\"properties\":{\"title\":\"femeji-openai-test\",\"summary\":\"Ignite - 2023: openAI summarize reviews API\",\"description\":\"Ignite 2023: openAI - summarize reviews API\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{},\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/echo-api-10\",\"name\":\"echo-api-10\",\"systemData\":{\"createdAt\":\"2023-11-24T04:09:30.5042234Z\",\"lastModifiedAt\":\"2023-11-24T04:09:30.5042235Z\"},\"properties\":{\"title\":\"Echo - API\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-100\",\"name\":\"cli-test-openai-api-100\",\"systemData\":{\"createdAt\":\"2023-11-24T04:18:06.6293674Z\",\"lastModifiedAt\":\"2023-11-24T04:22:28.1864979Z\"},\"properties\":{\"title\":\"cli-test-openai-api-100\",\"summary\":\"APIs - for sampling from and fine-tuning language models\",\"description\":\"APIs - for sampling from and fine-tuning language models\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"termsOfService\":{},\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-104\",\"name\":\"cli-test-api-104\",\"systemData\":{\"createdAt\":\"2023-11-24T04:22:10.1136578Z\",\"lastModifiedAt\":\"2023-11-24T04:35:33.5876506Z\"},\"properties\":{\"title\":\"CLI - Test API 105\",\"description\":\"CLI Test API 105\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106\",\"name\":\"cli-test-api-106\",\"systemData\":{\"createdAt\":\"2023-11-24T04:36:46.6151158Z\",\"lastModifiedAt\":\"2023-11-24T04:36:46.6151159Z\"},\"properties\":{\"title\":\"CLI + filters.\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}},{\"type\":\"Microsoft.ApiCenter/services/apis\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106\",\"name\":\"cli-test-api-106\",\"systemData\":{\"createdAt\":\"2023-11-29T00:37:22.3456411Z\",\"lastModifiedAt\":\"2023-11-29T00:37:22.3456422Z\"},\"properties\":{\"title\":\"CLI Test API 106\",\"description\":\"CLI Test API 106\",\"kind\":\"rest\",\"lifecycleStage\":\"design\",\"externalDocumentation\":[],\"contacts\":[],\"customProperties\":{}}}]}" headers: api-supported-versions: @@ -521,11 +502,11 @@ interactions: cache-control: - no-cache content-length: - - '12071' + - '7788' content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:47 GMT + - Wed, 29 Nov 2023 00:37:23 GMT expires: - '-1' pragma: @@ -568,7 +549,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-24T04:36:48.5019943Z","lastModifiedAt":"2023-11-24T04:36:48.5019943Z"},"properties":{"title":"cli-test-2023-01-02","lifecycleStage":"design"}}' + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-29T00:37:24.4649903Z","lastModifiedAt":"2023-11-29T00:37:24.4649903Z"},"properties":{"title":"cli-test-2023-01-02","lifecycleStage":"design"}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 @@ -579,9 +560,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:47 GMT + - Wed, 29 Nov 2023 00:37:24 GMT etag: - - 5f00ebcc-0000-3300-0000-656028600000 + - 9a0072b9-0000-3300-0000-656687c40000 expires: - '-1' pragma: @@ -615,14 +596,14 @@ interactions: Connection: - keep-alive ParameterSetName: - - -g -s --api-name --name --title + - -g -s --api-name --name --title -w User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-24T04:36:48.5019943Z","lastModifiedAt":"2023-11-24T04:36:48.5019943Z"},"properties":{"title":"cli-test-2023-01-02","lifecycleStage":"design"}}' + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-29T00:37:24.4649903Z","lastModifiedAt":"2023-11-29T00:37:24.4649903Z"},"properties":{"title":"cli-test-2023-01-02","lifecycleStage":"design"}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 @@ -633,9 +614,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:48 GMT + - Wed, 29 Nov 2023 00:37:24 GMT etag: - - 5f00ebcc-0000-3300-0000-656028600000 + - 9a0072b9-0000-3300-0000-656687c40000 expires: - '-1' pragma: @@ -672,14 +653,14 @@ interactions: Content-Type: - application/json ParameterSetName: - - -g -s --api-name --name --title + - -g -s --api-name --name --title -w User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-24T04:36:48.5019943Z","lastModifiedAt":"2023-11-24T04:36:49.4205098Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-29T00:37:24.4649903Z","lastModifiedAt":"2023-11-29T00:37:25.4952003Z"},"properties":{"title":"CLI Test API Version 0","lifecycleStage":"design"}}' headers: api-supported-versions: @@ -691,9 +672,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:48 GMT + - Wed, 29 Nov 2023 00:37:25 GMT etag: - - 5f00fbcc-0000-3300-0000-656028610000 + - 9a007cb9-0000-3300-0000-656687c50000 expires: - '-1' pragma: @@ -709,7 +690,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1197' + - '1199' x-powered-by: - ASP.NET status: @@ -734,7 +715,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-24T04:36:48.5019943Z","lastModifiedAt":"2023-11-24T04:36:49.4205098Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-29T00:37:24.4649903Z","lastModifiedAt":"2023-11-29T00:37:25.4952003Z"},"properties":{"title":"CLI Test API Version 0","lifecycleStage":"design"}}' headers: api-supported-versions: @@ -746,9 +727,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:49 GMT + - Wed, 29 Nov 2023 00:37:26 GMT etag: - - 5f00fbcc-0000-3300-0000-656028610000 + - 9a007cb9-0000-3300-0000-656687c50000 expires: - '-1' pragma: @@ -787,7 +768,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions?api-version=2024-03-01 response: body: - string: '{"value":[{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-24T04:36:48.5019943Z","lastModifiedAt":"2023-11-24T04:36:49.4205098Z"},"properties":{"title":"CLI + string: '{"value":[{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02","name":"cli-test-2023-01-02","systemData":{"createdAt":"2023-11-29T00:37:24.4649903Z","lastModifiedAt":"2023-11-29T00:37:25.4952003Z"},"properties":{"title":"CLI Test API Version 0","lifecycleStage":"design"}}]}' headers: api-supported-versions: @@ -799,7 +780,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:49 GMT + - Wed, 29 Nov 2023 00:37:26 GMT expires: - '-1' pragma: @@ -842,20 +823,20 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-24T04:36:51.2266973Z"},"properties":{"title":"OpenAPI"}}' + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-29T00:37:27.6778681Z"},"properties":{"title":"OpenAPI","specification":{"name":"openapi","version":"3.0.0"}}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '464' + - '517' content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:50 GMT + - Wed, 29 Nov 2023 00:37:27 GMT etag: - - 0000ee00-0000-3300-0000-656028630000 + - 00000a01-0000-3300-0000-656687c70000 expires: - '-1' pragma: @@ -871,7 +852,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' x-powered-by: - ASP.NET status: @@ -889,27 +870,27 @@ interactions: Connection: - keep-alive ParameterSetName: - - -g -s --api-name --version --name --title + - -g -s --api-name --version --name --title -w User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-24T04:36:51.2266973Z"},"properties":{"title":"OpenAPI"}}' + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-29T00:37:27.6778681Z"},"properties":{"title":"OpenAPI","specification":{"name":"openapi","version":"3.0.0"}}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '464' + - '517' content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:51 GMT + - Wed, 29 Nov 2023 00:37:27 GMT etag: - - 0000ee00-0000-3300-0000-656028630000 + - 00000a01-0000-3300-0000-656687c70000 expires: - '-1' pragma: @@ -945,28 +926,28 @@ interactions: Content-Type: - application/json ParameterSetName: - - -g -s --api-name --version --name --title + - -g -s --api-name --version --name --title -w User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-24T04:36:52.1899192Z"},"properties":{"title":"CLI - Test API Definition 0"}}' + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-29T00:37:28.5978862Z"},"properties":{"title":"CLI + Test API Definition 0","specification":{"name":"openapi","version":"3.0.0"}}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '482' + - '535' content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:51 GMT + - Wed, 29 Nov 2023 00:37:27 GMT etag: - - 0000ef00-0000-3300-0000-656028640000 + - 00000b01-0000-3300-0000-656687c80000 expires: - '-1' pragma: @@ -1007,35 +988,35 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-24T04:36:52.1899192Z"},"properties":{"title":"CLI - Test API Definition 0"}}' + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-29T00:37:28.5978862Z"},"properties":{"title":"CLI + Test API Definition 0","specification":{"name":"openapi","version":"3.0.0"}}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '482' + - '535' content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:52 GMT + - Wed, 29 Nov 2023 00:37:28 GMT etag: - - 0000ef00-0000-3300-0000-656028640000 + - 00000b01-0000-3300-0000-656687c80000 expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: 3CAA6C2332F9486FA8C93DB25833038C Ref B: SN4AA2022302035 Ref C: 2023-11-29T00:37:29Z' x-powered-by: - ASP.NET status: @@ -1060,33 +1041,33 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions?api-version=2024-03-01 response: body: - string: '{"value":[{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-24T04:36:52.1899192Z"},"properties":{"title":"CLI - Test API Definition 0"}}]}' + string: '{"value":[{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","name":"cli-test-openapi-106","systemData":{"createdAt":"2023-11-24T04:36:51.2266973Z","lastModifiedAt":"2023-11-29T00:37:28.5978862Z"},"properties":{"title":"CLI + Test API Definition 0","specification":{"name":"openapi","version":"3.0.0"}}}]}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '494' + - '547' content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:53 GMT + - Wed, 29 Nov 2023 00:37:29 GMT expires: - '-1' pragma: - no-cache - server: - - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked vary: - - Accept-Encoding,Accept-Encoding + - Accept-Encoding + x-cache: + - CONFIG_NOCACHE x-content-type-options: - nosniff + x-msedge-ref: + - 'Ref A: FFBBA555E1004D52A83FE29475C8C244 Ref B: DM2AA1091211047 Ref C: 2023-11-29T00:37:29Z' x-powered-by: - ASP.NET status: @@ -1131,11 +1112,11 @@ interactions: content-length: - '0' date: - - Fri, 24 Nov 2023 04:36:53 GMT + - Wed, 29 Nov 2023 00:37:30 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106/operationResults/43b92c63-7922-4466-a416-c90000de9394?api-version=2024-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106/operationResults/b2118ba0-9884-4a2a-8bea-0082985ed8b0?api-version=2024-03-01 pragma: - no-cache strict-transport-security: @@ -1147,7 +1128,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-msedge-ref: - - 'Ref A: 0316F8152CAB499B8A4BEF786C95D1C5 Ref B: SN4AA2022304011 Ref C: 2023-11-24T04:36:53Z' + - 'Ref A: 6D2F1FD2759B4CD5A0C644D7B25EC516 Ref B: SN4AA2022303027 Ref C: 2023-11-29T00:37:30Z' x-powered-by: - ASP.NET status: @@ -1169,7 +1150,7 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106/operationResults/43b92c63-7922-4466-a416-c90000de9394?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106/operationResults/b2118ba0-9884-4a2a-8bea-0082985ed8b0?api-version=2024-03-01 response: body: string: '{"apiName":"default","apiVersion":"cli-test-2023-01-02","catalogName":"contosoeuap","provisioningState":"Succeeded","error":{"message":""}}' @@ -1183,7 +1164,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:54 GMT + - Wed, 29 Nov 2023 00:37:30 GMT expires: - '-1' pragma: @@ -1197,7 +1178,7 @@ interactions: x-content-type-options: - nosniff x-msedge-ref: - - 'Ref A: 82E7424910474AACB9573AD62213A1D6 Ref B: SN4AA2022304011 Ref C: 2023-11-24T04:36:54Z' + - 'Ref A: 519E2E277D5F445BB5BEABAE6705FBF3 Ref B: SN4AA2022303027 Ref C: 2023-11-29T00:37:30Z' x-powered-by: - ASP.NET status: @@ -1241,7 +1222,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:54 GMT + - Wed, 29 Nov 2023 00:37:31 GMT expires: - '-1' pragma: @@ -1257,7 +1238,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-msedge-ref: - - 'Ref A: 0D433DD64083445D9419A4F8307AA489 Ref B: SN4AA2022302027 Ref C: 2023-11-24T04:36:55Z' + - 'Ref A: 47A372177331425E8F52BF6142DE2BA2 Ref B: SN4AA2022303031 Ref C: 2023-11-29T00:37:31Z' x-powered-by: - ASP.NET status: @@ -1290,7 +1271,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/mock-deployment?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-24T04:36:56.0382948Z","lastModifiedAt":"2023-11-24T04:36:56.0382948Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-29T00:37:32.7590411Z","lastModifiedAt":"2023-11-29T00:37:32.7590411Z"},"properties":{"title":"CLI Test Production deployment","description":"CLI Test Public cloud production deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' headers: @@ -1303,9 +1284,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:55 GMT + - Wed, 29 Nov 2023 00:37:32 GMT etag: - - 0700a8c1-0000-3300-0000-656028680000 + - 0c00f79a-0000-3300-0000-656687cc0000 expires: - '-1' pragma: @@ -1321,7 +1302,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-msedge-ref: - - 'Ref A: CDE05808D9264C56A875AADFC849B8A8 Ref B: SN4AA2022302021 Ref C: 2023-11-24T04:36:55Z' + - 'Ref A: A775BED7A86B45F6AC881AE659B49758 Ref B: SN4AA2022304023 Ref C: 2023-11-29T00:37:32Z' x-powered-by: - ASP.NET status: @@ -1346,7 +1327,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/mock-deployment?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-24T04:36:56.0382948Z","lastModifiedAt":"2023-11-24T04:36:56.0382948Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-29T00:37:32.7590411Z","lastModifiedAt":"2023-11-29T00:37:32.7590411Z"},"properties":{"title":"CLI Test Production deployment","description":"CLI Test Public cloud production deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' headers: @@ -1359,9 +1340,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:56 GMT + - Wed, 29 Nov 2023 00:37:33 GMT etag: - - 0700a8c1-0000-3300-0000-656028680000 + - 0c00f79a-0000-3300-0000-656687cc0000 expires: - '-1' pragma: @@ -1375,7 +1356,7 @@ interactions: x-content-type-options: - nosniff x-msedge-ref: - - 'Ref A: 84CAFA11780C41AFA7C3918459133078 Ref B: SN4AA2022303051 Ref C: 2023-11-24T04:36:56Z' + - 'Ref A: 95366EE161A64EECA6B668010553962E Ref B: SN4AA2022304047 Ref C: 2023-11-29T00:37:33Z' x-powered-by: - ASP.NET status: @@ -1393,14 +1374,14 @@ interactions: Connection: - keep-alive ParameterSetName: - - -g -s --api-name --name --title + - -g -s --api-name --name --title -w User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/mock-deployment?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-24T04:36:56.0382948Z","lastModifiedAt":"2023-11-24T04:36:56.0382948Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-29T00:37:32.7590411Z","lastModifiedAt":"2023-11-29T00:37:32.7590411Z"},"properties":{"title":"CLI Test Production deployment","description":"CLI Test Public cloud production deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' headers: @@ -1413,9 +1394,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:56 GMT + - Wed, 29 Nov 2023 00:37:33 GMT etag: - - 0700a8c1-0000-3300-0000-656028680000 + - 0c00f79a-0000-3300-0000-656687cc0000 expires: - '-1' pragma: @@ -1429,7 +1410,7 @@ interactions: x-content-type-options: - nosniff x-msedge-ref: - - 'Ref A: D1779482FF044BE5B9CFB56D67E3A231 Ref B: SN4AA2022302053 Ref C: 2023-11-24T04:36:56Z' + - 'Ref A: B08C21F4C5BA4173BAB47FDE11604037 Ref B: DM2AA1091213047 Ref C: 2023-11-29T00:37:33Z' x-powered-by: - ASP.NET status: @@ -1454,14 +1435,14 @@ interactions: Content-Type: - application/json ParameterSetName: - - -g -s --api-name --name --title + - -g -s --api-name --name --title -w User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/mock-deployment?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-24T04:36:56.0382948Z","lastModifiedAt":"2023-11-24T04:36:57.6537983Z"},"properties":{"title":"CLI + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-29T00:37:32.7590411Z","lastModifiedAt":"2023-11-29T00:37:34.3376453Z"},"properties":{"title":"CLI Test Production deployment update","description":"CLI Test Public cloud production deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}' headers: @@ -1474,9 +1455,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:57 GMT + - Wed, 29 Nov 2023 00:37:34 GMT etag: - - 0700a9c1-0000-3300-0000-656028690000 + - 0c00f89a-0000-3300-0000-656687ce0000 expires: - '-1' pragma: @@ -1492,7 +1473,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-msedge-ref: - - 'Ref A: 92FEE29544D34854B34C07F3ECF6E3DB Ref B: SN4AA2022302053 Ref C: 2023-11-24T04:36:57Z' + - 'Ref A: 409433B794F54C128553F217B1A12BCD Ref B: DM2AA1091213047 Ref C: 2023-11-29T00:37:34Z' x-powered-by: - ASP.NET status: @@ -1517,7 +1498,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments?api-version=2024-03-01 response: body: - string: '{"value":[{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-24T04:36:56.0382948Z","lastModifiedAt":"2023-11-24T04:36:57.6537983Z"},"properties":{"title":"CLI + string: '{"value":[{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-api-106/deployments/production","name":"production","systemData":{"createdAt":"2023-11-29T00:37:32.7590411Z","lastModifiedAt":"2023-11-29T00:37:34.3376453Z"},"properties":{"title":"CLI Test Production deployment update","description":"CLI Test Public cloud production deployment.","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-api-106/versions/cli-test-2023-01-02/definitions/cli-test-openapi-106","server":{"runtimeUri":["https://api.contoso.com"]},"customProperties":{},"recommended":false}}]}' headers: @@ -1530,7 +1511,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:57 GMT + - Wed, 29 Nov 2023 00:37:34 GMT expires: - '-1' pragma: @@ -1544,7 +1525,7 @@ interactions: x-content-type-options: - nosniff x-msedge-ref: - - 'Ref A: 0657D851BD5A4E969EDE5F00D936C3F4 Ref B: SN4AA2022302047 Ref C: 2023-11-24T04:36:57Z' + - 'Ref A: 7912630E8FE54DDE8FAC2139BD1C449E Ref B: DM2AA1091212047 Ref C: 2023-11-29T00:37:34Z' x-powered-by: - ASP.NET status: @@ -1574,7 +1555,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchemas/cli-test-metadata-schema-1?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/metadataSchema","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchema/cli-test-metadata-schema-1","name":"cli-test-metadata-schema-1","systemData":{"createdAt":"2023-11-24T04:18:02.4538124Z","lastModifiedAt":"2023-11-24T04:36:58.7877708Z"},"properties":{"assignedTo":[],"schema":"{\"type\": + string: '{"type":"Microsoft.ApiCenter/services/metadataSchema","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchema/cli-test-metadata-schema-1","name":"cli-test-metadata-schema-1","systemData":{"createdAt":"2023-11-24T04:18:02.4538124Z","lastModifiedAt":"2023-11-29T00:37:35.7449241Z"},"properties":{"assignedTo":[],"schema":"{\"type\": \"string\", \"title\": \"CLI Test First name\", \"pattern\": \"^[a-zA-Z0-9 ]+$\"}"}}' headers: @@ -1587,7 +1568,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:58 GMT + - Wed, 29 Nov 2023 00:37:35 GMT expires: - '-1' pragma: @@ -1603,7 +1584,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-msedge-ref: - - 'Ref A: B6A4C820FF9C4946817B83D04ED5C0A7 Ref B: DM2AA1091213025 Ref C: 2023-11-24T04:36:58Z' + - 'Ref A: 1E4BB2FFF5834FDCB03696445C9D9A1D Ref B: DM2AA1091214027 Ref C: 2023-11-29T00:37:35Z' x-powered-by: - ASP.NET status: @@ -1664,7 +1645,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:59 GMT + - Wed, 29 Nov 2023 00:37:36 GMT expires: - '-1' pragma: @@ -1680,7 +1661,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-msedge-ref: - - 'Ref A: 55E267E228BD4BF8BF4484E4CCF82A1A Ref B: SN4AA2022304049 Ref C: 2023-11-24T04:36:59Z' + - 'Ref A: AC122277A38748ADA2CA5C8BCF337707 Ref B: SN4AA2022303053 Ref C: 2023-11-29T00:37:36Z' x-powered-by: - ASP.NET status: @@ -1727,7 +1708,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:36:59 GMT + - Wed, 29 Nov 2023 00:37:37 GMT expires: - '-1' pragma: @@ -1743,7 +1724,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-msedge-ref: - - 'Ref A: 8014F0F7A36546358A45E76F2E144CA1 Ref B: SN4AA2022304039 Ref C: 2023-11-24T04:36:59Z' + - 'Ref A: 6411025974C344859EBC6E33123B5339 Ref B: SN4AA2022305023 Ref C: 2023-11-29T00:37:37Z' x-powered-by: - ASP.NET status: @@ -1792,7 +1773,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:37:00 GMT + - Wed, 29 Nov 2023 00:37:38 GMT expires: - '-1' pragma: @@ -1808,7 +1789,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-msedge-ref: - - 'Ref A: B59CF175EED4423BA60C50674536BCDA Ref B: SN4AA2022304021 Ref C: 2023-11-24T04:37:00Z' + - 'Ref A: 6597CE2286DB4C96871CAE488D948E75 Ref B: SN4AA2022304047 Ref C: 2023-11-29T00:37:38Z' x-powered-by: - ASP.NET status: @@ -1833,7 +1814,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchemas/cli-test-metadata-schema-1?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/metadataSchema","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchema/cli-test-metadata-schema-1","name":"cli-test-metadata-schema-1","systemData":{"createdAt":"2023-11-24T04:18:02.4538124Z","lastModifiedAt":"2023-11-24T04:36:58.7877708Z"},"properties":{"assignedTo":[],"schema":"{\"type\": + string: '{"type":"Microsoft.ApiCenter/services/metadataSchema","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/metadataSchema/cli-test-metadata-schema-1","name":"cli-test-metadata-schema-1","systemData":{"createdAt":"2023-11-24T04:18:02.4538124Z","lastModifiedAt":"2023-11-29T00:37:35.7449241Z"},"properties":{"assignedTo":[],"schema":"{\"type\": \"string\", \"title\": \"CLI Test First name\", \"pattern\": \"^[a-zA-Z0-9 ]+$\"}"}}' headers: @@ -1846,7 +1827,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:37:00 GMT + - Wed, 29 Nov 2023 00:37:39 GMT expires: - '-1' pragma: @@ -1860,7 +1841,7 @@ interactions: x-content-type-options: - nosniff x-msedge-ref: - - 'Ref A: 47D8D33BD5774E768B5D6BD1598BB802 Ref B: DM2AA1091214051 Ref C: 2023-11-24T04:37:01Z' + - 'Ref A: 63A25FB85ACC4BD7A837D0E20400D363 Ref B: DM2AA1091214031 Ref C: 2023-11-29T00:37:39Z' x-powered-by: - ASP.NET status: @@ -1891,7 +1872,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105","name":"cli-test-openai-api-105","systemData":{"createdAt":"2023-11-24T04:37:02.4875811Z","lastModifiedAt":"2023-11-24T04:37:02.4875811Z"},"properties":{"title":"cli-test-openai-api-105","summary":"APIs + string: '{"type":"Microsoft.ApiCenter/services/apis","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105","name":"cli-test-openai-api-105","systemData":{"createdAt":"2023-11-29T00:37:40.6349454Z","lastModifiedAt":"2023-11-29T00:37:40.6349466Z"},"properties":{"title":"cli-test-openai-api-105","summary":"APIs for sampling from and fine-tuning language models","description":"APIs for sampling from and fine-tuning language models","kind":"rest","lifecycleStage":"design","termsOfService":{},"externalDocumentation":[],"contacts":[],"customProperties":{}}}' headers: @@ -1904,9 +1885,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:37:02 GMT + - Wed, 29 Nov 2023 00:37:40 GMT etag: - - 4a00b091-0000-3300-0000-6560286e0000 + - 6e00a049-0000-3300-0000-656687d40000 expires: - '-1' pragma: @@ -1922,7 +1903,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-msedge-ref: - - 'Ref A: EAC894D813BF44CCA7B557AF7B109A47 Ref B: DM2AA1091211019 Ref C: 2023-11-24T04:37:02Z' + - 'Ref A: 9148C489A269482DB1EF86956161D00C Ref B: SN4AA2022304029 Ref C: 2023-11-29T00:37:40Z' x-powered-by: - ASP.NET status: @@ -1951,7 +1932,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0","name":"1-2-0","systemData":{"createdAt":"2023-11-24T04:37:03.0013841Z","lastModifiedAt":"2023-11-24T04:37:03.0013841Z"},"properties":{"title":"1-2-0","lifecycleStage":"design"}}' + string: '{"type":"Microsoft.ApiCenter/services/versions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0","name":"1-2-0","systemData":{"createdAt":"2023-11-29T00:37:41.2557802Z","lastModifiedAt":"2023-11-29T00:37:41.2557802Z"},"properties":{"title":"1-2-0","lifecycleStage":"design"}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 @@ -1962,9 +1943,9 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:37:02 GMT + - Wed, 29 Nov 2023 00:37:40 GMT etag: - - 5f0085cd-0000-3300-0000-6560286f0000 + - 9a00efb9-0000-3300-0000-656687d50000 expires: - '-1' pragma: @@ -1980,7 +1961,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-msedge-ref: - - 'Ref A: 1A0FFCD2E9354CAA85FEB982313680B1 Ref B: SN4AA2022302037 Ref C: 2023-11-24T04:37:02Z' + - 'Ref A: 1DC444D7954546E4847C70E73E3D2CEC Ref B: SN4AA2022303011 Ref C: 2023-11-29T00:37:40Z' x-powered-by: - ASP.NET status: @@ -2010,21 +1991,21 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi","name":"openapi","systemData":{"createdAt":"2023-11-24T04:37:03.5685003Z","lastModifiedAt":"2023-11-24T04:37:03.5685003Z"},"properties":{"title":"openapi","description":"APIs - for sampling from and fine-tuning language models"}}' + string: '{"type":"Microsoft.ApiCenter/services/definitions","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi","name":"openapi","systemData":{"createdAt":"2023-11-24T04:37:03.5685003Z","lastModifiedAt":"2023-11-29T00:37:41.8357734Z"},"properties":{"title":"openapi","description":"APIs + for sampling from and fine-tuning language models","specification":{"name":"openapi","version":"3-0-0"}}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '502' + - '555' content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:37:03 GMT + - Wed, 29 Nov 2023 00:37:41 GMT etag: - - 0000f100-0000-3300-0000-6560286f0000 + - 00000d01-0000-3300-0000-656687d50000 expires: - '-1' pragma: @@ -2040,7 +2021,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-msedge-ref: - - 'Ref A: 07C1FE707ABA4CFF8F7C1155CA44E146 Ref B: DM2AA1091212025 Ref C: 2023-11-24T04:37:03Z' + - 'Ref A: B6C6DCF90E8F4CF1A7581615896577CE Ref B: DM2AA1091213029 Ref C: 2023-11-29T00:37:41Z' x-powered-by: - ASP.NET status: @@ -3370,11 +3351,11 @@ interactions: content-length: - '0' date: - - Fri, 24 Nov 2023 04:37:04 GMT + - Wed, 29 Nov 2023 00:37:43 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi/operationResults/7852d102-9119-4187-a8e9-2b8afd78c41b?api-version=2024-03-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi/operationResults/b86151fd-4624-4a2f-acc6-70a5c131ff4c?api-version=2024-03-01 pragma: - no-cache strict-transport-security: @@ -3386,7 +3367,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-msedge-ref: - - 'Ref A: D756DCCF6F8B426CB412D11F597F842A Ref B: SN4AA2022305049 Ref C: 2023-11-24T04:37:04Z' + - 'Ref A: DE9FB46FEDB047789A4625B6B5763FED Ref B: DM2AA1091211051 Ref C: 2023-11-29T00:37:42Z' x-powered-by: - ASP.NET status: @@ -3408,21 +3389,21 @@ interactions: User-Agent: - AZURECLI/2.53.0 (AAZ) azsdk-python-core/1.26.0 Python/3.8.10 (Windows-10-10.0.22621-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi/operationResults/7852d102-9119-4187-a8e9-2b8afd78c41b?api-version=2024-03-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi/operationResults/b86151fd-4624-4a2f-acc6-70a5c131ff4c?api-version=2024-03-01 response: body: - string: '{"apiName":"default","apiVersion":"1-2-0","catalogName":"contosoeuap","provisioningState":"InProgress","error":{"message":""}}' + string: '{"apiName":"default","apiVersion":"1-2-0","catalogName":"contosoeuap","provisioningState":"Succeeded","error":{"message":""}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 cache-control: - no-cache content-length: - - '126' + - '125' content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:37:04 GMT + - Wed, 29 Nov 2023 00:37:43 GMT expires: - '-1' pragma: @@ -3436,7 +3417,7 @@ interactions: x-content-type-options: - nosniff x-msedge-ref: - - 'Ref A: A91FBAD5B64A40BEA70ADE2A6DE3C7F9 Ref B: SN4AA2022305049 Ref C: 2023-11-24T04:37:04Z' + - 'Ref A: FC3AE84FAE2F45A8B607EE3A5AE71298 Ref B: DM2AA1091211051 Ref C: 2023-11-29T00:37:43Z' x-powered-by: - ASP.NET status: @@ -3461,7 +3442,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-24T04:36:44.6605067Z"},"properties":{"title":"Public + string: '{"type":"Microsoft.ApiCenter/services/environments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/environments/cli-test-public","name":"cli-test-public","systemData":{"createdAt":"2023-11-22T16:52:05.746898Z","lastModifiedAt":"2023-11-29T00:37:20.325193Z"},"properties":{"title":"Public cloud","kind":"development","server":{"type":"Azure API Management","managementPortalUri":["management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"]},"customProperties":{}}}' headers: api-supported-versions: @@ -3469,27 +3450,27 @@ interactions: cache-control: - no-cache content-length: - - '692' + - '691' content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:37:05 GMT + - Wed, 29 Nov 2023 00:37:43 GMT etag: - - 05002f6e-0000-3300-0000-6560285c0000 + - 0800337f-0000-3300-0000-656687c00000 expires: - '-1' pragma: - no-cache + server: + - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked vary: - - Accept-Encoding - x-cache: - - CONFIG_NOCACHE + - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff - x-msedge-ref: - - 'Ref A: 3281AC3BD0BD488AABBBDAD3CF09B258 Ref B: DM2AA1091212039 Ref C: 2023-11-24T04:37:05Z' x-powered-by: - ASP.NET status: @@ -3521,7 +3502,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/deployments/mock-deployment?api-version=2024-03-01 response: body: - string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/deployments/clitestopenaiapi105deployment","name":"clitestopenaiapi105deployment","systemData":{"createdAt":"2023-11-24T04:37:06.0766871Z","lastModifiedAt":"2023-11-24T04:37:06.0766871Z"},"properties":{"title":"clitestopenaiapi105deployment","description":"clitestopenaiapi105deployment","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi","server":{"runtimeUri":["https://api.openai.com/v1"]},"customProperties":{},"recommended":false}}' + string: '{"type":"Microsoft.ApiCenter/services/deployments","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/api-center-test/providers/Microsoft.ApiCenter/services/contosoeuap/workspaces/default/apis/cli-test-openai-api-105/deployments/clitestopenaiapi105deployment","name":"clitestopenaiapi105deployment","systemData":{"createdAt":"2023-11-29T00:37:44.5969176Z","lastModifiedAt":"2023-11-29T00:37:44.5969176Z"},"properties":{"title":"clitestopenaiapi105deployment","description":"clitestopenaiapi105deployment","environmentId":"/workspaces/default/environments/cli-test-public","definitionId":"/workspaces/default/apis/cli-test-openai-api-105/versions/1-2-0/definitions/openapi","server":{"runtimeUri":["https://api.openai.com/v1"]},"customProperties":{},"recommended":false}}' headers: api-supported-versions: - 2023-07-01-preview, 2024-03-01 @@ -3532,25 +3513,25 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 24 Nov 2023 04:37:05 GMT + - Wed, 29 Nov 2023 00:37:44 GMT etag: - - 0700afc1-0000-3300-0000-656028720000 + - 0c00fd9a-0000-3300-0000-656687d80000 expires: - '-1' pragma: - no-cache + server: + - Microsoft-IIS/10.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked vary: - - Accept-Encoding - x-cache: - - CONFIG_NOCACHE + - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - '1199' - x-msedge-ref: - - 'Ref A: 336A05B8E49E4C768EB3825B17C631C4 Ref B: SN4AA2022304053 Ref C: 2023-11-24T04:37:05Z' x-powered-by: - ASP.NET status: diff --git a/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py b/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py index 607f28638cf..6dacb2e995a 100644 --- a/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py +++ b/src/apic-extension/azext_apic_extension/tests/latest/test_apic_extension.py @@ -54,7 +54,7 @@ def test_apic_scenarios(self): self.kwargs.update({ 'server_details': server_details, }) - self.cmd('az apic environment update -g {resource_group} -s {service_name} --name {environment_name} --title "Public cloud" --kind "development" --server "{server_details}"', + self.cmd('az apic environment update -g {resource_group} -s {service_name} --name {environment_name} --title "Public cloud" --kind "development" --server "{server_details}" -w default', checks=[ self.check('name', self.kwargs['environment_name']), self.check('title', 'Public cloud'), @@ -104,7 +104,7 @@ def test_apic_scenarios(self): self.kwargs.update({ 'api_version_title_update': "CLI Test API Version 0" }) - self.cmd('az apic api version update -g {resource_group} -s {service_name} --api-name {api_name} --name {api_version} --title "{api_version_title_update}"', + self.cmd('az apic api version update -g {resource_group} -s {service_name} --api-name {api_name} --name {api_version} --title "{api_version_title_update}" -w default', checks=[ self.check('name', self.kwargs['api_version']), self.check('title', self.kwargs['api_version_title_update'])]) @@ -128,7 +128,7 @@ def test_apic_scenarios(self): self.kwargs.update({ 'api_definition_title_update': "CLI Test API Definition 0" }) - self.cmd('az apic api definition update -g {resource_group} -s {service_name} --api-name {api_name} --version {api_version} --name {api_definition_name} --title "{api_definition_title_update}"', + self.cmd('az apic api definition update -g {resource_group} -s {service_name} --api-name {api_name} --version {api_version} --name {api_definition_name} --title "{api_definition_title_update}" -w default', checks=[ self.check('name', self.kwargs['api_definition_name']), self.check('title', self.kwargs['api_definition_title_update'])]) @@ -196,7 +196,7 @@ def test_apic_scenarios(self): self.kwargs.update({ 'deployment_title_update': 'CLI Test Production deployment update' }) - self.cmd('az apic api deployment update -g {resource_group} -s {service_name} --api-name {api_name} --name {deployment_name} --title "{deployment_title_update}"', + self.cmd('az apic api deployment update -g {resource_group} -s {service_name} --api-name {api_name} --name {deployment_name} --title "{deployment_title_update}" -w default', checks=[ self.check('name', self.kwargs['deployment_name']), self.check('title', self.kwargs['deployment_title_update'])]) From ea8db47de26c22eed394663241fc8cd52aef6890 Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Tue, 28 Nov 2023 20:22:51 -0600 Subject: [PATCH 26/27] change print statement to logger --- .../azext_apic_extension/custom.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index 39b6513d9da..f065a96531b 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -225,13 +225,13 @@ def _output(self, *args, **kwargs): arguments = self.ctx.args if result: - print('Results found. Exporting to', arguments.source_profile) + logger.info('Results found. Exporting to %s', arguments.source_profile) response_format = result['format'] exportedResults = result['value'] if response_format == 'link': - print('Fetching metadata from:', exportedResults) + logger.info('Fetching metadata from: %s', exportedResults) getReponse = requests.get(exportedResults, timeout=10) if getReponse.status_code == 200: exportedResults = getReponse.content.decode() @@ -241,7 +241,8 @@ def _output(self, *args, **kwargs): if arguments.source_profile: try: self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) - print('Results exported to', arguments.source_profile) + logger.info('Results exported to %s', arguments.source_profile) + except Exception as e: # pylint: disable=broad-except logger.error('Error while writing the results to the file. Error: %s', e) else: @@ -367,7 +368,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n } CreateAPI(cli_ctx=cmd.cli_ctx)(command_args=api_args) - print("API was created successfully") + logger.info('API was created successfully') # Create API Version ----------------------------------------------------------------------------- from .aaz.latest.apic.api.version import Create as CreateAPIVersion @@ -383,7 +384,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n } CreateAPIVersion(cli_ctx=cmd.cli_ctx)(command_args=api_version_args) - print("API version was created successfully") + logger.info('API version was created successfully') # Create API Definition ----------------------------------------------------------------------------- from .aaz.latest.apic.api.definition import Create as CreateAPIDefinition @@ -400,7 +401,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n } CreateAPIDefinition(cli_ctx=cmd.cli_ctx)(command_args=api_definition_args) - print("API definition was created successfully") + logger.info('API definition was created successfully') # Import Specification ----------------------------------------------------------------------------- from azure.cli.core.commands import LongRunningOperation @@ -425,7 +426,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n importAPISpecificationResults = ImportSpecificationExtension(cli_ctx=cmd.cli_ctx)(command_args=api_specification_args) LongRunningOperation(cmd.cli_ctx)(importAPISpecificationResults) - print("API specification was imported successfully") + logger.info('API specification was created successfully') # Create API Deployment ----------------------------------------------------------------------------- from .aaz.latest.apic.api.deployment import Create as CreateAPIDeployment @@ -477,4 +478,4 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n } CreateAPIDeployment(cli_ctx=cmd.cli_ctx)(command_args=api_deployment_args) - print("API deployment was created successfully") + logger.info('API deployment was created successfully') From 0ceb053ab58f1186b1afff9d73b0fa2fe5fcae0b Mon Sep 17 00:00:00 2001 From: Arpi Shah Date: Tue, 28 Nov 2023 22:30:50 -0600 Subject: [PATCH 27/27] use logger warning --- .../azext_apic_extension/custom.py | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/apic-extension/azext_apic_extension/custom.py b/src/apic-extension/azext_apic_extension/custom.py index f065a96531b..b9d015ded75 100644 --- a/src/apic-extension/azext_apic_extension/custom.py +++ b/src/apic-extension/azext_apic_extension/custom.py @@ -89,13 +89,11 @@ def _output(self, *args, **kwargs): arguments = self.ctx.args if result: - print('Results found. Exporting to', arguments.source_profile) - response_format = result['format'] exportedResults = result['value'] if response_format == 'link': - print('Fetching specification from:', exportedResults) + logger.warning('Fetching specification from: %s', exportedResults) getReponse = requests.get(exportedResults, timeout=10) if getReponse.status_code == 200: exportedResults = getReponse.content.decode() @@ -106,7 +104,7 @@ def _output(self, *args, **kwargs): if arguments.source_profile: try: self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) - logger.info('Results exported to %s', arguments.source_profile) + logger.warning('Results exported to %s', arguments.source_profile) except Exception as e: # pylint: disable=broad-except logger.error('Error while writing the results to the file. Error: %s', e) else: @@ -225,13 +223,10 @@ def _output(self, *args, **kwargs): arguments = self.ctx.args if result: - logger.info('Results found. Exporting to %s', arguments.source_profile) - response_format = result['format'] exportedResults = result['value'] if response_format == 'link': - logger.info('Fetching metadata from: %s', exportedResults) getReponse = requests.get(exportedResults, timeout=10) if getReponse.status_code == 200: exportedResults = getReponse.content.decode() @@ -241,7 +236,7 @@ def _output(self, *args, **kwargs): if arguments.source_profile: try: self.writeResultsToFile(results=exportedResults, file_name=str(arguments.source_profile)) - logger.info('Results exported to %s', arguments.source_profile) + logger.warning('Results exported to %s', arguments.source_profile) except Exception as e: # pylint: disable=broad-except logger.error('Error while writing the results to the file. Error: %s', e) @@ -368,7 +363,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n } CreateAPI(cli_ctx=cmd.cli_ctx)(command_args=api_args) - logger.info('API was created successfully') + logger.warning('API was created successfully') # Create API Version ----------------------------------------------------------------------------- from .aaz.latest.apic.api.version import Create as CreateAPIVersion @@ -384,7 +379,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n } CreateAPIVersion(cli_ctx=cmd.cli_ctx)(command_args=api_version_args) - logger.info('API version was created successfully') + logger.warning('API version was created successfully') # Create API Definition ----------------------------------------------------------------------------- from .aaz.latest.apic.api.definition import Create as CreateAPIDefinition @@ -401,7 +396,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n } CreateAPIDefinition(cli_ctx=cmd.cli_ctx)(command_args=api_definition_args) - logger.info('API definition was created successfully') + logger.warning('API definition was created successfully') # Import Specification ----------------------------------------------------------------------------- from azure.cli.core.commands import LongRunningOperation @@ -426,7 +421,7 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n importAPISpecificationResults = ImportSpecificationExtension(cli_ctx=cmd.cli_ctx)(command_args=api_specification_args) LongRunningOperation(cmd.cli_ctx)(importAPISpecificationResults) - logger.info('API specification was created successfully') + logger.warning('API specification was created successfully') # Create API Deployment ----------------------------------------------------------------------------- from .aaz.latest.apic.api.deployment import Create as CreateAPIDeployment @@ -478,4 +473,4 @@ def register_apic(cmd, api_location, resource_group, service_name, environment_n } CreateAPIDeployment(cli_ctx=cmd.cli_ctx)(command_args=api_deployment_args) - logger.info('API deployment was created successfully') + logger.warning('API deployment was created successfully')