Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion azure-cli2017.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
<Compile Include="azure-cli\azure\cli\command_modules\ams\operations\asset.py" />
<Compile Include="azure-cli\azure\cli\command_modules\ams\operations\asset_filter.py" />
<Compile Include="azure-cli\azure\cli\command_modules\ams\operations\content_key_policy.py" />
<Compile Include="azure-cli\azure\cli\command_modules\ams\operations\encryption.py" />
<Compile Include="azure-cli\azure\cli\command_modules\ams\operations\job.py" />
<Compile Include="azure-cli\azure\cli\command_modules\ams\operations\live_event.py" />
<Compile Include="azure-cli\azure\cli\command_modules\ams\operations\live_output.py" />
Expand All @@ -211,6 +212,7 @@
<Compile Include="azure-cli\azure\cli\command_modules\ams\operations\streaming_policy.py" />
<Compile Include="azure-cli\azure\cli\command_modules\ams\operations\transform.py" />
<Compile Include="azure-cli\azure\cli\command_modules\ams\operations\__init__.py" />
<Compile Include="azure-cli\azure\cli\command_modules\ams\tests\latest\test_ams_account_encryption_scenarios.py" />
<Compile Include="azure-cli\azure\cli\command_modules\ams\tests\latest\test_ams_account_filter_scenarios.py" />
<Compile Include="azure-cli\azure\cli\command_modules\ams\tests\latest\test_ams_account_mru_scenarios.py" />
<Compile Include="azure-cli\azure\cli\command_modules\ams\tests\latest\test_ams_account_scenarios.py" />
Expand Down Expand Up @@ -1486,4 +1488,4 @@
</Interpreter>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
</Project>
</Project>
24 changes: 23 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 @@ -11,7 +11,9 @@
get_rentalandlease_types, get_tokens,
get_allowed_languages_for_preset,
get_protocols, get_encoding_types,
get_allowed_resolutions)
get_allowed_resolutions, get_transcription_langauges,
get_analysis_modes, get_stretch_mode_types,
get_storage_authentication_allowed_values)

from azure.mgmt.media.models import EncoderNamedPreset

Expand Down Expand Up @@ -75,3 +77,23 @@ def get_mru_type_completion_list():
def get_encoding_types_list():
encoding_types = get_encoding_types()
return encoding_types


def get_allowed_transcription_languages():
languages = get_transcription_langauges()
return languages


def get_allowed_analysis_modes():
modes = get_analysis_modes()
return modes


def get_stretch_mode_types_list():
modes = get_stretch_mode_types()
return modes


def get_storage_authentication_allowed_values_list():
values = get_storage_authentication_allowed_values()
return values
42 changes: 39 additions & 3 deletions src/azure-cli/azure/cli/command_modules/ams/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,32 @@
short-summary: Checks whether the Media Service resource name is available.
"""

helps['ams account encryption'] = """
type: group
short-summary: Manage encryption for an Azure Media Services account.
"""

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'] = """
type: command
short-summary: Set the encryption settings for an Azure Media Services account.
examples:
- name: Set the media account's encryption to a customer managed key
text: >
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 set -a myAmsAccount -g myRG --key-type SystemKey
"""

helps['ams account storage'] = """
type: group
short-summary: Manage storage for an Azure Media Services account.
Expand Down Expand Up @@ -90,6 +116,11 @@
short-summary: Synchronize storage account keys for a storage account associated with an Azure Media Services account.
"""

helps['ams account storage set-authentication'] = """
type: command
short-summary: Set the authentication of a storage account attached to an Azure Media Services account.
"""

helps['ams transform'] = """
type: group
short-summary: Manage transforms for an Azure Media Services account.
Expand Down Expand Up @@ -482,6 +513,11 @@
short-summary: Start a live event.
"""

helps['ams live-event standby'] = """
type: command
short-summary: Allocate a live event to be started later.
"""

helps['ams live-event show'] = """
type: command
short-summary: Show the details of a live event.
Expand Down Expand Up @@ -588,15 +624,15 @@

helps['ams account mru'] = """
type: group
short-summary: Manage media reserved units for an Azure Media Services account.
short-summary: Manage media reserved units for an Azure Media Services account. This doesn't work with accounts created with 2020-05-01 version of the Media Services API or later. Accounts created this way no longer need to set media reserved units as the system will automaticaly scale up and down based on load.
"""

helps['ams account mru set'] = """
type: command
short-summary: Set the type and number of media reserved units for an Azure Media Services account.
short-summary: Set the type and number of media reserved units for an Azure Media Services account. This doesn't work with accounts created with 2020-05-01 version of the Media Services API or later. Accounts created this way no longer need to set media reserved units as the system will automaticaly scale up and down based on load.
"""

