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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/durabletask/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ Release History

1.0.0b1
++++++
* Initial release.
* Initial release.

1.0.0b2
++++++
* Updating name of subresource from namespace to scheduler.
* Adding support for tags in scheduler.
28 changes: 14 additions & 14 deletions src/durabletask/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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> `
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@

@register_command_group(
"durabletask",
is_preview=True,
)
class __CMDGroup(AAZCommandGroup):
"""Commands to manage Durabletasks.
"""Commands to manage Durabletask schedulers and taskhubs
"""
pass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@


@register_command_group(
"durabletask namespace",
is_preview=True,
"durabletask scheduler",
)
class __CMDGroup(AAZCommandGroup):
"""Commands to manage Durabletask namespaces
"""Commands to manage Durabletask schedulers
"""
pass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@


@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"],
]
}

Expand All @@ -46,26 +45,25 @@ def _build_arguments_schema(cls, *args, **kwargs):
# 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"

_args_schema = cls._args_schema
_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
Expand All @@ -90,11 +88,25 @@ def _build_arguments_schema(cls, *args, **kwargs):

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
Expand All @@ -109,7 +121,7 @@ def _output(self, *args, **kwargs):
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):
Expand Down Expand Up @@ -139,7 +151,7 @@ def __call__(self, *args, **kwargs):
@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
)

Expand All @@ -155,11 +167,11 @@ def error_format(self):
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(
Expand All @@ -173,7 +185,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2024-02-01-preview",
"api-version", "2024-10-01-preview",
required=True,
),
}
Expand Down Expand Up @@ -204,12 +216,18 @@ def content(self):

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, ".")
Expand Down Expand Up @@ -254,24 +272,34 @@ def _build_schema_on_200_201(cls):
)

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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@


@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"],
]
}

Expand All @@ -47,24 +46,23 @@ def _build_arguments_schema(cls, *args, **kwargs):
# 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
Expand All @@ -75,7 +73,7 @@ def pre_operations(self):
def post_operations(self):
pass

class NamespacesDelete(AAZHttpOperation):
class SchedulersDelete(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
Expand Down Expand Up @@ -114,7 +112,7 @@ def __call__(self, *args, **kwargs):
@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
)

Expand All @@ -130,11 +128,11 @@ def error_format(self):
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(
Expand All @@ -148,7 +146,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2024-02-01-preview",
"api-version", "2024-10-01-preview",
required=True,
),
}
Expand Down
Loading