Exemplo n.º 1
0
        public void RefreshStreamingEndpoint(IStreamingEndpoint origin)
        {
            int index = -1;

            foreach (StreamingEndpointEntry CE in _MyObservStreamingEndpoints) // let's search for index
            {
                if (CE.Id == origin.Id)
                {
                    index = _MyObservStreamingEndpoints.IndexOf(CE);
                    break;
                }
            }

            if (index >= 0)                                                                          // we found it
            {                                                                                        // we update the observation collection
                origin = _context.StreamingEndpoints.Where(o => o.Id == origin.Id).FirstOrDefault(); //refresh
                if (origin != null)
                {
                    _MyObservStreamingEndpoints[index].State        = origin.State;
                    _MyObservStreamingEndpoints[index].Description  = origin.Description;
                    _MyObservStreamingEndpoints[index].LastModified = origin.LastModified.ToLocalTime();
                    _MyObservStreamingEndpoints[index].Type         = StreamingEndpointInformation.ReturnTypeSE(origin);
                    _MyObservStreamingEndpoints[index].CDN          = origin.CdnEnabled ? StreamingEndpointInformation.ReturnDisplayedProvider(origin.CdnProvider) ?? "CDN" : string.Empty;
                    _MyObservStreamingEndpoints[index].ScaleUnits   = StreamingEndpointInformation.ReturnTypeSE(origin) != StreamingEndpointInformation.StreamEndpointType.Premium ? "" : ((int)origin.ScaleUnits).ToString();
                    this.Refresh();
                }
            }
        }
Exemplo n.º 2
0
        public async Task RefreshStreamingEndpointAsync(StreamingEndpoint streamingEndpoint)
        {
            int index = -1;

            foreach (StreamingEndpointEntry CE in _MyObservStreamingEndpoints) // let's search for index
            {
                if (CE.Id == streamingEndpoint.Id)
                {
                    index = _MyObservStreamingEndpoints.IndexOf(CE);
                    break;
                }
            }

            if (index >= 0) // we found it
            {               // we update the observation collection
                await _client.RefreshTokenIfNeededAsync();

                streamingEndpoint = await _client.AMSclient.StreamingEndpoints.GetAsync(_client.credentialsEntry.ResourceGroup, _client.credentialsEntry.AccountName, streamingEndpoint.Name); //refresh

                if (streamingEndpoint != null)
                {
                    _MyObservStreamingEndpoints[index].State        = (StreamingEndpointResourceState)streamingEndpoint.ResourceState;
                    _MyObservStreamingEndpoints[index].Description  = streamingEndpoint.Description;
                    _MyObservStreamingEndpoints[index].LastModified = ((DateTime)streamingEndpoint.LastModified).ToLocalTime();
                    _MyObservStreamingEndpoints[index].Type         = StreamingEndpointInformation.ReturnTypeSE(streamingEndpoint);
                    _MyObservStreamingEndpoints[index].CDN          = ((bool)streamingEndpoint.CdnEnabled) ? StreamingEndpointInformation.ReturnDisplayedProvider(streamingEndpoint.CdnProvider) ?? "CDN" : string.Empty;
                    _MyObservStreamingEndpoints[index].ScaleUnits   = StreamingEndpointInformation.ReturnTypeSE(streamingEndpoint) != StreamingEndpointInformation.StreamEndpointType.Premium ? string.Empty : ((int)streamingEndpoint.ScaleUnits).ToString();
                    this.BeginInvoke(new Action(() => this.Refresh()));
                }
            }
        }
