Skip to content

Commit

Permalink
[Logic] az logic workflow: Add new command group identity to supp…
Browse files Browse the repository at this point in the history
…ort managing identity (#7029)
  • Loading branch information
Jing-song authored Dec 1, 2023
1 parent 24dd60c commit 8cf7a07
Show file tree
Hide file tree
Showing 109 changed files with 7,604 additions and 37,022 deletions.
5 changes: 5 additions & 0 deletions src/logic/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
===============

1.0.0
++++++
* Add new command group `az logic workflow identity` to support managing identity
* `az logic workflow identity`: Add new parameters `--mi-system-assigned` `--mi-user-assigned` to support managing identity

0.1.7
++++++
* Add new command group `az logic integration-account map` to support manage integration account map
Expand Down
35 changes: 11 additions & 24 deletions src/logic/azext_logic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
# --------------------------------------------------------------------------------------------
# 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_logic.generated._help import helps # pylint: disable=unused-import
try:
from azext_logic.manual._help import helps # pylint: disable=reimported
except ImportError:
pass
from azext_logic._help import helps # pylint: disable=unused-import


class LogicManagementClientCommandsLoader(AzCommandsLoader):
class LogicCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_logic.generated._client_factory import cf_logic
logic_custom = CliCommandType(
operations_tmpl='azext_logic.custom#{}',
client_factory=cf_logic)
super().__init__(cli_ctx=cli_ctx, custom_command_type=logic_custom)
custom_command_type = CliCommandType(
operations_tmpl='azext_logic.custom#{}')
super().__init__(cli_ctx=cli_ctx,
custom_command_type=custom_command_type)

def load_command_table(self, args):
from azext_logic.generated.commands import load_command_table
from azext_logic.commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
Expand All @@ -35,21 +32,11 @@ def load_command_table(self, args):
args=args
)
load_command_table(self, args)
try:
from azext_logic.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
return self.command_table

def load_arguments(self, command):
from azext_logic.generated._params import load_arguments
from azext_logic._params import load_arguments
load_arguments(self, command)
try:
from azext_logic.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = LogicManagementClientCommandsLoader
COMMAND_LOADER_CLS = LogicCommandsLoader
Original file line number Diff line number Diff line change
@@ -1,12 +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=too-many-lines

from knack.help_files import helps
# pylint: disable=line-too-long
# pylint: disable=too-many-lines

helps['logic'] = """
type: group
short-summary: Manage Logic
"""
from knack.help_files import helps # pylint: disable=unused-import
Original file line number Diff line number Diff line change
@@ -1,12 +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=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError:
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements


def load_arguments(self, _): # pylint: disable=unused-argument
pass
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
# flake8: noqa

from .__cmd_group import *
from ._create import *
from ._delete import *
from ._list import *
from ._show import *
from ._update import *
268 changes: 268 additions & 0 deletions src/logic/azext_logic/aaz/latest/logic/integration_account/_create.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
# --------------------------------------------------------------------------------------------
# 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(
"logic integration-account create",
)
class Create(AAZCommand):
"""Create an integration account.
:example: Create integration account
az logic integration-account create --sku Standard --name integration-account-name --resource-group rg
"""

_aaz_info = {
"version": "2019-05-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.logic/integrationaccounts/{}", "2019-05-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.name = AAZStrArg(
options=["-n", "--name"],
help="The integration account name.",
required=True,
)
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
)
_args_schema.location = AAZResourceLocationArg(
help="The resource location.",
fmt=AAZResourceLocationArgFormat(
resource_group_arg="resource_group",
),
)
_args_schema.integration_service_environment = AAZObjectArg(
options=["--integration-service-environment"],
help="The integration service environment.",
)
_args_schema.state = AAZStrArg(
options=["--state"],
help="The workflow state.",
enum={"Completed": "Completed", "Deleted": "Deleted", "Disabled": "Disabled", "Enabled": "Enabled", "NotSpecified": "NotSpecified", "Suspended": "Suspended"},
)
_args_schema.sku = AAZStrArg(
options=["--sku"],
help="The sku name.",
enum={"Basic": "Basic", "Free": "Free", "NotSpecified": "NotSpecified", "Standard": "Standard"},
)
_args_schema.tags = AAZDictArg(
options=["--tags"],
help="The resource tags.",
)

integration_service_environment = cls._args_schema.integration_service_environment
integration_service_environment.id = AAZStrArg(
options=["id"],
help="The resource id.",
)

tags = cls._args_schema.tags
tags.Element = AAZStrArg()
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
self.IntegrationAccountsCreateOrUpdate(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 IntegrationAccountsCreateOrUpdate(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.Logic/integrationAccounts/{integrationAccountName}",
**self.url_parameters
)

@property
def method(self):
return "PUT"

@property
def error_format(self):
return "ODataV4Format"

@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"integrationAccountName", self.ctx.args.name,
required=True,
),
**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", "2019-05-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("location", AAZStrType, ".location")
_builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
_builder.set_prop("sku", AAZObjectType)
_builder.set_prop("tags", AAZDictType, ".tags")

properties = _builder.get(".properties")
if properties is not None:
properties.set_prop("integrationServiceEnvironment", AAZObjectType, ".integration_service_environment")
properties.set_prop("state", AAZStrType, ".state")

integration_service_environment = _builder.get(".properties.integrationServiceEnvironment")
if integration_service_environment is not None:
integration_service_environment.set_prop("id", AAZStrType, ".id")

sku = _builder.get(".sku")
if sku is not None:
sku.set_prop("name", AAZStrType, ".sku", typ_kwargs={"flags": {"required": 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.location = AAZStrType()
_schema_on_200_201.name = AAZStrType(
flags={"read_only": True},
)
_schema_on_200_201.properties = AAZObjectType(
flags={"client_flatten": True},
)
_schema_on_200_201.sku = AAZObjectType()
_schema_on_200_201.tags = AAZDictType()
_schema_on_200_201.type = AAZStrType(
flags={"read_only": True},
)

properties = cls._schema_on_200_201.properties
properties.integration_service_environment = AAZObjectType(
serialized_name="integrationServiceEnvironment",
)
properties.state = AAZStrType()

integration_service_environment = cls._schema_on_200_201.properties.integration_service_environment
integration_service_environment.id = AAZStrType()
integration_service_environment.name = AAZStrType(
flags={"read_only": True},
)
integration_service_environment.type = AAZStrType(
flags={"read_only": True},
)

sku = cls._schema_on_200_201.sku
sku.name = AAZStrType(
flags={"required": True},
)

tags = cls._schema_on_200_201.tags
tags.Element = AAZStrType()

return cls._schema_on_200_201


class _CreateHelper:
"""Helper class for Create"""


__all__ = ["Create"]
Loading

0 comments on commit 8cf7a07

Please sign in to comment.