private void Run() { // OrchestratorProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceOrchestratorProfile vOrchestratorProfile = null; // CustomProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceCustomProfile vCustomProfile = null; // ServicePrincipalProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceServicePrincipalProfile vServicePrincipalProfile = null; // MasterProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceMasterProfile vMasterProfile = null; // WindowsProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceWindowsProfile vWindowsProfile = null; // LinuxProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceLinuxProfile vLinuxProfile = null; // DiagnosticsProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceDiagnosticsProfile vDiagnosticsProfile = null; if (this.MyInvocation.BoundParameters.ContainsKey("OrchestratorType")) { if (vOrchestratorProfile == null) { vOrchestratorProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceOrchestratorProfile(); } vOrchestratorProfile.OrchestratorType = this.OrchestratorType.Value; } if (this.MyInvocation.BoundParameters.ContainsKey("CustomProfileOrchestrator")) { if (vCustomProfile == null) { vCustomProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceCustomProfile(); } vCustomProfile.Orchestrator = this.CustomProfileOrchestrator; } if (this.MyInvocation.BoundParameters.ContainsKey("ServicePrincipalProfileClientId")) { if (vServicePrincipalProfile == null) { vServicePrincipalProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceServicePrincipalProfile(); } vServicePrincipalProfile.ClientId = this.ServicePrincipalProfileClientId; } if (this.MyInvocation.BoundParameters.ContainsKey("ServicePrincipalProfileSecret")) { if (vServicePrincipalProfile == null) { vServicePrincipalProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceServicePrincipalProfile(); } vServicePrincipalProfile.Secret = this.ServicePrincipalProfileSecret; } if (this.MyInvocation.BoundParameters.ContainsKey("MasterCount")) { if (vMasterProfile == null) { vMasterProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceMasterProfile(); } vMasterProfile.Count = this.MasterCount; } if (this.MyInvocation.BoundParameters.ContainsKey("MasterDnsPrefix")) { if (vMasterProfile == null) { vMasterProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceMasterProfile(); } vMasterProfile.DnsPrefix = this.MasterDnsPrefix; } if (this.MyInvocation.BoundParameters.ContainsKey("WindowsProfileAdminUsername")) { if (vWindowsProfile == null) { vWindowsProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceWindowsProfile(); } vWindowsProfile.AdminUsername = this.WindowsProfileAdminUsername; } if (this.MyInvocation.BoundParameters.ContainsKey("WindowsProfileAdminPassword")) { if (vWindowsProfile == null) { vWindowsProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceWindowsProfile(); } vWindowsProfile.AdminPassword = this.WindowsProfileAdminPassword; } if (this.MyInvocation.BoundParameters.ContainsKey("AdminUsername")) { if (vLinuxProfile == null) { vLinuxProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceLinuxProfile(); } vLinuxProfile.AdminUsername = this.AdminUsername; } if (this.MyInvocation.BoundParameters.ContainsKey("SshPublicKey")) { if (vLinuxProfile == null) { vLinuxProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceLinuxProfile(); } if (vLinuxProfile.Ssh == null) { vLinuxProfile.Ssh = new Microsoft.Azure.Management.Compute.Models.ContainerServiceSshConfiguration(); } if (vLinuxProfile.Ssh.PublicKeys == null) { vLinuxProfile.Ssh.PublicKeys = new List <Microsoft.Azure.Management.Compute.Models.ContainerServiceSshPublicKey>(); } foreach (var element in this.SshPublicKey) { var vPublicKeys = new Microsoft.Azure.Management.Compute.Models.ContainerServiceSshPublicKey(); vPublicKeys.KeyData = element; vLinuxProfile.Ssh.PublicKeys.Add(vPublicKeys); } } if (vDiagnosticsProfile == null) { vDiagnosticsProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceDiagnosticsProfile(); } if (vDiagnosticsProfile.VmDiagnostics == null) { vDiagnosticsProfile.VmDiagnostics = new Microsoft.Azure.Management.Compute.Models.ContainerServiceVMDiagnostics(); } vDiagnosticsProfile.VmDiagnostics.Enabled = this.VmDiagnosticsEnabled; var vContainerService = new PSContainerService { Location = this.MyInvocation.BoundParameters.ContainsKey("Location") ? this.Location : null, Tags = this.MyInvocation.BoundParameters.ContainsKey("Tag") ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null, AgentPoolProfiles = this.MyInvocation.BoundParameters.ContainsKey("AgentPoolProfile") ? this.AgentPoolProfile : null, OrchestratorProfile = vOrchestratorProfile, CustomProfile = vCustomProfile, ServicePrincipalProfile = vServicePrincipalProfile, MasterProfile = vMasterProfile, WindowsProfile = vWindowsProfile, LinuxProfile = vLinuxProfile, DiagnosticsProfile = vDiagnosticsProfile, }; WriteObject(vContainerService); }
protected override void ProcessRecord() { // OrchestratorProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceOrchestratorProfile vOrchestratorProfile = null; // MasterProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceMasterProfile vMasterProfile = null; // WindowsProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceWindowsProfile vWindowsProfile = null; // LinuxProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceLinuxProfile vLinuxProfile = null; // DiagnosticsProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceDiagnosticsProfile vDiagnosticsProfile = null; if (this.OrchestratorType != null) { if (vOrchestratorProfile == null) { vOrchestratorProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceOrchestratorProfile(); } vOrchestratorProfile.OrchestratorType = this.OrchestratorType; } if (this.MasterCount != null) { if (vMasterProfile == null) { vMasterProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceMasterProfile(); } vMasterProfile.Count = this.MasterCount; } if (this.MasterDnsPrefix != null) { if (vMasterProfile == null) { vMasterProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceMasterProfile(); } vMasterProfile.DnsPrefix = this.MasterDnsPrefix; } if (this.WindowsProfileAdminUsername != null) { if (vWindowsProfile == null) { vWindowsProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceWindowsProfile(); } vWindowsProfile.AdminUsername = this.WindowsProfileAdminUsername; } if (this.WindowsProfileAdminPassword != null) { if (vWindowsProfile == null) { vWindowsProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceWindowsProfile(); } vWindowsProfile.AdminPassword = this.WindowsProfileAdminPassword; } if (this.AdminUsername != null) { if (vLinuxProfile == null) { vLinuxProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceLinuxProfile(); } vLinuxProfile.AdminUsername = this.AdminUsername; } if (this.SshPublicKey != null) { if (vLinuxProfile == null) { vLinuxProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceLinuxProfile(); } if (vLinuxProfile.Ssh == null) { vLinuxProfile.Ssh = new Microsoft.Azure.Management.Compute.Models.ContainerServiceSshConfiguration(); } if (vLinuxProfile.Ssh.PublicKeys == null) { vLinuxProfile.Ssh.PublicKeys = new List <Microsoft.Azure.Management.Compute.Models.ContainerServiceSshPublicKey>(); } foreach (var element in this.SshPublicKey) { var vPublicKeys = new Microsoft.Azure.Management.Compute.Models.ContainerServiceSshPublicKey(); vPublicKeys.KeyData = element; vLinuxProfile.Ssh.PublicKeys.Add(vPublicKeys); } } if (this.VmDiagnosticsEnabled != null) { if (vDiagnosticsProfile == null) { vDiagnosticsProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceDiagnosticsProfile(); } if (vDiagnosticsProfile.VmDiagnostics == null) { vDiagnosticsProfile.VmDiagnostics = new Microsoft.Azure.Management.Compute.Models.ContainerServiceVMDiagnostics(); } vDiagnosticsProfile.VmDiagnostics.Enabled = this.VmDiagnosticsEnabled; } var vContainerService = new ContainerService { Location = this.Location, Tags = (this.Tag == null) ? null : this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value), AgentPoolProfiles = this.AgentPoolProfile, OrchestratorProfile = vOrchestratorProfile, MasterProfile = vMasterProfile, WindowsProfile = vWindowsProfile, LinuxProfile = vLinuxProfile, DiagnosticsProfile = vDiagnosticsProfile, }; WriteObject(vContainerService); }
protected override void ProcessRecord() { // OrchestratorProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceOrchestratorProfile vOrchestratorProfile = null; // MasterProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceMasterProfile vMasterProfile = null; // WindowsProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceWindowsProfile vWindowsProfile = null; // LinuxProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceLinuxProfile vLinuxProfile = null; // DiagnosticsProfile Microsoft.Azure.Management.Compute.Models.ContainerServiceDiagnosticsProfile vDiagnosticsProfile = null; if (this.OrchestratorType != null) { if (vOrchestratorProfile == null) { vOrchestratorProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceOrchestratorProfile(); } vOrchestratorProfile.OrchestratorType = this.OrchestratorType; } if (this.MasterCount != null) { if (vMasterProfile == null) { vMasterProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceMasterProfile(); } vMasterProfile.Count = this.MasterCount; } if (this.MasterDnsPrefix != null) { if (vMasterProfile == null) { vMasterProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceMasterProfile(); } vMasterProfile.DnsPrefix = this.MasterDnsPrefix; } if (this.WindowsProfileAdminUsername != null) { if (vWindowsProfile == null) { vWindowsProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceWindowsProfile(); } vWindowsProfile.AdminUsername = this.WindowsProfileAdminUsername; } if (this.WindowsProfileAdminPassword != null) { if (vWindowsProfile == null) { vWindowsProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceWindowsProfile(); } vWindowsProfile.AdminPassword = this.WindowsProfileAdminPassword; } if (this.AdminUsername != null) { if (vLinuxProfile == null) { vLinuxProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceLinuxProfile(); } vLinuxProfile.AdminUsername = this.AdminUsername; } if (this.SshPublicKey != null) { if (vLinuxProfile == null) { vLinuxProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceLinuxProfile(); } if (vLinuxProfile.Ssh == null) { vLinuxProfile.Ssh = new Microsoft.Azure.Management.Compute.Models.ContainerServiceSshConfiguration(); } if (vLinuxProfile.Ssh.PublicKeys == null) { vLinuxProfile.Ssh.PublicKeys = new List<Microsoft.Azure.Management.Compute.Models.ContainerServiceSshPublicKey>(); } foreach (var element in this.SshPublicKey) { var vPublicKeys = new Microsoft.Azure.Management.Compute.Models.ContainerServiceSshPublicKey(); vPublicKeys.KeyData = element; vLinuxProfile.Ssh.PublicKeys.Add(vPublicKeys); } } if (this.VmDiagnosticsEnabled != null) { if (vDiagnosticsProfile == null) { vDiagnosticsProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceDiagnosticsProfile(); } if (vDiagnosticsProfile.VmDiagnostics == null) { vDiagnosticsProfile.VmDiagnostics = new Microsoft.Azure.Management.Compute.Models.ContainerServiceVMDiagnostics(); } vDiagnosticsProfile.VmDiagnostics.Enabled = this.VmDiagnosticsEnabled; } var vContainerService = new ContainerService { Location = this.Location, Tags = (this.Tag == null) ? null : this.Tag.Cast<DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value), AgentPoolProfiles = this.AgentPoolProfile, OrchestratorProfile = vOrchestratorProfile, MasterProfile = vMasterProfile, WindowsProfile = vWindowsProfile, LinuxProfile = vLinuxProfile, DiagnosticsProfile = vDiagnosticsProfile, }; WriteObject(vContainerService); }