Skip to content

Commit

Permalink
[Logic] az logic workflow: Fix the issue with parameters in `--de…
Browse files Browse the repository at this point in the history
…finition` not working (Azure#7132)
  • Loading branch information
Jing-song authored and ddouglas-msft committed Jan 10, 2024
1 parent 7ff91e9 commit c8ff517
Show file tree
Hide file tree
Showing 14 changed files with 434 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/logic/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

1.0.1
++++++
* `az logic workflow`: Fix the issue with `parameters` in `--definition` not working

1.0.0
++++++
* Add new command group `az logic workflow identity` to support managing identity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"logic integration-account list",
)
class List(AAZCommand):
"""List a list of integration accounts by subscription.
"""List integration accounts
:example: List integration accounts by resource group name
az logic integration-account list --resource-group rg
Expand Down
11 changes: 10 additions & 1 deletion src/logic/azext_logic/aaz/latest/logic/workflow/_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
_args_schema.definition = AAZFreeFormDictArg(
options=["--definition"],
help="The definition.",
blank={},
)
_args_schema.endpoints_configuration = AAZObjectArg(
options=["--endpoints-configuration"],
Expand All @@ -83,6 +82,10 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["--integration-service-environment"],
help="The integration service environment.",
)
_args_schema.parameters = AAZFreeFormDictArg(
options=["--parameters"],
help="The parameters.",
)
_args_schema.state = AAZStrArg(
options=["--state"],
help="The state.",
Expand Down Expand Up @@ -487,6 +490,7 @@ def content(self):
properties.set_prop("endpointsConfiguration", AAZObjectType, ".endpoints_configuration")
properties.set_prop("integrationAccount", AAZObjectType, ".integration_account")
properties.set_prop("integrationServiceEnvironment", AAZObjectType, ".integration_service_environment")
properties.set_prop("parameters", AAZFreeFormDictType, ".parameters")
properties.set_prop("state", AAZStrType, ".state")

access_control = _builder.get(".properties.accessControl")
Expand Down Expand Up @@ -695,6 +699,10 @@ def content(self):
if integration_service_environment is not None:
integration_service_environment.set_prop("id", AAZStrType, ".id")

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

tags = _builder.get(".tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
Expand Down Expand Up @@ -792,6 +800,7 @@ def _build_schema_on_200_201(cls):
serialized_name="integrationServiceEnvironment",
)
_CreateHelper._build_schema_resource_reference_read(properties.integration_service_environment)
properties.parameters = AAZFreeFormDictType()
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
)
Expand Down
4 changes: 3 additions & 1 deletion src/logic/azext_logic/aaz/latest/logic/workflow/_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"logic workflow list",
)
class List(AAZCommand):
"""List a list of workflows by subscription.
"""List workflows
:example: List all workflows in a resource group
az logic workflow list --resource-group rg
Expand Down Expand Up @@ -248,6 +248,7 @@ def _build_schema_on_200(cls):
serialized_name="integrationServiceEnvironment",
)
_ListHelper._build_schema_resource_reference_read(properties.integration_service_environment)
properties.parameters = AAZFreeFormDictType()
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
)
Expand Down Expand Up @@ -448,6 +449,7 @@ def _build_schema_on_200(cls):
serialized_name="integrationServiceEnvironment",
)
_ListHelper._build_schema_resource_reference_read(properties.integration_service_environment)
properties.parameters = AAZFreeFormDictType()
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
)
Expand Down
3 changes: 2 additions & 1 deletion src/logic/azext_logic/aaz/latest/logic/workflow/_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"logic workflow show",
)
class Show(AAZCommand):
"""Get a workflow.
"""Show a workflow.
:example: Show workflow
az logic workflow show --resource-group rg --name workflow
Expand Down Expand Up @@ -226,6 +226,7 @@ def _build_schema_on_200(cls):
serialized_name="integrationServiceEnvironment",
)
_ShowHelper._build_schema_resource_reference_read(properties.integration_service_environment)
properties.parameters = AAZFreeFormDictType()
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
)
Expand Down
12 changes: 11 additions & 1 deletion src/logic/azext_logic/aaz/latest/logic/workflow/_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["--definition"],
help="The definition.",
nullable=True,
blank={},
)
_args_schema.endpoints_configuration = AAZObjectArg(
options=["--endpoints-configuration"],
Expand All @@ -93,6 +92,11 @@ def _build_arguments_schema(cls, *args, **kwargs):
help="The integration service environment.",
nullable=True,
)
_args_schema.parameters = AAZFreeFormDictArg(
options=["--parameters"],
help="The parameters.",
nullable=True,
)
_args_schema.state = AAZStrArg(
options=["--state"],
help="The state.",
Expand Down Expand Up @@ -711,6 +715,7 @@ def _update_instance(self, instance):
properties.set_prop("endpointsConfiguration", AAZObjectType, ".endpoints_configuration")
properties.set_prop("integrationAccount", AAZObjectType, ".integration_account")
properties.set_prop("integrationServiceEnvironment", AAZObjectType, ".integration_service_environment")
properties.set_prop("parameters", AAZFreeFormDictType, ".parameters")
properties.set_prop("state", AAZStrType, ".state")

access_control = _builder.get(".properties.accessControl")
Expand Down Expand Up @@ -919,6 +924,10 @@ def _update_instance(self, instance):
if integration_service_environment is not None:
integration_service_environment.set_prop("id", AAZStrType, ".id")

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

tags = _builder.get(".tags")
if tags is not None:
tags.set_elements(AAZStrType, ".")
Expand Down Expand Up @@ -1144,6 +1153,7 @@ def _build_schema_workflow_read(cls, _schema):
serialized_name="integrationServiceEnvironment",
)
cls._build_schema_resource_reference_read(properties.integration_service_environment)
properties.parameters = AAZFreeFormDictType()
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ def _build_schema_workflow_read(cls, _schema):
serialized_name="integrationServiceEnvironment",
)
cls._build_schema_resource_reference_read(properties.integration_service_environment)
properties.parameters = AAZFreeFormDictType()
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ def _build_schema_workflow_read(cls, _schema):
serialized_name="integrationServiceEnvironment",
)
cls._build_schema_resource_reference_read(properties.integration_service_environment)
properties.parameters = AAZFreeFormDictType()
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
)
Expand Down
4 changes: 4 additions & 0 deletions src/logic/azext_logic/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
"/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{}")
)
args_schema.identity._registered = False
args_schema.parameters._registered = False
return args_schema

def pre_operations(self):
Expand All @@ -142,6 +143,7 @@ def pre_operations(self):
raise RequiredArgumentMissingError("--definition does not contain a 'definition' key")
definition = args.definition.to_serialized_data()
args.access_control = definition.get('accessControl', args.access_control)
args.parameters = definition.get('parameters', None)
args.definition = definition['definition']
if args.mi_system_assigned:
args.identity.type = "SystemAssigned"
Expand All @@ -165,6 +167,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
args_schema.integration_service_environment._registered = False
args_schema.integration_account._registered = False
args_schema.access_control._registered = False
args_schema.parameters._registered = False
return args_schema

def pre_operations(self):
Expand All @@ -175,6 +178,7 @@ def pre_operations(self):
definition = args.definition.to_serialized_data()
args.definition = definition['definition']
args.access_control = definition.get('accessControl', args.access_control)
args.parameters = definition.get('parameters', None)

def pre_instance_update(self, instance):
self.ctx.args.location = instance.location
Expand Down
Loading

0 comments on commit c8ff517

Please sign in to comment.