Exemplo n.º 3
0
        public void RefreshStreamingEndpoints(CloudMediaContext context)
        {
            if (!_initialized)
            {
                return;
            }

            this.BeginInvoke(new Action(() => this.FindForm().Cursor = Cursors.WaitCursor));

            _context = context;

            IEnumerable <StreamingEndpointEntry> endpointquery;

            streamingendpoints = context.StreamingEndpoints;

            _context = context;

            try
            {
                int c = streamingendpoints.Count();
            }
            catch (Exception e)
            {
                MessageBox.Show("There is a problem when connecting to Azure Media Services. Application will close. " + e.Message);
                Environment.Exit(0);
            }

            endpointquery = from c in streamingendpoints
                            select new StreamingEndpointEntry
            {
                Name         = c.Name,
                Id           = c.Id,
                Description  = c.Description,
                CDN          = c.CdnEnabled ? StreamingEndpointInformation.ReturnDisplayedProvider(c.CdnProvider) ?? "CDN" : string.Empty,
                ScaleUnits   = StreamingEndpointInformation.ReturnTypeSE(c) != StreamingEndpointInformation.StreamEndpointType.Premium ? "" : ((int)c.ScaleUnits).ToString(),
                State        = c.State,
                LastModified = c.LastModified.ToLocalTime(),
                Type         = StreamingEndpointInformation.ReturnTypeSE(c)
            };

            _MyObservStreamingEndpoints = new SortableBindingList <StreamingEndpointEntry>(endpointquery.ToList());
            this.BeginInvoke(new Action(() => this.DataSource = _MyObservStreamingEndpoints));
            _refreshedatleastonetime = true;
            this.BeginInvoke(new Action(() => this.FindForm().Cursor = Cursors.Default));
        }
Exemplo n.º 4
0
        public async Task RefreshStreamingEndpointsAsync()
        {
            if (!_initialized)
            {
                return;
            }

            this.BeginInvoke(new Action(() => this.FindForm().Cursor = Cursors.WaitCursor));

            IEnumerable <StreamingEndpointEntry> endpointquery;

            await _client.RefreshTokenIfNeededAsync();

            streamingendpoints = await _client.AMSclient.StreamingEndpoints.ListAsync(_client.credentialsEntry.ResourceGroup, _client.credentialsEntry.AccountName);

            try
            {
                int c = streamingendpoints.Count();
            }
            catch (Exception e)
            {
                MessageBox.Show("There is a problem when connecting to Azure Media Services. Application will close. " + e.Message);
                Environment.Exit(0);
            }

            endpointquery = from c in streamingendpoints
                            select new StreamingEndpointEntry
            {
                Name         = c.Name,
                Id           = c.Id,
                Description  = c.Description,
                CDN          = (bool)c.CdnEnabled ? StreamingEndpointInformation.ReturnDisplayedProvider(c.CdnProvider) ?? "CDN" : string.Empty,
                ScaleUnits   = StreamingEndpointInformation.ReturnTypeSE(c) != StreamingEndpointInformation.StreamEndpointType.Premium ? string.Empty : ((int)c.ScaleUnits).ToString(),
                State        = (StreamingEndpointResourceState)c.ResourceState,
                LastModified = ((DateTime)c.LastModified).ToLocalTime(),
                Type         = StreamingEndpointInformation.ReturnTypeSE(c)
            };

            _MyObservStreamingEndpoints = new SortableBindingList <StreamingEndpointEntry>(endpointquery.ToList());
            this.BeginInvoke(new Action(() => this.DataSource        = _MyObservStreamingEndpoints));
            this.BeginInvoke(new Action(() => this.FindForm().Cursor = Cursors.Default));
        }
