Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NGINX.NGINXPLUS 1.0.0 #7247

Merged
merged 15 commits into from
Mar 7, 2024
Merged
4 changes: 2 additions & 2 deletions src/nginx/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Release History
===============

0.1.1
1.0.0
++++++
* Update the GA sku in the creation example.
* Deployment identity, logging and scaling added. Configuration analyze added.

george-ngugi marked this conversation as resolved.
Show resolved Hide resolved
0.1.0
++++++
Expand Down
3 changes: 1 addition & 2 deletions src/nginx/azext_nginx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
nginx_custom = CliCommandType(
operations_tmpl='azext_nginx.custom#{}')
super(NginxCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=nginx_custom)
super().__init__(cli_ctx=cli_ctx, custom_command_type=nginx_custom)

def load_command_table(self, args):
from azext_nginx.commands import load_command_table
Expand Down
3 changes: 0 additions & 3 deletions src/nginx/azext_nginx/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long

from knack.arguments import CLIArgumentType


def load_arguments(self, _): # pylint: disable=unused-argument
pass
4 changes: 4 additions & 0 deletions src/nginx/azext_nginx/aaz/latest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

133 changes: 94 additions & 39 deletions src/nginx/azext_nginx/aaz/latest/nginx/deployment/_create.py

Large diffs are not rendered by default.

47 changes: 32 additions & 15 deletions src/nginx/azext_nginx/aaz/latest/nginx/deployment/_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
confirmation="Are you sure you want to perform this operation?",
)
class Delete(AAZCommand):
"""Delete an Nginx deployment
"""Delete an NGINX deployment

:example: Deployment Delete
az nginx deployment delete --name myDeployment --resource-group myResourceGroup
"""

_aaz_info = {
"version": "2022-08-01",
"version": "2023-09-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/nginx.nginxplus/nginxdeployments/{}", "2022-08-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/nginx.nginxplus/nginxdeployments/{}", "2023-09-01"],
]
}

Expand All @@ -48,17 +48,30 @@ def _build_arguments_schema(cls, *args, **kwargs):
_args_schema = cls._args_schema
_args_schema.deployment_name = AAZStrArg(
options=["-n", "--name", "--deployment-name"],
help="The name of targeted Nginx deployment",
help="The name of targeted NGINX deployment",
required=True,
id_part="name",
fmt=AAZStrArgFormat(
pattern="^([a-z0-9A-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]|[a-z0-9A-Z])$",
),
)
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
)
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
yield self.DeploymentsDelete(ctx=self.ctx)()
self.post_operations()

@register_callback
def pre_operations(self):
pass

@register_callback
def post_operations(self):
pass

class DeploymentsDelete(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"
Expand Down Expand Up @@ -109,17 +122,7 @@ def method(self):

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

@property
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2022-08-01",
required=True,
),
}
return parameters
return "MgmtErrorFormat"

@property
def url_parameters(self):
Expand All @@ -139,11 +142,25 @@ def url_parameters(self):
}
return parameters

@property
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-09-01",
required=True,
),
}
return parameters

def on_200(self, session):
pass

def on_204(self, session):
pass


class _DeleteHelper:
"""Helper class for Delete"""


__all__ = ["Delete"]
102 changes: 68 additions & 34 deletions src/nginx/azext_nginx/aaz/latest/nginx/deployment/_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"nginx deployment list",
)
class List(AAZCommand):
"""List of Nginx deployments
"""List of NGINX deployments

List all deployments under the specified subscription.
List all Nginx Deployments under the specified resource group
Expand All @@ -26,13 +26,15 @@ class List(AAZCommand):
"""

_aaz_info = {
"version": "2022-08-01",
"version": "2023-09-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/nginx.nginxplus/nginxdeployments", "2022-08-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/nginx.nginxplus/nginxdeployments", "2022-08-01"],
["mgmt-plane", "/subscriptions/{}/providers/nginx.nginxplus/nginxdeployments", "2023-09-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/nginx.nginxplus/nginxdeployments", "2023-09-01"],
]
}

AZ_SUPPORT_PAGINATION = True

def _handler(self, command_args):
super()._handler(command_args)
return self.build_paging(self._execute_operations, self._output)
Expand All @@ -52,12 +54,22 @@ def _build_arguments_schema(cls, *args, **kwargs):
return cls._args_schema

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
if condition_0:
self.DeploymentsListByResourceGroup(ctx=self.ctx)()
if condition_1:
self.DeploymentsList(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.value, client_flatten=True)
Expand Down Expand Up @@ -88,17 +100,7 @@ def method(self):

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

