Skip to content
3 changes: 3 additions & 0 deletions src/azure-cli-core/azure/cli/core/commands/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ def parse_resource_id(rid):
- resource_type Type of the target resource (not the parent)
- resource_name Name of the target resource (not the parent)
'''
if not rid:
return {}

m = regex.match(rid)
if m:
result = m.groupdict()
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, import_prefix, client_name):
AZURE_API_PROFILES = {
'latest': {
ResourceType.MGMT_STORAGE: '2017-06-01',
ResourceType.MGMT_NETWORK: '2017-06-01',
ResourceType.MGMT_NETWORK: '2017-08-01',
ResourceType.MGMT_COMPUTE: '2017-03-30',
ResourceType.MGMT_RESOURCE_FEATURES: '2015-12-01',
ResourceType.MGMT_RESOURCE_LINKS: '2016-09-01',
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_monitor(self, resource_group):
webhook2 = 'https://contoso.com/alerts'
self.cmd('monitor alert create -g {} -n {} --target {} --condition "Percentage CPU > 90 avg 5m"'.format(resource_group, rule1, vm_id), checks=[
JMESPathCheck('actions[0].customEmails', []),
JMESPathCheck('actions[0].sendToServiceOwners', None),
JMESPathCheck('actions[0].sendToServiceOwners', False),
JMESPathCheck('alertRuleResourceName', rule1),
JMESPathCheck('condition.dataSource.metricName', 'Percentage CPU'),
JMESPathCheck('condition.dataSource.resourceUri', vm_id),
Expand All @@ -39,14 +39,14 @@ def test_monitor(self, resource_group):
])
self.cmd('monitor alert create -g {} -n {} --target {} --target-namespace Microsoft.Compute --target-type virtualMachines --disabled --condition "Percentage CPU >= 60 avg 1h" --description "Test Rule 2" -a email test1@contoso.com test2@contoso.com test3@contoso.com'.format(resource_group, rule2, vm), checks=[
JMESPathCheck('length(actions[0].customEmails)', 3),
JMESPathCheck('actions[0].sendToServiceOwners', None),
JMESPathCheck('actions[0].sendToServiceOwners', False),
JMESPathCheck('alertRuleResourceName', rule2),
JMESPathCheck('condition.dataSource.metricName', 'Percentage CPU'),
JMESPathCheck('condition.dataSource.resourceUri', vm_id),
JMESPathCheck('condition.threshold', 60.0),
JMESPathCheck('condition.timeAggregation', 'Average'),
JMESPathCheck('condition.windowSize', '1:00:00'),
JMESPathCheck('isEnabled', None),
JMESPathCheck('isEnabled', False),
JMESPathCheck('description', 'Test Rule 2')
])
self.cmd('monitor alert create -g {} -n {} --target {} --condition "Percentage CPU >= 99 avg 5m" --action webhook {} --action webhook {} apiKey=value'.format(resource_group, rule3, vm_id, webhook1, webhook2), checks=[
Expand Down
5 changes: 5 additions & 0 deletions src/command_modules/azure-cli-network/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
===============

unreleased
+++++++++++++++++++
* BC `vnet list-private-access-services`: renamed to `vnet list-endpoint-services`
* BC `vnet subnet create/update`: renamed `--private-access-services` to `--service-endpoints`

2.0.12 (2017-08-11)
+++++++++++++++++++
* `lb`: fixed issue where the certain child resource names did not resolve correctly when omitted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def cf_packet_capture(_):
return _network_client_factory().packet_captures


def cf_private_access(_):
return _network_client_factory().available_private_access_services
def cf_endpoint_service(_):
return _network_client_factory().available_endpoint_services


def cf_public_ip_addresses(_):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1752,10 +1752,10 @@
type: command
short-summary: Create a subnet and associate an existing NSG and route table.
parameters:
- name: --private-access-services
short-summary: Space separated list of services for which to allow private access to this subnet.
- name: --service-endpoints
short-summary: Space separated list of services for which to allow tunneling to this subnet.
populator-commands:
- az network list-private-access-services
- az network vnet list-endpoint-services
examples:
- name: Create new subnet attached to an NSG with a custom route table.
text: >
Expand All @@ -1782,10 +1782,10 @@
type: command
short-summary: Update a subnet.
parameters:
- name: --private-access-services
short-summary: Space separated list of services for which to allow private access to this subnet.
- name: --service-endpoints
short-summary: Space separated list of services for which to allow tunneling to this subnet.
populator-commands:
- az network list-private-access-services
- az network vnet list-endpoint-services
"""
# endregion

Expand Down Expand Up @@ -2159,7 +2159,7 @@

# endregion

helps['network list-private-access-services'] = """
helps['network vnet list-service-endpoints'] = """
type: command
short-summary: List which services support private access for a given region.
short-summary: List which services support VNET service tunneling for a given region.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def completer(prefix, action, parsed_args, **kwargs): # pylint: disable=unused-
register_cli_argument('network vnet subnet', 'route_table', help='Name or ID of a route table to associate with the subnet.')

with VersionConstraint(ResourceType.MGMT_NETWORK, min_api='2017-06-01') as c:
c.register_cli_argument('network vnet subnet', 'private_access_services', nargs='+')
c.register_cli_argument('network vnet subnet', 'service_endpoints', nargs='+')

lb_subresources = [
{'name': 'address-pool', 'display': 'backend address pool', 'ref': 'backend_address_pools'},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
cf_virtual_network_gateways, cf_traffic_manager_mgmt_endpoints,
cf_traffic_manager_mgmt_profiles, cf_dns_mgmt_record_sets, cf_dns_mgmt_zones,
cf_tm_geographic, cf_security_rules, cf_subnets, cf_usages, cf_service_community,
cf_public_ip_addresses, cf_private_access)
cf_public_ip_addresses, cf_endpoint_service)
from ._util import (list_network_resource_property,
get_network_resource_property_entry,
delete_network_resource_property_entry)
Expand Down Expand Up @@ -431,8 +431,8 @@ def _make_singular(value):
cli_generic_update_command(__name__, 'network vnet peering update', vnet_peering_path + 'get', vnet_peering_path + 'create_or_update', cf_virtual_network_peerings, setter_arg_name='virtual_network_peering_parameters')

if supported_api_version(ResourceType.MGMT_NETWORK, min_api='2017-06-01'):
private_access_path = 'azure.mgmt.network.operations.available_private_access_services_operations#AvailablePrivateAccessServicesOperations.'
cli_command(__name__, 'network list-private-access-services', private_access_path + 'list', cf_private_access)
endpoint_service_path = 'azure.mgmt.network.operations.available_endpoint_services_operations#AvailableEndpointServicesOperations.'
cli_command(__name__, 'network vnet list-endpoint-services', endpoint_service_path + 'list', cf_endpoint_service)

# Traffic Manager ProfileOperations
tm_profile_path = 'azure.mgmt.trafficmanager.operations.profiles_operations#ProfilesOperations.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,7 @@ def _set_route_table(ncf, resource_group_name, route_table, subnet):

def create_subnet(resource_group_name, virtual_network_name, subnet_name,
address_prefix, network_security_group=None,
route_table=None, private_access_services=None):
route_table=None, service_endpoints=None):
'''Create a virtual network (VNet) subnet.
:param str address_prefix: address prefix in CIDR format.
:param str network_security_group: Name or ID of network security
Expand All @@ -1536,19 +1536,18 @@ def create_subnet(resource_group_name, virtual_network_name, subnet_name,
if network_security_group:
subnet.network_security_group = NetworkSecurityGroup(id=network_security_group)
_set_route_table(ncf, resource_group_name, route_table, subnet)
if private_access_services:
PrivateAccessService = get_sdk(ResourceType.MGMT_NETWORK, 'PrivateAccessServicePropertiesFormat',
mod='models')
subnet.private_access_services = []
for service in private_access_services:
subnet.private_access_services.append(PrivateAccessService(service=service))
if service_endpoints:
ServiceEndpoint = get_sdk(ResourceType.MGMT_NETWORK, 'ServiceEndpointPropertiesFormat', mod='models')
subnet.service_endpoints = []
for service in service_endpoints:
subnet.service_endpoints.append(ServiceEndpoint(service=service))

return ncf.subnets.create_or_update(resource_group_name, virtual_network_name,
subnet_name, subnet)


def update_subnet(instance, resource_group_name, address_prefix=None, network_security_group=None,
route_table=None, private_access_services=None):
route_table=None, service_endpoints=None):
'''update existing virtual sub network
:param str address_prefix: New address prefix in CIDR format, for example 10.0.0.0/24.
:param str network_security_group: attach with existing network security group,
Expand All @@ -1564,14 +1563,13 @@ def update_subnet(instance, resource_group_name, address_prefix=None, network_se

_set_route_table(_network_client_factory(), resource_group_name, route_table, instance)

if private_access_services == ['']:
instance.private_access_services = None
elif private_access_services:
PrivateAccessService = get_sdk(ResourceType.MGMT_NETWORK, 'PrivateAccessServicePropertiesFormat',
mod='models')
instance.private_access_services = []
for service in private_access_services:
instance.private_access_services.append(PrivateAccessService(service=service))
if service_endpoints == ['']:
instance.service_endpoints = None
elif service_endpoints:
ServiceEndpoint = get_sdk(ResourceType.MGMT_NETWORK, 'ServiceEndpointPropertiesFormat', mod='models')
instance.service_endpoints = []
for service in service_endpoints:
instance.service_endpoints.append(ServiceEndpoint(service=service))

return instance

Expand Down
Loading