Skip to content

Commit

Permalink
[dataprotection] Added '-v' option for all --vault-name parameters (#…
Browse files Browse the repository at this point in the history
…6897)

* Added '-v' option for all --vault-name parameters

* Added history and new version, removed incorrectly committed JSON

---------

Co-authored-by: Zubair Abid <[email protected]>
  • Loading branch information
zubairabid and Zubair Abid authored Oct 26, 2023
1 parent 37ef8d4 commit 42d12ff
Show file tree
Hide file tree
Showing 29 changed files with 63 additions and 57 deletions.
4 changes: 4 additions & 0 deletions src/dataprotection/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Release History
===============
0.11.1
++++++
* Added '-v' option for all --vault-name parameters

0.11.0
++++++
* Add support for Multi-User Authentication for Backup vaults
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
)
Expand All @@ -80,6 +80,7 @@ def _build_args_base_resource_properties_create(cls, _schema):
options=["object-type"],
help="Type of the specific object - used for deserializing",
required=True,
enum={"DefaultResourceProperties": "DefaultResourceProperties"},
)

_schema.object_type = cls._args_base_resource_properties_create.object_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down Expand Up @@ -273,6 +273,7 @@ def _build_args_base_resource_properties_update(cls, _schema):
base_resource_properties_update.object_type = AAZStrArg(
options=["object-type"],
help="Type of the specific object - used for deserializing",
enum={"DefaultResourceProperties": "DefaultResourceProperties"},
)

_schema.object_type = cls._args_base_resource_properties_update.object_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down Expand Up @@ -353,6 +353,7 @@ def _build_args_base_resource_properties_create(cls, _schema):
options=["object-type"],
help="Type of the specific object - used for deserializing",
required=True,
enum={"DefaultResourceProperties": "DefaultResourceProperties"},
)

_schema.object_type = cls._args_base_resource_properties_create.object_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down Expand Up @@ -433,6 +433,7 @@ def _build_args_base_resource_properties_create(cls, _schema):
options=["object-type"],
help="Type of the specific object - used for deserializing",
required=True,
enum={"DefaultResourceProperties": "DefaultResourceProperties"},
)

_schema.object_type = cls._args_base_resource_properties_create.object_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down Expand Up @@ -369,6 +369,7 @@ def _build_args_base_resource_properties_create(cls, _schema):
options=["object-type"],
help="Type of the specific object - used for deserializing",
required=True,
enum={"DefaultResourceProperties": "DefaultResourceProperties"},
)

_schema.object_type = cls._args_base_resource_properties_create.object_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
)

# define Arg Group "Resource Id Arguments"

Expand All @@ -59,13 +65,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
id_part="child_name_1",
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
arg_group="Resource Id Arguments",
help="The name of the backup vault.",
required=True,
id_part="name",
)
return cls._args_schema

def _execute_operations(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
)
_args_schema.vault_name = AAZStrArg(
options=["-v", "--vault-name"],
help="The name of the backup vault.",
required=True,
id_part="name",
)

# define Arg Group "Resource Id Arguments"

Expand All @@ -66,13 +72,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
id_part="child_name_2",
)
_args_schema.vault_name = AAZStrArg(
options=["--vault-name"],
arg_group="Resource Id Arguments",
help="The name of the backup vault.",
required=True,
id_part="name",
)
return cls._args_schema

def _execute_operations(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ def _build_arguments_schema(cls, *args, **kwargs):

def _execute_operations(self):
self.pre_operations()
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)
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
if condition_0:
self.ResourceGuardsGetResourcesInSubscription(ctx=self.ctx)()
if condition_1:
self.ResourceGuardsGetResourcesInResourceGroup(ctx=self.ctx)()
if condition_1:
self.ResourceGuardsGetResourcesInSubscription(ctx=self.ctx)()
self.post_operations()

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

class ResourceGuardsGetResourcesInSubscription(AAZHttpOperation):
class ResourceGuardsGetResourcesInResourceGroup(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

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

Expand All @@ -105,6 +105,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 Expand Up @@ -239,7 +243,7 @@ def _build_schema_on_200(cls):

return cls._schema_on_200

class ResourceGuardsGetResourcesInResourceGroup(AAZHttpOperation):
class ResourceGuardsGetResourcesInSubscription(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

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

Expand All @@ -268,10 +272,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
Loading

0 comments on commit 42d12ff

Please sign in to comment.