Exemplo n.º 5
0
        public void Init(CredentialsEntry credentials, CloudMediaContext context)
        {
            IEnumerable <StreamingEndpointEntry> originquery;

            _credentials = credentials;

            _context    = context;
            originquery = from o in _context.StreamingEndpoints
                          orderby o.LastModified descending
                          select new StreamingEndpointEntry
            {
                Name         = o.Name,
                Id           = o.Id,
                Description  = o.Description,
                CDN          = o.CdnEnabled ? StreamingEndpointInformation.ReturnDisplayedProvider(o.CdnProvider) ?? "CDN" : string.Empty,
                ScaleUnits   = StreamingEndpointInformation.ReturnTypeSE(o) != StreamingEndpointInformation.StreamEndpointType.Premium ? "" : ((int)o.ScaleUnits).ToString(),
                Type         = StreamingEndpointInformation.ReturnTypeSE(o),
                State        = o.State,
                LastModified = o.LastModified.ToLocalTime()
            };


            SortableBindingList <StreamingEndpointEntry> MyObservOriginInPage = new SortableBindingList <StreamingEndpointEntry>(originquery.Take(0).ToList());

            this.DataSource                         = MyObservOriginInPage;
            this.Columns["Id"].Visible              = Properties.Settings.Default.DisplayOriginIDinGrid;
            this.Columns["Name"].Width              = 300;
            this.Columns["State"].Width             = 100;
            this.Columns["CDN"].Width               = 120;
            this.Columns["Description"].Width       = 230;
            this.Columns["ScaleUnits"].Width        = 100;
            this.Columns["ScaleUnits"].HeaderText   = "Streaming Units";
            this.Columns["LastModified"].Width      = 150;
            this.Columns["LastModified"].HeaderText = "Last modified";

            WorkerRefreshStreamingEndpoints = new BackgroundWorker();
            WorkerRefreshStreamingEndpoints.WorkerSupportsCancellation = true;
            WorkerRefreshStreamingEndpoints.DoWork += new System.ComponentModel.DoWorkEventHandler(this.WorkerRefreshStreamingEndpoints_DoWork);

            _initialized = true;
        }
Exemplo n.º 6
0
        public void Init(AMSClientV3 client)
        {
            IEnumerable <StreamingEndpointEntry> originquery;

            _client = client;
            _client.RefreshTokenIfNeeded();
            originquery = _client.AMSclient.StreamingEndpoints.List(_client.credentialsEntry.ResourceGroup, _client.credentialsEntry.AccountName).Select(o => new
                                                                                                                                                         StreamingEndpointEntry
            {
                Name         = o.Name,
                Id           = o.Id,
                Description  = o.Description,
                CDN          = ((bool)o.CdnEnabled) ? StreamingEndpointInformation.ReturnDisplayedProvider(o.CdnProvider) ?? "CDN" : string.Empty,
                ScaleUnits   = StreamingEndpointInformation.ReturnTypeSE(o) != StreamingEndpointInformation.StreamEndpointType.Premium ? string.Empty : ((int)o.ScaleUnits).ToString(),
                Type         = StreamingEndpointInformation.ReturnTypeSE(o),
                State        = (StreamingEndpointResourceState)o.ResourceState,
                LastModified = ((DateTime)o.LastModified).ToLocalTime()
            });


            SortableBindingList <StreamingEndpointEntry> MyObservOriginInPage = new SortableBindingList <StreamingEndpointEntry>(originquery.Take(0).ToList());

            this.DataSource                         = MyObservOriginInPage;
            this.Columns["Name"].Width              = 300;
            this.Columns["State"].Width             = 100;
            this.Columns["CDN"].Width               = 120;
            this.Columns["Description"].Width       = 230;
            this.Columns["ScaleUnits"].Width        = 100;
            this.Columns["ScaleUnits"].HeaderText   = "Streaming Units";
            this.Columns["LastModified"].Width      = 150;
            this.Columns["LastModified"].HeaderText = "Last modified";

            WorkerRefreshStreamingEndpoints = new BackgroundWorker();
            WorkerRefreshStreamingEndpoints.WorkerSupportsCancellation = true;
            WorkerRefreshStreamingEndpoints.DoWork += new System.ComponentModel.DoWorkEventHandler(this.WorkerRefreshStreamingEndpoints_DoWork);

            _initialized = true;
        }