@property
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2022-08-01",
required=True,
),
}
return parameters
return "MgmtErrorFormat"

@property
def url_parameters(self):
Expand All @@ -114,6 +116,16 @@ def url_parameters(self):
}
return parameters

@property
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-09-01",
required=True,
),
}
return parameters

@property
def header_parameters(self):
parameters = {
Expand Down Expand Up @@ -217,6 +229,13 @@ def _build_schema_on_200(cls):
)
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
flags={"read_only": True},
)
properties.scaling_properties = AAZObjectType(
serialized_name="scalingProperties",
)
properties.user_profile = AAZObjectType(
serialized_name="userProfile",
)

logging = cls._schema_on_200.value.Element.properties.logging
Expand Down Expand Up @@ -273,6 +292,14 @@ def _build_schema_on_200(cls):
serialized_name="subnetId",
)

scaling_properties = cls._schema_on_200.value.Element.properties.scaling_properties
scaling_properties.capacity = AAZIntType()

user_profile = cls._schema_on_200.value.Element.properties.user_profile
user_profile.preferred_email = AAZStrType(
serialized_name="preferredEmail",
)

sku = cls._schema_on_200.value.Element.sku
sku.name = AAZStrType(
flags={"required": True},
Expand All @@ -281,27 +308,21 @@ def _build_schema_on_200(cls):
system_data = cls._schema_on_200.value.Element.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
flags={"read_only": True},
george-ngugi marked this conversation as resolved.
Show resolved Hide resolved
)
system_data.created_by = AAZStrType(
serialized_name="createdBy",
flags={"read_only": True},
)
system_data.created_by_type = AAZStrType(
serialized_name="createdByType",
flags={"read_only": True},
)
system_data.last_modified_at = AAZStrType(
serialized_name="lastModifiedAt",
flags={"read_only": True},
)
system_data.last_modified_by = AAZStrType(
serialized_name="lastModifiedBy",
flags={"read_only": True},
)
system_data.last_modified_by_type = AAZStrType(
serialized_name="lastModifiedByType",
flags={"read_only": True},
)

tags = cls._schema_on_200.value.Element.tags
Expand Down Expand Up @@ -333,23 +354,23 @@ def method(self):

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

@property
def query_parameters(self):
def url_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2022-08-01",
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
),
}
return parameters

@property
def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
**self.serialize_query_param(
"api-version", "2023-09-01",
required=True,
),
}
Expand Down Expand Up @@ -458,6 +479,13 @@ def _build_schema_on_200(cls):
)
properties.provisioning_state = AAZStrType(
serialized_name="provisioningState",
flags={"read_only": True},
)
properties.scaling_properties = AAZObjectType(
serialized_name="scalingProperties",
)
properties.user_profile = AAZObjectType(
serialized_name="userProfile",
)

logging = cls._schema_on_200.value.Element.properties.logging
Expand Down Expand Up @@ -514,6 +542,14 @@ def _build_schema_on_200(cls):
serialized_name="subnetId",
)

scaling_properties = cls._schema_on_200.value.Element.properties.scaling_properties
scaling_properties.capacity = AAZIntType()

user_profile = cls._schema_on_200.value.Element.properties.user_profile
user_profile.preferred_email = AAZStrType(
serialized_name="preferredEmail",
)

sku = cls._schema_on_200.value.Element.sku
sku.name = AAZStrType(
flags={"required": True},
Expand All @@ -522,27 +558,21 @@ def _build_schema_on_200(cls):
system_data = cls._schema_on_200.value.Element.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
flags={"read_only": True},
)
system_data.created_by = AAZStrType(
serialized_name="createdBy",
flags={"read_only": True},
)
system_data.created_by_type = AAZStrType(
serialized_name="createdByType",
flags={"read_only": True},
)
system_data.last_modified_at = AAZStrType(
serialized_name="lastModifiedAt",
flags={"read_only": True},
)
system_data.last_modified_by = AAZStrType(
serialized_name="lastModifiedBy",
flags={"read_only": True},
)
system_data.last_modified_by_type = AAZStrType(
serialized_name="lastModifiedByType",
flags={"read_only": True},
)

tags = cls._schema_on_200.value.Element.tags
Expand All @@ -551,4 +581,8 @@ def _build_schema_on_200(cls):
return cls._schema_on_200


class _ListHelper:
"""Helper class for List"""


__all__ = ["List"]
Loading