Skip to content

Commit

Permalink
[DNS Resolver] Initial Release (#4676)
Browse files Browse the repository at this point in the history
* initial generation

* fix style and linter checks

* add crud tests

* refine help message and README.md

* complete info for initial release
  • Loading branch information
necusjz authored May 5, 2022
1 parent a379919 commit af1775e
Show file tree
Hide file tree
Showing 57 changed files with 22,043 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 @@ -30,6 +30,8 @@

/src/dnc/ @alegal

/src/dns-resolver/ @necusjz

/src/edgeorder/ @necusjz

/src/express-route-cross-connection/ @necusjz @kairu-ms @jsntcy
Expand Down
8 changes: 8 additions & 0 deletions src/dns-resolver/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:
Release History
===============

0.1.0
++++++
* Initial release.
183 changes: 183 additions & 0 deletions src/dns-resolver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
# Azure CLI dns-resolver Extension #
This is the extension for dns-resolver

### How to use ###
Install this extension using the below CLI command
```
az extension add --name dns-resolver
```

### Included Features ###
#### dns-resolver ####
##### Create #####
```
az dns-resolver create --name "sampleDnsResolver" --location "westus2" \
--id "/subscriptions/cbb1387e-4b03-44f2-ad41-58d4677b9873/resourceGroups/virtualNetworkResourceGroup/providers/Microsoft.Network/virtualNetworks/sampleVirtualNetwork" \
--tags key1="value1" --resource-group "sampleResourceGroup"
az dns-resolver wait --created --name "{myDnsResolver}" --resource-group "{rg}"
```
##### Show #####
```
az dns-resolver show --name "sampleDnsResolver" --resource-group "sampleResourceGroup"
```
##### List #####
```
az dns-resolver list --resource-group "sampleResourceGroup"
```
##### Update #####
```
az dns-resolver update --name "sampleDnsResolver" --tags key1="value1" --resource-group "sampleResourceGroup"
```
##### Delete #####
```
az dns-resolver delete --name "sampleDnsResolver" --resource-group "sampleResourceGroup"
```
#### dns-resolver inbound-endpoint ####
##### Create #####
```
az dns-resolver inbound-endpoint create --dns-resolver-name "sampleDnsResolver" --name "sampleInboundEndpoint" \
--location "westus2" \
--ip-configurations private-ip-address="" private-ip-allocation-method="Dynamic" id="/subscriptions/0403cfa9-9659-4f33-9f30-1f191c51d111/resourceGroups/sampleVnetResourceGroupName/providers/Microsoft.Network/virtualNetworks/sampleVirtualNetwork/subnets/sampleSubnet" \
--tags key1="value1" --resource-group "sampleResourceGroup"
az dns-resolver inbound-endpoint wait --created --dns-resolver-name "{myDnsResolver}" --name "{myInboundEndpoint}" \
--resource-group "{rg}"
```
##### Show #####
```
az dns-resolver inbound-endpoint show --dns-resolver-name "sampleDnsResolver" --name "sampleInboundEndpoint" \
--resource-group "sampleResourceGroup"
```
##### List #####
```
az dns-resolver inbound-endpoint list --dns-resolver-name "sampleDnsResolver" --resource-group "sampleResourceGroup"
```
##### Update #####
```
az dns-resolver inbound-endpoint update --dns-resolver-name "sampleDnsResolver" --name "sampleInboundEndpoint" \
--tags key1="value1" --resource-group "sampleResourceGroup"
```
##### Delete #####
```
az dns-resolver inbound-endpoint delete --dns-resolver-name "sampleDnsResolver" --name "sampleInboundEndpoint" \
--resource-group "sampleResourceGroup"
```
#### dns-resolver outbound-endpoint ####
##### Create #####
```
az dns-resolver outbound-endpoint create --dns-resolver-name "sampleDnsResolver" --name "sampleOutboundEndpoint" \
--location "westus2" \
--id "/subscriptions/0403cfa9-9659-4f33-9f30-1f191c51d111/resourceGroups/sampleVnetResourceGroupName/providers/Microsoft.Network/virtualNetworks/sampleVirtualNetwork/subnets/sampleSubnet" \
--tags key1="value1" --resource-group "sampleResourceGroup"
az dns-resolver outbound-endpoint wait --created --dns-resolver-name "{myDnsResolver}" --name "{myOutboundEndpoint}" \
--resource-group "{rg}"
```
##### Show #####
```
az dns-resolver outbound-endpoint show --dns-resolver-name "sampleDnsResolver" --name "sampleOutboundEndpoint" \
--resource-group "sampleResourceGroup"
```
##### List #####
```
az dns-resolver outbound-endpoint list --dns-resolver-name "sampleDnsResolver" --resource-group "sampleResourceGroup"
```
##### Update #####
```
az dns-resolver outbound-endpoint update --dns-resolver-name "sampleDnsResolver" --name "sampleOutboundEndpoint" \
--tags key1="value1" --resource-group "sampleResourceGroup"
```
##### Delete #####
```
az dns-resolver outbound-endpoint delete --dns-resolver-name "sampleDnsResolver" --name "sampleOutboundEndpoint" \
--resource-group "sampleResourceGroup"
```
#### dns-resolver forwarding-ruleset ####
##### Create #####
```
az dns-resolver forwarding-ruleset create --name "samplednsForwardingRuleset" --location "westus2" \
--outbound-endpoints id="/subscriptions/abdd4249-9f34-4cc6-8e42-c2e32110603e/resourceGroups/sampleResourceGroup/providers/Microsoft.Network/dnsResolvers/sampleDnsResolver/outboundEndpoints/sampleOutboundEndpoint0" \
--outbound-endpoints id="/subscriptions/abdd4249-9f34-4cc6-8e42-c2e32110603e/resourceGroups/sampleResourceGroup/providers/Microsoft.Network/dnsResolvers/sampleDnsResolver/outboundEndpoints/sampleOutboundEndpoint1" \
--tags key1="value1" --resource-group "sampleResourceGroup"
az dns-resolver forwarding-ruleset wait --created --name "{myDnsForwardingRuleset2}" --resource-group "{rg}"
```
##### Show #####
```
az dns-resolver forwarding-ruleset show --name "sampleDnsForwardingRuleset" --resource-group "sampleResourceGroup"
```
##### List #####
```
az dns-resolver forwarding-ruleset list --resource-group "sampleResourceGroup"
```
##### Update #####
```
az dns-resolver forwarding-ruleset update --name "sampleDnsForwardingRuleset" --tags key1="value1" \
--resource-group "sampleResourceGroup"
```
##### Delete #####
```
az dns-resolver forwarding-ruleset delete --name "samplednsForwardingRulesetName" \
--resource-group "sampleResourceGroup"
```
#### dns-resolver forwarding-rule ####
##### Create #####
```
az dns-resolver forwarding-rule create --ruleset-name "sampleDnsForwardingRuleset" \
--name "sampleForwardingRule" --domain-name "contoso.com." --forwarding-rule-state "Enabled" \
--metadata additionalProp1="value1" --target-dns-servers ip-address="10.0.0.1" port=53 \
--target-dns-servers ip-address="10.0.0.2" port=53 --resource-group "sampleResourceGroup"
```
##### Show #####
```
az dns-resolver forwarding-rule show --ruleset-name "sampleDnsForwardingRuleset" \
--name "sampleForwardingRule" --resource-group "sampleResourceGroup"
```
##### List #####
```
az dns-resolver forwarding-rule list --ruleset-name "sampleDnsForwardingRuleset" \
--resource-group "sampleResourceGroup"
```
##### Update #####
```
az dns-resolver forwarding-rule update --ruleset-name "sampleDnsForwardingRuleset" \
--name "sampleForwardingRule" --forwarding-rule-state "Disabled" --metadata additionalProp2="value2" \
--resource-group "sampleResourceGroup"
```
##### Delete #####
```
az dns-resolver forwarding-rule delete --ruleset-name "sampleDnsForwardingRuleset" \
--name "sampleForwardingRule" --resource-group "sampleResourceGroup"
```
#### dns-resolver virtual-network-link ####
##### Create #####
```
az dns-resolver vnet-link create --ruleset-name "sampleDnsForwardingRuleset" \
--metadata additionalProp1="value1" \
--id "/subscriptions/0403cfa9-9659-4f33-9f30-1f191c51d111/resourceGroups/sampleVnetResourceGroupName/providers/Microsoft.Network/virtualNetworks/sampleVirtualNetwork" \
--resource-group "sampleResourceGroup" --name "sampleVirtualNetworkLink"
az dns-resolver vnet-link wait --created --ruleset-name "{myDnsForwardingRuleset}" \
--resource-group "{rg}" --name "{myVirtualNetworkLink}"
```
##### Show #####
```
az dns-resolver vnet-link show --ruleset-name "sampleDnsForwardingRuleset" \
--resource-group "sampleResourceGroup" --name "sampleVirtualNetworkLink"
```
##### List #####
```
az dns-resolver vnet-link list --ruleset-name "sampleDnsForwardingRuleset" \
--resource-group "sampleResourceGroup"
```
##### Update #####
```
az dns-resolver vnet-link update --ruleset-name "sampleDnsForwardingRuleset" \
--metadata additionalProp1="value1" --resource-group "sampleResourceGroup" --name "sampleVirtualNetworkLink"
```
##### Delete #####
```
az dns-resolver vnet-link delete --ruleset-name "sampleDnsForwardingRuleset" \
--resource-group "sampleResourceGroup" --name "sampleVirtualNetworkLink"
```
53 changes: 53 additions & 0 deletions src/dns-resolver/azext_dnsresolver/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# --------------------------------------------------------------------------
# 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 Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=unused-import

import azext_dnsresolver._help
from azure.cli.core import AzCommandsLoader


class DnsResolverManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_dnsresolver.generated._client_factory import cf_dns_resolver_cl
dns_resolver_custom = CliCommandType(
operations_tmpl='azext_dnsresolver.custom#{}',
client_factory=cf_dns_resolver_cl)
parent = super()
parent.__init__(cli_ctx=cli_ctx, custom_command_type=dns_resolver_custom)

def load_command_table(self, args):
from azext_dnsresolver.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_dnsresolver.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError as e:
if e.name.endswith('manual.commands'):
pass
else:
raise e
return self.command_table

def load_arguments(self, command):
from azext_dnsresolver.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_dnsresolver.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError as e:
if e.name.endswith('manual._params'):
pass
else:
raise e


COMMAND_LOADER_CLS = DnsResolverManagementClientCommandsLoader
20 changes: 20 additions & 0 deletions src/dns-resolver/azext_dnsresolver/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# 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 Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import
# pylint: disable=unused-import
from .generated._help import helps # pylint: disable=reimported
try:
from .manual._help import helps # pylint: disable=reimported
except ImportError as e:
if e.name.endswith('manual._help'):
pass
else:
raise e
20 changes: 20 additions & 0 deletions src/dns-resolver/azext_dnsresolver/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# 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 Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403
except ImportError as e:
if e.name.endswith('manual.action'):
pass
else:
raise e
4 changes: 4 additions & 0 deletions src/dns-resolver/azext_dnsresolver/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.15.0"
}
20 changes: 20 additions & 0 deletions src/dns-resolver/azext_dnsresolver/custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# --------------------------------------------------------------------------
# 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 Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wildcard-import
# pylint: disable=unused-wildcard-import

