private void ReplicateStreamingLocatorsPage(IPage <StreamingLocator> streamingLocatorsPage)
        {
            if (streamingLocatorsPage.Any())
            {
                foreach (var streamingLocator in streamingLocatorsPage)
                {
                    Helpers.WriteLine($"Copying streaming locator '{streamingLocator.Name}'...", 2);

                    if (DestinationOperations.Get(DestinationAuth.ResourceGroup, DestinationAuth.AccountName, streamingLocator.Name) == null)
                    {
                        DestinationOperations.Create(DestinationAuth.ResourceGroup, DestinationAuth.AccountName, streamingLocator.Name, new StreamingLocator()
                        {
                            AssetName                   = streamingLocator.AssetName,
                            StreamingPolicyName         = streamingLocator.StreamingPolicyName,
                            StartTime                   = streamingLocator.StartTime,
                            EndTime                     = streamingLocator.EndTime,
                            DefaultContentKeyPolicyName = streamingLocator.DefaultContentKeyPolicyName,
                            ContentKeys                 = streamingLocator.ContentKeys.Count == 0 ? null : streamingLocator.ContentKeys,
                            Filters                     = streamingLocator.Filters.Count == 0 ? null : streamingLocator.Filters
                        });

                        Helpers.WriteLine("Done", 3);
                    }
                    else
                    {
                        Helpers.WriteLine($"Already exists", 3);
                    }
                }
            }
            else
            {
                Helpers.WriteLine($"No streaming locators to replicate", 2);
            }
        }
Example #2
0
        private void ReplicateStreamingEndpointsPage(IPage <StreamingEndpoint> streamingEndpointsPage)
        {
            if (streamingEndpointsPage.Any())
            {
                foreach (var streamingEndpoint in streamingEndpointsPage)
                {
                    Helpers.WriteLine($"Copying streaming endpoint '{streamingEndpoint.Name}'...", 2);

                    if (DestinationOperations.Get(DestinationAuth.ResourceGroup, DestinationAuth.AccountName, streamingEndpoint.Name) == null)
                    {
                        streamingEndpoint.Location = DestinationAuth.Location;

                        DestinationOperations.Create(DestinationAuth.ResourceGroup, DestinationAuth.AccountName, streamingEndpoint.Name, streamingEndpoint);
                        Helpers.WriteLine("Done", 3);
                    }
                    else
                    {
                        Helpers.WriteLine("Already exists", 3);
                    }
                }
            }
            else
            {
                Helpers.WriteLine("No streaming endpoints to copy", 2);
            }
        }
        private void ReplicateLiveEventsPage(IPage <LiveEvent> liveEventsPage)
        {
            if (liveEventsPage.Any())
            {
                foreach (var liveEvent in liveEventsPage)
                {
                    Helpers.WriteLine($"Replicating live event '{liveEvent.Name}'...", 2);
                    string tempResult = "";

                    if (DestinationOperations.Get(DestinationAuth.ResourceGroup, DestinationAuth.AccountName, liveEvent.Name) == null)
                    {
                        Helpers.WriteLine($"Copying live event...", 3);

                        LiveEvent tempLiveEvent = new LiveEvent()
                        {
                            CrossSiteAccessPolicies = liveEvent.CrossSiteAccessPolicies,
                            Description             = liveEvent.Description,
                            Encoding          = liveEvent.Encoding,
                            Input             = liveEvent.Input,
                            StreamOptions     = liveEvent.StreamOptions,
                            Tags              = liveEvent.Tags,
                            Transcriptions    = liveEvent.Transcriptions,
                            UseStaticHostname = liveEvent.UseStaticHostname,
                            HostnamePrefix    = liveEvent.HostnamePrefix,
                            Location          = DestinationAuth.Location,
                            Preview           = liveEvent.Preview
                        };

                        tempLiveEvent.Input.Endpoints        = null;
                        tempLiveEvent.Preview.PreviewLocator = "";

                        DestinationOperations.Create(DestinationAuth.ResourceGroup, DestinationAuth.AccountName, liveEvent.Name, tempLiveEvent);

                        tempResult = "Done";
                    }
                    else
                    {
                        tempResult = "Already exists";
                    }
                    Helpers.WriteLine(tempResult, 4);

                    ReplicateLiveOutputs(liveEvent.Name);
                }
            }
            else
            {
                Helpers.WriteLine("No live events to copy", 2);
            }
        }