Updating api version and changing namespace commands to scheduler (#8362)
* Updating api version and changing namespace commands to scheduler Signed-off-by: Ryan Lettieri <ryanLettieri@microsoft.com> * Updating some docs and upgrading version Signed-off-by: Ryan Lettieri <ryanLettieri@microsoft.com> * Expanding sku into 2 separate arguments Signed-off-by: Ryan Lettieri <ryanLettieri@microsoft.com> --------- Signed-off-by: Ryan Lettieri <ryanLettieri@microsoft.com>
This commit is contained in:
Родитель
d157fbeca7
Коммит
a4d59c7b1b
|
@ -6,3 +6,8 @@ Release History
|
|||
1.0.0b1
|
||||
++++++
|
||||
* Initial release.
|
||||
|
||||
1.0.0b2
|
||||
++++++
|
||||
* Updating name of subresource from namespace to scheduler.
|
||||
* Adding support for tags in scheduler.
|
|
@ -8,29 +8,29 @@ Remove this extension using the following CLI command `az extension remove --nam
|
|||
|
||||
For more information on how to use this service, run the following CLI commands:
|
||||
|
||||
` az durabletask namespace -h `
|
||||
` az durabletask scheduler -h `
|
||||
` az durabletask taskhub -h `
|
||||
|
||||
You can create a namespace with the following command:
|
||||
` az durabletask namespace create -g "<resource-group-name>" -n "<namespace-name>"`
|
||||
You can create a scheduler with the following command:
|
||||
` az durabletask scheduler create -g "<resource-group-name>" -n "<scheduler-name>"`
|
||||
|
||||
List all the namespaces in your resource group:
|
||||
` az durabletask namespace list -g <resource-group-name> `
|
||||
List all the schedulers in your resource group:
|
||||
` az durabletask scheduler list -g <resource-group-name> `
|
||||
|
||||
Show the information for a particular namespace within a resource group:
|
||||
` az durabletask namespace show -g <resource-group-name> -n <namespace-name> `
|
||||
Show the information for a particular scheduler within a resource group:
|
||||
` az durabletask scheduler show -g <resource-group-name> -n <scheduler-name> `
|
||||
|
||||
Delete a namespace:
|
||||
` az durabletask namespace delete -g <resource-group-name> -n <namespace-name> `
|
||||
Delete a scheduler:
|
||||
` az durabletask scheduler delete -g <resource-group-name> -n <scheduler-name> `
|
||||
|
||||
You can create a taskhub with the following command:
|
||||
` az durabletask taskhub create -g <resource-group-name> -s <namespace-name> -n <taskhub-name> `
|
||||
` az durabletask taskhub create -g <resource-group-name> -s <scheduler-name> -n <taskhub-name> `
|
||||
|
||||
List all taskhubs within a particular namespace:
|
||||
` az durabletask taskhub list -g <resource-group-name> -n <namespace-name> `
|
||||
List all taskhubs within a particular scheduler:
|
||||
` az durabletask taskhub list -g <resource-group-name> -n <scheduler-name> `
|
||||
|
||||
Show information on a single taskhub:
|
||||
` az durabletask taskhub show -g <resource-group-name> -s <namespace-name> -n <task-hub-name> `
|
||||
` az durabletask taskhub show -g <resource-group-name> -s <scheduler-name> -n <task-hub-name> `
|
||||
|
||||
Delete a taskhub:
|
||||
` az durabletask taskhub delete -g <resource-group-name> -s <namespace-name> -n <task-hub-name> `
|
||||
` az durabletask taskhub delete -g <resource-group-name> -s <scheduler-name> -n <task-hub-name> `
|
|
@ -13,10 +13,9 @@ from azure.cli.core.aaz import *
|
|||
|
||||
@register_command_group(
|
||||
"durabletask",
|
||||
is_preview=True,
|
||||
)
|
||||
class __CMDGroup(AAZCommandGroup):
|
||||
"""Commands to manage Durabletasks.
|
||||
"""Commands to manage Durabletask schedulers and taskhubs
|
||||
"""
|
||||
pass
|
||||
|
||||
|
|
|
@ -12,11 +12,10 @@ from azure.cli.core.aaz import *
|
|||
|
||||
|
||||
@register_command_group(
|
||||
"durabletask namespace",
|
||||
is_preview=True,
|
||||
"durabletask scheduler",
|
||||
)
|
||||
class __CMDGroup(AAZCommandGroup):
|
||||
"""Commands to manage Durabletask namespaces
|
||||
"""Commands to manage Durabletask schedulers
|
||||
"""
|
||||
pass
|
||||
|
|
@ -12,20 +12,19 @@ from azure.cli.core.aaz import *
|
|||
|
||||
|
||||
@register_command(
|
||||
"durabletask namespace create",
|
||||
is_preview=True,
|
||||
"durabletask scheduler create",
|
||||
)
|
||||
class Create(AAZCommand):
|
||||
"""Create a Namespace
|
||||
"""Create a Scheduler
|
||||
|
||||
:example: Create a namespace in northcentralus
|
||||
az durabletask namespace create -g resource-group-name -n namespace-name --location northcentralus
|
||||
:example: Create a scheduler in northcentralus
|
||||
az durable-task scheduler create --resource-group testrg --scheduler-name testscheduler --location northcentralus --ip-allowlist "[0.0.0.0/0]" --sku-capacity "1", --sku-name "Dedicated" --tags "{}"
|
||||
"""
|
||||
|
||||
_aaz_info = {
|
||||
"version": "2024-02-01-preview",
|
||||
"version": "2024-10-01-preview",
|
||||
"resources": [
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/namespaces/{}", "2024-02-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/schedulers/{}", "2024-10-01-preview"],
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -46,18 +45,17 @@ class Create(AAZCommand):
|
|||
# define Arg Group ""
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.namespace_name = AAZStrArg(
|
||||
options=["-n", "--name", "--namespace-name"],
|
||||
help="The name of the service",
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
required=True,
|
||||
)
|
||||
_args_schema.scheduler_name = AAZStrArg(
|
||||
options=["-n", "--name", "--scheduler-name"],
|
||||
help="The name of the Scheduler",
|
||||
required=True,
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
help="The name of the resource group",
|
||||
required=True,
|
||||
)
|
||||
|
||||
# define Arg Group "Properties"
|
||||
|
||||
|
@ -65,7 +63,7 @@ class Create(AAZCommand):
|
|||
_args_schema.ip_allowlist = AAZListArg(
|
||||
options=["--ip-allowlist"],
|
||||
arg_group="Properties",
|
||||
help="IP allow list for durable task service. Values can be Pv4, IPv6 or CIDR",
|
||||
help="IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR",
|
||||
)
|
||||
|
||||
ip_allowlist = cls._args_schema.ip_allowlist
|
||||
|
@ -90,11 +88,25 @@ class Create(AAZCommand):
|
|||
|
||||
tags = cls._args_schema.tags
|
||||
tags.Element = AAZStrArg()
|
||||
|
||||
# define Arg Group "Sku"
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.sku_capacity = AAZIntArg(
|
||||
options=["--sku-capacity"],
|
||||
arg_group="Sku",
|
||||
help="The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy",
|
||||
)
|
||||
_args_schema.sku_name = AAZStrArg(
|
||||
options=["--sku-name"],
|
||||
arg_group="Sku",
|
||||
help="The name of the SKU",
|
||||
)
|
||||
return cls._args_schema
|
||||
|
||||
def _execute_operations(self):
|
||||
self.pre_operations()
|
||||
yield self.NamespacesCreateOrUpdate(ctx=self.ctx)()
|
||||
yield self.SchedulersCreateOrUpdate(ctx=self.ctx)()
|
||||
self.post_operations()
|
||||
|
||||
@register_callback
|
||||
|
@ -109,7 +121,7 @@ class Create(AAZCommand):
|
|||
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
|
||||
return result
|
||||
|
||||
class NamespacesCreateOrUpdate(AAZHttpOperation):
|
||||
class SchedulersCreateOrUpdate(AAZHttpOperation):
|
||||
CLIENT_TYPE = "MgmtClient"
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
|
@ -139,7 +151,7 @@ class Create(AAZCommand):
|
|||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces/{namespaceName}",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -155,11 +167,11 @@ class Create(AAZCommand):
|
|||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"namespaceName", self.ctx.args.namespace_name,
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
|
@ -173,7 +185,7 @@ class Create(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
@ -204,12 +216,18 @@ class Create(AAZCommand):
|
|||
|
||||
properties = _builder.get(".properties")
|
||||
if properties is not None:
|
||||
properties.set_prop("ipAllowlist", AAZListType, ".ip_allowlist")
|
||||
properties.set_prop("ipAllowlist", AAZListType, ".ip_allowlist", typ_kwargs={"flags": {"required": True}})
|
||||
properties.set_prop("sku", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}})
|
||||
|
||||
ip_allowlist = _builder.get(".properties.ipAllowlist")
|
||||
if ip_allowlist is not None:
|
||||
ip_allowlist.set_elements(AAZStrType, ".")
|
||||
|
||||
sku = _builder.get(".properties.sku")
|
||||
if sku is not None:
|
||||
sku.set_prop("capacity", AAZIntType, ".sku_capacity")
|
||||
sku.set_prop("name", AAZStrType, ".sku_name", typ_kwargs={"flags": {"required": True}})
|
||||
|
||||
tags = _builder.get(".tags")
|
||||
if tags is not None:
|
||||
tags.set_elements(AAZStrType, ".")
|
||||
|
@ -254,24 +272,34 @@ class Create(AAZCommand):
|
|||
)
|
||||
|
||||
properties = cls._schema_on_200_201.properties
|
||||
properties.dashboard_url = AAZStrType(
|
||||
serialized_name="dashboardUrl",
|
||||
properties.endpoint = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.ip_allowlist = AAZListType(
|
||||
serialized_name="ipAllowlist",
|
||||
flags={"required": True},
|
||||
)
|
||||
properties.provisioning_state = AAZStrType(
|
||||
serialized_name="provisioningState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.url = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
properties.sku = AAZObjectType(
|
||||
flags={"required": True},
|
||||
)
|
||||
|
||||
ip_allowlist = cls._schema_on_200_201.properties.ip_allowlist
|
||||
ip_allowlist.Element = AAZStrType()
|
||||
|
||||
sku = cls._schema_on_200_201.properties.sku
|
||||
sku.capacity = AAZIntType()
|
||||
sku.name = AAZStrType(
|
||||
flags={"required": True},
|
||||
)
|
||||
sku.redundancy_state = AAZStrType(
|
||||
serialized_name="redundancyState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
||||
system_data = cls._schema_on_200_201.system_data
|
||||
system_data.created_at = AAZStrType(
|
||||
serialized_name="createdAt",
|
|
@ -12,21 +12,20 @@ from azure.cli.core.aaz import *
|
|||
|
||||
|
||||
@register_command(
|
||||
"durabletask namespace delete",
|
||||
is_preview=True,
|
||||
"durabletask scheduler delete",
|
||||
confirmation="Are you sure you want to perform this operation?",
|
||||
)
|
||||
class Delete(AAZCommand):
|
||||
"""Delete a Namespace
|
||||
"""Delete a Scheduler
|
||||
|
||||
:example: Delete a namespace
|
||||
az durabletask namespace delete -g resource-group-name -n namespace-name
|
||||
:example: Delete a scheduler
|
||||
az durable-task scheduler delete --resource-group testrg --scheduler-name testscheduler
|
||||
"""
|
||||
|
||||
_aaz_info = {
|
||||
"version": "2024-02-01-preview",
|
||||
"version": "2024-10-01-preview",
|
||||
"resources": [
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/namespaces/{}", "2024-02-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/schedulers/{}", "2024-10-01-preview"],
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -47,24 +46,23 @@ class Delete(AAZCommand):
|
|||
# define Arg Group ""
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.namespace_name = AAZStrArg(
|
||||
options=["-n", "--name", "--namespace-name"],
|
||||
help="The name of the service",
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
required=True,
|
||||
)
|
||||
_args_schema.scheduler_name = AAZStrArg(
|
||||
options=["-n", "--name", "--scheduler-name"],
|
||||
help="The name of the Scheduler",
|
||||
required=True,
|
||||
id_part="name",
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
help="The name of the resource group",
|
||||
required=True,
|
||||
)
|
||||
return cls._args_schema
|
||||
|
||||
def _execute_operations(self):
|
||||
self.pre_operations()
|
||||
yield self.NamespacesDelete(ctx=self.ctx)()
|
||||
yield self.SchedulersDelete(ctx=self.ctx)()
|
||||
self.post_operations()
|
||||
|
||||
@register_callback
|
||||
|
@ -75,7 +73,7 @@ class Delete(AAZCommand):
|
|||
def post_operations(self):
|
||||
pass
|
||||
|
||||
class NamespacesDelete(AAZHttpOperation):
|
||||
class SchedulersDelete(AAZHttpOperation):
|
||||
CLIENT_TYPE = "MgmtClient"
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
|
@ -114,7 +112,7 @@ class Delete(AAZCommand):
|
|||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces/{namespaceName}",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -130,11 +128,11 @@ class Delete(AAZCommand):
|
|||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"namespaceName", self.ctx.args.namespace_name,
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
|
@ -148,7 +146,7 @@ class Delete(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
|
@ -12,21 +12,20 @@ from azure.cli.core.aaz import *
|
|||
|
||||
|
||||
@register_command(
|
||||
"durabletask namespace list",
|
||||
is_preview=True,
|
||||
"durabletask scheduler list",
|
||||
)
|
||||
class List(AAZCommand):
|
||||
"""List Namespace resources by subscription ID
|
||||
"""List Schedulers by subscription
|
||||
|
||||
:example: List all namespaces in a resource group
|
||||
az durabletask namespace list -g resource-group-name
|
||||
:example: List all schedulers in a resource group
|
||||
az durable-task scheduler list -g testrg
|
||||
"""
|
||||
|
||||
_aaz_info = {
|
||||
"version": "2024-02-01-preview",
|
||||
"version": "2024-10-01-preview",
|
||||
"resources": [
|
||||
["mgmt-plane", "/subscriptions/{}/providers/microsoft.durabletask/namespaces", "2024-02-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/namespaces", "2024-02-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/providers/microsoft.durabletask/schedulers", "2024-10-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/schedulers", "2024-10-01-preview"],
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -47,9 +46,7 @@ class List(AAZCommand):
|
|||
# define Arg Group ""
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
help="The name of the resource group",
|
||||
)
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg()
|
||||
return cls._args_schema
|
||||
|
||||
def _execute_operations(self):
|
||||
|
@ -57,9 +54,9 @@ class List(AAZCommand):
|
|||
condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True
|
||||
condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id)
|
||||
if condition_0:
|
||||
self.NamespacesListBySubscription(ctx=self.ctx)()
|
||||
self.SchedulersListBySubscription(ctx=self.ctx)()
|
||||
if condition_1:
|
||||
self.NamespacesListByResourceGroup(ctx=self.ctx)()
|
||||
self.SchedulersListByResourceGroup(ctx=self.ctx)()
|
||||
self.post_operations()
|
||||
|
||||
@register_callback
|
||||
|
@ -75,7 +72,7 @@ class List(AAZCommand):
|
|||
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
|
||||
return result, next_link
|
||||
|
||||
class NamespacesListBySubscription(AAZHttpOperation):
|
||||
class SchedulersListBySubscription(AAZHttpOperation):
|
||||
CLIENT_TYPE = "MgmtClient"
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
|
@ -89,7 +86,7 @@ class List(AAZCommand):
|
|||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/namespaces",
|
||||
"/subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/schedulers",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -115,7 +112,7 @@ class List(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
@ -179,24 +176,34 @@ class List(AAZCommand):
|
|||
)
|
||||
|
||||
properties = cls._schema_on_200.value.Element.properties
|
||||
properties.dashboard_url = AAZStrType(
|
||||
serialized_name="dashboardUrl",
|
||||
properties.endpoint = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.ip_allowlist = AAZListType(
|
||||
serialized_name="ipAllowlist",
|
||||
flags={"required": True},
|
||||
)
|
||||
properties.provisioning_state = AAZStrType(
|
||||
serialized_name="provisioningState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.url = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
properties.sku = AAZObjectType(
|
||||
flags={"required": True},
|
||||
)
|
||||
|
||||
ip_allowlist = cls._schema_on_200.value.Element.properties.ip_allowlist
|
||||
ip_allowlist.Element = AAZStrType()
|
||||
|
||||
sku = cls._schema_on_200.value.Element.properties.sku
|
||||
sku.capacity = AAZIntType()
|
||||
sku.name = AAZStrType(
|
||||
flags={"required": True},
|
||||
)
|
||||
sku.redundancy_state = AAZStrType(
|
||||
serialized_name="redundancyState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
||||
system_data = cls._schema_on_200.value.Element.system_data
|
||||
system_data.created_at = AAZStrType(
|
||||
serialized_name="createdAt",
|
||||
|
@ -222,7 +229,7 @@ class List(AAZCommand):
|
|||
|
||||
return cls._schema_on_200
|
||||
|
||||
class NamespacesListByResourceGroup(AAZHttpOperation):
|
||||
class SchedulersListByResourceGroup(AAZHttpOperation):
|
||||
CLIENT_TYPE = "MgmtClient"
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
|
@ -236,7 +243,7 @@ class List(AAZCommand):
|
|||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -266,7 +273,7 @@ class List(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
@ -330,24 +337,34 @@ class List(AAZCommand):
|
|||
)
|
||||
|
||||
properties = cls._schema_on_200.value.Element.properties
|
||||
properties.dashboard_url = AAZStrType(
|
||||
serialized_name="dashboardUrl",
|
||||
properties.endpoint = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.ip_allowlist = AAZListType(
|
||||
serialized_name="ipAllowlist",
|
||||
flags={"required": True},
|
||||
)
|
||||
properties.provisioning_state = AAZStrType(
|
||||
serialized_name="provisioningState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.url = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
properties.sku = AAZObjectType(
|
||||
flags={"required": True},
|
||||
)
|
||||
|
||||
ip_allowlist = cls._schema_on_200.value.Element.properties.ip_allowlist
|
||||
ip_allowlist.Element = AAZStrType()
|
||||
|
||||
sku = cls._schema_on_200.value.Element.properties.sku
|
||||
sku.capacity = AAZIntType()
|
||||
sku.name = AAZStrType(
|
||||
flags={"required": True},
|
||||
)
|
||||
sku.redundancy_state = AAZStrType(
|
||||
serialized_name="redundancyState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
||||
system_data = cls._schema_on_200.value.Element.system_data
|
||||
system_data.created_at = AAZStrType(
|
||||
serialized_name="createdAt",
|
|
@ -12,20 +12,19 @@ from azure.cli.core.aaz import *
|
|||
|
||||
|
||||
@register_command(
|
||||
"durabletask namespace show",
|
||||
is_preview=True,
|
||||
"durabletask scheduler show",
|
||||
)
|
||||
class Show(AAZCommand):
|
||||
"""Get a Namespace
|
||||
"""Get a Scheduler
|
||||
|
||||
:example: Show information on a particular namespace
|
||||
az durabletask namespace show -g resource-group-name -n namespace-name
|
||||
:example: Show information on a particular scheduler
|
||||
az durable-task scheduler show --resource-group testrg --scheduler-name testscheduler
|
||||
"""
|
||||
|
||||
_aaz_info = {
|
||||
"version": "2024-02-01-preview",
|
||||
"version": "2024-10-01-preview",
|
||||
"resources": [
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/namespaces/{}", "2024-02-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/schedulers/{}", "2024-10-01-preview"],
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -45,24 +44,23 @@ class Show(AAZCommand):
|
|||
# define Arg Group ""
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.namespace_name = AAZStrArg(
|
||||
options=["-n", "--name", "--namespace-name"],
|
||||
help="The name of the namespace",
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
required=True,
|
||||
)
|
||||
_args_schema.scheduler_name = AAZStrArg(
|
||||
options=["-n", "--name", "--scheduler-name"],
|
||||
help="The name of the Scheduler",
|
||||
required=True,
|
||||
id_part="name",
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
help="The name of the resource group",
|
||||
required=True,
|
||||
)
|
||||
return cls._args_schema
|
||||
|
||||
def _execute_operations(self):
|
||||
self.pre_operations()
|
||||
self.NamespacesGet(ctx=self.ctx)()
|
||||
self.SchedulersGet(ctx=self.ctx)()
|
||||
self.post_operations()
|
||||
|
||||
@register_callback
|
||||
|
@ -77,7 +75,7 @@ class Show(AAZCommand):
|
|||
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
|
||||
return result
|
||||
|
||||
class NamespacesGet(AAZHttpOperation):
|
||||
class SchedulersGet(AAZHttpOperation):
|
||||
CLIENT_TYPE = "MgmtClient"
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
|
@ -91,7 +89,7 @@ class Show(AAZCommand):
|
|||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces/{namespaceName}",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -107,11 +105,11 @@ class Show(AAZCommand):
|
|||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"namespaceName", self.ctx.args.namespace_name,
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
|
@ -125,7 +123,7 @@ class Show(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
@ -178,24 +176,34 @@ class Show(AAZCommand):
|
|||
)
|
||||
|
||||
properties = cls._schema_on_200.properties
|
||||
properties.dashboard_url = AAZStrType(
|
||||
serialized_name="dashboardUrl",
|
||||
properties.endpoint = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.ip_allowlist = AAZListType(
|
||||
serialized_name="ipAllowlist",
|
||||
flags={"required": True},
|
||||
)
|
||||
properties.provisioning_state = AAZStrType(
|
||||
serialized_name="provisioningState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.url = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
properties.sku = AAZObjectType(
|
||||
flags={"required": True},
|
||||
)
|
||||
|
||||
ip_allowlist = cls._schema_on_200.properties.ip_allowlist
|
||||
ip_allowlist.Element = AAZStrType()
|
||||
|
||||
sku = cls._schema_on_200.properties.sku
|
||||
sku.capacity = AAZIntType()
|
||||
sku.name = AAZStrType(
|
||||
flags={"required": True},
|
||||
)
|
||||
sku.redundancy_state = AAZStrType(
|
||||
serialized_name="redundancyState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
||||
system_data = cls._schema_on_200.system_data
|
||||
system_data.created_at = AAZStrType(
|
||||
serialized_name="createdAt",
|
|
@ -12,17 +12,16 @@ from azure.cli.core.aaz import *
|
|||
|
||||
|
||||
@register_command(
|
||||
"durabletask namespace update",
|
||||
is_preview=True,
|
||||
"durabletask scheduler update",
|
||||
)
|
||||
class Update(AAZCommand):
|
||||
"""Update a Namespace
|
||||
"""Update a Scheduler
|
||||
"""
|
||||
|
||||
_aaz_info = {
|
||||
"version": "2024-02-01-preview",
|
||||
"version": "2024-10-01-preview",
|
||||
"resources": [
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/namespaces/{}", "2024-02-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/schedulers/{}", "2024-10-01-preview"],
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -45,19 +44,18 @@ class Update(AAZCommand):
|
|||
# define Arg Group ""
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.namespace_name = AAZStrArg(
|
||||
options=["-n", "--name", "--namespace-name"],
|
||||
help="The name of the service",
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
required=True,
|
||||
)
|
||||
_args_schema.scheduler_name = AAZStrArg(
|
||||
options=["-n", "--name", "--scheduler-name"],
|
||||
help="The name of the Scheduler",
|
||||
required=True,
|
||||
id_part="name",
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
help="The name of the resource group",
|
||||
required=True,
|
||||
)
|
||||
|
||||
# define Arg Group "Properties"
|
||||
|
||||
|
@ -65,8 +63,7 @@ class Update(AAZCommand):
|
|||
_args_schema.ip_allowlist = AAZListArg(
|
||||
options=["--ip-allowlist"],
|
||||
arg_group="Properties",
|
||||
help="IP allow list for durable task service. Values can be Pv4, IPv6 or CIDR",
|
||||
nullable=True,
|
||||
help="IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR",
|
||||
)
|
||||
|
||||
ip_allowlist = cls._args_schema.ip_allowlist
|
||||
|
@ -88,16 +85,31 @@ class Update(AAZCommand):
|
|||
tags.Element = AAZStrArg(
|
||||
nullable=True,
|
||||
)
|
||||
|
||||
# define Arg Group "Sku"
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.sku_capacity = AAZIntArg(
|
||||
options=["--sku-capacity"],
|
||||
arg_group="Sku",
|
||||
help="The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy",
|
||||
nullable=True,
|
||||
)
|
||||
_args_schema.sku_name = AAZStrArg(
|
||||
options=["--sku-name"],
|
||||
arg_group="Sku",
|
||||
help="The name of the SKU",
|
||||
)
|
||||
return cls._args_schema
|
||||
|
||||
def _execute_operations(self):
|
||||
self.pre_operations()
|
||||
self.NamespacesGet(ctx=self.ctx)()
|
||||
self.SchedulersGet(ctx=self.ctx)()
|
||||
self.pre_instance_update(self.ctx.vars.instance)
|
||||
self.InstanceUpdateByJson(ctx=self.ctx)()
|
||||
self.InstanceUpdateByGeneric(ctx=self.ctx)()
|
||||
self.post_instance_update(self.ctx.vars.instance)
|
||||
yield self.NamespacesCreateOrUpdate(ctx=self.ctx)()
|
||||
yield self.SchedulersCreateOrUpdate(ctx=self.ctx)()
|
||||
self.post_operations()
|
||||
|
||||
@register_callback
|
||||
|
@ -120,7 +132,7 @@ class Update(AAZCommand):
|
|||
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
|
||||
return result
|
||||
|
||||
class NamespacesGet(AAZHttpOperation):
|
||||
class SchedulersGet(AAZHttpOperation):
|
||||
CLIENT_TYPE = "MgmtClient"
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
|
@ -134,7 +146,7 @@ class Update(AAZCommand):
|
|||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces/{namespaceName}",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -150,11 +162,11 @@ class Update(AAZCommand):
|
|||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"namespaceName", self.ctx.args.namespace_name,
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
|
@ -168,7 +180,7 @@ class Update(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
@ -199,11 +211,11 @@ class Update(AAZCommand):
|
|||
return cls._schema_on_200
|
||||
|
||||
cls._schema_on_200 = AAZObjectType()
|
||||
_UpdateHelper._build_schema_namespace_read(cls._schema_on_200)
|
||||
_UpdateHelper._build_schema_scheduler_read(cls._schema_on_200)
|
||||
|
||||
return cls._schema_on_200
|
||||
|
||||
class NamespacesCreateOrUpdate(AAZHttpOperation):
|
||||
class SchedulersCreateOrUpdate(AAZHttpOperation):
|
||||
CLIENT_TYPE = "MgmtClient"
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
|
@ -233,7 +245,7 @@ class Update(AAZCommand):
|
|||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces/{namespaceName}",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -249,11 +261,11 @@ class Update(AAZCommand):
|
|||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"namespaceName", self.ctx.args.namespace_name,
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
|
@ -267,7 +279,7 @@ class Update(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
@ -310,7 +322,7 @@ class Update(AAZCommand):
|
|||
return cls._schema_on_200_201
|
||||
|
||||
cls._schema_on_200_201 = AAZObjectType()
|
||||
_UpdateHelper._build_schema_namespace_read(cls._schema_on_200_201)
|
||||
_UpdateHelper._build_schema_scheduler_read(cls._schema_on_200_201)
|
||||
|
||||
return cls._schema_on_200_201
|
||||
|
||||
|
@ -330,12 +342,18 @@ class Update(AAZCommand):
|
|||
|
||||
properties = _builder.get(".properties")
|
||||
if properties is not None:
|
||||
properties.set_prop("ipAllowlist", AAZListType, ".ip_allowlist")
|
||||
properties.set_prop("ipAllowlist", AAZListType, ".ip_allowlist", typ_kwargs={"flags": {"required": True}})
|
||||
properties.set_prop("sku", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}})
|
||||
|
||||
ip_allowlist = _builder.get(".properties.ipAllowlist")
|
||||
if ip_allowlist is not None:
|
||||
ip_allowlist.set_elements(AAZStrType, ".")
|
||||
|
||||
sku = _builder.get(".properties.sku")
|
||||
if sku is not None:
|
||||
sku.set_prop("capacity", AAZIntType, ".sku_capacity")
|
||||
sku.set_prop("name", AAZStrType, ".sku_name", typ_kwargs={"flags": {"required": True}})
|
||||
|
||||
tags = _builder.get(".tags")
|
||||
if tags is not None:
|
||||
tags.set_elements(AAZStrType, ".")
|
||||
|
@ -354,62 +372,72 @@ class Update(AAZCommand):
|
|||
class _UpdateHelper:
|
||||
"""Helper class for Update"""
|
||||
|
||||
_schema_namespace_read = None
|
||||
_schema_scheduler_read = None
|
||||
|
||||
@classmethod
|
||||
def _build_schema_namespace_read(cls, _schema):
|
||||
if cls._schema_namespace_read is not None:
|
||||
_schema.id = cls._schema_namespace_read.id
|
||||
_schema.location = cls._schema_namespace_read.location
|
||||
_schema.name = cls._schema_namespace_read.name
|
||||
_schema.properties = cls._schema_namespace_read.properties
|
||||
_schema.system_data = cls._schema_namespace_read.system_data
|
||||
_schema.tags = cls._schema_namespace_read.tags
|
||||
_schema.type = cls._schema_namespace_read.type
|
||||
def _build_schema_scheduler_read(cls, _schema):
|
||||
if cls._schema_scheduler_read is not None:
|
||||
_schema.id = cls._schema_scheduler_read.id
|
||||
_schema.location = cls._schema_scheduler_read.location
|
||||
_schema.name = cls._schema_scheduler_read.name
|
||||
_schema.properties = cls._schema_scheduler_read.properties
|
||||
_schema.system_data = cls._schema_scheduler_read.system_data
|
||||
_schema.tags = cls._schema_scheduler_read.tags
|
||||
_schema.type = cls._schema_scheduler_read.type
|
||||
return
|
||||
|
||||
cls._schema_namespace_read = _schema_namespace_read = AAZObjectType()
|
||||
cls._schema_scheduler_read = _schema_scheduler_read = AAZObjectType()
|
||||
|
||||
namespace_read = _schema_namespace_read
|
||||
namespace_read.id = AAZStrType(
|
||||
scheduler_read = _schema_scheduler_read
|
||||
scheduler_read.id = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
namespace_read.location = AAZStrType(
|
||||
scheduler_read.location = AAZStrType(
|
||||
flags={"required": True},
|
||||
)
|
||||
namespace_read.name = AAZStrType(
|
||||
scheduler_read.name = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
namespace_read.properties = AAZObjectType()
|
||||
namespace_read.system_data = AAZObjectType(
|
||||
scheduler_read.properties = AAZObjectType()
|
||||
scheduler_read.system_data = AAZObjectType(
|
||||
serialized_name="systemData",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
namespace_read.tags = AAZDictType()
|
||||
namespace_read.type = AAZStrType(
|
||||
scheduler_read.tags = AAZDictType()
|
||||
scheduler_read.type = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
||||
properties = _schema_namespace_read.properties
|
||||
properties.dashboard_url = AAZStrType(
|
||||
serialized_name="dashboardUrl",
|
||||
properties = _schema_scheduler_read.properties
|
||||
properties.endpoint = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.ip_allowlist = AAZListType(
|
||||
serialized_name="ipAllowlist",
|
||||
flags={"required": True},
|
||||
)
|
||||
properties.provisioning_state = AAZStrType(
|
||||
serialized_name="provisioningState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.url = AAZStrType(
|
||||
properties.sku = AAZObjectType(
|
||||
flags={"required": True},
|
||||
)
|
||||
|
||||
ip_allowlist = _schema_scheduler_read.properties.ip_allowlist
|
||||
ip_allowlist.Element = AAZStrType()
|
||||
|
||||
sku = _schema_scheduler_read.properties.sku
|
||||
sku.capacity = AAZIntType()
|
||||
sku.name = AAZStrType(
|
||||
flags={"required": True},
|
||||
)
|
||||
sku.redundancy_state = AAZStrType(
|
||||
serialized_name="redundancyState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
||||
ip_allowlist = _schema_namespace_read.properties.ip_allowlist
|
||||
ip_allowlist.Element = AAZStrType()
|
||||
|
||||
system_data = _schema_namespace_read.system_data
|
||||
system_data = _schema_scheduler_read.system_data
|
||||
system_data.created_at = AAZStrType(
|
||||
serialized_name="createdAt",
|
||||
)
|
||||
|
@ -429,16 +457,16 @@ class _UpdateHelper:
|
|||
serialized_name="lastModifiedByType",
|
||||
)
|
||||
|
||||
tags = _schema_namespace_read.tags
|
||||
tags = _schema_scheduler_read.tags
|
||||
tags.Element = AAZStrType()
|
||||
|
||||
_schema.id = cls._schema_namespace_read.id
|
||||
_schema.location = cls._schema_namespace_read.location
|
||||
_schema.name = cls._schema_namespace_read.name
|
||||
_schema.properties = cls._schema_namespace_read.properties
|
||||
_schema.system_data = cls._schema_namespace_read.system_data
|
||||
_schema.tags = cls._schema_namespace_read.tags
|
||||
_schema.type = cls._schema_namespace_read.type
|
||||
_schema.id = cls._schema_scheduler_read.id
|
||||
_schema.location = cls._schema_scheduler_read.location
|
||||
_schema.name = cls._schema_scheduler_read.name
|
||||
_schema.properties = cls._schema_scheduler_read.properties
|
||||
_schema.system_data = cls._schema_scheduler_read.system_data
|
||||
_schema.tags = cls._schema_scheduler_read.tags
|
||||
_schema.type = cls._schema_scheduler_read.type
|
||||
|
||||
|
||||
__all__ = ["Update"]
|
|
@ -12,7 +12,7 @@ from azure.cli.core.aaz import *
|
|||
|
||||
|
||||
@register_command(
|
||||
"durabletask namespace wait",
|
||||
"durabletask scheduler wait",
|
||||
)
|
||||
class Wait(AAZWaitCommand):
|
||||
"""Place the CLI in a waiting state until a condition is met.
|
||||
|
@ -20,7 +20,7 @@ class Wait(AAZWaitCommand):
|
|||
|
||||
_aaz_info = {
|
||||
"resources": [
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/namespaces/{}", "2024-02-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/schedulers/{}", "2024-10-01-preview"],
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -40,24 +40,23 @@ class Wait(AAZWaitCommand):
|
|||
# define Arg Group ""
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.namespace_name = AAZStrArg(
|
||||
options=["-n", "--name", "--namespace-name"],
|
||||
help="The name of the namespace",
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
required=True,
|
||||
)
|
||||
_args_schema.scheduler_name = AAZStrArg(
|
||||
options=["-n", "--name", "--scheduler-name"],
|
||||
help="The name of the Scheduler",
|
||||
required=True,
|
||||
id_part="name",
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
help="The name of the resource group",
|
||||
required=True,
|
||||
)
|
||||
return cls._args_schema
|
||||
|
||||
def _execute_operations(self):
|
||||
self.pre_operations()
|
||||
self.NamespacesGet(ctx=self.ctx)()
|
||||
self.SchedulersGet(ctx=self.ctx)()
|
||||
self.post_operations()
|
||||
|
||||
@register_callback
|
||||
|
@ -72,7 +71,7 @@ class Wait(AAZWaitCommand):
|
|||
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False)
|
||||
return result
|
||||
|
||||
class NamespacesGet(AAZHttpOperation):
|
||||
class SchedulersGet(AAZHttpOperation):
|
||||
CLIENT_TYPE = "MgmtClient"
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
|
@ -86,7 +85,7 @@ class Wait(AAZWaitCommand):
|
|||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces/{namespaceName}",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -102,11 +101,11 @@ class Wait(AAZWaitCommand):
|
|||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"namespaceName", self.ctx.args.namespace_name,
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
|
@ -120,7 +119,7 @@ class Wait(AAZWaitCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
@ -173,24 +172,34 @@ class Wait(AAZWaitCommand):
|
|||
)
|
||||
|
||||
properties = cls._schema_on_200.properties
|
||||
properties.dashboard_url = AAZStrType(
|
||||
serialized_name="dashboardUrl",
|
||||
properties.endpoint = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.ip_allowlist = AAZListType(
|
||||
serialized_name="ipAllowlist",
|
||||
flags={"required": True},
|
||||
)
|
||||
properties.provisioning_state = AAZStrType(
|
||||
serialized_name="provisioningState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.url = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
properties.sku = AAZObjectType(
|
||||
flags={"required": True},
|
||||
)
|
||||
|
||||
ip_allowlist = cls._schema_on_200.properties.ip_allowlist
|
||||
ip_allowlist.Element = AAZStrType()
|
||||
|
||||
sku = cls._schema_on_200.properties.sku
|
||||
sku.capacity = AAZIntType()
|
||||
sku.name = AAZStrType(
|
||||
flags={"required": True},
|
||||
)
|
||||
sku.redundancy_state = AAZStrType(
|
||||
serialized_name="redundancyState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
||||
system_data = cls._schema_on_200.system_data
|
||||
system_data.created_at = AAZStrType(
|
||||
serialized_name="createdAt",
|
|
@ -13,10 +13,9 @@ from azure.cli.core.aaz import *
|
|||
|
||||
@register_command_group(
|
||||
"durabletask taskhub",
|
||||
is_preview=True,
|
||||
)
|
||||
class __CMDGroup(AAZCommandGroup):
|
||||
"""Commands to manage Durabletask taskhubs.
|
||||
"""Commands to manage Durabletask taskhubs
|
||||
"""
|
||||
pass
|
||||
|
||||
|
|
|
@ -14,3 +14,4 @@ from ._delete import *
|
|||
from ._list import *
|
||||
from ._show import *
|
||||
from ._update import *
|
||||
from ._wait import *
|
||||
|
|
|
@ -13,26 +13,26 @@ from azure.cli.core.aaz import *
|
|||
|
||||
@register_command(
|
||||
"durabletask taskhub create",
|
||||
is_preview=True,
|
||||
)
|
||||
class Create(AAZCommand):
|
||||
"""Create a Task Hub
|
||||
|
||||
:example: Create a taskhub in a namespace
|
||||
az durabletask taskhub create -g resource-group-name -s testnamespace -n taskhub-name
|
||||
:example: Create a taskhub in a scheduler
|
||||
az durabletask taskhub create --resource-group testrg--scheduler-name testscheduler --task-hub-name testtaskhub
|
||||
"""
|
||||
|
||||
_aaz_info = {
|
||||
"version": "2024-02-01-preview",
|
||||
"version": "2024-10-01-preview",
|
||||
"resources": [
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/namespaces/{}/taskhubs/{}", "2024-02-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/schedulers/{}/taskhubs/{}", "2024-10-01-preview"],
|
||||
]
|
||||
}
|
||||
|
||||
AZ_SUPPORT_NO_WAIT = True
|
||||
|
||||
def _handler(self, command_args):
|
||||
super()._handler(command_args)
|
||||
self._execute_operations()
|
||||
return self._output()
|
||||
return self.build_lro_poller(self._execute_operations, self._output)
|
||||
|
||||
_args_schema = None
|
||||
|
||||
|
@ -45,43 +45,30 @@ class Create(AAZCommand):
|
|||
# define Arg Group ""
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.namespace_name = AAZStrArg(
|
||||
options=["-s", "--namespace-name"],
|
||||
help="The name of the namespace",
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
required=True,
|
||||
)
|
||||
_args_schema.scheduler_name = AAZStrArg(
|
||||
options=["--scheduler-name"],
|
||||
help="The name of the Scheduler",
|
||||
required=True,
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
help="The name of the resource group",
|
||||
required=True,
|
||||
)
|
||||
_args_schema.task_hub_name = AAZStrArg(
|
||||
options=["-n", "--name", "--task-hub-name"],
|
||||
help="Task Hub name",
|
||||
help="The name of the TaskHub",
|
||||
required=True,
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
|
||||
# define Arg Group "Resource"
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.tags = AAZDictArg(
|
||||
options=["--tags"],
|
||||
arg_group="Resource",
|
||||
help="Resource tags.",
|
||||
)
|
||||
|
||||
tags = cls._args_schema.tags
|
||||
tags.Element = AAZStrArg()
|
||||
return cls._args_schema
|
||||
|
||||
def _execute_operations(self):
|
||||
self.pre_operations()
|
||||
self.TaskHubsCreateOrUpdate(ctx=self.ctx)()
|
||||
yield self.TaskHubsCreateOrUpdate(ctx=self.ctx)()
|
||||
self.post_operations()
|
||||
|
||||
@register_callback
|
||||
|
@ -102,15 +89,31 @@ class Create(AAZCommand):
|
|||
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 [202]:
|
||||
return self.client.build_lro_polling(
|
||||
self.ctx.args.no_wait,
|
||||
session,
|
||||
self.on_200_201,
|
||||
self.on_error,
|
||||
lro_options={"final-state-via": "azure-async-operation"},
|
||||
path_format_arguments=self.url_parameters,
|
||||
)
|
||||
if session.http_response.status_code in [200, 201]:
|
||||
return self.on_200_201(session)
|
||||
return self.client.build_lro_polling(
|
||||
self.ctx.args.no_wait,
|
||||
session,
|
||||
self.on_200_201,
|
||||
self.on_error,
|
||||
lro_options={"final-state-via": "azure-async-operation"},
|
||||
path_format_arguments=self.url_parameters,
|
||||
)
|
||||
|
||||
return self.on_error(session.http_response)
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces/{namespaceName}/taskHubs/{taskHubName}",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -126,11 +129,11 @@ class Create(AAZCommand):
|
|||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"namespaceName", self.ctx.args.namespace_name,
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
|
@ -148,7 +151,7 @@ class Create(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
@ -173,11 +176,6 @@ class Create(AAZCommand):
|
|||
typ=AAZObjectType,
|
||||
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
|
||||
)
|
||||
_builder.set_prop("tags", AAZDictType, ".tags")
|
||||
|
||||
tags = _builder.get(".tags")
|
||||
if tags is not None:
|
||||
tags.set_elements(AAZStrType, ".")
|
||||
|
||||
return self.serialize_content(_content_value)
|
||||
|
||||
|
@ -210,7 +208,6 @@ class Create(AAZCommand):
|
|||
serialized_name="systemData",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
_schema_on_200_201.tags = AAZDictType()
|
||||
_schema_on_200_201.type = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
@ -245,9 +242,6 @@ class Create(AAZCommand):
|
|||
serialized_name="lastModifiedByType",
|
||||
)
|
||||
|
||||
tags = cls._schema_on_200_201.tags
|
||||
tags.Element = AAZStrType()
|
||||
|
||||
return cls._schema_on_200_201
|
||||
|
||||
|
||||
|
|
|
@ -13,27 +13,27 @@ from azure.cli.core.aaz import *
|
|||
|
||||
@register_command(
|
||||
"durabletask taskhub delete",
|
||||
is_preview=True,
|
||||
confirmation="Are you sure you want to perform this operation?",
|
||||
)
|
||||
class Delete(AAZCommand):
|
||||
"""Delete a Task Hub
|
||||
|
||||
:example: Delete a taskhub
|
||||
az durabletask taskhub delete -g resource-grou-name -s namespace-name -n taskhub-name
|
||||
:example: Delete a taskhub in a scheduler
|
||||
az durabletask taskhub delete --resource-group testrg --scheduler-name testscheduler --task-hub-name testtuskhub
|
||||
"""
|
||||
|
||||
_aaz_info = {
|
||||
"version": "2024-02-01-preview",
|
||||
"version": "2024-10-01-preview",
|
||||
"resources": [
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/namespaces/{}/taskhubs/{}", "2024-02-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/schedulers/{}/taskhubs/{}", "2024-10-01-preview"],
|
||||
]
|
||||
}
|
||||
|
||||
AZ_SUPPORT_NO_WAIT = True
|
||||
|
||||
def _handler(self, command_args):
|
||||
super()._handler(command_args)
|
||||
self._execute_operations()
|
||||
return None
|
||||
return self.build_lro_poller(self._execute_operations, None)
|
||||
|
||||
_args_schema = None
|
||||
|
||||
|
@ -46,22 +46,21 @@ class Delete(AAZCommand):
|
|||
# define Arg Group ""
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.namespace_name = AAZStrArg(
|
||||
options=["-s", "--namespace-name"],
|
||||
help="The name of the namespace",
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
required=True,
|
||||
)
|
||||
_args_schema.scheduler_name = AAZStrArg(
|
||||
options=["--scheduler-name"],
|
||||
help="The name of the Scheduler",
|
||||
required=True,
|
||||
id_part="name",
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
help="The name of the resource group",
|
||||
required=True,
|
||||
)
|
||||
_args_schema.task_hub_name = AAZStrArg(
|
||||
options=["-n", "--name", "--task-hub-name"],
|
||||
help="Task Hub name",
|
||||
help="The name of the TaskHub",
|
||||
required=True,
|
||||
id_part="child_name_1",
|
||||
fmt=AAZStrArgFormat(
|
||||
|
@ -72,7 +71,7 @@ class Delete(AAZCommand):
|
|||
|
||||
def _execute_operations(self):
|
||||
self.pre_operations()
|
||||
self.TaskHubsDelete(ctx=self.ctx)()
|
||||
yield self.TaskHubsDelete(ctx=self.ctx)()
|
||||
self.post_operations()
|
||||
|
||||
@register_callback
|
||||
|
@ -89,17 +88,40 @@ class Delete(AAZCommand):
|
|||
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]:
|
||||
return self.on_200(session)
|
||||
if session.http_response.status_code in [202]:
|
||||
return self.client.build_lro_polling(
|
||||
self.ctx.args.no_wait,
|
||||
session,
|
||||
self.on_200_201,
|
||||
self.on_error,
|
||||
lro_options={"final-state-via": "location"},
|
||||
path_format_arguments=self.url_parameters,
|
||||
)
|
||||
if session.http_response.status_code in [204]:
|
||||
return self.on_204(session)
|
||||
return self.client.build_lro_polling(
|
||||
self.ctx.args.no_wait,
|
||||
session,
|
||||
self.on_204,
|
||||
self.on_error,
|
||||
lro_options={"final-state-via": "location"},
|
||||
path_format_arguments=self.url_parameters,
|
||||
)
|
||||
if session.http_response.status_code in [200, 201]:
|
||||
return self.client.build_lro_polling(
|
||||
self.ctx.args.no_wait,
|
||||
session,
|
||||
self.on_200_201,
|
||||
self.on_error,
|
||||
lro_options={"final-state-via": "location"},
|
||||
path_format_arguments=self.url_parameters,
|
||||
)
|
||||
|
||||
return self.on_error(session.http_response)
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces/{namespaceName}/taskHubs/{taskHubName}",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -115,11 +137,11 @@ class Delete(AAZCommand):
|
|||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"namespaceName", self.ctx.args.namespace_name,
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
|
@ -137,16 +159,16 @@ class Delete(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
return parameters
|
||||
|
||||
def on_200(self, session):
|
||||
def on_204(self, session):
|
||||
pass
|
||||
|
||||
def on_204(self, session):
|
||||
def on_200_201(self, session):
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
@ -13,19 +13,18 @@ from azure.cli.core.aaz import *
|
|||
|
||||
@register_command(
|
||||
"durabletask taskhub list",
|
||||
is_preview=True,
|
||||
)
|
||||
class List(AAZCommand):
|
||||
"""List Task Hubs
|
||||
|
||||
:example: List all taskhubs for a given namespace
|
||||
az durabletask taskhub show -g resource-group-name -s namespace-name
|
||||
:example: List all taskhubs for a given scheduler
|
||||
az durabletask taskhub list --resource-group testrg --scheduler-name testscheduler
|
||||
"""
|
||||
|
||||
_aaz_info = {
|
||||
"version": "2024-02-01-preview",
|
||||
"version": "2024-10-01-preview",
|
||||
"resources": [
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/namespaces/{}/taskhubs", "2024-02-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/schedulers/{}/taskhubs", "2024-10-01-preview"],
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -46,23 +45,22 @@ class List(AAZCommand):
|
|||
# define Arg Group ""
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.namespace_name = AAZStrArg(
|
||||
options=["-s", "--namespace-name"],
|
||||
help="The name of the namespace",
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
required=True,
|
||||
)
|
||||
_args_schema.scheduler_name = AAZStrArg(
|
||||
options=["--scheduler-name"],
|
||||
help="The name of the Scheduler",
|
||||
required=True,
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
help="The name of the resource group",
|
||||
required=True,
|
||||
)
|
||||
return cls._args_schema
|
||||
|
||||
def _execute_operations(self):
|
||||
self.pre_operations()
|
||||
self.TaskHubsListByNamespace(ctx=self.ctx)()
|
||||
self.TaskHubsListByScheduler(ctx=self.ctx)()
|
||||
self.post_operations()
|
||||
|
||||
@register_callback
|
||||
|
@ -78,7 +76,7 @@ class List(AAZCommand):
|
|||
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
|
||||
return result, next_link
|
||||
|
||||
class TaskHubsListByNamespace(AAZHttpOperation):
|
||||
class TaskHubsListByScheduler(AAZHttpOperation):
|
||||
CLIENT_TYPE = "MgmtClient"
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
|
@ -92,7 +90,7 @@ class List(AAZCommand):
|
|||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces/{namespaceName}/taskHubs",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -108,11 +106,11 @@ class List(AAZCommand):
|
|||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"namespaceName", self.ctx.args.namespace_name,
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
|
@ -126,7 +124,7 @@ class List(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
@ -181,7 +179,6 @@ class List(AAZCommand):
|
|||
serialized_name="systemData",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
_element.tags = AAZDictType()
|
||||
_element.type = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
@ -216,9 +213,6 @@ class List(AAZCommand):
|
|||
serialized_name="lastModifiedByType",
|
||||
)
|
||||
|
||||
tags = cls._schema_on_200.value.Element.tags
|
||||
tags.Element = AAZStrType()
|
||||
|
||||
return cls._schema_on_200
|
||||
|
||||
|
||||
|
|
|
@ -13,19 +13,18 @@ from azure.cli.core.aaz import *
|
|||
|
||||
@register_command(
|
||||
"durabletask taskhub show",
|
||||
is_preview=True,
|
||||
)
|
||||
class Show(AAZCommand):
|
||||
"""Get a Task Hub
|
||||
|
||||
:example: Show information on a particular taskhub
|
||||
az durabletask taskhub show -g resource-group-name -s namespace-name -n taskhub-name
|
||||
az durabletask taskhub show --resource-group testrg --scheduler-name testscheduler --task-hub-name testtuskhub
|
||||
"""
|
||||
|
||||
_aaz_info = {
|
||||
"version": "2024-02-01-preview",
|
||||
"version": "2024-10-01-preview",
|
||||
"resources": [
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/namespaces/{}/taskhubs/{}", "2024-02-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/schedulers/{}/taskhubs/{}", "2024-10-01-preview"],
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -45,22 +44,21 @@ class Show(AAZCommand):
|
|||
# define Arg Group ""
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.namespace_name = AAZStrArg(
|
||||
options=["-s", "--namespace-name"],
|
||||
help="The name of the namespace",
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
required=True,
|
||||
)
|
||||
_args_schema.scheduler_name = AAZStrArg(
|
||||
options=["--scheduler-name"],
|
||||
help="The name of the Scheduler",
|
||||
required=True,
|
||||
id_part="name",
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
help="The name of the resource group",
|
||||
required=True,
|
||||
)
|
||||
_args_schema.task_hub_name = AAZStrArg(
|
||||
options=["-n", "--name", "--task-hub-name"],
|
||||
help="Task Hub name",
|
||||
help="The name of the TaskHub",
|
||||
required=True,
|
||||
id_part="child_name_1",
|
||||
fmt=AAZStrArgFormat(
|
||||
|
@ -100,7 +98,7 @@ class Show(AAZCommand):
|
|||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces/{namespaceName}/taskHubs/{taskHubName}",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -116,11 +114,11 @@ class Show(AAZCommand):
|
|||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"namespaceName", self.ctx.args.namespace_name,
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
|
@ -138,7 +136,7 @@ class Show(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
@ -182,7 +180,6 @@ class Show(AAZCommand):
|
|||
serialized_name="systemData",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
_schema_on_200.tags = AAZDictType()
|
||||
_schema_on_200.type = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
@ -217,9 +214,6 @@ class Show(AAZCommand):
|
|||
serialized_name="lastModifiedByType",
|
||||
)
|
||||
|
||||
tags = cls._schema_on_200.tags
|
||||
tags.Element = AAZStrType()
|
||||
|
||||
return cls._schema_on_200
|
||||
|
||||
|
||||
|
|
|
@ -13,25 +13,25 @@ from azure.cli.core.aaz import *
|
|||
|
||||
@register_command(
|
||||
"durabletask taskhub update",
|
||||
is_preview=True,
|
||||
)
|
||||
class Update(AAZCommand):
|
||||
"""Update a Task Hub
|
||||
"""
|
||||
|
||||
_aaz_info = {
|
||||
"version": "2024-02-01-preview",
|
||||
"version": "2024-10-01-preview",
|
||||
"resources": [
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/namespaces/{}/taskhubs/{}", "2024-02-01-preview"],
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/schedulers/{}/taskhubs/{}", "2024-10-01-preview"],
|
||||
]
|
||||
}
|
||||
|
||||
AZ_SUPPORT_NO_WAIT = True
|
||||
|
||||
AZ_SUPPORT_GENERIC_UPDATE = True
|
||||
|
||||
def _handler(self, command_args):
|
||||
super()._handler(command_args)
|
||||
self._execute_operations()
|
||||
return self._output()
|
||||
return self.build_lro_poller(self._execute_operations, self._output)
|
||||
|
||||
_args_schema = None
|
||||
|
||||
|
@ -44,43 +44,27 @@ class Update(AAZCommand):
|
|||
# define Arg Group ""
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.namespace_name = AAZStrArg(
|
||||
options=["-s", "--namespace-name"],
|
||||
help="The name of the namespace",
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
required=True,
|
||||
)
|
||||
_args_schema.scheduler_name = AAZStrArg(
|
||||
options=["--scheduler-name"],
|
||||
help="The name of the Scheduler",
|
||||
required=True,
|
||||
id_part="name",
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
_args_schema.resource_group = AAZResourceGroupNameArg(
|
||||
help="The name of the resource group",
|
||||
required=True,
|
||||
)
|
||||
_args_schema.task_hub_name = AAZStrArg(
|
||||
options=["-n", "--name", "--task-hub-name"],
|
||||
help="Task Hub name",
|
||||
help="The name of the TaskHub",
|
||||
required=True,
|
||||
id_part="child_name_1",
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
|
||||
# define Arg Group "Resource"
|
||||
|
||||
_args_schema = cls._args_schema
|
||||
_args_schema.tags = AAZDictArg(
|
||||
options=["--tags"],
|
||||
arg_group="Resource",
|
||||
help="Resource tags.",
|
||||
nullable=True,
|
||||
)
|
||||
|
||||
tags = cls._args_schema.tags
|
||||
tags.Element = AAZStrArg(
|
||||
nullable=True,
|
||||
)
|
||||
return cls._args_schema
|
||||
|
||||
def _execute_operations(self):
|
||||
|
@ -90,7 +74,7 @@ class Update(AAZCommand):
|
|||
self.InstanceUpdateByJson(ctx=self.ctx)()
|
||||
self.InstanceUpdateByGeneric(ctx=self.ctx)()
|
||||
self.post_instance_update(self.ctx.vars.instance)
|
||||
self.TaskHubsCreateOrUpdate(ctx=self.ctx)()
|
||||
yield self.TaskHubsCreateOrUpdate(ctx=self.ctx)()
|
||||
self.post_operations()
|
||||
|
||||
@register_callback
|
||||
|
@ -127,7 +111,7 @@ class Update(AAZCommand):
|
|||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces/{namespaceName}/taskHubs/{taskHubName}",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -143,11 +127,11 @@ class Update(AAZCommand):
|
|||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"namespaceName", self.ctx.args.namespace_name,
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
|
@ -165,7 +149,7 @@ class Update(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
@ -206,15 +190,31 @@ class Update(AAZCommand):
|
|||
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 [202]:
|
||||
return self.client.build_lro_polling(
|
||||
self.ctx.args.no_wait,
|
||||
session,
|
||||
self.on_200_201,
|
||||
self.on_error,
|
||||
lro_options={"final-state-via": "azure-async-operation"},
|
||||
path_format_arguments=self.url_parameters,
|
||||
)
|
||||
if session.http_response.status_code in [200, 201]:
|
||||
return self.on_200_201(session)
|
||||
return self.client.build_lro_polling(
|
||||
self.ctx.args.no_wait,
|
||||
session,
|
||||
self.on_200_201,
|
||||
self.on_error,
|
||||
lro_options={"final-state-via": "azure-async-operation"},
|
||||
path_format_arguments=self.url_parameters,
|
||||
)
|
||||
|
||||
return self.on_error(session.http_response)
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces/{namespaceName}/taskHubs/{taskHubName}",
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
|
@ -230,11 +230,11 @@ class Update(AAZCommand):
|
|||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"namespaceName", self.ctx.args.namespace_name,
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
|
@ -252,7 +252,7 @@ class Update(AAZCommand):
|
|||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-02-01-preview",
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
@ -310,11 +310,6 @@ class Update(AAZCommand):
|
|||
value=instance,
|
||||
typ=AAZObjectType
|
||||
)
|
||||
_builder.set_prop("tags", AAZDictType, ".tags")
|
||||
|
||||
tags = _builder.get(".tags")
|
||||
if tags is not None:
|
||||
tags.set_elements(AAZStrType, ".")
|
||||
|
||||
return _instance_value
|
||||
|
||||
|
@ -339,7 +334,6 @@ class _UpdateHelper:
|
|||
_schema.name = cls._schema_task_hub_read.name
|
||||
_schema.properties = cls._schema_task_hub_read.properties
|
||||
_schema.system_data = cls._schema_task_hub_read.system_data
|
||||
_schema.tags = cls._schema_task_hub_read.tags
|
||||
_schema.type = cls._schema_task_hub_read.type
|
||||
return
|
||||
|
||||
|
@ -357,7 +351,6 @@ class _UpdateHelper:
|
|||
serialized_name="systemData",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
task_hub_read.tags = AAZDictType()
|
||||
task_hub_read.type = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
@ -392,14 +385,10 @@ class _UpdateHelper:
|
|||
serialized_name="lastModifiedByType",
|
||||
)
|
||||
|
||||
tags = _schema_task_hub_read.tags
|
||||
tags.Element = AAZStrType()
|
||||
|
||||
_schema.id = cls._schema_task_hub_read.id
|
||||
_schema.name = cls._schema_task_hub_read.name
|
||||
_schema.properties = cls._schema_task_hub_read.properties
|
||||
_schema.system_data = cls._schema_task_hub_read.system_data
|
||||
_schema.tags = cls._schema_task_hub_read.tags
|
||||
_schema.type = cls._schema_task_hub_read.type
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,220 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
# 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(
|
||||
"durabletask taskhub wait",
|
||||
)
|
||||
class Wait(AAZWaitCommand):
|
||||
"""Place the CLI in a waiting state until a condition is met.
|
||||
"""
|
||||
|
||||
_aaz_info = {
|
||||
"resources": [
|
||||
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.durabletask/schedulers/{}/taskhubs/{}", "2024-10-01-preview"],
|
||||
]
|
||||
}
|
||||
|
||||
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.resource_group = AAZResourceGroupNameArg(
|
||||
required=True,
|
||||
)
|
||||
_args_schema.scheduler_name = AAZStrArg(
|
||||
options=["--scheduler-name"],
|
||||
help="The name of the Scheduler",
|
||||
required=True,
|
||||
id_part="name",
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
_args_schema.task_hub_name = AAZStrArg(
|
||||
options=["-n", "--name", "--task-hub-name"],
|
||||
help="The name of the TaskHub",
|
||||
required=True,
|
||||
id_part="child_name_1",
|
||||
fmt=AAZStrArgFormat(
|
||||
pattern="^[a-zA-Z0-9-]{3,64}$",
|
||||
),
|
||||
)
|
||||
return cls._args_schema
|
||||
|
||||
def _execute_operations(self):
|
||||
self.pre_operations()
|
||||
self.TaskHubsGet(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=False)
|
||||
return result
|
||||
|
||||
class TaskHubsGet(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]:
|
||||
return self.on_200(session)
|
||||
|
||||
return self.on_error(session.http_response)
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return self.client.format_url(
|
||||
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}",
|
||||
**self.url_parameters
|
||||
)
|
||||
|
||||
@property
|
||||
def method(self):
|
||||
return "GET"
|
||||
|
||||
@property
|
||||
def error_format(self):
|
||||
return "MgmtErrorFormat"
|
||||
|
||||
@property
|
||||
def url_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_url_param(
|
||||
"resourceGroupName", self.ctx.args.resource_group,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"schedulerName", self.ctx.args.scheduler_name,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"subscriptionId", self.ctx.subscription_id,
|
||||
required=True,
|
||||
),
|
||||
**self.serialize_url_param(
|
||||
"taskHubName", self.ctx.args.task_hub_name,
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
return parameters
|
||||
|
||||
@property
|
||||
def query_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_query_param(
|
||||
"api-version", "2024-10-01-preview",
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
return parameters
|
||||
|
||||
@property
|
||||
def header_parameters(self):
|
||||
parameters = {
|
||||
**self.serialize_header_param(
|
||||
"Accept", "application/json",
|
||||
),
|
||||
}
|
||||
return parameters
|
||||
|
||||
def on_200(self, session):
|
||||
data = self.deserialize_http_content(session)
|
||||
self.ctx.set_var(
|
||||
"instance",
|
||||
data,
|
||||
schema_builder=self._build_schema_on_200
|
||||
)
|
||||
|
||||
_schema_on_200 = None
|
||||
|
||||
@classmethod
|
||||
def _build_schema_on_200(cls):
|
||||
if cls._schema_on_200 is not None:
|
||||
return cls._schema_on_200
|
||||
|
||||
cls._schema_on_200 = AAZObjectType()
|
||||
|
||||
_schema_on_200 = cls._schema_on_200
|
||||
_schema_on_200.id = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
_schema_on_200.name = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
_schema_on_200.properties = AAZObjectType()
|
||||
_schema_on_200.system_data = AAZObjectType(
|
||||
serialized_name="systemData",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
_schema_on_200.type = AAZStrType(
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
||||
properties = cls._schema_on_200.properties
|
||||
properties.dashboard_url = AAZStrType(
|
||||
serialized_name="dashboardUrl",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
properties.provisioning_state = AAZStrType(
|
||||
serialized_name="provisioningState",
|
||||
flags={"read_only": True},
|
||||
)
|
||||
|
||||
system_data = cls._schema_on_200.system_data
|
||||
system_data.created_at = AAZStrType(
|
||||
serialized_name="createdAt",
|
||||
)
|
||||
system_data.created_by = AAZStrType(
|
||||
serialized_name="createdBy",
|
||||
)
|
||||
system_data.created_by_type = AAZStrType(
|
||||
serialized_name="createdByType",
|
||||
)
|
||||
system_data.last_modified_at = AAZStrType(
|
||||
serialized_name="lastModifiedAt",
|
||||
)
|
||||
system_data.last_modified_by = AAZStrType(
|
||||
serialized_name="lastModifiedBy",
|
||||
)
|
||||
system_data.last_modified_by_type = AAZStrType(
|
||||
serialized_name="lastModifiedByType",
|
||||
)
|
||||
|
||||
return cls._schema_on_200
|
||||
|
||||
|
||||
class _WaitHelper:
|
||||
"""Helper class for Wait"""
|
||||
|
||||
|
||||
__all__ = ["Wait"]
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"azext.isPreview": true,
|
||||
"azext.minCliCoreVersion": "2.61.0"
|
||||
"azext.minCliCoreVersion": "2.67.0"
|
||||
}
|
|
@ -10,7 +10,7 @@ from setuptools import setup, find_packages
|
|||
|
||||
|
||||
# HISTORY.rst entry.
|
||||
VERSION = '1.0.0b1'
|
||||
VERSION = '1.0.0b2'
|
||||
|
||||
# The full list of classifiers is available at
|
||||
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
||||
|
|
Загрузка…
Ссылка в новой задаче