diff --git a/Tests/Fluent.Tests/Network/ApplicationGateway/PrivateMinimal.cs b/Tests/Fluent.Tests/Network/ApplicationGateway/PrivateMinimal.cs index 20e37130b7d..8242ad7d3a2 100644 --- a/Tests/Fluent.Tests/Network/ApplicationGateway/PrivateMinimal.cs +++ b/Tests/Fluent.Tests/Network/ApplicationGateway/PrivateMinimal.cs @@ -103,12 +103,15 @@ public override IApplicationGateway UpdateResource(IApplicationGateway resource) .WithSize(ApplicationGatewaySkuName.StandardMedium) .WithFrontendPort(81, "port81") // Add a new port .WithoutBackendIPAddress("11.1.1.1") // Remove from all existing backends + .DefineSslCertificate("testSSL") + .WithPfxFromFile(new FileInfo(Path.Combine("Assets", "myTest._pfx"))) + .WithPfxPassword("Abc123") + .Attach() .DefineListener("listener2") .WithPrivateFrontend() .WithFrontendPort(81) .WithHttps() - .WithSslCertificateFromPfxFile(new FileInfo(Path.Combine("Assets", "myTest._pfx"))) - .WithSslCertificatePassword("Abc123") + .WithSslCertificate("testSSL") .Attach() .DefineBackend("backend2") .WithIPAddress("11.1.1.3") diff --git a/src/ResourceManagement/Network/Domain/ApplicationGatewaySslCertificate/UpdateDefinition/IUpdateDefinition.cs b/src/ResourceManagement/Network/Domain/ApplicationGatewaySslCertificate/UpdateDefinition/IUpdateDefinition.cs index d89fee92ba6..e891bd3f1b5 100644 --- a/src/ResourceManagement/Network/Domain/ApplicationGatewaySslCertificate/UpdateDefinition/IUpdateDefinition.cs +++ b/src/ResourceManagement/Network/Domain/ApplicationGatewaySslCertificate/UpdateDefinition/IUpdateDefinition.cs @@ -3,6 +3,7 @@ namespace Microsoft.Azure.Management.Network.Fluent.ApplicationGatewaySslCertificate.UpdateDefinition { using Microsoft.Azure.Management.ResourceManager.Fluent.Core.ChildResource.Update; + using System.IO; /// /// The entirety of an application gateway SSL certificate definition as part of an application gateway update. @@ -10,7 +11,9 @@ namespace Microsoft.Azure.Management.Network.Fluent.ApplicationGatewaySslCertifi /// The stage of the parent application gateway definition to return to after attaching. public interface IUpdateDefinition : Microsoft.Azure.Management.Network.Fluent.ApplicationGatewaySslCertificate.UpdateDefinition.IBlank, - Microsoft.Azure.Management.Network.Fluent.ApplicationGatewaySslCertificate.UpdateDefinition.IWithAttach + Microsoft.Azure.Management.Network.Fluent.ApplicationGatewaySslCertificate.UpdateDefinition.IWithAttach, + Microsoft.Azure.Management.Network.Fluent.ApplicationGatewaySslCertificate.UpdateDefinition.IWithData, + Microsoft.Azure.Management.Network.Fluent.ApplicationGatewaySslCertificate.UpdateDefinition.IWithPassword { } @@ -25,12 +28,49 @@ public interface IWithAttach : { } + + /// + /// The stage of an SSL certificate definition allowing to specify the password for the private key (PFX) content of the certificate. + /// + /// The stage of the parent application gateway to return to after attaching. + public interface IWithPassword + { + /// + /// Specifies the password currently used to protect the provided PFX content of the SSL certificate. + /// + /// A password. + /// The next stage of the definition. + Microsoft.Azure.Management.Network.Fluent.ApplicationGatewaySslCertificate.UpdateDefinition.IWithAttach WithPfxPassword(string password); + } + + /// + /// The stage of an SSL certificate definition allowing to specify the contents of the SSL certificate. + /// + /// The stage of the parent application gateway to return to after attaching. + public interface IWithData + { + /// + /// Specifies the PFX (PKCS#12) file to get the private key content from. + /// + /// A file in the PFX format. + /// The next stage of the definition. + /// Java.io.IOException when there are problems with the provided file. + Microsoft.Azure.Management.Network.Fluent.ApplicationGatewaySslCertificate.UpdateDefinition.IWithPassword WithPfxFromFile(FileInfo pfxFile); + + /// + /// Specifies the contents of the private key in the PFX (PKCS#12) format, not base64-encoded. + /// + /// The contents of the private key in the PFX format. + /// The next stage of the definition. + Microsoft.Azure.Management.Network.Fluent.ApplicationGatewaySslCertificate.UpdateDefinition.IWithPassword WithPfxFromBytes(params byte[] pfxData); + } + /// /// The first stage of an application gateway authentication certificate definition. /// /// The stage of the parent application gateway definition to return to after attaching. public interface IBlank : - Microsoft.Azure.Management.Network.Fluent.ApplicationGatewaySslCertificate.UpdateDefinition.IWithAttach + Microsoft.Azure.Management.Network.Fluent.ApplicationGatewaySslCertificate.UpdateDefinition.IWithData { } } \ No newline at end of file diff --git a/src/ResourceManagement/Network/Domain/InterfaceImpl/ApplicationGatewaySslCertificateImpl.cs b/src/ResourceManagement/Network/Domain/InterfaceImpl/ApplicationGatewaySslCertificateImpl.cs index aa922e45712..9e5ab3c5e34 100644 --- a/src/ResourceManagement/Network/Domain/InterfaceImpl/ApplicationGatewaySslCertificateImpl.cs +++ b/src/ResourceManagement/Network/Domain/InterfaceImpl/ApplicationGatewaySslCertificateImpl.cs @@ -85,5 +85,37 @@ string Microsoft.Azure.Management.Network.Fluent.IApplicationGatewaySslCertifica { return this.WithPfxPassword(password) as ApplicationGatewaySslCertificate.Definition.IWithAttach; } + + + /// + /// Specifies the PFX (PKCS#12) file to get the private key content from. + /// + /// A file in the PFX format. + /// The next stage of the definition. + /// System.IO.IOException when there are problems with the provided file. + ApplicationGatewaySslCertificate.UpdateDefinition.IWithPassword ApplicationGatewaySslCertificate.UpdateDefinition.IWithData.WithPfxFromFile(FileInfo pfxFile) + { + return this.WithPfxFromFile(pfxFile) as ApplicationGatewaySslCertificate.UpdateDefinition.IWithPassword; + } + + /// + /// Specifies the password currently used to protect the provided PFX content of the SSL certificate. + /// + /// A password. + /// The next stage of the definition. + ApplicationGatewaySslCertificate.UpdateDefinition.IWithPassword ApplicationGatewaySslCertificate.UpdateDefinition.IWithData.WithPfxFromBytes(params byte[] pfxData) + { + return this.WithPfxFromBytes(pfxData) as ApplicationGatewaySslCertificate.UpdateDefinition.IWithPassword; + } + + /// + /// Specifies the password currently used to protect the provided PFX content of the SSL certificate. + /// + /// A password. + /// The next stage of the definition. + ApplicationGatewaySslCertificate.UpdateDefinition.IWithAttach ApplicationGatewaySslCertificate.UpdateDefinition.IWithPassword.WithPfxPassword(string password) + { + return this.WithPfxPassword(password) as ApplicationGatewaySslCertificate.UpdateDefinition.IWithAttach; + } } } \ No newline at end of file