Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Create(AAZCommand):
az apic api create -g contoso-resources -n contoso --api-id echo-api --title "Echo API" --type REST

:example: Create API with custom properties
az apic api create -g contoso-resources -n contoso --api-id echo-api --title "Echo API" --type REST --custom-properties '{\"public-facing\":true}'
az apic api create -g contoso-resources -n contoso --api-id echo-api --title "Echo API" --type REST --custom-properties '{\\"public-facing\\":true}'
"""

_aaz_info = {
Expand Down Expand Up @@ -90,7 +90,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
arg_group="Properties",
help="The contact information for the API.",
)
_args_schema.custom_properties = AAZFreeFormDictArg(
_args_schema.custom_properties = AAZObjectArg(
options=["--custom-properties"],
arg_group="Properties",
help="The custom metadata defined for API catalog entities.",
Expand All @@ -113,7 +113,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["--type"],
arg_group="Properties",
help="Type of API.",
required=True,
enum={"graphql": "graphql", "grpc": "grpc", "rest": "rest", "soap": "soap", "webhook": "webhook", "websocket": "websocket"},
)
_args_schema.license = AAZObjectArg(
Expand All @@ -133,7 +132,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["--title"],
arg_group="Properties",
help="API title.",
required=True,
fmt=AAZStrArgFormat(
max_length=50,
min_length=1,
Expand Down Expand Up @@ -315,12 +313,12 @@ def content(self):
typ=AAZObjectType,
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
)
_builder.set_prop("properties", 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", AAZFreeFormDictType, ".custom_properties")
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, ".type", typ_kwargs={"flags": {"required": True}})
Expand All @@ -338,10 +336,6 @@ def content(self):
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("url", AAZStrType, ".url")

custom_properties = _builder.get(".properties.customProperties")
if custom_properties is not None:
custom_properties.set_anytype_elements(".")

external_documentation = _builder.get(".properties.externalDocumentation")
if external_documentation is not None:
external_documentation.set_elements(AAZObjectType, ".")
Expand Down Expand Up @@ -385,7 +379,7 @@ def _build_schema_on_200_201(cls):
flags={"read_only": True},
)
_schema_on_200_201.properties = AAZObjectType(
flags={"required": True, "client_flatten": True},
flags={"client_flatten": True},
)
_schema_on_200_201.system_data = AAZObjectType(
serialized_name="systemData",
Expand All @@ -397,7 +391,7 @@ def _build_schema_on_200_201(cls):

properties = cls._schema_on_200_201.properties
properties.contacts = AAZListType()
properties.custom_properties = AAZFreeFormDictType(
properties.custom_properties = AAZObjectType(
serialized_name="customProperties",
)
properties.description = AAZStrType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def _build_schema_on_200(cls):
flags={"read_only": True},
)
_schema_on_200.properties = AAZObjectType(
flags={"required": True, "client_flatten": True},
flags={"client_flatten": True},
)
_schema_on_200.system_data = AAZObjectType(
serialized_name="systemData",
Expand All @@ -208,7 +208,7 @@ def _build_schema_on_200(cls):

properties = cls._schema_on_200.properties
properties.contacts = AAZListType()
properties.custom_properties = AAZFreeFormDictType(
properties.custom_properties = AAZObjectType(
serialized_name="customProperties",
)
properties.description = AAZStrType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Update(AAZCommand):

:example: Update custom properties
az apic api update -g contoso-resources -n contoso --api-id echo-api --custom-properties '{\"public-facing\":true}'

:example: Update single custom metadata
az az apic api update -g contoso-resources -n contoso --api-id echo-api --set customProperties.internal=false
"""

_aaz_info = {
Expand Down Expand Up @@ -95,7 +98,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
help="The contact information for the API.",
nullable=True,
)
_args_schema.custom_properties = AAZFreeFormDictArg(
_args_schema.custom_properties = AAZObjectArg(
options=["--custom-properties"],
arg_group="Properties",
help="The custom metadata defined for API catalog entities.",
Expand Down Expand Up @@ -471,12 +474,12 @@ def _update_instance(self, instance):
value=instance,
typ=AAZObjectType
)
_builder.set_prop("properties", 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", AAZFreeFormDictType, ".custom_properties")
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, ".type", typ_kwargs={"flags": {"required": True}})
Expand All @@ -494,10 +497,6 @@ def _update_instance(self, instance):
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("url", AAZStrType, ".url")

custom_properties = _builder.get(".properties.customProperties")
if custom_properties is not None:
custom_properties.set_anytype_elements(".")

external_documentation = _builder.get(".properties.externalDocumentation")
if external_documentation is not None:
external_documentation.set_elements(AAZObjectType, ".")
Expand Down Expand Up @@ -550,7 +549,7 @@ def _build_schema_api_read(cls, _schema):
flags={"read_only": True},
)
api_read.properties = AAZObjectType(
flags={"required": True, "client_flatten": True},
flags={"client_flatten": True},
)
api_read.system_data = AAZObjectType(
serialized_name="systemData",
Expand All @@ -562,7 +561,7 @@ def _build_schema_api_read(cls, _schema):

properties = _schema_api_read.properties
properties.contacts = AAZListType()
properties.custom_properties = AAZFreeFormDictType(
properties.custom_properties = AAZObjectType(
serialized_name="customProperties",
)
properties.description = AAZStrType()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"azext.minCliCoreVersion": "2.57.0"
"azext.minCliCoreVersion": "2.61.0"
}