Skip to content

Commit 35433ca

Browse files
committed
Update
1 parent fd6766a commit 35433ca

File tree

4 files changed

+408
-0
lines changed

4 files changed

+408
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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("Add", "AzureRmVmssSshPublicKey")]
32+
[OutputType(typeof(VirtualMachineScaleSet))]
33+
public class AddAzureRmVmssSshPublicKeyCommand : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
34+
{
35+
[Parameter(
36+
Mandatory = false,
37+
Position = 0,
38+
ValueFromPipeline = true,
39+
ValueFromPipelineByPropertyName = true)]
40+
public VirtualMachineScaleSet VirtualMachineScaleSet { get; set; }
41+
42+
[Parameter(
43+
Mandatory = false,
44+
Position = 1,
45+
ValueFromPipelineByPropertyName = true)]
46+
public string Path { get; set; }
47+
48+
[Parameter(
49+
Mandatory = false,
50+
Position = 2,
51+
ValueFromPipelineByPropertyName = true)]
52+
public string KeyData { get; set; }
53+
54+
protected override void ProcessRecord()
55+
{
56+
// VirtualMachineProfile
57+
if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
58+
{
59+
this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
60+
}
61+
62+
// OsProfile
63+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile == null)
64+
{
65+
this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetOSProfile();
66+
}
67+
68+
// LinuxConfiguration
69+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration == null)
70+
{
71+
this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration = new Microsoft.Azure.Management.Compute.Models.LinuxConfiguration();
72+
}
73+
74+
// Ssh
75+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration.Ssh == null)
76+
{
77+
this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration.Ssh = new Microsoft.Azure.Management.Compute.Models.SshConfiguration();
78+
}
79+
80+
// PublicKeys
81+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration.Ssh.PublicKeys == null)
82+
{
83+
this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration.Ssh.PublicKeys = new List<Microsoft.Azure.Management.Compute.Models.SshPublicKey>();
84+
}
85+
86+
var vPublicKeys = new Microsoft.Azure.Management.Compute.Models.SshPublicKey();
87+
88+
vPublicKeys.Path = this.Path;
89+
vPublicKeys.KeyData = this.KeyData;
90+
this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration.Ssh.PublicKeys.Add(vPublicKeys);
91+
WriteObject(this.VirtualMachineScaleSet);
92+
}
93+
}
94+
}
95+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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("Add", "AzureRmVmssWinRMListener")]
32+
[OutputType(typeof(VirtualMachineScaleSet))]
33+
public class AddAzureRmVmssWinRMListenerCommand : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
34+
{
35+
[Parameter(
36+
Mandatory = false,
37+
Position = 0,
38+
ValueFromPipeline = true,
39+
ValueFromPipelineByPropertyName = true)]
40+
public VirtualMachineScaleSet VirtualMachineScaleSet { get; set; }
41+
42+
[Parameter(
43+
Mandatory = false,
44+
Position = 1,
45+
ValueFromPipelineByPropertyName = true)]
46+
public ProtocolTypes? Protocol { get; set; }
47+
48+
[Parameter(
49+
Mandatory = false,
50+
Position = 2,
51+
ValueFromPipelineByPropertyName = true)]
52+
public string CertificateUrl { get; set; }
53+
54+
protected override void ProcessRecord()
55+
{
56+
// VirtualMachineProfile
57+
if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
58+
{
59+
this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
60+
}
61+
62+
// OsProfile
63+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile == null)
64+
{
65+
this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetOSProfile();
66+
}
67+
68+
// WindowsConfiguration
69+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.WindowsConfiguration == null)
70+
{
71+
this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.WindowsConfiguration = new Microsoft.Azure.Management.Compute.Models.WindowsConfiguration();
72+
}
73+
74+
// WinRM
75+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.WindowsConfiguration.WinRM == null)
76+
{
77+
this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.WindowsConfiguration.WinRM = new Microsoft.Azure.Management.Compute.Models.WinRMConfiguration();
78+
}
79+
80+
// Listeners
81+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.WindowsConfiguration.WinRM.Listeners == null)
82+
{
83+
this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.WindowsConfiguration.WinRM.Listeners = new List<Microsoft.Azure.Management.Compute.Models.WinRMListener>();
84+
}
85+
86+
var vListeners = new Microsoft.Azure.Management.Compute.Models.WinRMListener();
87+
88+
vListeners.Protocol = this.Protocol;
89+
vListeners.CertificateUrl = this.CertificateUrl;
90+
this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.WindowsConfiguration.WinRM.Listeners.Add(vListeners);
91+
WriteObject(this.VirtualMachineScaleSet);
92+
}
93+
}
94+
}
95+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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("Remove", "AzureRmVmssSshPublicKey")]
32+
[OutputType(typeof(VirtualMachineScaleSet))]
33+
public class RemoveAzureRmVmssSshPublicKeyCommand : Microsoft.Azure.Commands.ResourceManager.Common.AzureRMCmdlet
34+
{
35+
[Parameter(
36+
Mandatory = false,
37+
Position = 0,
38+
ValueFromPipeline = true,
39+
ValueFromPipelineByPropertyName = true)]
40+
public VirtualMachineScaleSet VirtualMachineScaleSet { get; set; }
41+
42+
[Parameter(
43+
Mandatory = false,
44+
Position = 1,
45+
ValueFromPipelineByPropertyName = true)]
46+
public string Path { get; set; }
47+
48+
[Parameter(
49+
Mandatory = false,
50+
Position = 2,
51+
ValueFromPipelineByPropertyName = true)]
52+
public string KeyData { get; set; }
53+
54+
protected override void ProcessRecord()
55+
{
56+
// VirtualMachineProfile
57+
if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
58+
{
59+
WriteObject(this.VirtualMachineScaleSet);
60+
return;
61+
}
62+
63+
// OsProfile
64+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile == null)
65+
{
66+
WriteObject(this.VirtualMachineScaleSet);
67+
return;
68+
}
69+
70+
// LinuxConfiguration
71+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration == null)
72+
{
73+
WriteObject(this.VirtualMachineScaleSet);
74+
return;
75+
}
76+
77+
// Ssh
78+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration.Ssh == null)
79+
{
80+
WriteObject(this.VirtualMachineScaleSet);
81+
return;
82+
}
83+
84+
// PublicKeys
85+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration.Ssh.PublicKeys == null)
86+
{
87+
WriteObject(this.VirtualMachineScaleSet);
88+
return;
89+
}
90+
var vPublicKeys = this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration.Ssh.PublicKeys.First
91+
(e =>
92+
(this.Path == null || e.Path == this.Path)
93+
&& (this.KeyData == null || e.KeyData == this.KeyData)
94+
);
95+
96+
if (vPublicKeys != null)
97+
{
98+
this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration.Ssh.PublicKeys.Remove(vPublicKeys);
99+
}
100+
101+
if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration.Ssh.PublicKeys.Count == 0)
102+
{
103+
this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.LinuxConfiguration.Ssh.PublicKeys = null;
104+
}
105+
WriteObject(this.VirtualMachineScaleSet);
106+
}
107+
}
108+
}
109+

0 commit comments

Comments
 (0)