Skip to content

Commit dcee6ba

Browse files
blackchoeyjukasper
andauthored
apic-extension GA release (Azure#7677)
* build: add cicd pipeline (#7) * build: move update version logic to workflow (#8) * build: Run CI on multiple python version (Azure#38) * build: Run CI in Python 3.8-3.11 * build: remove pull request event for CI to avoid duplicate runs * test: add test cases for commands (Azure#40) * fix: error when register API with long description spec (Azure#41) * test: add test cases for optional parameters (Azure#42) * feat!: remove file name param (Azure#43) * fix: error not thrown when import spec with >3MB file (Azure#44) * feat!: remove state param for deployment commands (Azure#46) * fix: API title created by register command is not same with provided spec (Azure#47) * feat!: redesign parameters to specify APIM instance for import-from-apim command (Azure#45) * test: clean up legacy test cases (Azure#48) * test: add test cases for command examples (Azure#49) * docs: update help message per feedback (Azure#50) * build: bump version to 1.0.0 and add changelog (Azure#51) * fix: some parameters should be required in import-specification and deployment command (Azure#53) * feat!: rename parameter names to align with other Azure CLI command experience (Azure#52) * test: enable test for import-from-apim (Azure#54) * test: fix show service test case (Azure#55) * docs: update changelog for 1.0.0 (Azure#56) * Update HISTORY.rst - jukasper updated changelog * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * Update HISTORY.rst * docs: update readme for apic-extension (#57) * fix: cannot run create command against existing resource (Azure#58) * fix: cannot run create command against existing resource * style: fix style * build: remove cicd pipeline (Azure#59) * build: resolve review comments (Azure#60) --------- Co-authored-by: Julia Kasper <[email protected]>
1 parent 01d7a7b commit dcee6ba

File tree

188 files changed

+24366
-4959
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+24366
-4959
lines changed

src/apic-extension/HISTORY.rst

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,34 @@
33
Release History
44
===============
55

6+
1.0.0
7+
++++++++++++++++++
8+
Potential Impact: The changes in this release, including the renaming of commands and parameters, may require changes to existing scripts and integrations. Please review the changes carefully and update your code accordingly.
9+
10+
**Updates:**
11+
12+
* Redesigned ``az apic service import-from-apim`` command for an easier specification of APIM instances.
13+
* [BREAKING CHANGE] Renamed ``az apic service *`` commands to ``az apic *`` commands.
14+
* [BREAKING CHANGE] Renamed ``--name/--service/--service-name/-s`` parameters in ``az apic *`` commands to ``--name/-n``.
15+
* [BREAKING CHANGE] Renamed ``--service/--service-name/-s`` parameters in subcommands to ``--service-name/-n``.
16+
* [BREAKING CHANGE] Renamed ``--metadata-schema/--metadata-schema-name/--name`` parameters in ``az apic metadata *`` commands to ``--metadata-name``.
17+
* [BREAKING CHANGE] Renamed ``--environment-name`` parameter in ``az apic api register`` command to ``--environment-id``.
18+
19+
**Fixes:**
20+
21+
* Ensured API title created by ``register`` command matches the provided specification.
22+
* Addressed the non-throwing of errors when importing specifications with files larger than 3MB.
23+
* Resolved errors occurring when registering APIs with long descriptions in the specification.
24+
* [BREAKING CHANGE] Made ``--definition-id``, ``--environment-id``, ``--server``, ``--title`` parameters mandatory in ``az apic api deployment create`` command.
25+
* [BREAKING CHANGE] Made ``--format``, ``--specification``, ``--value`` parameters mandatory in ``az apic api definition import-specification`` command.
26+
27+
**Removals:**
28+
29+
* Removed ``--state`` parameter from ``az apic api deployment`` commands.
30+
* [BREAKING CHANGE] Eliminated ``--file-name`` parameter for ``az apic api definition import-specification``, ``az apic metadata create``, and ``az apic metadata update`` commands. Introduced usage of the ``@filename`` syntax for reading parameter values from a file directly in Azure CLI.
31+
632
1.0.0b5
7-
+++++
33+
++++++++++++++++++
834
* Add: Support yaml file for `az apic api register` command.
935
* Update: Command names, parameter names, and command descriptions for better understanding. Please leverage `-h` option or refer Azure CLI reference doc to see full list of commands and parameters.
1036
* Update: Introduction to parameter constraints to ensure that valid values are provided.
@@ -15,17 +41,17 @@ Release History
1541
* Remove: `head` commands in each command group are removed.
1642

1743
1.0.0b4
18-
+++++
44+
++++++++++++++++++
1945
* Add: Support for Default Portal configuration and default hostname provisoning deprovisioning commands
2046

2147
1.0.0b3
22-
+++++
48+
++++++++++++++++++
2349
* Add: Support for Import from apim command along with add examples for create service
2450

2551
1.0.0b2
26-
++++++
52+
++++++++++++++++++
2753
* Remove: All workspace cli commands as it should not be exposed to customers just yet.
2854

2955
1.0.0b1
30-
++++++
31-
* Initial release.
56+
++++++++++++++++++
57+
* Initial release.

src/apic-extension/README.md

Lines changed: 10 additions & 271 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# Azure CLI APICenter Extension
1+
# Azure CLI API Center Extension
22

3-
This extension can help create and manage APICenter Resources
3+
*This extension can help create and manage API Center Resources.*
4+
5+
**Azure API Center** enables tracking all of your APIs in a centralized location for discovery, reuse, and governance. Use an API center to develop and maintain a structured and organized inventory of your organization's APIs - regardless of their type, lifecycle stage, or deployment location - along with related information such as version details, API definition files, and common metadata.
6+
See [Azure API Center documentation](https://learn.microsoft.com/azure/api-center/overview) for more information.
47

58
### How to use
69
Install this extension using the below CLI command
@@ -9,274 +12,10 @@ az extension add --name apic-extension
912
```
1013

1114
### API Center Extension Info
12-
APICenter documentation: https://learn.microsoft.com/en-us/azure/api-center/
13-
14-
List Service Examples
15-
```
16-
az apic service show --resource-group api-center-test
17-
```
18-
```
19-
az apic service show -g api-center-test
20-
```
21-
22-
Show service Examples
23-
```
24-
az apic service show --resource-group api-center-test --service-name contosoeuap
25-
```
26-
```
27-
az apic service show -g api-center-test -s contosoeuap
28-
```
29-
30-
Delete Service Examples
31-
```
32-
az apic service delete --resource-group api-center-test --service-name contosoeuap
33-
```
34-
```
35-
az apic service delete --resource-group arpi-test-rg1 -s apictestcli3
36-
```
37-
38-
Create API Examples
39-
```
40-
az apic api create -g api-center-test -s contosoeuap --name echo-api --title "Echo API" --kind "rest"
41-
```
42-
```
43-
az apic api create --resource-group api-center-test --service-name contosoeuap --api-name echo-api2 --description "CLI Test" --kind rest --title "Echo API"
44-
```
45-
46-
Update API Examples
47-
```
48-
az apic api update -g api-center-test -s contosoeuap --name echo-api --summary "Basic REST API service"
49-
```
50-
```
51-
az apic api update --resource-group api-center-test -s contosoeuap --name echo-api --summary "Basic REST API service"
52-
```
53-
54-
LIST Api Example
55-
```
56-
az apic api list --resource-group api-center-test --service-name contosoeuap
57-
```
58-
```
59-
az apic api list -g api-center-test -s contosoeuap
60-
```
61-
62-
SHOW Api Examples
63-
```
64-
az apic api show -g api-center-test -s contosoeuap --name echo-api
65-
```
66-
```
67-
az apic api show --resource-group api-center-test --service-name contosoeuap -w default --api echo-api
68-
```
69-
70-
Delete API Examples
71-
```
72-
az apic api delete -g api-center-test -s contosoeuap --name echo-api
73-
```
74-
```
75-
az apic api delete --resource-group contoso-resources --service-name contosoeuap --name echo-api
76-
```
77-
78-
CREATE Api Version Examples
79-
```
80-
az apic api version create -g api-center-test -s contosoeuap --api-name echo-api --name 2023-01-01 --title "2023-01-01"
81-
```
82-
```
83-
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"
84-
```
85-
86-
UPDATE Api Version Examples
87-
```
88-
Az apic api version update -g api-center-test -s contosoeuap --api-name echo-api --name 2023-01-01 --title "2023-01-01"
89-
```
90-
```
91-
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"
92-
```
93-
94-
LIST Api Version Examples
95-
```
96-
az apic api version list -g api-center-test -s contosoeuap --api-name echo-api
97-
```
98-
```
99-
az apic api version list --resource-group api-center-test --service-name contosoeuap --api-name echo-api
100-
```
101-
102-
SHOW Api Version Example
103-
```
104-
az apic api version show -g api-center-test -s contosoeuap --api-name echo-api --name 2023-01-01
105-
```
106-
```
107-
az apic api version show --resource-group api-center-test --service-name contosoeuap --api-name echo-api --name 2023-01-01
108-
```
109-
110-
DELETE Api Version Example
111-
```
112-
az apic api version delete -g api-center-test -s contosoeuap --api-name echo-api --name 2023-01-01
113-
```
114-
```
115-
az apic api version delete --resource-group api-center-test --service-name contosoeuap --api-name echo-api --name 2023-01-01
116-
```
117-
118-
CREATE API Definition Example
119-
```
120-
az apic api definition create -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi" --title "OpenAPI"
121-
```
122-
123-
UPDATE API Definition Example
124-
```
125-
az apic api definition update -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi" --title "OpenAPI"
126-
```
127-
128-
SHOW API Definition Example
129-
```
130-
az apic api definition show -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi"
131-
```
132-
133-
LIST API Definition Example
134-
```
135-
az apic api definition list -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01
136-
```
137-
138-
DELETE API Definition Example
139-
```
140-
az apic api definition delete -g api-center-test -s contosoeuap --api-name echo-api --version 2023-01-01 --name "openapi"
141-
```
142-
143-
IMPORT Specification Examples
144-
Import Specification inline option
145-
```
146-
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"}'
147-
```
148-
149-
Import Specification Inline option where spec is provided by sending a file
150-
```
151-
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
152-
```
153-
154-
Import Specification Link option where spec is provided via a link
155-
```
156-
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"}'
157-
```
158-
159-
Export Specification Examples
160-
Export Spec to a file
161-
```
162-
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
163-
```
164-
165-
CREATE Api Deployment
166-
167-
```
168-
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"
169-
where examples/deplcreate.json contains
170-
{"runtime-uri": ["https://api.contoso.com"]}
171-
```
172-
173-
UPDATE Api Deployment
174-
```
175-
az apic api deployment update -g api-center-test -s contosoeuap --name production --title "Production deployment 10" --api echo-api –w default
176-
```
177-
178-
LIST Api Deployment
179-
```
180-
az apic api deployment list -g api-center-test -s contosoeuap --api-name echo-api
181-
```
182-
183-
SHOW Api Deployment
184-
```
185-
az apic api deployment show -g api-center-test -s contosoeuap --name production --api-name echo-api
186-
```
187-
188-
DELETE Api Deployment
189-
```
190-
Az apic api deployment delete -g api-center-test -s contosoeuap --name production --api-name echo-api
191-
```
192-
193-
CREATE Environment
194-
```
195-
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"
196-
Where envcreate1.json contains
197-
{
198-
"type": "Azure API Management",
199-
"managementPortalUri": [
200-
"management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ApiManagement/service/my-api-management-service"
201-
]
202-
}
203-
```
204-
205-
UPDATE Environment
206-
```
207-
az apic environment update -g api-center-test -s contosoeuap --name public --title "Public cloud"
208-
```
209-
210-
LIST Environment
211-
```
212-
az apic environment list -g api-center-test -s contosoeuap
213-
```
15+
API Center CLI documentation: [https://learn.microsoft.com/cli/azure/api-center/](https://learn.microsoft.com/cli/azure/service-page/api%20center?view=azure-cli-latest)
21416

215-
SHOW Environment
216-
```
217-
az apic environment show -g api-center-test -s contosoeuap --name public
218-
```
17+
### Tutorials
21918

220-
DELETE Environment
221-
```
222-
az apic environment delete -g api-center-test -s contosoeuap --name public
223-
```
224-
225-
CREATE Metadata Schema
226-
```
227-
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"
228-
Where schemacreate.json contains metadata schema
229-
{
230-
"type": "string",
231-
"title": "First name",
232-
"pattern": "^[a-zA-Z0-9 ]+$"
233-
}
234-
```
235-
236-
UPDATE Metadata Schema
237-
```
238-
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"
239-
Where schemaupdate.json contains metadata schema
240-
{
241-
"type": "string",
242-
"title": "Last name",
243-
"pattern": "^[a-zA-Z0-9 ]+$"
244-
}
245-
```
246-
247-
LIST Metadata Schema
248-
```
249-
az apic metadata-schema list -g api-center-test -s contosoeuap
250-
```
251-
252-
SHOW Metadata Schema
253-
```
254-
az apic metadata-schema show --resource-group api-center-test --service-name contosoeuap --name "test1"
255-
```
256-
257-
DELETE Metadata Schema
258-
```
259-
az apic metadata-schema delete --resource-group api-center-test --service-name contosoeuap --name "test1"
260-
```
261-
262-
EXPORT Metadata Schema
263-
EXPORT Metadata Schema assigned to an API
264-
```
265-
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
266-
```
267-
268-
EXPORT Metadata Schema assigned to a Deployment
269-
```
270-
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
271-
```
272-
273-
EXPORT Metadata Schema assigned to an Environment
274-
```
275-
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
276-
```
277-
278-
Register API or Quick Add
279-
```
280-
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
281-
az apic api register -g api-center-test -s contosoeuap --api-location "C:/Users/arpishah/examples/cli-examples/spec-examples/openai.yml" --environment-name public
282-
```
19+
* [Use the Azure CLI to manage your API inventory](https://learn.microsoft.com/azure/api-center/manage-apis-azure-cli)
20+
* [Register API, API version, and definition](https://learn.microsoft.com/azure/api-center/manage-apis-azure-cli#register-api-api-version-and-definition)
21+
* [Import APIs to your API center from Azure API Management](https://learn.microsoft.com/azure/api-center/import-api-management-apis)

src/apic-extension/azext_apic_extension/_help.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212

1313
helps['apic api register'] = """
1414
type: command
15-
short-summary: Registers a new API with version, definition, and associated deployments using the specification file as the source of truth.
15+
short-summary: Registers a new API with version, definition, and associated deployments using the specification file as the source of truth. For now we only support OpenAPI JSON/YAML format.
1616
parameters:
1717
- name: --api-location -l
1818
type: string
1919
short-summary: Location of spec file.
2020
- name: --resource-group -g
2121
type: string
2222
short-summary: Resource group name.
23-
- name: --service -s
23+
- name: --service-name -n
2424
type: string
2525
short-summary: APICenter Catalog or Service name.
26-
- name: --environment-name -e
26+
- name: --environment-id
2727
type: string
28-
short-summary: Name of environment created before.
28+
short-summary: Id of environment created before.
2929
examples:
3030
- name: Register api by providing spec file.
3131
text: |
32-
az apic api register -g api-center-test -s contosoeuap --api-location "examples/cli-examples/spec-examples/openai.json" --environment-name public
33-
az apic api register -g api-center-test -s contosoeuap --api-location "examples/cli-examples/spec-examples/openai.yml" --environment-name public
32+
az apic api register -g api-center-test -n contosoeuap --api-location "examples/cli-examples/spec-examples/openai.json" --environment-id public
33+
az apic api register -g api-center-test -n contosoeuap --api-location "examples/cli-examples/spec-examples/openai.yml" --environment-id public
3434
"""

0 commit comments

Comments
 (0)