Skip to content

Commit 80a0050

Browse files
committed
review findings fixes
1 parent e40f8d9 commit 80a0050

File tree

5 files changed

+18
-22
lines changed

5 files changed

+18
-22
lines changed

src/azure-cli/azure/cli/command_modules/cognitiveservices/_client_factory.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ def cf_outbound_rule(cli_ctx, *_):
105105
return get_cognitiveservices_management_client(cli_ctx).outbound_rule
106106

107107

108-
def cf_outbound_rules(cli_ctx, *_):
109-
return get_cognitiveservices_management_client(cli_ctx).outbound_rules
110-
111-
112108
def cf_account_capability_hosts(cli_ctx, *_):
113109
return get_cognitiveservices_management_client(cli_ctx).account_capability_hosts
114110

src/azure-cli/azure/cli/command_modules/cognitiveservices/_params.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,6 @@ def load_arguments(self, _):
706706
help='Firewall SKU for the managed network.')
707707

708708
with self.argument_context('cognitiveservices account managed-network update') as c:
709-
c.argument('managed_network_name', default=None)
710709
c.argument('managed_network',
711710
options_list=['--managed-network'],
712711
arg_type=get_enum_type(['allow_internet_outbound', 'allow_only_approved_outbound']),
@@ -741,7 +740,7 @@ def load_arguments(self, _):
741740
help='Destination for the outbound rule. '
742741
'For FQDN rules, this is the FQDN string. '
743742
'For PrivateEndpoint rules, this is the service resource ID. '
744-
'For ServiceTag rules, provide a JSON string or @file path.')
743+
'For ServiceTag rules, provide a JSON string.')
745744
c.argument('subresource_target',
746745
options_list=['--subresource-target'],
747746
help='Subresource target for PrivateEndpoint outbound rules '

src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,14 +2330,23 @@ def _build_outbound_rule(rule_type, category=None, destination=None, subresource
23302330
)
23312331
if normalized_type == 'ServiceTag':
23322332
# ServiceTag requires a structured destination object with serviceTag field
2333+
# Map camelCase keys (from JSON examples) to snake_case (SDK model kwargs)
2334+
_service_tag_key_map = {
2335+
'serviceTag': 'service_tag',
2336+
'portRanges': 'port_ranges',
2337+
}
2338+
2339+
def _normalize_service_tag_keys(d):
2340+
return {_service_tag_key_map.get(k, k): v for k, v in d.items()}
2341+
23332342
if isinstance(destination, ServiceTagOutboundRuleDestination):
23342343
dest_obj = destination
23352344
elif isinstance(destination, dict):
2336-
dest_obj = ServiceTagOutboundRuleDestination(**destination)
2345+
dest_obj = ServiceTagOutboundRuleDestination(**_normalize_service_tag_keys(destination))
23372346
elif isinstance(destination, str):
23382347
try:
23392348
dest_dict = json.loads(destination)
2340-
dest_obj = ServiceTagOutboundRuleDestination(**dest_dict)
2349+
dest_obj = ServiceTagOutboundRuleDestination(**_normalize_service_tag_keys(dest_dict))
23412350
except (json.JSONDecodeError, TypeError):
23422351
dest_obj = ServiceTagOutboundRuleDestination(
23432352
service_tag=destination,

src/azure-cli/azure/cli/command_modules/cognitiveservices/linter_exclusions.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ cognitiveservices account managed-network:
99
managed_network_name:
1010
rule_exclusions:
1111
- missing_parameter_test_coverage
12+
cognitiveservices account managed-network update:
13+
parameters:
14+
managed_network_name:
15+
rule_exclusions:
16+
- no_parameter_defaults_for_update_commands
1217
cognitiveservices account connection list:
1318
parameters:
1419
category:

src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_managed_network.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -194,20 +194,7 @@ def test_outbound_rule_service_tag(self, resource_group):
194194

195195
sname = self.create_random_name(prefix='cog', length=12)
196196
rule_name = 'test-st-rule'
197-
198-
# Print resource details so we can share with service team
199-
import sys
200-
from datetime import datetime, timezone
201-
print(f'\n=== SERVICE TAG TEST RESOURCES ===', file=sys.stderr)
202-
print(f'Subscription: {self.get_subscription_id()}', file=sys.stderr)
203-
print(f'Resource Group: {resource_group}', file=sys.stderr)
204-
print(f'Account Name: {sname}', file=sys.stderr)
205-
print(f'Rule Name: {rule_name}', file=sys.stderr)
206-
print(f'Region: eastus', file=sys.stderr)
207-
print(f'API Version: 2025-10-01-preview', file=sys.stderr)
208-
print(f'Timestamp: {datetime.now(timezone.utc).isoformat()}', file=sys.stderr)
209-
print(f'=================================\n', file=sys.stderr)
210-
197+
211198
self.kwargs.update({
212199
'sname': sname,
213200
'kind': 'AIServices',

0 commit comments

Comments
 (0)