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); } }
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); } }
private void ReplicateAssetPage(IPage <Asset> assetPage) { if (assetPage.Any()) { //Loop through page assets and move them to the destination foreach (var asset in assetPage) { Helpers.WriteLine($"Replicating asset '{asset.Name}'...", 2); Helpers.WriteLine($"Copying asset's blobs...", 3); Asset destinationAsset = DestinationOperations.Get(DestinationAuth.ResourceGroup, DestinationAuth.AccountName, asset.Name); //Create destination asset if it does not exists if (destinationAsset == null) { destinationAsset = DestinationOperations.CreateOrUpdate(DestinationAuth.ResourceGroup, DestinationAuth.AccountName, asset.Name, new Asset() { AlternateId = asset.AlternateId, Description = asset.Description }); } //Used to update asset info. sometimes it will be empty destinationAsset = DestinationOperations.Get(DestinationAuth.ResourceGroup, DestinationAuth.AccountName, destinationAsset.Name); CloudBlobContainer sourceContainer = GetCloudBlobContainer(SourceAuth, asset.Container); CloudBlobContainer destinationContainer = GetCloudBlobContainer(DestinationAuth, destinationAsset.Container); CopyAsset(sourceContainer, destinationContainer); if (_sourceAssetFilterOperations != null && _destinationAssetFilterOperations != null) { Helpers.WriteLine($"Copying asset's filters...", 3); ReplicateAssetFilter(asset.Name); } } } else { Helpers.WriteLine("No assets to copy", 2); } }