Exemplo n.º 7
0
        private void ChooseStreamingEndpoint_Load(object sender, EventArgs e)
        {
            label.Text = string.Format(label.Text, _asset.Name);

            // SE List
            IStreamingEndpoint BestSE = AssetInfo.GetBestStreamingEndpoint(_context);

            foreach (var se in _context.StreamingEndpoints)
            {
                listBoxSE.Items.Add(new Item(string.Format(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_012ScaleUnit, se.Name, se.State, StreamingEndpointInformation.ReturnTypeSE(se)), se.Id + "|" + se.HostName));
                if (se.Id == BestSE.Id)
                {
                    listBoxSE.SelectedIndex = listBoxSE.Items.Count - 1;
                }
                foreach (var custom in se.CustomHostNames)
                {
                    listBoxSE.Items.Add(new Item(string.Format(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_012ScaleUnitCustomHostname3, se.Name, se.State, StreamingEndpointInformation.ReturnTypeSE(se), custom), se.Id + "|" + custom));
                }
            }

            // Filters

            // asset filters
            var afilters      = _asset.AssetFilters.ToList();
            var afiltersnames = afilters.Select(a => a.Name).ToList();

            afilters.ForEach(f =>
            {
                var lvitem = new ListViewItem(new string[] { AMSExplorer.Properties.Resources.ChooseStreamingEndpoint_ChooseStreamingEndpoint_Load_AssetFilter + f.Name, f.Name });
                if (_filter != null && f.Name == _filter)
                {
                    lvitem.Checked = true;
                }
                listViewFilters.Items.Add(lvitem);
            }
                             );

            // global filters
            _context.Filters.ToList().ForEach(f =>
            {
                var lvitem = new ListViewItem(new string[] { AMSExplorer.Properties.Resources.ChooseStreamingEndpoint_ChooseStreamingEndpoint_Load_GlobalFilter + f.Name, f.Name });
                if (_filter != null && f.Name == _filter && listViewFilters.CheckedItems.Count == 0) // only if not already selected (asset filter priority > global filter)
                {
                    lvitem.Checked = true;
                }
                if (afiltersnames.Contains(f.Name)) // global filter with same name than asset filter
                {
                    lvitem.ForeColor = Color.Gray;
                }
                listViewFilters.Items.Add(lvitem);
            }
                                              );


            if (_playertype == PlayerType.DASHIFRefPlayer)
            {
                radioButtonDASHCSF.Checked = true;
            }

            comboBoxBrowser.Items.Add(new Item(AMSExplorer.Properties.Resources.ChooseStreamingEndpoint_ChooseStreamingEndpoint_Load_DefaultBrowser, string.Empty));
            if (_displayBrowserSelection)
            { // let's add the browser options to lplayback the content (IE, Edge, Chrome...)
                if (IsWindows10())
                {
                    comboBoxBrowser.Items.Add(new Item(Constants.BrowserEdge[0], Constants.BrowserEdge[1]));
                }
                comboBoxBrowser.Items.Add(new Item(Constants.BrowserIE[0], Constants.BrowserIE[1]));
                comboBoxBrowser.Items.Add(new Item(Constants.BrowserChrome[0], Constants.BrowserChrome[1]));
                comboBoxBrowser.SelectedIndex = 0;
            }
            comboBoxBrowser.Visible = _displayBrowserSelection;

            UpdatePreviewUrl();
        }
