Skip to content

Commit

Permalink
Updating durabletask extension to include new fields for url
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Lettieri <[email protected]>
  • Loading branch information
RyanLettieri committed Oct 21, 2024
1 parent ce918f2 commit 04a8582
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ def _build_arguments_schema(cls, *args, **kwargs):

def _execute_operations(self):
self.pre_operations()
condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id)
condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True
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.NamespacesListByResourceGroup(ctx=self.ctx)()
if condition_1:
self.NamespacesListBySubscription(ctx=self.ctx)()
if condition_1:
self.NamespacesListByResourceGroup(ctx=self.ctx)()
self.post_operations()

@register_callback
Expand All @@ -75,7 +75,7 @@ def _output(self, *args, **kwargs):
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
return result, next_link

class NamespacesListByResourceGroup(AAZHttpOperation):
class NamespacesListBySubscription(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
Expand All @@ -89,7 +89,7 @@ def __call__(self, *args, **kwargs):
@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces",
"/subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/namespaces",
**self.url_parameters
)

Expand All @@ -104,10 +104,6 @@ def error_format(self):
@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"resourceGroupName", self.ctx.args.resource_group,
required=True,
),
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
Expand Down Expand Up @@ -226,7 +222,7 @@ def _build_schema_on_200(cls):

return cls._schema_on_200

class NamespacesListBySubscription(AAZHttpOperation):
class NamespacesListByResourceGroup(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
Expand All @@ -240,7 +236,7 @@ def __call__(self, *args, **kwargs):
@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/namespaces",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/namespaces",
**self.url_parameters
)

Expand All @@ -255,6 +251,10 @@ def error_format(self):
@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"resourceGroupName", self.ctx.args.resource_group,
required=True,
),
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Create(AAZCommand):
"""Create a Task Hub
:example: Create a taskhub in a namespace
az durabletask taskhub create -g resource-grou-name -s testnamespace -n taskhub-name
az durabletask taskhub create -g resource-group-name -s testnamespace -n taskhub-name
"""

_aaz_info = {
Expand Down Expand Up @@ -216,6 +216,10 @@ def _build_schema_on_200_201(cls):
)

properties = cls._schema_on_200_201.properties
properties.dashboard_url = AAZStrType(
serialized_name="dashboardUrl",
flags={"read_only": True},
)
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
flags={"read_only": True},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ def _build_schema_on_200(cls):
)

properties = cls._schema_on_200.value.Element.properties
properties.dashboard_url = AAZStrType(
serialized_name="dashboardUrl",
flags={"read_only": True},
)
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
flags={"read_only": True},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ def _build_schema_on_200(cls):
)

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},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ def _build_schema_task_hub_read(cls, _schema):
)

properties = _schema_task_hub_read.properties
properties.dashboard_url = AAZStrType(
serialized_name="dashboardUrl",
flags={"read_only": True},
)
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
flags={"read_only": True},
Expand Down

0 comments on commit 04a8582

Please sign in to comment.