|
| 1 | +// |
| 2 | +// Copyright (c) Microsoft and contributors. All rights reserved. |
| 3 | +// |
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +// you may not use this file except in compliance with the License. |
| 6 | +// You may obtain a copy of the License at |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// |
| 13 | +// See the License for the specific language governing permissions and |
| 14 | +// limitations under the License. |
| 15 | +// |
| 16 | + |
| 17 | +// Warning: This code was generated by a tool. |
| 18 | +// |
| 19 | +// Changes to this file may cause incorrect behavior and will be lost if the |
| 20 | +// code is regenerated. |
| 21 | + |
| 22 | +using Microsoft.Azure.Management.Compute.Models; |
| 23 | +using System; |
| 24 | +using System.Collections; |
| 25 | +using System.Collections.Generic; |
| 26 | +using System.Linq; |
| 27 | +using System.Management.Automation; |
| 28 | + |
| 29 | +namespace Microsoft.Azure.Commands.Compute.Automation |
| 30 | +{ |
| 31 | + [Cmdlet("New", "AzureRmContainerServiceConfig")] |
| 32 | + [OutputType(typeof(ContainerService))] |
| 33 | + public class NewAzureRmContainerServiceConfigCommand : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet |
| 34 | + { |
| 35 | + [Parameter( |
| 36 | + Mandatory = false, |
| 37 | + Position = 0, |
| 38 | + ValueFromPipelineByPropertyName = true)] |
| 39 | + public string Location { get; set; } |
| 40 | + |
| 41 | + [Parameter( |
| 42 | + Mandatory = false, |
| 43 | + Position = 1, |
| 44 | + ValueFromPipelineByPropertyName = true)] |
| 45 | + public Hashtable Tag { get; set; } |
| 46 | + |
| 47 | + [Parameter( |
| 48 | + Mandatory = false, |
| 49 | + Position = 2, |
| 50 | + ValueFromPipelineByPropertyName = true)] |
| 51 | + public ContainerServiceOchestratorTypes? OrchestratorProfileOrchestratorType { get; set; } |
| 52 | + |
| 53 | + [Parameter( |
| 54 | + Mandatory = false, |
| 55 | + Position = 3, |
| 56 | + ValueFromPipelineByPropertyName = true)] |
| 57 | + public int? MasterProfileCount { get; set; } |
| 58 | + |
| 59 | + [Parameter( |
| 60 | + Mandatory = false, |
| 61 | + Position = 4, |
| 62 | + ValueFromPipelineByPropertyName = true)] |
| 63 | + public string MasterProfileDnsPrefix { get; set; } |
| 64 | + |
| 65 | + [Parameter( |
| 66 | + Mandatory = false, |
| 67 | + Position = 5, |
| 68 | + ValueFromPipelineByPropertyName = true)] |
| 69 | + public ContainerServiceAgentPoolProfile [] AgentPoolProfile { get; set; } |
| 70 | + |
| 71 | + [Parameter( |
| 72 | + Mandatory = false, |
| 73 | + Position = 6, |
| 74 | + ValueFromPipelineByPropertyName = true)] |
| 75 | + public string WindowsProfileAdminUsername { get; set; } |
| 76 | + |
| 77 | + [Parameter( |
| 78 | + Mandatory = false, |
| 79 | + Position = 7, |
| 80 | + ValueFromPipelineByPropertyName = true)] |
| 81 | + public string WindowsProfileAdminPassword { get; set; } |
| 82 | + |
| 83 | + [Parameter( |
| 84 | + Mandatory = false, |
| 85 | + Position = 8, |
| 86 | + ValueFromPipelineByPropertyName = true)] |
| 87 | + public string AdminUsername { get; set; } |
| 88 | + |
| 89 | + [Parameter( |
| 90 | + Mandatory = false, |
| 91 | + Position = 9, |
| 92 | + ValueFromPipelineByPropertyName = true)] |
| 93 | + public string [] Ssh { get; set; } |
| 94 | + |
| 95 | + [Parameter( |
| 96 | + Mandatory = false, |
| 97 | + Position = 10, |
| 98 | + ValueFromPipelineByPropertyName = true)] |
| 99 | + public bool? VmDiagnosticsEnabled { get; set; } |
| 100 | + |
| 101 | + protected override void ProcessRecord() |
| 102 | + { |
| 103 | + // OrchestratorProfile |
| 104 | + Microsoft.Azure.Management.Compute.Models.ContainerServiceOrchestratorProfile vOrchestratorProfile = null; |
| 105 | + |
| 106 | + // MasterProfile |
| 107 | + Microsoft.Azure.Management.Compute.Models.ContainerServiceMasterProfile vMasterProfile = null; |
| 108 | + |
| 109 | + // WindowsProfile |
| 110 | + Microsoft.Azure.Management.Compute.Models.ContainerServiceWindowsProfile vWindowsProfile = null; |
| 111 | + |
| 112 | + // LinuxProfile |
| 113 | + Microsoft.Azure.Management.Compute.Models.ContainerServiceLinuxProfile vLinuxProfile = null; |
| 114 | + |
| 115 | + // DiagnosticsProfile |
| 116 | + Microsoft.Azure.Management.Compute.Models.ContainerServiceDiagnosticsProfile vDiagnosticsProfile = null; |
| 117 | + |
| 118 | + if (this.OrchestratorProfileOrchestratorType != null) |
| 119 | + { |
| 120 | + if (vOrchestratorProfile == null) |
| 121 | + { |
| 122 | + vOrchestratorProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceOrchestratorProfile(); |
| 123 | + } |
| 124 | + vOrchestratorProfile.OrchestratorType = this.OrchestratorProfileOrchestratorType; |
| 125 | + } |
| 126 | + |
| 127 | + if (this.MasterProfileCount != null) |
| 128 | + { |
| 129 | + if (vMasterProfile == null) |
| 130 | + { |
| 131 | + vMasterProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceMasterProfile(); |
| 132 | + } |
| 133 | + vMasterProfile.Count = this.MasterProfileCount; |
| 134 | + } |
| 135 | + |
| 136 | + if (this.MasterProfileDnsPrefix != null) |
| 137 | + { |
| 138 | + if (vMasterProfile == null) |
| 139 | + { |
| 140 | + vMasterProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceMasterProfile(); |
| 141 | + } |
| 142 | + vMasterProfile.DnsPrefix = this.MasterProfileDnsPrefix; |
| 143 | + } |
| 144 | + |
| 145 | + if (this.WindowsProfileAdminUsername != null) |
| 146 | + { |
| 147 | + if (vWindowsProfile == null) |
| 148 | + { |
| 149 | + vWindowsProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceWindowsProfile(); |
| 150 | + } |
| 151 | + vWindowsProfile.AdminUsername = this.WindowsProfileAdminUsername; |
| 152 | + } |
| 153 | + |
| 154 | + if (this.WindowsProfileAdminPassword != null) |
| 155 | + { |
| 156 | + if (vWindowsProfile == null) |
| 157 | + { |
| 158 | + vWindowsProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceWindowsProfile(); |
| 159 | + } |
| 160 | + vWindowsProfile.AdminPassword = this.WindowsProfileAdminPassword; |
| 161 | + } |
| 162 | + |
| 163 | + if (this.AdminUsername != null) |
| 164 | + { |
| 165 | + if (vLinuxProfile == null) |
| 166 | + { |
| 167 | + vLinuxProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceLinuxProfile(); |
| 168 | + } |
| 169 | + vLinuxProfile.AdminUsername = this.AdminUsername; |
| 170 | + } |
| 171 | + |
| 172 | + |
| 173 | + if (this.Ssh != null) |
| 174 | + { |
| 175 | + if (vLinuxProfile == null) |
| 176 | + { |
| 177 | + vLinuxProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceLinuxProfile(); |
| 178 | + } |
| 179 | + if (vLinuxProfile.Ssh == null) |
| 180 | + { |
| 181 | + vLinuxProfile.Ssh = new Microsoft.Azure.Management.Compute.Models.ContainerServiceSshConfiguration(); |
| 182 | + } |
| 183 | + if (vLinuxProfile.Ssh.PublicKeys == null) |
| 184 | + { |
| 185 | + vLinuxProfile.Ssh.PublicKeys = new List<Microsoft.Azure.Management.Compute.Models.ContainerServiceSshPublicKey>(); |
| 186 | + } |
| 187 | + foreach (var element in this.Ssh) |
| 188 | + { |
| 189 | + var vPublicKeys = new Microsoft.Azure.Management.Compute.Models.ContainerServiceSshPublicKey(); |
| 190 | + vPublicKeys.KeyData = element; |
| 191 | + vLinuxProfile.Ssh.PublicKeys.Add(vPublicKeys); |
| 192 | + } |
| 193 | + } |
| 194 | + |
| 195 | + if (this.VmDiagnosticsEnabled != null) |
| 196 | + { |
| 197 | + if (vDiagnosticsProfile == null) |
| 198 | + { |
| 199 | + vDiagnosticsProfile = new Microsoft.Azure.Management.Compute.Models.ContainerServiceDiagnosticsProfile(); |
| 200 | + } |
| 201 | + if (vDiagnosticsProfile.VmDiagnostics == null) |
| 202 | + { |
| 203 | + vDiagnosticsProfile.VmDiagnostics = new Microsoft.Azure.Management.Compute.Models.ContainerServiceVMDiagnostics(); |
| 204 | + } |
| 205 | + vDiagnosticsProfile.VmDiagnostics.Enabled = this.VmDiagnosticsEnabled; |
| 206 | + } |
| 207 | + |
| 208 | + |
| 209 | + var vContainerService = new ContainerService |
| 210 | + { |
| 211 | + Location = this.Location, |
| 212 | + Tags = (this.Tag == null) ? null : this.Tag.Cast<DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value), |
| 213 | + AgentPoolProfiles = this.AgentPoolProfile, |
| 214 | + OrchestratorProfile = vOrchestratorProfile, |
| 215 | + MasterProfile = vMasterProfile, |
| 216 | + WindowsProfile = vWindowsProfile, |
| 217 | + LinuxProfile = vLinuxProfile, |
| 218 | + DiagnosticsProfile = vDiagnosticsProfile, |
| 219 | + }; |
| 220 | + |
| 221 | + WriteObject(vContainerService); |
| 222 | + } |
| 223 | + } |
| 224 | +} |
| 225 | + |
0 commit comments