Skip to content

Commit

Permalink
[FluidRelay] Generate fluid-relay with CodeGen v2 (Azure#5155)
Browse files Browse the repository at this point in the history
* [FluidRelay] Generate fluid-relay with codegen v2

* Update service_name.json

* Update CODEOWNERS

* Update azext_metadata.json
  • Loading branch information
ZengTaoxu authored Jul 27, 2022
1 parent 3112f7a commit 1dab6ae
Show file tree
Hide file tree
Showing 34 changed files with 4,505 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,5 @@
/src/containerapp-compose/ @smurawski @jldeen

/src/change-analysis/ @linglingtong

/src/fluid-relay/ @kairu-ms @necusjz @ZengTaoxu
8 changes: 8 additions & 0 deletions src/fluid-relay/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:
Release History
===============

0.1.0
++++++
* Initial release.
76 changes: 76 additions & 0 deletions src/fluid-relay/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Azure CLI FluidRelay Extension #
This is an extension to Azure CLI to manage FluidRelay resources.

### How to use ###
```
az extension add --name fluid-relay
```

### Included Features
#### Server:
Manage a fluid relay server: [more info](https://docs.microsoft.com/en-us/azure/azure-fluid-relay/overview/overview)
*Examples:*
```
az fluid-relay server create \
-n TestFluidRelay \
-l westus2 \
-g MyResourceGroup \
--sku standard \
--tags category=sales \
--identity type="SystemAssigned
az fluid-relay server create \
-n TestFluidRelay \
-l westus2 \
-g MyResourceGroup \
--sku standard \
--tags category=sales \
--identity type="SystemAssigned, UserAssigned" \
user-assigned-identities= \
{"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/ \
Microsoft.ManagedIdentity/userAssignedIdentities/id1","/subscriptions/00000000-0000-0000-0000-000000000000/ \
resourceGroups/MyResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2"}
az fluid-relay server update \
-n MyFluidRelay \
-l westus2 \
-g MyResourceGroup \
--tags category=sale
az fluid-relay server list-key \
-g MyResourceGroup \
--server-name MyServerName
az fluid-relay server regenerate-key \
-g MyResourceGroup \
--server-name MyServerName \
--key-name key1
az fluid-relay server list \
--subscription 00000000-0000-0000-0000-000000000000
az fluid-relay server list \
-g MyResourceGroup
az fluid-relay server show \
-g MyResourceGroup \
-n MyFluidRelay
```

#### Container:
Manage a fluid relay container: [more info](https://docs.microsoft.com/en-us/azure/azure-fluid-relay/overview/overview)
```
az fluid-relay container list \
-g MyResourceGroup \
--server-name MyServerName
az fluid-relay container show \
-g MyResourceGroup \
--server-name MyServerName \
-n MyContainerName
az fluid-relay container delete \
-g MyResourceGroup \
--server-name MyServerName \
-n MyContainerName
```
42 changes: 42 additions & 0 deletions src/fluid-relay/azext_fluid_relay/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# --------------------------------------------------------------------------------------------
# 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
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_fluid_relay._help import helps # pylint: disable=unused-import


class FluidRelayCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
custom_command_type = CliCommandType(
operations_tmpl='azext_fluid_relay.custom#{}')
super().__init__(cli_ctx=cli_ctx,
custom_command_type=custom_command_type)

def load_command_table(self, args):
from azext_fluid_relay.commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
except ImportError:
aaz = None
if aaz:
load_aaz_command_table(
loader=self,
aaz_pkg_name=aaz.__name__,
args=args
)
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from azext_fluid_relay._params import load_arguments
load_arguments(self, command)


COMMAND_LOADER_CLS = FluidRelayCommandsLoader
11 changes: 11 additions & 0 deletions src/fluid-relay/azext_fluid_relay/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# --------------------------------------------------------------------------------------------
# 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: disable=line-too-long
# pylint: disable=too-many-lines

from knack.help_files import helps # pylint: disable=unused-import
13 changes: 13 additions & 0 deletions src/fluid-relay/azext_fluid_relay/_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# --------------------------------------------------------------------------------------------
# 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: disable=too-many-lines
# pylint: disable=too-many-statements


def load_arguments(self, _): # pylint: disable=unused-argument
pass
6 changes: 6 additions & 0 deletions src/fluid-relay/azext_fluid_relay/aaz/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# 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
# --------------------------------------------------------------------------------------------
6 changes: 6 additions & 0 deletions src/fluid-relay/azext_fluid_relay/aaz/latest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# 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
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# 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_group(
"fluid-relay",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Fluid Relay
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# --------------------------------------------------------------------------------------------
# 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 .__cmd_group import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# 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_group(
"fluid-relay container",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Fluid Relay Container.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# --------------------------------------------------------------------------------------------
# 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 .__cmd_group import *
from ._delete import *
from ._list import *
from ._show import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# --------------------------------------------------------------------------------------------
# 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(
"fluid-relay container delete",
confirmation="Are you sure you want to perform this operation?",
)
class Delete(AAZCommand):
"""Delete a Fluid Relay container.
:example: FluidRelayContainer_Delete
az fluid-relay container delete -g MyResourceGroup --server-name MyServerName -n MyContainerName
"""

_aaz_info = {
"version": "2022-06-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fluidrelay/fluidrelayservers/{}/fluidrelaycontainers/{}", "2022-06-01"],
]
}

def _handler(self, command_args):
super()._handler(command_args)
self._execute_operations()
return None

_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.container_name = AAZStrArg(
options=["-n", "--name", "--container-name"],
help="The Fluid Relay container resource name.",
required=True,
id_part="child_name_1",
)
_args_schema.server_name = AAZStrArg(
options=["--server-name"],
help="The Fluid Relay server resource name.",
required=True,
id_part="name",
)
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
)
return cls._args_schema

def _execute_operations(self):
self.FluidRelayContainersDelete(ctx=self.ctx)()

class FluidRelayContainersDelete(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)
if session.http_response.status_code in [204]:
return self.on_204(session)

return self.on_error(session.http_response)

@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}/fluidRelayContainers/{fluidRelayContainerName}",
**self.url_parameters
)

@property
def method(self):
return "DELETE"

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

@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"fluidRelayContainerName", self.ctx.args.container_name,
required=True,
),
**self.serialize_url_param(
"fluidRelayServerName", self.ctx.args.server_name,
required=True,
),
**self.serialize_url_param(
"resourceGroup", self.ctx.args.resource_group,
required=True,
),
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
),
}
return parameters

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

def on_200(self, session):
pass

def on_204(self, session):
pass


__all__ = ["Delete"]
Loading

0 comments on commit 1dab6ae

Please sign in to comment.