Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1c998bd
reverting changes for ASK key
hivyas Mar 16, 2020
67c7e04
reverting changes
hivyas Mar 16, 2020
44e755f
updated ams module to dec 2019 swagger
hivyas Apr 24, 2020
dc0e466
added test cases
hivyas Apr 28, 2020
eaf7f59
added ability to update offlinerental
hivyas Apr 29, 2020
0885ea9
fixed audio language bug
hivyas Apr 30, 2020
6fbab37
Merge branch 'dev' into dev
hivyas May 1, 2020
2cd98d7
fixing requirements*.txt files
hivyas May 7, 2020
3b31409
Fixed transforms test case and national bug
hivyas May 7, 2020
b398868
updated content key policy tests
hivyas May 8, 2020
12fbf09
fixed style and lint errors
hivyas May 8, 2020
20c3944
Merge remote-tracking branch 'upstream/dev' into dev
hivyas Jun 11, 2020
91528ee
made az ams sp create idempotent
hivyas Jul 20, 2020
9297770
fixed typo and updated help text
hivyas Jul 21, 2020
d0e7756
Merge remote-tracking branch 'upstream/dev' into dev
hivyas Aug 11, 2020
c46c527
Merge remote-tracking branch 'upstream/dev' into dev
hivyas Sep 22, 2020
b70c052
Merge remote-tracking branch 'upstream/dev' into dev
hivyas Oct 26, 2020
b393193
Merge remote-tracking branch 'upstream/dev' into dev
hivyas Nov 18, 2020
7c2d5d7
added support for most 2020 updates
hivyas Dec 17, 2020
3067062
added encryption subgroup
hivyas Jan 7, 2021
2eaf71c
updated encryption
hivyas Jan 11, 2021
83b7a79
added testsd
hivyas Jan 13, 2021
2409710
style check changes
hivyas Jan 20, 2021
b730365
Merge remote-tracking branch 'upstream/dev' into dev
hivyas Jan 20, 2021
3df2b2a
rebasing dev
hivyas Jan 20, 2021
970a32b
reran encryption test
hivyas Jan 20, 2021
31834ac
reran all ams tests live
hivyas Jan 21, 2021
6fcd069
renamed live event parameter name
hivyas Jan 21, 2021
360cdcb
updating live tests
hivyas Jan 22, 2021
24fcbb4
added examples to encryption and updated mru file
hivyas Feb 19, 2021
415d7bd
updated strings and reran tests
hivyas Feb 19, 2021
42ce31c
updated parameter name
hivyas Feb 19, 2021
cdc5ad4
changes based off PR comments'
hivyas Feb 23, 2021
87c29b1
fixed style and linter errors
hivyas Feb 23, 2021
0c7e807
fixing style issues
hivyas Feb 23, 2021
f3f24bf
adding none to allowed values
hivyas Feb 23, 2021
1a784d9
spliting assign_identity into system and user
hivyas Feb 23, 2021
7286848
Update azure-cli2017.pyproj
hivyas Feb 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed style and linter errors
  • Loading branch information
hivyas committed Feb 23, 2021
commit 87c29b19d6048c4ae10f0945a8a1c1e673391a98
7 changes: 6 additions & 1 deletion src/azure-cli/azure/cli/command_modules/ams/_completers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
get_protocols, get_encoding_types,
get_allowed_resolutions, get_transcription_langauges,
get_analysis_modes, get_stretch_mode_types,
get_storage_authentication_allowed_values)
get_storage_authentication_allowed_values,
get_managed_identity_allowed_values)

from azure.mgmt.media.models import EncoderNamedPreset

Expand Down Expand Up @@ -97,3 +98,7 @@ def get_stretch_mode_types_list():
def get_storage_authentication_allowed_values_list():
values = get_storage_authentication_allowed_values()
return values

def get_managed_identity_allowed_values_list():
values = get_managed_identity_allowed_values()
return values
8 changes: 6 additions & 2 deletions src/azure-cli/azure/cli/command_modules/ams/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
helps['ams account encryption show'] = """
type: command
short-summary: Show the details of encryption settings for an Azure Media Services account.
examples:
- name: Show the media account's encryption details
text: >
az ams account encryption show --account-name myAmsAccount -g myRG
"""

helps['ams account encryption set'] = """
Expand All @@ -63,10 +67,10 @@
examples:
- name: Set the media account's encryption to a customer managed key
text: >
az ams account encryption create -a myAmsAccount -g myRG --key-source CustomerKey --key-vault-id keyVaultId
az ams account encryption set -a myAmsAccount -g myRG --key-type CustomerKey --key-identifier keyVaultId
- name: Set the media account's encryption to a system managed key
text: >
az ams account encryption create -a myAmsAccount -g myRG --key-source SystemKey
az ams account encryption set -a myAmsAccount -g myRG --key-type SystemKey
"""