Exemplo n.º 8
0
        private async void ChooseStreamingEndpoint_Load(object sender, EventArgs e)
        {
            DpiUtils.InitPerMonitorDpi(this);

            label.Text = string.Format(label.Text, _asset.Name);

            // SE List
            await _amsClient.RefreshTokenIfNeededAsync();

            // StreamingEndpoint BestSE = Task.Run(async () => await AssetInfo.GetBestStreamingEndpointAsync(_client)).Result;
            StreamingEndpoint BestSE = await AssetInfo.GetBestStreamingEndpointAsync(_amsClient);

            var myStreamingEndpoints = Task.Run(() => _amsClient.AMSclient.StreamingEndpoints.ListAsync(_amsClient.credentialsEntry.ResourceGroup, _amsClient.credentialsEntry.AccountName)).GetAwaiter().GetResult();

            foreach (StreamingEndpoint se in myStreamingEndpoints)
            {
                listBoxSE.Items.Add(new Item(string.Format(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_012ScaleUnit, se.Name, se.ResourceState, StreamingEndpointInformation.ReturnTypeSE(se)), se.Name + "|" + se.HostName));
                if (se.Id == BestSE.Id)
                {
                    listBoxSE.SelectedIndex = listBoxSE.Items.Count - 1;
                }

                foreach (string custom in se.CustomHostNames)
                {
                    listBoxSE.Items.Add(new Item(string.Format(AMSExplorer.Properties.Resources.AssetInformation_AssetInformation_Load_012ScaleUnitCustomHostname3, se.Name, se.ResourceState, StreamingEndpointInformation.ReturnTypeSE(se), custom), se.Name + "|" + custom));
                }
            }


            // Filters

            // asset filters
            Microsoft.Rest.Azure.IPage <AssetFilter> assetFilters = await _amsClient.AMSclient.AssetFilters.ListAsync(_amsClient.credentialsEntry.ResourceGroup, _amsClient.credentialsEntry.AccountName, _asset.Name);

            List <string> afiltersnames = assetFilters.Select(a => a.Name).ToList();

            listViewFilters.BeginUpdate();
            assetFilters.ToList().ForEach(f =>
            {
                ListViewItem lvitem = new ListViewItem(new string[] { AMSExplorer.Properties.Resources.ChooseStreamingEndpoint_ChooseStreamingEndpoint_Load_AssetFilter + f.Name, f.Name });
                if (_filter != null && f.Name == _filter)
                {
                    lvitem.Checked = true;
                }
                listViewFilters.Items.Add(lvitem);
            }
                                          );

            // account filters
            IPage <AccountFilter> acctFilters = await _amsClient.AMSclient.AccountFilters.ListAsync(_amsClient.credentialsEntry.ResourceGroup, _amsClient.credentialsEntry.AccountName);

            acctFilters.ToList().ForEach(f =>
            {
                ListViewItem lvitem = new ListViewItem(new string[] { AMSExplorer.Properties.Resources.ChooseStreamingEndpoint_ChooseStreamingEndpoint_Load_GlobalFilter + f.Name, f.Name });
                if (_filter != null && f.Name == _filter && listViewFilters.CheckedItems.Count == 0) // only if not already selected (asset filter priority > account filter)
                {
                    lvitem.Checked = true;
                }
                if (afiltersnames.Contains(f.Name)) // global filter with same name than asset filter
                {
                    lvitem.ForeColor = Color.Gray;
                }
                listViewFilters.Items.Add(lvitem);
            }
                                         );
            listViewFilters.EndUpdate();


            if (_playertype == PlayerType.DASHIFRefPlayer)
            {
                radioButtonDASHCSF.Checked = true;
            }

            comboBoxBrowser.Items.Add(new Item(AMSExplorer.Properties.Resources.ChooseStreamingEndpoint_ChooseStreamingEndpoint_Load_DefaultBrowser, string.Empty));
            if (_displayBrowserSelection)
            { // let's add the browser options to lplayback the content (IE, Edge, Chrome...)
                if (IsWindows10())
                {
                    comboBoxBrowser.Items.Add(new Item(Constants.BrowserEdge[0], Constants.BrowserEdge[1]));
                }

                comboBoxBrowser.Items.Add(new Item(Constants.BrowserIE[0], Constants.BrowserIE[1]));
                comboBoxBrowser.Items.Add(new Item(Constants.BrowserChrome[0], Constants.BrowserChrome[1]));
                comboBoxBrowser.SelectedIndex = 0;
            }
            comboBoxBrowser.Visible = _displayBrowserSelection;

            UpdatePreviewUrl();

            FillLocatorComboInPolicyTab();
        }
        private async void DoDisplayStreamingEndpointInfo(IStreamingEndpoint streamingendpoint)
        {
            // Refresh the context
            _context = Program.ConnectAndGetNewContext(_credentials);

            StreamingEndpointInformation form = new StreamingEndpointInformation()
            {
                MyStreamingEndpoint = streamingendpoint,
                MyContext = _context
            };


            if (form.ShowDialog() == DialogResult.OK)
            {


                streamingendpoint.CustomHostNames = form.GetStreamingCustomHostnames;

                if (form.GetStreamingAllowList != null)
                {
                    if (streamingendpoint.AccessControl == null)
                    {
                        streamingendpoint.AccessControl = new StreamingEndpointAccessControl();
                    }
                    streamingendpoint.AccessControl.IPAllowList = form.GetStreamingAllowList;
                }
                else
                {
                    if (streamingendpoint.AccessControl != null)
                    {
                        streamingendpoint.AccessControl.IPAllowList = null;
                    }
                }

                if (form.GetStreamingAkamaiList != null)
                {
                    if (streamingendpoint.AccessControl == null)
                    {
                        streamingendpoint.AccessControl = new StreamingEndpointAccessControl();
                    }
                    streamingendpoint.AccessControl.AkamaiSignatureHeaderAuthenticationKeyList = form.GetStreamingAkamaiList;

                }
                else
                {
                    if (streamingendpoint.AccessControl != null)
                    {
                        streamingendpoint.AccessControl.AkamaiSignatureHeaderAuthenticationKeyList = null;
                    }
                }

                if (form.MaxCacheAge != null)
                {
                    if (streamingendpoint.CacheControl == null)
                    {
                        streamingendpoint.CacheControl = new StreamingEndpointCacheControl();
                    }
                    streamingendpoint.CacheControl.MaxAge = form.MaxCacheAge;
                }
                else
                {
                    if (streamingendpoint.CacheControl != null)
                    {
                        streamingendpoint.CacheControl.MaxAge = null;
                    }
                }

                // Client Access Policy
                if (form.GetOriginClientPolicy != null)
                {
                    if (streamingendpoint.CrossSiteAccessPolicies == null)
                    {
                        streamingendpoint.CrossSiteAccessPolicies = new CrossSiteAccessPolicies();
                    }
                    streamingendpoint.CrossSiteAccessPolicies.ClientAccessPolicy = form.GetOriginClientPolicy;

                }
                else
                {
                    if (streamingendpoint.CrossSiteAccessPolicies != null)
                    {
                        streamingendpoint.CrossSiteAccessPolicies.ClientAccessPolicy = null;
                    }
                }


                // Cross domain  Policy
                if (form.GetOriginCrossdomaintPolicy != null)
                {
                    if (streamingendpoint.CrossSiteAccessPolicies == null)
                    {
                        streamingendpoint.CrossSiteAccessPolicies = new CrossSiteAccessPolicies();
                    }
                    streamingendpoint.CrossSiteAccessPolicies.CrossDomainPolicy = form.GetOriginCrossdomaintPolicy;

                }
                else
                {
                    if (streamingendpoint.CrossSiteAccessPolicies != null)
                    {
                        streamingendpoint.CrossSiteAccessPolicies.CrossDomainPolicy = null;
                    }
                }

                streamingendpoint.Description = form.GetOriginDescription;

                // Let's take actions now

                if (streamingendpoint.ScaleUnits != form.GetScaleUnits)
                {
                    Task.Run(async () =>
                   {
                       await StreamingEndpointExecuteOperationAsync(streamingendpoint.SendUpdateOperationAsync, streamingendpoint, "updated");
                       await ScaleStreamingEndpoint(streamingendpoint, form.GetScaleUnits);
                   });
                }
                else // no scaling
                {
                    Task.Run(async () =>
                   {
                       await StreamingEndpointExecuteOperationAsync(streamingendpoint.SendUpdateOperationAsync, streamingendpoint, "updated");
                   });

                }

            }
        }