helps['ams account mru show'] = """
type: command
short-summary: Show the details of media reserved units for an Azure Media Services account.
short-summary: Show the details of media reserved units for an Azure Media Services account. This doesn't work with accounts created with 2020-05-01 version of the Media Services API or later. Accounts created this way no longer need to set media reserved units as the system will automaticaly scale up and down based on load.
"""
26 changes: 23 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 @@ -24,7 +24,11 @@
get_token_completion_list,
get_mru_type_completion_list,
get_encoding_types_list,
get_allowed_resolutions_completion_list)
get_allowed_resolutions_completion_list,
get_allowed_transcription_languages,
get_allowed_analysis_modes,
get_stretch_mode_types_list,
get_storage_authentication_allowed_values_list)

from azure.cli.command_modules.ams._validators import (validate_storage_account_id,
datetime_format,
Expand Down Expand Up @@ -56,12 +60,13 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem

with self.argument_context('ams account') as c:
c.argument('location', arg_type=get_location_type(self.cli_ctx),
validator=get_default_location_from_resource_group)
validator=get_default_location_from_resource_group, required=False)
c.argument('tags', arg_type=tags_type)

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('assign_identity', options_list=['--id-system-assigned'], action='store_true', help='Set the system 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 All @@ -81,6 +86,9 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
with self.argument_context('ams account storage sync-storage-keys') as c:
c.argument('id', required=True)

with self.argument_context('ams account storage set-authentication') as c:
c.argument('storage_auth', arg_type=get_enum_type(get_storage_authentication_allowed_values_list()), help='The type of authentication for the storage account associated with the media services account.')

with self.argument_context('ams account sp') as c:
c.argument('account_name', account_name_arg_type)
c.argument('sp_name', name_arg_type,
Expand All @@ -92,15 +100,23 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
c.argument('xml', action='store_true', help='Enables xml output format.')
c.argument('years', help='Number of years for which the secret will be valid. Default: 1 year.', type=int, default=None)

with self.argument_context('ams account encryption') as c:
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_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)
c.argument('transform_name', name_arg_type, id_part='child_name_1',
help='The name of the transform.')
c.argument('preset', help='Preset that describes the operations that will be used to modify, transcode, or extract insights from the source file to generate the transform output. Allowed values: {}. In addition to the allowed values, you can also pass a path to a custom Standard Encoder preset JSON file. See https://docs.microsoft.com/rest/api/media/transforms/createorupdate#standardencoderpreset for further details on the settings to use to build a custom preset.'
.format(", ".join(get_presets_definition_name_completion_list())))
c.argument('insights_to_extract', arg_group='Video Analyzer', arg_type=get_enum_type(InsightsType), help='The type of insights to be extracted. If not set then the type will be selected based on the content type. If the content is audio only then only audio insights will be extracted and if it is video only video insights will be extracted.')
c.argument('video_analysis_mode', arg_group='Video Analyzer', help='Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen. Allowed values: {}'.format(", ".join(get_allowed_analysis_modes())))
c.argument('audio_language', arg_group='Audio/Video Analyzer', help='The language for the audio payload in the input using the BCP-47 format of \"language tag-region\" (e.g: en-US). If not specified, automatic language detection would be employed. This feature currently supports English, Chinese, French, German, Italian, Japanese, Spanish, Russian, and Portuguese. The automatic detection works best with audio recordings with clearly discernable speech. If automatic detection fails to find the language, transcription would fallback to English. Allowed values: {}.'
.format(", ".join(get_allowed_languages_for_preset_completion_list())))
c.argument('audio_analysis_mode', arg_group='Audio/Video Analyzer', help='Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen. Allowed values: {}.'.format(", ".join(get_allowed_analysis_modes())))
c.argument('resolution', arg_group='Face Detector', help='Specifies the maximum resolution at which your video is analyzed. The default behavior is "SourceResolution," which will keep the input video at its original resolution when analyzed. Using StandardDefinition will resize input videos to standard definition while preserving the appropriate aspect ratio. It will only resize if the video is of higher resolution. For example, a 1920x1080 input would be scaled to 640x360 before processing. Switching to "StandardDefinition" will reduce the time it takes to process high resolution video. It may also reduce the cost of using this component (see https://azure.microsoft.com/en-us/pricing/details/media-services/#analytics for details). However, faces that end up being too small in the resized video may not be detected. Allowed values: {}.'
.format(", ".join(get_allowed_resolutions_completion_list())))
c.argument('relative_priority', arg_type=get_enum_type(Priority), help='Sets the relative priority of the transform outputs within a transform. This sets the priority that the service uses for processing TransformOutputs. The default priority is Normal.')
Expand Down Expand Up @@ -338,6 +354,8 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
c.argument('auto_start', action='store_true', help='The flag indicates if the resource should be automatically started on creation.')
c.argument('encoding_type', arg_group='Encoding', help='The encoding type for live event. This value is specified at creation time and cannot be updated. Allowed values: {}.'.format(", ".join(get_encoding_types_list())))
c.argument('preset_name', arg_group='Encoding', help='The encoding preset name. This value is specified at creation time and cannot be updated.')
c.argument('stretch_mode', arg_group='Encoding', help='Specifies how the input video will be resized to fit the desired output resolution(s). Default is None. Allowed values: {}.'.format(", ".join(get_stretch_mode_types_list())))
c.argument('key_frame_interval', arg_group='Encoding', help='Use an ISO 8601 time value between 0.5 to 20 seconds to specify the output fragment length for the video and audiotracks of an encoding live event. For example, use PT2S to indicate 2 seconds. For the video track it also defines the key frame interval, or the length of a GoP (group of pictures). If this value is not set for anencoding live event, the fragment duration defaults to 2 seconds. The value cannot be set for pass-through live events.')
c.argument('tags', arg_type=tags_type)
c.argument('key_frame_interval_duration', key_frame_interval_duration_arg_type, arg_group='Input', validator=validate_key_frame_interval_duration,
help='ISO 8601 timespan duration of the key frame interval duration in seconds. The value should be an interger in the range of 1 (PT1S or 00:00:01) to 30 (PT30S or 00:00:30) seconds.')
Expand All @@ -348,10 +366,12 @@ def load_arguments(self, _): # pylint: disable=too-many-locals, too-many-statem
c.argument('preview_locator', arg_group='Preview', help='The identifier of the preview locator in Guid format. Specifying this at creation time allows the caller to know the preview locator url before the event is created. If omitted, the service will generate a random identifier. This value cannot be updated once the live event is created.')
c.argument('streaming_policy_name', arg_group='Preview', help='The name of streaming policy used for the live event preview. This can be specified at creation time but cannot be updated.')
c.argument('alternative_media_id', arg_group='Preview', help='An Alternative Media Identifier associated with the StreamingLocator created for the preview. This value is specified at creation time and cannot be updated. The identifier can be used in the CustomLicenseAcquisitionUrlTemplate or the CustomKeyAcquisitionUrlTemplate of the StreamingPolicy specified in the StreamingPolicyName field.')
c.argument('vanity_url', arg_type=get_three_state_flag(), help='Specifies whether to use a vanity url with the Live Event. This value is specified at creation time and cannot be updated.')
c.argument('client_access_policy', arg_group='Cross Site Access Policies', help='Filepath to the clientaccesspolicy.xml used by Microsoft Silverlight and Adobe Flash. Use @{file} to load from a file.')
c.argument('cross_domain_policy', arg_group='Cross Site Access Policies', help='Filepath to the crossdomain.xml used by Microsoft Silverlight and Adobe Flash. Use @{file} to load from a file.')
c.argument('stream_options', nargs='+', arg_type=get_enum_type(StreamOptionsFlag), help='The options to use for the LiveEvent. This value is specified at creation time and cannot be updated.')
c.argument('transcription_lang', help='Live transcription language for the live event. Allowed values: {} See https://go.microsoft.com/fwlink/?linkid=2133742 for more information about the live transcription feature.'.format(", ".join(get_allowed_transcription_languages())))
c.argument('use_static_hostname', help='Specifies whether a static hostname would be assigned to the live event preview and ingest endpoints. This value can only be updated if the live event is in Standby state. If hostname_prefix is not specified, the live event name will be used as the hostname prefix.')
c.argument('hostname_prefix', help='When useStaticHostname is set to true, hostname_prefix specifies the first part of the hostname assigned to the live event preview and ingest endpoints. The final hostname would be a combination of this prefix, the media service account name and a short code for the Azure Media Services data center.')
c.argument('remove_outputs_on_stop', action='store_true', help='Remove live outputs on stop.')

with self.argument_context('ams live-event list') as c:
Expand Down
19 changes: 18 additions & 1 deletion src/azure-cli/azure/cli/command_modules/ams/_sdk_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,21 @@ def get_media_type():


def get_encoding_types():
return ['Basic', 'None', 'Standard']
return ['Premium1080p', 'None', 'Standard']


def get_transcription_langauges():
return ['ca-ES', 'da-DK', 'de-DE', 'en-AU', 'en-CA', 'en-GB', 'en-IN', 'en-NZ', 'en-US', 'es-ES',
'es-MX', 'fi-FI', 'fr-CA', 'fr-FR', 'it-IT', 'nl-NL', 'pt-BR', 'pt-PT', 'sv-SE']


def get_analysis_modes():
return ['Standard', 'Basic']


def get_stretch_mode_types():
return ['None', 'AutoSize', 'AutoFit']


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