Skip to content

Commit 2cd218d

Browse files
committed
merging the latest changes
2 parents 8d50775 + 051136f commit 2cd218d

File tree

12 files changed

+52
-33
lines changed

12 files changed

+52
-33
lines changed

src/ServiceManagement/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationCertificateTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void GetAzureAutomationCertificateByAllSuccessfull()
7171
// Setup
7272
string accountName = "automation";
7373

74-
this.mockAutomationClient.Setup(f => f.ListCertificates(accountName)).Returns((string a) => new List<Certificate>());
74+
this.mockAutomationClient.Setup(f => f.ListCertificates(accountName)).Returns((string a) => new List<CertificateInfo>());
7575

7676
// Test
7777
this.cmdlet.AutomationAccountName = accountName;

src/ServiceManagement/Automation/Commands.Automation/Cmdlet/GetAzureAutomationCertificate.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2525
/// Gets a certificate for automation.
2626
/// </summary>
2727
[Cmdlet(VerbsCommon.Get, "AzureAutomationCertificate", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
28-
[OutputType(typeof(Certificate))]
28+
[OutputType(typeof(CertificateInfo))]
2929
public class GetAzureAutomationCertificate : AzureAutomationBaseCmdlet
3030
{
3131
/// <summary>
@@ -41,10 +41,10 @@ public class GetAzureAutomationCertificate : AzureAutomationBaseCmdlet
4141
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
4242
protected override void AutomationExecuteCmdlet()
4343
{
44-
IEnumerable<Certificate> ret = null;
44+
IEnumerable<CertificateInfo> ret = null;
4545
if (this.ParameterSetName == AutomationCmdletParameterSets.ByCertificateName)
4646
{
47-
ret = new List<Certificate>
47+
ret = new List<CertificateInfo>
4848
{
4949
this.AutomationClient.GetCertificate(this.AutomationAccountName, this.Name)
5050
};

src/ServiceManagement/Automation/Commands.Automation/Cmdlet/NewAzureAutomationCertificate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2626
/// Create a new Certificate for automation.
2727
/// </summary>
2828
[Cmdlet(VerbsCommon.New, "AzureAutomationCertificate", DefaultParameterSetName = AutomationCmdletParameterSets.ByCertificateName)]
29-
[OutputType(typeof(Certificate))]
29+
[OutputType(typeof(CertificateInfo))]
3030
public class NewAzureAutomationCertificate : AzureAutomationBaseCmdlet
3131
{
3232
/// <summary>
@@ -61,7 +61,7 @@ public class NewAzureAutomationCertificate : AzureAutomationBaseCmdlet
6161
/// <summary>
6262
/// Gets or sets the certificate exportable Property.
6363
/// </summary>
64-
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The exportable property of the variable.")]
64+
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The exportable property of the certificate.")]
6565
public SwitchParameter Exportable { get; set; }
6666

6767
/// <summary>

src/ServiceManagement/Automation/Commands.Automation/Cmdlet/SetAzureAutomationCertificate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.Automation.Cmdlet
2626
/// Create a new Certificate for automation.
2727
/// </summary>
2828
[Cmdlet(VerbsCommon.Set, "AzureAutomationCertificate", DefaultParameterSetName = AutomationCmdletParameterSets.ByCertificateName)]
29-
[OutputType(typeof(Certificate))]
29+
[OutputType(typeof(CertificateInfo))]
3030
public class SetAzureAutomationCertificate : AzureAutomationBaseCmdlet
3131
{
3232
/// <summary>
@@ -61,7 +61,7 @@ public class SetAzureAutomationCertificate : AzureAutomationBaseCmdlet
6161
/// <summary>
6262
/// Gets or sets the certificate exportable Property.
6363
/// </summary>
64-
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The exportable property of the variable.")]
64+
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The exportable property of the certificate.")]
6565
public bool? Exportable { get; set; }
6666

6767
/// <summary>

src/ServiceManagement/Automation/Commands.Automation/Cmdlet/SetAzureAutomationConnection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ public class SetAzureAutomationConnectionFieldValue : AzureAutomationBaseCmdlet
5858
protected override void AutomationExecuteCmdlet()
5959
{
6060

61-
var updateddConnection = this.AutomationClient.UpdateConnectionFieldValue(this.AutomationAccountName, this.Name, this.ConnectionFieldName, this.Value);
61+
var updatedConnection = this.AutomationClient.UpdateConnectionFieldValue(this.AutomationAccountName, this.Name, this.ConnectionFieldName, this.Value);
6262

63-
this.WriteObject(updateddConnection);
63+
this.WriteObject(updatedConnection);
6464
}
6565
}
6666
}

src/ServiceManagement/Automation/Commands.Automation/Commands.Automation.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
<Compile Include="DataContract\OdataErrorMessage.cs" />
179179
<Compile Include="Model\AutomationAccount.cs" />
180180
<Compile Include="Model\Connection.cs" />
181-
<Compile Include="Model\Certificate.cs" />
181+
<Compile Include="Model\CertificateInfo.cs" />
182182
<Compile Include="Model\JobSchedule.cs" />
183183
<Compile Include="Model\JobStream.cs" />
184184
<Compile Include="Model\CredentialInfo.cs" />

src/ServiceManagement/Automation/Commands.Automation/Common/AutomationClient.cs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
using Credential = Microsoft.Azure.Commands.Automation.Model.CredentialInfo;
3636
using Module = Microsoft.Azure.Commands.Automation.Model.Module;
3737
using JobSchedule = Microsoft.Azure.Commands.Automation.Model.JobSchedule;
38-
using Certificate = Microsoft.Azure.Commands.Automation.Model.Certificate;
38+
using Certificate = Microsoft.Azure.Commands.Automation.Model.CertificateInfo;
3939
using Connection = Microsoft.Azure.Commands.Automation.Model.Connection;
4040

4141
namespace Microsoft.Azure.Commands.Automation.Common
@@ -1048,27 +1048,33 @@ public void DeleteAutomationAccount(string automationAccountName)
10481048

10491049
#region Certificate Operations
10501050

1051-
public Certificate CreateCertificate(string automationAccountName, string name, string path, SecureString password,
1051+
public CertificateInfo CreateCertificate(string automationAccountName, string name, string path, SecureString password,
10521052
string description, bool exportable)
10531053
{
10541054
var certificateModel = this.TryGetCertificateModel(automationAccountName, name);
10551055
if (certificateModel != null)
10561056
{
1057-
throw new ResourceCommonException(typeof(Certificate),
1057+
throw new ResourceCommonException(typeof(CertificateInfo),
10581058
string.Format(CultureInfo.CurrentCulture, Resources.CertificateAlreadyExists, name));
10591059
}
10601060

10611061
return CreateCertificateInternal(automationAccountName, name, path, password, description, exportable);
10621062
}
10631063

1064-
1065-
public Certificate UpdateCertificate(string automationAccountName, string name, string path, SecureString password,
1064+
1065+
public CertificateInfo UpdateCertificate(string automationAccountName, string name, string path, SecureString password,
10661066
string description, bool? exportable)
10671067
{
1068+
if (String.IsNullOrWhiteSpace(path) && password != null && exportable.HasValue)
1069+
{
1070+
throw new ResourceCommonException(typeof(CertificateInfo),
1071+
string.Format(CultureInfo.CurrentCulture, Resources.SetCertificateInvalidArgs, name));
1072+
}
1073+
10681074
var certificateModel = this.TryGetCertificateModel(automationAccountName, name);
10691075
if (certificateModel == null)
10701076
{
1071-
throw new ResourceCommonException(typeof(Certificate),
1077+
throw new ResourceCommonException(typeof(CertificateInfo),
10721078
string.Format(CultureInfo.CurrentCulture, Resources.CertificateNotFound, name));
10731079
}
10741080

@@ -1093,22 +1099,22 @@ public Certificate UpdateCertificate(string automationAccountName, string name,
10931099

10941100
this.automationManagementClient.Certificates.Update(automationAccountName, cuparam);
10951101

1096-
return new Certificate(automationAccountName, this.automationManagementClient.Certificates.Get(automationAccountName, name).Certificate);
1102+
return new CertificateInfo(automationAccountName, this.automationManagementClient.Certificates.Get(automationAccountName, name).Certificate);
10971103
}
10981104

1099-
public Certificate GetCertificate(string automationAccountName, string name)
1105+
public CertificateInfo GetCertificate(string automationAccountName, string name)
11001106
{
11011107
var certificateModel = this.TryGetCertificateModel(automationAccountName, name);
11021108
if (certificateModel == null)
11031109
{
1104-
throw new ResourceCommonException(typeof(Certificate),
1110+
throw new ResourceCommonException(typeof(CertificateInfo),
11051111
string.Format(CultureInfo.CurrentCulture, Resources.CertificateNotFound, name));
11061112
}
11071113

11081114
return new Certificate(automationAccountName, certificateModel);
11091115
}
11101116

1111-
public IEnumerable<Certificate> ListCertificates(string automationAccountName)
1117+
public IEnumerable<CertificateInfo> ListCertificates(string automationAccountName)
11121118
{
11131119
return AutomationManagementClient
11141120
.ContinuationTokenHandler(
@@ -1118,7 +1124,7 @@ public IEnumerable<Certificate> ListCertificates(string automationAccountName)
11181124
automationAccountName);
11191125
return new ResponseWithSkipToken<AutomationManagement.Models.Certificate>(
11201126
response, response.Certificates);
1121-
}).Select(c => new Certificate(automationAccountName, c));
1127+
}).Select(c => new CertificateInfo(automationAccountName, c));
11221128
}
11231129

11241130
public void DeleteCertificate(string automationAccountName, string name)

src/ServiceManagement/Automation/Commands.Automation/Common/IAutomationClient.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ public interface IAutomationClient
139139

140140
#region Certificates
141141

142-
Certificate CreateCertificate(string automationAccountName, string name, string path, SecureString password, string description, bool exportable);
142+
CertificateInfo CreateCertificate(string automationAccountName, string name, string path, SecureString password, string description, bool exportable);
143143

144-
Certificate UpdateCertificate(string automationAccountName, string name, string path, SecureString password, string description, bool? exportable);
144+
CertificateInfo UpdateCertificate(string automationAccountName, string name, string path, SecureString password, string description, bool? exportable);
145145

146-
Certificate GetCertificate(string automationAccountName, string name);
146+
CertificateInfo GetCertificate(string automationAccountName, string name);
147147

148-
IEnumerable<Certificate> ListCertificates(string automationAccountName);
148+
IEnumerable<CertificateInfo> ListCertificates(string automationAccountName);
149149

150150
void DeleteCertificate(string automationAccountName, string name);
151151

src/ServiceManagement/Automation/Commands.Automation/Model/Certificate.cs renamed to src/ServiceManagement/Automation/Commands.Automation/Model/CertificateInfo.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818

1919
namespace Microsoft.Azure.Commands.Automation.Model
2020
{
21-
public class Certificate
21+
public class CertificateInfo
2222
{
2323
/// <summary>
24-
/// Initializes a new instance of the <see cref="Certificate"/> class.
24+
/// Initializes a new instance of the <see cref="CertificateInfo"/> class.
2525
/// </summary>
2626
/// <param name="accountAcccountName">
2727
/// The account name.
@@ -31,7 +31,7 @@ public class Certificate
3131
/// </param>
3232
/// <exception cref="System.ArgumentException">
3333
/// </exception>
34-
public Certificate(string accountAcccountName, Azure.Management.Automation.Models.Certificate certificate)
34+
public CertificateInfo(string accountAcccountName, Azure.Management.Automation.Models.Certificate certificate)
3535
{
3636
Requires.Argument("certificate", certificate).NotNull();
3737
this.AutomationAccountName = accountAcccountName;
@@ -48,9 +48,9 @@ public Certificate(string accountAcccountName, Azure.Management.Automation.Model
4848
}
4949

5050
/// <summary>
51-
/// Initializes a new instance of the <see cref="Certificate"/> class.
51+
/// Initializes a new instance of the <see cref="CertificateInfo"/> class.
5252
/// </summary>
53-
public Certificate()
53+
public CertificateInfo()
5454
{
5555
}
5656

src/ServiceManagement/Automation/Commands.Automation/Model/JobStream.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public JobStream(AutomationManagement.Models.JobStream jobStream, string automat
3636
{
3737
Requires.Argument("jobStream", jobStream).NotNull();
3838

39-
this.StreamId = jobStream.Properties.JobStreamId;
39+
this.JobStreamId = jobStream.Properties.JobStreamId;
4040
this.Type = jobStream.Properties.StreamType;
4141
this.Text = jobStream.Properties.Summary;
4242
this.Time = jobStream.Properties.Time;
@@ -64,7 +64,7 @@ public JobStream()
6464
/// <summary>
6565
/// Gets or sets the stream id
6666
/// </summary>
67-
public string StreamId { get; set; }
67+
public string JobStreamId { get; set; }
6868

6969
/// <summary>
7070
/// Gets or sets the stream time.

src/ServiceManagement/Automation/Commands.Automation/Properties/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ServiceManagement/Automation/Commands.Automation/Properties/Resources.resx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,8 @@
258258
<value>The connection was not found. Connection name: {0}.</value>
259259
<comment>Automation</comment>
260260
</data>
261+
<data name="SetCertificateInvalidArgs" xml:space="preserve">
262+
<value>Password and Exportable parameters cannot be updated for an existing certificate. They can only be specified when overwriting this certificate with a new one, via the Path parameter</value>
263+
<comment>Automation</comment>
264+
</data>
261265
</root>

0 commit comments

Comments
 (0)