Exemplo n.º 10
0
        private async void DoDisplayStreamingEndpointInfo(List<IStreamingEndpoint> streamingendpoints)
        {
            // Refresh the context
            _context = Program.ConnectAndGetNewContext(_credentials);
            bool multiselection = streamingendpoints.Count > 1;


            StreamingEndpointInformation form = new StreamingEndpointInformation()
            {
                MyStreamingEndpoint = streamingendpoints.FirstOrDefault(),
                MyContext = _context,
                MultipleSelection = multiselection
            };


            if (form.ShowDialog() == DialogResult.OK)
            {
                var modifications = form.Modifications;
                if (multiselection)
                {
                    var formSettings = new SettingsSelection("streaming endpoints", modifications);

                    if (formSettings.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    else
                    {
                        modifications = (ExplorerSEModifications)formSettings.SettingsObject;
                    }
                }

                foreach (var streamingendpoint in streamingendpoints)
                {
                    if (modifications.CustomHostNames)
                    {
                        streamingendpoint.CustomHostNames = form.GetStreamingCustomHostnames;
                    }

                    if (modifications.StreamingAllowedIPAddresses)
                    {
                        if (form.GetStreamingAllowList != null)
                        {
                            if (streamingendpoint.AccessControl == null)
                            {
                                streamingendpoint.AccessControl = new StreamingEndpointAccessControl();
                            }
                            streamingendpoint.AccessControl.IPAllowList = form.GetStreamingAllowList;
                        }
                        else
                        {
                            if (streamingendpoint.AccessControl != null)
                            {
                                streamingendpoint.AccessControl.IPAllowList = null;
                            }
                        }
                    }

                    if (modifications.AkamaiSignatureHeaderAuthentication)
                    {

                        if (form.GetStreamingAkamaiList != null)
                        {
                            if (streamingendpoint.AccessControl == null)
                            {
                                streamingendpoint.AccessControl = new StreamingEndpointAccessControl();
                            }
                            streamingendpoint.AccessControl.AkamaiSignatureHeaderAuthenticationKeyList = form.GetStreamingAkamaiList;

                        }
                        else
                        {
                            if (streamingendpoint.AccessControl != null)
                            {
                                streamingendpoint.AccessControl.AkamaiSignatureHeaderAuthenticationKeyList = null;
                            }

                        }
                    }

                    if (modifications.MaxCacheAge)
                    {

                        if (form.MaxCacheAge != null)
                        {
                            if (streamingendpoint.CacheControl == null)
                            {
                                streamingendpoint.CacheControl = new StreamingEndpointCacheControl();
                            }
                            streamingendpoint.CacheControl.MaxAge = form.MaxCacheAge;
                        }
                        else
                        {
                            if (streamingendpoint.CacheControl != null)
                            {
                                streamingendpoint.CacheControl.MaxAge = null;
                            }
                        }
                    }

                    // Client Access Policy
                    if (modifications.ClientAccessPolicy)
                    {
                        if (form.GetOriginClientPolicy != null)
                        {
                            if (streamingendpoint.CrossSiteAccessPolicies == null)
                            {
                                streamingendpoint.CrossSiteAccessPolicies = new CrossSiteAccessPolicies();
                            }
                            streamingendpoint.CrossSiteAccessPolicies.ClientAccessPolicy = form.GetOriginClientPolicy;

                        }
                        else
                        {
                            if (streamingendpoint.CrossSiteAccessPolicies != null)
                            {
                                streamingendpoint.CrossSiteAccessPolicies.ClientAccessPolicy = null;
                            }
                        }
                    }

                    // Cross domain  Policy
                    if (modifications.CrossDomainPolicy)
                    {
                        if (form.GetOriginCrossdomaintPolicy != null)
                        {
                            if (streamingendpoint.CrossSiteAccessPolicies == null)
                            {
                                streamingendpoint.CrossSiteAccessPolicies = new CrossSiteAccessPolicies();
                            }
                            streamingendpoint.CrossSiteAccessPolicies.CrossDomainPolicy = form.GetOriginCrossdomaintPolicy;

                        }
                        else
                        {
                            if (streamingendpoint.CrossSiteAccessPolicies != null)
                            {
                                streamingendpoint.CrossSiteAccessPolicies.CrossDomainPolicy = null;
                            }
                        }
                    }

                    if (modifications.Description)
                    {
                        streamingendpoint.Description = form.GetOriginDescription;
                    }

                    // Let's take actions now

                    if (modifications.StreamingUnits && streamingendpoint.ScaleUnits != form.GetScaleUnits)
                    {
                        Task.Run(async () =>
                        {
                            await StreamingEndpointExecuteOperationAsync(streamingendpoint.SendUpdateOperationAsync, streamingendpoint, "updated");
                            await ScaleStreamingEndpoint(streamingendpoint, form.GetScaleUnits);
                        });
                    }
                    else // no scaling
                    {
                        Task.Run(async () =>
                        {
                            await StreamingEndpointExecuteOperationAsync(streamingendpoint.SendUpdateOperationAsync, streamingendpoint, "updated");
                        });
                    }
                }
            }
        }