9
9
from knack .util import CLIError
10
10
from knack .log import get_logger
11
11
12
- from msrestazure .azure_exceptions import CloudError
13
12
from azure .cli .core .commands import LongRunningOperation
14
13
from azure .cli .core .commands .parameters import get_resources_in_subscription
14
+ from azure .core .exceptions import ResourceNotFoundError
15
15
16
16
from ._constants import (
17
17
REGISTRY_RESOURCE_TYPE ,
@@ -198,7 +198,8 @@ def get_validate_platform(cmd, platform):
198
198
"""Gets and validates the Platform from both flags
199
199
:param str platform: The name of Platform passed by user in --platform flag
200
200
"""
201
- OS , Architecture = cmd .get_models ('OS' , 'Architecture' )
201
+ OS , Architecture = cmd .get_models ('OS' , 'Architecture' , operation_group = 'runs' )
202
+
202
203
# Defaults
203
204
platform_os = OS .linux .value
204
205
platform_arch = Architecture .amd64 .value
@@ -285,10 +286,14 @@ def get_custom_registry_credentials(cmd,
285
286
:param str password: The password for custom registry (plain text or a key vault secret URI)
286
287
:param str identity: The task managed identity used for the credential
287
288
"""
289
+ Credentials , SourceRegistryCredentials , CustomRegistryCredentials , SecretObject , \
290
+ SecretObjectType = cmd .get_models (
291
+ 'Credentials' , 'CustomRegistryCredentials' , 'SourceRegistryCredentials' , 'SecretObject' ,
292
+ 'SecretObjectType' ,
293
+ operation_group = 'tasks' )
288
294
289
295
source_registry_credentials = None
290
296
if auth_mode :
291
- SourceRegistryCredentials = cmd .get_models ('SourceRegistryCredentials' )
292
297
source_registry_credentials = SourceRegistryCredentials (
293
298
login_mode = auth_mode )
294
299
@@ -301,11 +306,6 @@ def get_custom_registry_credentials(cmd,
301
306
if not username and not password :
302
307
is_identity_credential = identity is not None
303
308
304
- CustomRegistryCredentials , SecretObject , SecretObjectType = cmd .get_models (
305
- 'CustomRegistryCredentials' ,
306
- 'SecretObject' ,
307
- 'SecretObjectType' )
308
-
309
309
if not is_remove :
310
310
if is_identity_credential :
311
311
custom_reg_credential = CustomRegistryCredentials (
@@ -328,17 +328,15 @@ def get_custom_registry_credentials(cmd,
328
328
329
329
custom_registries = {login_server : custom_reg_credential }
330
330
331
- Credentials = cmd .get_models ('Credentials' )
332
331
return Credentials (
333
332
source_registry = source_registry_credentials ,
334
333
custom_registries = custom_registries
335
334
)
336
335
337
336
338
337
def build_timers_info (cmd , schedules ):
339
- TimerTrigger , TriggerStatus = cmd .get_models (
340
- 'TimerTrigger' , 'TriggerStatus' )
341
338
timer_triggers = []
339
+ TriggerStatus , TimerTrigger = cmd .get_models ('TriggerStatus' , 'TimerTrigger' , operation_group = 'tasks' )
342
340
343
341
# Provide a default name for the timer if no name was provided.
344
342
for index , schedule in enumerate (schedules , start = 1 ):
@@ -507,11 +505,14 @@ def create_default_scope_map(cmd,
507
505
raise CLIError ('The default scope map was already configured with different repository permissions.' +
508
506
'\n Please use "az acr scope-map update -r {} -n {} --add <REPO> --remove <REPO>" to update.'
509
507
.format (registry_name , scope_map_name ))
510
- except CloudError :
508
+ except ResourceNotFoundError :
511
509
pass
512
510
logger .info ('Creating a scope map "%s" for provided permissions.' , scope_map_name )
513
- poller = scope_map_client .create (resource_group_name , registry_name , scope_map_name ,
514
- actions , scope_map_description )
511
+ scope_map_request = {
512
+ 'actions' : actions ,
513
+ 'scope_map_description' : scope_map_description
514
+ }
515
+ poller = scope_map_client .begin_create (resource_group_name , registry_name , scope_map_name , scope_map_request )
515
516
scope_map = LongRunningOperation (cmd .cli_ctx )(poller )
516
517
return scope_map
517
518
0 commit comments