from .generated.custom import * # noqa: F403
try:
from .manual.custom import * # noqa: F403
except ImportError as e:
if e.name.endswith('manual.custom'):
pass
else:
raise e
12 changes: 12 additions & 0 deletions src/dns-resolver/azext_dnsresolver/generated/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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 Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
40 changes: 40 additions & 0 deletions src/dns-resolver/azext_dnsresolver/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# --------------------------------------------------------------------------
# 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 Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------


def cf_dns_resolver_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_dnsresolver.vendored_sdks.dnsresolver import DnsResolverManagementClient
return get_mgmt_service_client(cli_ctx,
DnsResolverManagementClient)


def cf_dns_resolver(cli_ctx, *_):
return cf_dns_resolver_cl(cli_ctx).dns_resolvers


def cf_inbound_endpoint(cli_ctx, *_):
return cf_dns_resolver_cl(cli_ctx).inbound_endpoints


def cf_outbound_endpoint(cli_ctx, *_):
return cf_dns_resolver_cl(cli_ctx).outbound_endpoints


def cf_dns_forwarding_ruleset(cli_ctx, *_):
return cf_dns_resolver_cl(cli_ctx).dns_forwarding_rulesets


def cf_forwarding_rule(cli_ctx, *_):
return cf_dns_resolver_cl(cli_ctx).forwarding_rules


def cf_virtual_network_link(cli_ctx, *_):
return cf_dns_resolver_cl(cli_ctx).virtual_network_links
Loading

0 comments on commit af1775e

Please sign in to comment.