Κοινή χρήση μέσω


az apic metadata

Note

This reference is part of the apic-extension extension for the Azure CLI (version 2.57.0 or higher). The extension will automatically install the first time you run an az apic metadata command. Learn more about extensions.

Commands to manage metadata schemas in API Center.

Commands

Name Description Type Status
az apic metadata create

Create a new metadata schema or update an existing metadata schema.

Extension GA
az apic metadata delete

Delete specified metadata schema.

Extension GA
az apic metadata export

Exports the metadata schema.

Extension GA
az apic metadata list

List a collection of metadata schemas.

Extension GA
az apic metadata show

Get details of the metadata schema.

Extension GA
az apic metadata update

Update existing metadata schema.

Extension GA

az apic metadata create

Create a new metadata schema or update an existing metadata schema.

az apic metadata create --assignments
                        --metadata-name
                        --resource-group
                        --schema
                        --service-name

Examples

Create metadata example 1

az apic metadata create --resource-group api-center-test --service-name contoso --metadata-name "test1" --schema '{"type":"string", "title":"First name", "pattern": "^[a-zA-Z0-9]+$"}' --assignments '[{entity:api,required:true,deprecated:false}]'

Create metadata example 2

az apic metadata create --resource-group api-center-test --service-name contoso  --metadata-name testregion --schema '{"type":"string","title":"testregion","oneOf":[{"const":"Region1","description":""},{"const":"Region2","description":""},{"const":"Region3","description":""}]}' --assignments '[{entity:api,required:true,deprecated:false},{entity:environment,required:true,deprecated:false}]'

Create metadata using json file schema and assignments example

az apic metadata create --resource-group api-center-test --service-name contoso --metadata-name "test" --schema '@schema.json' --assignments '@assignments.json'

Required Parameters

--assignments

Defines the assignment scope for the custom metadata, e.g. "[{entity:api,required:true,deprecated:false}]". The available entity values are: api, deployment, environment. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Property Value
Parameter group: Properties Arguments
--metadata-name

The name of the metadata schema.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--schema

JSON schema defining the type.

Property Value
Parameter group: Properties Arguments
--service-name -n

The name of Azure API Center service.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az apic metadata delete

Delete specified metadata schema.

az apic metadata delete [--ids]
                        [--metadata-name]
                        [--resource-group]
                        [--service-name]
                        [--subscription]
                        [--yes]

Examples

Delete Metadata Schema

az apic metadata delete --resource-group api-center-test --service-name contoso --metadata-name "test1"

Delete schema

az apic metadata delete -g api-center-test -n contosoeuap --metadata-name "approver"

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

Property Value
Parameter group: Resource Id Arguments
--metadata-name

The name of the metadata schema.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Property Value
Parameter group: Resource Id Arguments
--service-name -n

The name of Azure API Center service.

Property Value
Parameter group: Resource Id Arguments
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Property Value
Parameter group: Resource Id Arguments
--yes -y

Do not prompt for confirmation.

Property Value
Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az apic metadata export

Exports the metadata schema.

az apic metadata export --assignments {api, deployment, environment}
                        --file-name
                        [--custom-metadata-only {0, 1, f, false, n, no, t, true, y, yes}]
                        [--ids]
                        [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                        [--resource-group]
                        [--service-name]
                        [--subscription]

Examples

Export Metadata Schema assigned to api

az apic metadata export -g api-center-test -n contosoeuap --assignments api --file-name filename.json

Export Metadata Schema assigned to deployment

az apic metadata export -g api-center-test -n contosoeuap --assignments deployment --file-name filename.json

Export Metadata Schema assigned to environment

az apic metadata export -g api-center-test -n contosoeuap --assignments environment --file-name filename.json

Export Custom Metadata Schema Only

az apic metadata export -g api-center-test -n contosoeuap --assignments api --file-name filename.json --custom-metadata-only

Required Parameters

--assignments

An entity the metadata schema is requested for.

Property Value
Parameter group: Payload Arguments
Accepted values: api, deployment, environment
--file-name

Name of the file where to export the metadata schema to.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--custom-metadata-only

Export only custom metadata.

Property Value
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

Property Value
Parameter group: Resource Id Arguments
--no-wait

Do not wait for the long-running operation to finish.

Property Value
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Property Value
Parameter group: Resource Id Arguments
--service-name -n

The name of the API Center service.

Property Value
Parameter group: Resource Id Arguments
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az apic metadata list

List a collection of metadata schemas.

az apic metadata list --resource-group
                      --service-name
                      [--filter]
                      [--max-items]
                      [--next-token]

Examples

List schemas

az apic metadata list -g api-center-test -n contosoeuap

Required Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--service-name -n

The name of Azure API Center service.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--filter

OData filter parameter.

--max-items

Total number of items to return in the command's output. If the total number of items available is more than the value specified, a token is provided in the command's output. To resume pagination, provide the token value in --next-token argument of a subsequent command.

Property Value
Parameter group: Pagination Arguments
--next-token

Token to specify where to start paginating. This is the token value from a previously truncated response.

Property Value
Parameter group: Pagination Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az apic metadata show

Get details of the metadata schema.

az apic metadata show [--ids]
                      [--metadata-name]
                      [--resource-group]
                      [--service-name]
                      [--subscription]

Examples

Show schema details 1

az apic metadata show -g api-center-test -n contosoeuap --metadata-name approver

Show schema details 2

az apic metadata show --resource-group api-center-test --service-name contoso --metadata-name "testchoices"

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

Property Value
Parameter group: Resource Id Arguments
--metadata-name

The name of the metadata schema.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Property Value
Parameter group: Resource Id Arguments
--service-name -n

The name of Azure API Center service.

Property Value
Parameter group: Resource Id Arguments
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az apic metadata update

Update existing metadata schema.

az apic metadata update [--add]
                        [--assignments]
                        [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                        [--ids]
                        [--metadata-name]
                        [--remove]
                        [--resource-group]
                        [--schema]
                        [--service-name]
                        [--set]
                        [--subscription]

Examples

Update schema

az apic metadata update --resource-group api-center-test --service-name contoso --metadata-name "test1" --schema '{"type":"string", "title":"Last name", "pattern": "^[a-zA-Z0-9]+$"}'

Update schema using schema json file

az apic metadata update --resource-group api-center-test --service-name contoso --metadata-name "test1" --schema '@schema.json'

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

Property Value
Parameter group: Generic Update Arguments
--assignments

Defines the assignment scope for the custom metadata, e.g. "[{entity:api,required:true,deprecated:false}]". The available entity values are: api, deployment, environment. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Property Value
Parameter group: Properties Arguments
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

Property Value
Parameter group: Generic Update Arguments
Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

Property Value
Parameter group: Resource Id Arguments
--metadata-name

The name of the metadata schema.

Property Value
Parameter group: Resource Id Arguments
--remove

Remove a property or an element from a list. Example: --remove property.list <indexToRemove> OR --remove propertyToRemove.

Property Value
Parameter group: Generic Update Arguments
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Property Value
Parameter group: Resource Id Arguments
--schema

YAML schema defining the type.

Property Value
Parameter group: Properties Arguments
--service-name -n

The name of Azure API Center service.

Property Value
Parameter group: Resource Id Arguments
--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=<value>.

Property Value
Parameter group: Generic Update Arguments
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False