helps['ams account storage'] = """
Expand Down
7 changes: 4 additions & 3 deletions src/azure-cli/azure/cli/command_modules/ams/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
get_allowed_transcription_languages,
get_allowed_analysis_modes,
get_stretch_mode_types_list,
get_storage_authentication_allowed_values_list)
get_storage_authentication_allowed_values_list,
get_managed_identity_allowed_values_list)

from azure.cli.command_modules.ams._validators import (validate_storage_account_id,
datetime_format,
Expand Down Expand Up @@ -66,7 +67,7 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
with self.argument_context('ams account create') as c:
c.argument('storage_account', storage_account_arg_type,
help='The name or resource ID of the primary storage account to attach to the Azure Media Services account. The storage account MUST be in the same Azure subscription as the Media Services account. It is strongly recommended that the storage account be in the same resource group as the Media Services account. Blob only accounts are not allowed as primary.')
c.argument('identity_system_assigned', help='Set this flag to enable managed identity on the account.', action='store_true')
c.argument('assign_identity', arg_type=get_enum_type(get_managed_identity_allowed_values_list()), help='Set the managed identity on the media services account.')

with self.argument_context('ams account check-name') as c:
c.argument('account_name', options_list=['--name', '-n'], id_part=None,
Expand Down Expand Up @@ -104,7 +105,7 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
c.argument('account_name', account_name_arg_type)
c.argument('key_type', help='The encryption key source (provider). Allowed values: SystemKey, CustomerKey.', required=True)
c.argument('key_identifier', help='The URL of the Key Vault key used to encrypt the account. The key may either be versioned (for example https://vault/keys/mykey/version1) or reference a key without a version (for example https://vault/keys/mykey).')
c.argument('current_key_identifier', help='The current key used to encrypt the Media Services account, including the key version.')
c.argument('current_key_id', help='The current key used to encrypt the Media Services account, including the key version.')

with self.argument_context('ams transform') as c:
c.argument('account_name', account_name_arg_type)
Expand Down
3 changes: 3 additions & 0 deletions src/azure-cli/azure/cli/command_modules/ams/_sdk_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,6 @@ def get_stretch_mode_types():

def get_storage_authentication_allowed_values():
return ['System', 'ManagedIdentity']

def get_managed_identity_allowed_values():
return ['System']
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ def list_mediaservices(client, resource_group_name=None):


def create_mediaservice(client, resource_group_name, account_name, storage_account, location=None,
identity_system_assigned=False, tags=None):
assign_identity=False, tags=None):
storage_account_primary = StorageAccount(type='Primary', id=storage_account)

return create_or_update_mediaservice(client, resource_group_name, account_name, [storage_account_primary],
location, identity_system_assigned,
location, assign_identity,
tags)


Expand Down Expand Up @@ -66,9 +66,9 @@ def set_mediaservice_trusted_storage(client, resource_group_name, account_name,


def create_or_update_mediaservice(client, resource_group_name, account_name, storage_accounts=None,
location=None, identity_system_assigned=False,
location=None, assign_identity=False,
tags=None):
identity = 'SystemAssigned' if identity_system_assigned else 'None'
identity = 'SystemAssigned' if assign_identity == 'System' else 'None'
media_service = MediaService(location=location, storage_accounts=storage_accounts,
identity=MediaServiceIdentity(type=identity), tags=tags)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ def get_encryption(client, resource_group_name, account_name):


def set_encryption(client, resource_group_name, account_name, key_type=None,
current_key_identifier=None, key_identifier=None):
current_key_id=None, key_identifier=None):
try:
account_info = client.get(resource_group_name,
account_name) if resource_group_name else client.get_by_subscription(account_name)
if key_type == 'CustomerKey':
key_vault_props = KeyVaultProperties(key_identifier=key_identifier, current_key_identifier=current_key_identifier)
key_vault_props = KeyVaultProperties(key_identifier=key_identifier,
current_key_identifier=current_key_id)
else:
key_vault_props = None
encryption = AccountEncryption(type=key_type, key_vault_properties=key_vault_props)
Expand Down
14 changes: 8 additions & 6 deletions src/azure-cli/azure/cli/command_modules/ams/operations/mru.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ def get_mru(client, cmd, resource_group_name, account_name):
account_info = client.get(resource_group_name,
account_name) if resource_group_name else client.get_by_subscription(account_name)
if account_info.encryption:
raise BadRequestError('The media reserved unit operation failed as the Media Services account was created with the'
' 2020-05-01 version of the API or later. Accounts created this way no longer need to set'
' media reserved units as the system will automatically scale up and down based on load.')
raise BadRequestError('The media reserved unit operation failed as the Media Services account was created'
' with the 2020-05-01 version of the API or later. Accounts created this way no'
' longer need to set media reserved units as the system will automatically'
' scale up and down based on load.')
mru = MediaV2Client(cmd.cli_ctx, resource_group_name, account_name).get_mru()
return _map_mru(mru)

Expand All @@ -32,9 +33,10 @@ def set_mru(client, cmd, resource_group_name, account_name, count=None, type=Non
account_info = client.get(resource_group_name,
account_name) if resource_group_name else client.get_by_subscription(account_name)
if account_info.encryption:
raise BadRequestError('The media reserved unit operation failed as the Media Services account was created with the'
' 2020-05-01 version of the API or later. Accounts created this way no longer need to set'
' media reserved units as the system will automatically scale up and down based on load.')
raise BadRequestError('The media reserved unit operation failed as the Media Services account was created'
' with the 2020-05-01 version of the API or later. Accounts created this way no'
' longer need to set media reserved units as the system will automatically'
' scale up and down based on load.')
client = MediaV2Client(cmd.cli_ctx, resource_group_name, account_name)
mru = client.get_mru()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ interactions:
response:
body:
string: "{\r\n \"name\":\"ams000003\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Media/mediaservices/ams000003\",\"type\":\"Microsoft.Media/mediaservices\",\"location\":\"East
US\",\"properties\":{\r\n \"mediaServiceId\":\"51b33ba9-ae34-4dc3-bd2f-908ca03d525f\",\"storageAccounts\":[\r\n
US\",\"properties\":{\r\n \"mediaServiceId\":\"9e2ed18f-3ffc-43d2-9fd8-affe4c4c55b2\",\"storageAccounts\":[\r\n
\ {\r\n \"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/clitest000002\",\"type\":\"Primary\"\r\n
\ }\r\n ],\"storageAuthentication\":\"System\",\"encryption\":{\r\n
\ \"type\":\"SystemKey\"\r\n }\r\n },\"systemData\":{\r\n \"createdBy\":\"[email protected]\",\"createdByType\":\"User\",\"createdAt\":\"2021-02-23T01:56:49.5603894Z\",\"lastModifiedBy\":\"[email protected]\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2021-02-23T01:56:49.5603894Z\"\r\n
\ \"type\":\"SystemKey\"\r\n }\r\n },\"systemData\":{\r\n \"createdBy\":\"[email protected]\",\"createdByType\":\"User\",\"createdAt\":\"2021-02-23T02:24:12.5577744Z\",\"lastModifiedBy\":\"[email protected]\",\"lastModifiedByType\":\"User\",\"lastModifiedAt\":\"2021-02-23T02:24:12.5577744Z\"\r\n
\ },\"identity\":{\r\n \"type\":\"None\"\r\n }\r\n}"
headers:
cache-control:
Expand All @@ -40,7 +40,7 @@ interactions:
content-type:
- application/json; odata.metadata=minimal
date:
- Tue, 23 Feb 2021 01:56:51 GMT
- Tue, 23 Feb 2021 02:24:14 GMT
expires:
- '-1'
odata-version:
Expand All @@ -54,7 +54,7 @@ interactions:
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1199'
- '1198'
status:
code: 201
message: Created
Expand Down Expand Up @@ -95,7 +95,7 @@ interactions:
content-type:
- application/json; odata.metadata=minimal
date:
- Tue, 23 Feb 2021 01:56:51 GMT
- Tue, 23 Feb 2021 02:24:14 GMT
expires:
- '-1'
odata-version:
Expand Down Expand Up @@ -152,7 +152,7 @@ interactions:
content-type:
- application/json; odata.metadata=minimal
date:
- Tue, 23 Feb 2021 01:56:52 GMT
- Tue, 23 Feb 2021 02:24:15 GMT
expires:
- '-1'
odata-version:
Expand Down Expand Up @@ -212,7 +212,7 @@ interactions:
content-type:
- application/json; odata.metadata=minimal
date:
- Tue, 23 Feb 2021 01:56:52 GMT
- Tue, 23 Feb 2021 02:24:15 GMT
expires:
- '-1'
odata-version:
Expand All @@ -230,7 +230,7 @@ interactions:
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1199'
- '1198'
status:
code: 200
message: OK
Expand Down Expand Up @@ -265,7 +265,7 @@ interactions:
content-length:
- '0'
date:
- Tue, 23 Feb 2021 01:56:55 GMT
- Tue, 23 Feb 2021 02:24:18 GMT
expires:
- '-1'
pragma:
Expand Down
Loading