private ContainerServiceImpl WithOrchestratorProfile(ContainerServiceOrchestratorTypes orchestratorType)
        {
            ContainerServiceOrchestratorProfile orchestratorProfile = new ContainerServiceOrchestratorProfile();

            orchestratorProfile.OrchestratorType = orchestratorType;
            this.Inner.OrchestratorProfile       = orchestratorProfile;
            return(this);
        }
        private void Run()
        {
            // OrchestratorProfile
            ContainerServiceOrchestratorProfile vOrchestratorProfile = null;

            // CustomProfile
            ContainerServiceCustomProfile vCustomProfile = null;

            // ServicePrincipalProfile
            ContainerServiceServicePrincipalProfile vServicePrincipalProfile = null;

            // MasterProfile
            ContainerServiceMasterProfile vMasterProfile = null;

            // WindowsProfile
            ContainerServiceWindowsProfile vWindowsProfile = null;

            // LinuxProfile
            ContainerServiceLinuxProfile vLinuxProfile = null;

            // DiagnosticsProfile
            ContainerServiceDiagnosticsProfile vDiagnosticsProfile = null;

            if (this.IsParameterBound(c => c.OrchestratorType))
            {
                if (vOrchestratorProfile == null)
                {
                    vOrchestratorProfile = new ContainerServiceOrchestratorProfile();
                }
                vOrchestratorProfile.OrchestratorType = this.OrchestratorType.Value;
            }

            if (this.IsParameterBound(c => c.CustomProfileOrchestrator))
            {
                if (vCustomProfile == null)
                {
                    vCustomProfile = new ContainerServiceCustomProfile();
                }
                vCustomProfile.Orchestrator = this.CustomProfileOrchestrator;
            }

            if (this.IsParameterBound(c => c.ServicePrincipalProfileClientId))
            {
                if (vServicePrincipalProfile == null)
                {
                    vServicePrincipalProfile = new ContainerServiceServicePrincipalProfile();
                }
                vServicePrincipalProfile.ClientId = this.ServicePrincipalProfileClientId;
            }

            if (this.IsParameterBound(c => c.ServicePrincipalProfileSecret))
            {
                if (vServicePrincipalProfile == null)
                {
                    vServicePrincipalProfile = new ContainerServiceServicePrincipalProfile();
                }
                vServicePrincipalProfile.Secret = this.ServicePrincipalProfileSecret;
            }

            if (this.IsParameterBound(c => c.MasterCount))
            {
                if (vMasterProfile == null)
                {
                    vMasterProfile = new ContainerServiceMasterProfile();
                }
                vMasterProfile.Count = this.MasterCount;
            }

            if (this.IsParameterBound(c => c.MasterDnsPrefix))
            {
                if (vMasterProfile == null)
                {
                    vMasterProfile = new ContainerServiceMasterProfile();
                }
                vMasterProfile.DnsPrefix = this.MasterDnsPrefix;
            }

            if (this.IsParameterBound(c => c.WindowsProfileAdminUsername))
            {
                if (vWindowsProfile == null)
                {
                    vWindowsProfile = new ContainerServiceWindowsProfile();
                }
                vWindowsProfile.AdminUsername = this.WindowsProfileAdminUsername;
            }

            if (this.IsParameterBound(c => c.WindowsProfileAdminPassword))
            {
                if (vWindowsProfile == null)
                {
                    vWindowsProfile = new ContainerServiceWindowsProfile();
                }
                vWindowsProfile.AdminPassword = this.WindowsProfileAdminPassword;
            }

            if (this.IsParameterBound(c => c.AdminUsername))
            {
                if (vLinuxProfile == null)
                {
                    vLinuxProfile = new ContainerServiceLinuxProfile();
                }
                vLinuxProfile.AdminUsername = this.AdminUsername;
            }


            if (this.IsParameterBound(c => c.SshPublicKey))
            {
                if (vLinuxProfile == null)
                {
                    vLinuxProfile = new ContainerServiceLinuxProfile();
                }
                if (vLinuxProfile.Ssh == null)
                {
                    vLinuxProfile.Ssh = new ContainerServiceSshConfiguration();
                }
                if (vLinuxProfile.Ssh.PublicKeys == null)
                {
                    vLinuxProfile.Ssh.PublicKeys = new List <ContainerServiceSshPublicKey>();
                }
                foreach (var element in this.SshPublicKey)
                {
                    var vPublicKeys = new ContainerServiceSshPublicKey();
                    vPublicKeys.KeyData = element;
                    vLinuxProfile.Ssh.PublicKeys.Add(vPublicKeys);
                }
            }

            if (vDiagnosticsProfile == null)
            {
                vDiagnosticsProfile = new ContainerServiceDiagnosticsProfile();
            }
            if (vDiagnosticsProfile.VmDiagnostics == null)
            {
                vDiagnosticsProfile.VmDiagnostics = new ContainerServiceVMDiagnostics();
            }

            vDiagnosticsProfile.VmDiagnostics.Enabled = this.VmDiagnosticsEnabled;

            var vContainerService = new PSContainerService
            {
                Location                = this.IsParameterBound(c => c.Location) ? this.Location : null,
                Tags                    = this.IsParameterBound(c => c.Tag) ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null,
                AgentPoolProfiles       = this.IsParameterBound(c => c.AgentPoolProfile) ? this.AgentPoolProfile : null,
                OrchestratorProfile     = vOrchestratorProfile,
                CustomProfile           = vCustomProfile,
                ServicePrincipalProfile = vServicePrincipalProfile,
                MasterProfile           = vMasterProfile,
                WindowsProfile          = vWindowsProfile,
                LinuxProfile            = vLinuxProfile,
                DiagnosticsProfile      = vDiagnosticsProfile,
            };

            WriteObject(vContainerService);
        }