public ViewEnvironmentModel( RenderingEnvironment environment, Microsoft.Azure.Management.Batch.Models.BatchAccount batchAccount = null, IList <PoolUsageResult> poolUsageResults = null) { if (environment != null) { EnvironmentName = environment.Name; SubscriptionId = environment.SubscriptionId; RenderManager = environment.RenderManager; LocationName = environment.LocationName; ResourceGroup = environment.ResourceGroupName; KeyVaultName = environment.KeyVault?.Name; KeyVaultUrl = environment.KeyVault?.Uri; if (environment.KeyVaultServicePrincipal != null) { KeyVaultServicePrincipalAppId = environment.KeyVaultServicePrincipal.ApplicationId; KeyVaultServicePrincipalObjectId = environment.KeyVaultServicePrincipal.ObjectId; KeyVaultServicePrincipalCertificatePath = environment.KeyVaultServicePrincipal.CertificateKeyVaultName; } if (environment.BatchAccount != null) { BatchAccountName = environment.BatchAccount.Name; BatchAccountResourceId = environment.BatchAccount.ResourceId; BatchAccountLocation = environment.BatchAccount.Location; BatchAccountUrl = environment.BatchAccount.Url; } if (environment.StorageAccount != null) { StorageAccountName = environment.StorageAccount.Name; StorageAccountResourceId = environment.StorageAccount.ResourceId; StorageAccountLocation = environment.StorageAccount.Location; } if (environment.Subnet != null) { SubnetName = environment.Subnet.Name; SubnetVNetName = environment.Subnet.VNetName; SubnetResourceId = environment.Subnet.ResourceId; SubnetPrefix = environment.Subnet.AddressPrefix; SubnetLocation = environment.Subnet.Location; } if (environment.ApplicationInsightsAccount?.ResourceId != null) { AppInsightsName = environment.ApplicationInsightsAccount.Name; AppInsightsResourceId = environment.ApplicationInsightsAccount.ResourceId; AppInsightsLocation = environment.ApplicationInsightsAccount.Location; } if (environment.AutoScaleConfiguration != null) { MaxIdleCpuPercent = environment.AutoScaleConfiguration.MaxIdleCpuPercent; WhitelistedProcesses = environment.AutoScaleConfiguration.SpecificProcesses; } if (environment.DeletionSettings != null && !string.IsNullOrEmpty(environment.DeletionSettings.DeleteErrors)) { DeleteErrors = environment.DeletionSettings.DeleteErrors; } if (environment.Domain != null) { JoinDomain = environment.Domain.JoinDomain; DomainName = environment.Domain.DomainName; DomainJoinUsername = environment.Domain.DomainJoinUsername; DomainJoinPassword = environment.Domain.DomainJoinPassword; DomainWorkerOuPath = environment.Domain.DomainWorkerOuPath; } if (environment.RenderManagerConfig != null) { if (environment.RenderManagerConfig.Deadline != null) { DeadlineEnvironment = new DeadlineEnvironment { WindowsDeadlineRepositoryShare = environment.RenderManagerConfig.Deadline.WindowsRepositoryPath, RepositoryUser = environment.RenderManagerConfig.Deadline.RepositoryUser, RepositoryPassword = environment.RenderManagerConfig.Deadline.RepositoryPassword, LicenseMode = environment.RenderManagerConfig.Deadline.LicenseMode.ToString(), LicenseServer = environment.RenderManagerConfig.Deadline.LicenseServer, DeadlineRegion = environment.RenderManagerConfig.Deadline.DeadlineRegion, DeadlineDatabaseCertificatePassword = environment.RenderManagerConfig.Deadline.DeadlineDatabaseCertificate?.Password, }; } if (environment.RenderManagerConfig.Qube != null) { QubeEnvironment = new QubeEnvironment { QubeSupervisor = environment.RenderManagerConfig.Qube.SupervisorIp, }; } if (environment.RenderManagerConfig.Tractor != null) { TractorEnvironment = new TractorEnvironment { TractorSettings = environment.RenderManagerConfig.Tractor.TractorSettings, }; } } } if (batchAccount != null) { BatchDedicatedCoreQuota = batchAccount.DedicatedCoreQuota; BatchLowPriorityCoreQuota = batchAccount.LowPriorityCoreQuota; BatchPoolQuota = batchAccount.PoolQuota; } PoolUsageResults = poolUsageResults; }
public ViewEnvironmentModel( RenderingEnvironment environment, Microsoft.Azure.Management.Batch.Models.BatchAccount batchAccount = null, IList <PoolUsageResult> poolUsageResults = null, EnvironmentCost usage = null) { if (environment != null) { EnvironmentName = environment.Name; SubscriptionId = environment.SubscriptionId; RenderManager = environment.RenderManager; LocationName = environment.LocationName; ResourceGroup = environment.ResourceGroupName; KeyVaultName = environment.KeyVault?.Name; KeyVaultUrl = environment.KeyVault?.Uri; KeyVaultResourceId = environment.KeyVault?.ResourceId; if (environment.KeyVaultServicePrincipal != null) { KeyVaultServicePrincipalAppId = environment.KeyVaultServicePrincipal.ApplicationId; KeyVaultServicePrincipalObjectId = environment.KeyVaultServicePrincipal.ObjectId; KeyVaultServicePrincipalCertificatePath = environment.KeyVaultServicePrincipal.CertificateKeyVaultName; } if (environment.BatchAccount != null) { BatchAccountName = environment.BatchAccount.Name; BatchAccountResourceId = environment.BatchAccount.ResourceId; BatchAccountLocation = environment.BatchAccount.Location; BatchAccountUrl = environment.BatchAccount.Url; } if (environment.StorageAccount != null) { StorageAccountName = environment.StorageAccount.Name; StorageAccountResourceId = environment.StorageAccount.ResourceId; StorageAccountLocation = environment.StorageAccount.Location; } if (environment.Subnet != null) { SubnetName = environment.Subnet.Name; SubnetVNetName = environment.Subnet.VNetName; SubnetResourceId = environment.Subnet.ResourceId; SubnetPrefix = environment.Subnet.AddressPrefix; SubnetLocation = environment.Subnet.Location; } if (environment.ApplicationInsightsAccount?.ResourceId != null) { AppInsightsName = environment.ApplicationInsightsAccount.Name; AppInsightsResourceId = environment.ApplicationInsightsAccount.ResourceId; AppInsightsLocation = environment.ApplicationInsightsAccount.Location; } if (environment.AutoScaleConfiguration != null) { MaxIdleCpuPercent = environment.AutoScaleConfiguration.MaxIdleCpuPercent; WhitelistedProcesses = environment.AutoScaleConfiguration.SpecificProcesses; } if (environment.DeletionSettings != null && !string.IsNullOrEmpty(environment.DeletionSettings.DeleteErrors)) { DeleteErrors = environment.DeletionSettings.DeleteErrors; } if (environment.Domain != null) { JoinDomain = environment.Domain.JoinDomain; DomainName = environment.Domain.DomainName; DomainJoinUsername = environment.Domain.DomainJoinUsername; DomainJoinPassword = environment.Domain.DomainJoinPassword; DomainWorkerOuPath = environment.Domain.DomainWorkerOuPath; } if (environment.RenderManagerConfig != null) { if (environment.RenderManagerConfig.Deadline != null) { DeadlineEnvironment = new DeadlineEnvironment { WindowsDeadlineRepositoryShare = environment.RenderManagerConfig.Deadline.WindowsRepositoryPath, RepositoryUser = environment.RenderManagerConfig.Deadline.RepositoryUser, RepositoryPassword = environment.RenderManagerConfig.Deadline.RepositoryPassword, InstallDeadlineClient = environment.RenderManagerConfig.Deadline.LicenseServer != null, LicenseMode = environment.RenderManagerConfig.Deadline.LicenseMode, LicenseServer = environment.RenderManagerConfig.Deadline.LicenseServer, DeadlineRegion = environment.RenderManagerConfig.Deadline.DeadlineRegion, DeadlineDatabaseCertificatePassword = environment.RenderManagerConfig.Deadline.DeadlineDatabaseCertificate?.Password, RunAsService = environment.RenderManagerConfig.Deadline.RunAsService, ServiceUser = environment.RenderManagerConfig.Deadline.ServiceUser, ServicePassword = environment.RenderManagerConfig.Deadline.ServicePassword, UseDeadlineDatabaseCertificate = environment.RenderManagerConfig.Deadline.DeadlineDatabaseCertificate?.FileName != null, DeadlineDatabaseCertificateFileName = environment.RenderManagerConfig.Deadline.DeadlineDatabaseCertificate?.FileName, ExcludeFromLimitGroups = environment.RenderManagerConfig.Deadline.ExcludeFromLimitGroups, }; } if (environment.RenderManagerConfig.Qube != null) { QubeEnvironment = new QubeEnvironment { QubeSupervisor = environment.RenderManagerConfig.Qube.SupervisorIp, }; } if (environment.RenderManagerConfig.Tractor != null) { TractorEnvironment = new TractorEnvironment { EngineIpOrHostnameAndPort = environment.RenderManagerConfig.Tractor.EngineIpOrHostnameAndPort, }; } if (environment.RenderManagerConfig.OpenCue != null) { OpenCueEnvironment = new OpenCueEnvironment { CuebotHostnameOrIp = environment.RenderManagerConfig.OpenCue.CuebotHostnameOrIp, Facility = environment.RenderManagerConfig.OpenCue.Facility, }; } if (environment.RenderManagerConfig.BYOS != null) { BYOSEnvironment = new BYOSEnvironment { SchedulerHostnameOrIp = environment.RenderManagerConfig.BYOS.SchedulerHostnameOrIp, }; } } } if (batchAccount != null) { BatchDedicatedCoreQuota = batchAccount.DedicatedCoreQuota; BatchLowPriorityCoreQuota = batchAccount.LowPriorityCoreQuota; BatchPoolQuota = batchAccount.PoolQuota; } PoolUsageResults = poolUsageResults; EnvironmentCost = usage; }