From 3341ba193c6b3bc3684a30d7fc623b7da52226d4 Mon Sep 17 00:00:00 2001 From: Deepanjan Bhattacharyya Date: Fri, 14 Aug 2020 17:51:06 -0400 Subject: [PATCH 1/7] Picocli implementation --- .../java/gyro/azure/AbstractAzureCommand.java | 8 +++++--- src/main/java/gyro/azure/AzureCommand.java | 18 +++++++++-------- .../azure/keyvault/AbstractVaultCommand.java | 15 -------------- .../keyvault/AddVaultCertificateCommand.java | 12 +++++------ .../azure/keyvault/AddVaultSecretCommand.java | 18 ++++++++--------- .../azure/keyvault/AzureKeyVaultCommand.java | 15 ++++++++++++++ .../keyvault/ListVaultCertificateCommand.java | 20 +++++++++---------- .../keyvault/ListVaultSecretCommand.java | 10 +++++----- .../RemoveVaultCertificateCommand.java | 8 ++++---- .../keyvault/RemoveVaultSecretCommand.java | 8 ++++---- .../AbstractApplicationGatewayCommand.java | 19 +++--------------- ...dApplicationGatewayCertificateCommand.java | 15 +++++++------- .../AzureApplicationGatewayCommand.java | 13 ++++++++++++ ...tApplicationGatewayCertificateCommand.java | 8 ++++---- ...tApplicationGatewayCertificateCommand.java | 16 +++++++-------- ...eApplicationGatewayCertificateCommand.java | 17 +++++++++------- 16 files changed, 114 insertions(+), 106 deletions(-) create mode 100644 src/main/java/gyro/azure/keyvault/AzureKeyVaultCommand.java create mode 100644 src/main/java/gyro/azure/network/AzureApplicationGatewayCommand.java diff --git a/src/main/java/gyro/azure/AbstractAzureCommand.java b/src/main/java/gyro/azure/AbstractAzureCommand.java index 6dbeea1a..29d28dc6 100644 --- a/src/main/java/gyro/azure/AbstractAzureCommand.java +++ b/src/main/java/gyro/azure/AbstractAzureCommand.java @@ -36,12 +36,12 @@ import gyro.lang.ast.Node; import gyro.lang.ast.block.FileNode; import gyro.util.Bug; -import io.airlift.airline.Option; import org.apache.commons.lang3.StringUtils; +import picocli.CommandLine.Option; public abstract class AbstractAzureCommand { - @Option(name = "--credential", description = "The azure credentials to be used as defined in the project init file. When not specified the 'default' credential is used.") + @Option(names = "--credential", description = "The azure credentials to be used as defined in the project init file. When not specified the 'default' credential is used.") private String credential; private RootScope scope; @@ -91,7 +91,9 @@ public Azure getClient() { .get("azure::" + getCredential()); if (credentials == null) { - throw new GyroException(String.format("No credentials with name - '%s' found. Check the your project init file.", getCredential())); + throw new GyroException(String.format( + "No credentials with name - '%s' found. Check the your project init file.", + getCredential())); } return AzureResource.createClient((AzureCredentials) credentials); diff --git a/src/main/java/gyro/azure/AzureCommand.java b/src/main/java/gyro/azure/AzureCommand.java index 092767cf..b7e437b2 100644 --- a/src/main/java/gyro/azure/AzureCommand.java +++ b/src/main/java/gyro/azure/AzureCommand.java @@ -19,21 +19,23 @@ import java.util.List; import gyro.azure.keyvault.AbstractVaultCommand; +import gyro.azure.keyvault.AzureKeyVaultCommand; import gyro.azure.network.AbstractApplicationGatewayCommand; +import gyro.azure.network.AzureApplicationGatewayCommand; import gyro.core.command.GyroCommand; -import io.airlift.airline.Arguments; -import io.airlift.airline.Cli; -import io.airlift.airline.Command; -import io.airlift.airline.Help; import org.reflections.Reflections; import org.reflections.util.ClasspathHelper; +import picocli.CommandLine.Command; +import picocli.CommandLine.Parameters; -@Command(name = "azure", description = "CLI command for all things azure") +@Command(name = "azure", description = "CLI command for all things azure.", mixinStandardHelpOptions = true, subcommands = { + AzureKeyVaultCommand.class, + AzureApplicationGatewayCommand.class }) public class AzureCommand implements GyroCommand { public static Reflections reflections; - @Arguments(description = "", required = true) + @Parameters(description = "", arity = "1") private List arguments; public static Reflections getReflections() { @@ -47,7 +49,7 @@ public static Reflections getReflections() { @Override public void execute() throws Exception { - Cli.CliBuilder builder = Cli.builder("azure") + /*Cli.CliBuilder builder = Cli.builder("azure") .withDescription("CLI command for all things azure") .withDefaultCommand(Help.class) .withCommands(Help.class); @@ -72,6 +74,6 @@ public void execute() throws Exception { command.getClass().getName(), Runnable.class.getName(), GyroCommand.class.getName())); - } + }*/ } } diff --git a/src/main/java/gyro/azure/keyvault/AbstractVaultCommand.java b/src/main/java/gyro/azure/keyvault/AbstractVaultCommand.java index 4bcc81f6..7ba905ae 100644 --- a/src/main/java/gyro/azure/keyvault/AbstractVaultCommand.java +++ b/src/main/java/gyro/azure/keyvault/AbstractVaultCommand.java @@ -16,19 +16,13 @@ package gyro.azure.keyvault; -import java.util.ArrayList; -import java.util.List; - import com.microsoft.azure.management.Azure; import com.microsoft.azure.management.keyvault.Vault; import gyro.azure.AbstractAzureCommand; -import gyro.azure.AzureCommand; import gyro.core.GyroException; import gyro.core.command.GyroCommand; import gyro.core.resource.Resource; import gyro.core.scope.RootScope; -import io.airlift.airline.Cli; -import io.airlift.airline.Help; public abstract class AbstractVaultCommand extends AbstractAzureCommand implements GyroCommand { @@ -54,13 +48,4 @@ Vault getVault(String vaultResourceName) { Azure client = getClient(); return getVault(vaultResourceName, scope, client); } - - public static void setVaultCommand(Cli.CliBuilder builder) { - List> subTypesOf = new ArrayList<>(AzureCommand.getReflections().getSubTypesOf(AbstractVaultCommand.class)); - - builder.withGroup("key-vault") - .withDescription("Manage azure key-vault secrets, keys and certificates") - .withDefaultCommand(Help.class) - .withCommands(subTypesOf); - } } diff --git a/src/main/java/gyro/azure/keyvault/AddVaultCertificateCommand.java b/src/main/java/gyro/azure/keyvault/AddVaultCertificateCommand.java index c0e58a59..26275424 100644 --- a/src/main/java/gyro/azure/keyvault/AddVaultCertificateCommand.java +++ b/src/main/java/gyro/azure/keyvault/AddVaultCertificateCommand.java @@ -26,17 +26,17 @@ import com.psddev.dari.util.ObjectUtils; import gyro.core.GyroCore; import gyro.core.GyroException; -import io.airlift.airline.Arguments; -import io.airlift.airline.Command; -import io.airlift.airline.Option; +import picocli.CommandLine.Command; +import picocli.CommandLine.Option; +import picocli.CommandLine.Parameters; -@Command(name = "add-certificate", description = "Add a certificate to an Azure key vault") +@Command(name = "add-certificate", description = "Add a certificate to an Azure key vault.", mixinStandardHelpOptions = true) public class AddVaultCertificateCommand extends AbstractVaultCommand { - @Arguments(description = "The command requires three arguments. : the key-vault resource name used in the config to which the certificate would be added. : name of the certificate to be added. : the path to the certificate file (.pfx)", required = true) + @Parameters(description = "The command requires three arguments. : the key-vault resource name used in the config to which the certificate would be added. : name of the certificate to be added. : the path to the certificate file (.pfx)", arity = "1") private List arguments; - @Option(name = { "--password" }, description = "Password used to encrypt the certificate file") + @Option(names = "--password", description = "Password used to encrypt the certificate file.", arity = "0..1", interactive = true) private String password; @Override diff --git a/src/main/java/gyro/azure/keyvault/AddVaultSecretCommand.java b/src/main/java/gyro/azure/keyvault/AddVaultSecretCommand.java index 8e36d38c..0fac0feb 100644 --- a/src/main/java/gyro/azure/keyvault/AddVaultSecretCommand.java +++ b/src/main/java/gyro/azure/keyvault/AddVaultSecretCommand.java @@ -8,27 +8,27 @@ import com.psddev.dari.util.ObjectUtils; import gyro.core.GyroCore; import gyro.core.GyroException; -import io.airlift.airline.Arguments; -import io.airlift.airline.Command; -import io.airlift.airline.Option; import org.joda.time.DateTime; +import picocli.CommandLine.Command; +import picocli.CommandLine.Option; +import picocli.CommandLine.Parameters; -@Command(name = "add-secret", description = "Add a secret to an Azure key vault") +@Command(name = "add-secret", description = "Add a secret to an Azure key vault.", mixinStandardHelpOptions = true) public class AddVaultSecretCommand extends AbstractVaultCommand { - @Arguments(description = "The command requires three arguments. : the key-vault resource name used in the config to which the secret would be added. : name of the secret to be added. : the secret value", required = true) + @Parameters(description = "The command requires three arguments. : the key-vault resource name used in the config to which the secret would be added. : name of the secret to be added. : the secret value", arity = "1") private List arguments; - @Option(name = { "--content-type" }, description = "Content type for the secret") + @Option(names = "--content-type", description = "Content type for the secret.") private String contentType; - @Option(name = { "--expires" }, description = "A date time value value in UTC specifying the expiration time. Format 'YYYY-MM-DDTHH:MM:SS.sssZ'") + @Option(names = "--expires", description = "A date time value value in UTC specifying the expiration time. Format 'YYYY-MM-DDTHH:MM:SS.sssZ'.") private String expires; - @Option(name = { "--not-before" }, description = "A date time value value in UTC specifying the expiration not before a specific time. Format 'YYYY-MM-DDTHH:MM:SS.sssZ'") + @Option(names = "--not-before", description = "A date time value value in UTC specifying the expiration not before a specific time. Format 'YYYY-MM-DDTHH:MM:SS.sssZ'.") private String notBefore; - @Option(name = { "--enabled" }, description = "Enable/Disable the secret. Defaults to 'false'") + @Option(names = "--enabled", description = "Enable/Disable the secret. Defaults to 'false'.") private boolean enabled; @Override diff --git a/src/main/java/gyro/azure/keyvault/AzureKeyVaultCommand.java b/src/main/java/gyro/azure/keyvault/AzureKeyVaultCommand.java new file mode 100644 index 00000000..366d6ef5 --- /dev/null +++ b/src/main/java/gyro/azure/keyvault/AzureKeyVaultCommand.java @@ -0,0 +1,15 @@ +package gyro.azure.keyvault; + +import gyro.core.command.GyroCommandGroup; +import picocli.CommandLine; + +@CommandLine.Command(name = "key-vault", description = "Manage azure key-vault secrets, keys and certificates.", mixinStandardHelpOptions = true, subcommands = { + AddVaultCertificateCommand.class, + AddVaultSecretCommand.class, + ListVaultCertificateCommand.class, + ListVaultSecretCommand.class, + RemoveVaultCertificateCommand.class, + RemoveVaultSecretCommand.class}) +public class AzureKeyVaultCommand implements GyroCommandGroup { + +} diff --git a/src/main/java/gyro/azure/keyvault/ListVaultCertificateCommand.java b/src/main/java/gyro/azure/keyvault/ListVaultCertificateCommand.java index e15ca93f..866fd601 100644 --- a/src/main/java/gyro/azure/keyvault/ListVaultCertificateCommand.java +++ b/src/main/java/gyro/azure/keyvault/ListVaultCertificateCommand.java @@ -17,25 +17,23 @@ package gyro.azure.keyvault; import java.util.List; -import java.util.stream.Collectors; import com.microsoft.azure.PagedList; import com.microsoft.azure.keyvault.models.CertificateItem; import com.microsoft.azure.management.keyvault.Vault; -import com.microsoft.azure.management.network.ApplicationGatewaySslCertificate; import gyro.core.GyroCore; import gyro.core.GyroException; -import io.airlift.airline.Arguments; -import io.airlift.airline.Command; -import io.airlift.airline.Option; +import picocli.CommandLine.Command; +import picocli.CommandLine.Option; +import picocli.CommandLine.Parameters; -@Command(name = "list-certificate", description = "List all certificates present in an Azure key vault") +@Command(name = "list-certificate", description = "List all certificates present in an Azure key vault.", mixinStandardHelpOptions = true) public class ListVaultCertificateCommand extends AbstractVaultCommand { - @Arguments(description = "The command requires one argument. : the key-vault resource name used in the config whose certificates would be listed", required = true) + @Parameters(description = "The command requires one argument. : the key-vault resource name used in the config whose certificates would be listed.", arity = "1") private List arguments; - @Option(name = "--show-thumbprint", description = "Show thumbprint of the certificate") + @Option(names = "--show-thumbprint", description = "Show thumbprint of the certificate.") private boolean showThumbprint; @Override @@ -49,14 +47,16 @@ public void execute() throws Exception { if (!certificateItemPagedList.isEmpty()) { certificateItemPagedList.loadAll(); - for (CertificateItem certificate: certificateItemPagedList) { + for (CertificateItem certificate : certificateItemPagedList) { StringBuilder sb = new StringBuilder(); sb.append("\n***********************"); sb.append(String.format("\nName: %s", certificate.identifier().name())); sb.append(String.format("\nVersion: %s", certificate.identifier().version())); if (showThumbprint) { - sb.append(String.format("\nThumbprint: %s", certificate.x509Thumbprint() != null ? new String(certificate.x509Thumbprint()) : null)); + sb.append(String.format( + "\nThumbprint: %s", + certificate.x509Thumbprint() != null ? new String(certificate.x509Thumbprint()) : null)); } GyroCore.ui().write(sb.toString()); diff --git a/src/main/java/gyro/azure/keyvault/ListVaultSecretCommand.java b/src/main/java/gyro/azure/keyvault/ListVaultSecretCommand.java index 14b3876c..556b538e 100644 --- a/src/main/java/gyro/azure/keyvault/ListVaultSecretCommand.java +++ b/src/main/java/gyro/azure/keyvault/ListVaultSecretCommand.java @@ -7,13 +7,13 @@ import com.microsoft.azure.management.keyvault.Vault; import gyro.core.GyroCore; import gyro.core.GyroException; -import io.airlift.airline.Arguments; -import io.airlift.airline.Command; +import picocli.CommandLine.Command; +import picocli.CommandLine.Parameters; -@Command(name = "list-secret", description = "List all secrets present in an Azure key vault") +@Command(name = "list-secret", description = "List all secrets present in an Azure key vault.", mixinStandardHelpOptions = true) public class ListVaultSecretCommand extends AbstractVaultCommand { - @Arguments(description = "The command requires one argument. : the key-vault resource name used in the config whose secrets would be listed", required = true) + @Parameters(description = "The command requires one argument. : the key-vault resource name used in the config whose secrets would be listed.", arity = "1") private List arguments; @Override @@ -27,7 +27,7 @@ public void execute() throws Exception { if (!secretItemPagedList.isEmpty()) { secretItemPagedList.loadAll(); - for (SecretItem secret: secretItemPagedList) { + for (SecretItem secret : secretItemPagedList) { StringBuilder sb = new StringBuilder(); sb.append("\n***********************"); sb.append(String.format("\nName: %s", secret.identifier().name())); diff --git a/src/main/java/gyro/azure/keyvault/RemoveVaultCertificateCommand.java b/src/main/java/gyro/azure/keyvault/RemoveVaultCertificateCommand.java index a6bcfbea..b6e5bb20 100644 --- a/src/main/java/gyro/azure/keyvault/RemoveVaultCertificateCommand.java +++ b/src/main/java/gyro/azure/keyvault/RemoveVaultCertificateCommand.java @@ -21,13 +21,13 @@ import com.microsoft.azure.management.keyvault.Vault; import gyro.core.GyroCore; import gyro.core.GyroException; -import io.airlift.airline.Arguments; -import io.airlift.airline.Command; +import picocli.CommandLine.Command; +import picocli.CommandLine.Parameters; -@Command(name = "remove-certificate", description = "Remove a certificate from an Azure key vault") +@Command(name = "remove-certificate", description = "Remove a certificate from an Azure key vault", mixinStandardHelpOptions = true) public class RemoveVaultCertificateCommand extends AbstractVaultCommand { - @Arguments(description = "The command requires two arguments. : the key-vault resource name used in the config from which the certificate would be removed. : name of the certificate to be removed.", required = true) + @Parameters(description = "The command requires two arguments. : the key-vault resource name used in the config from which the certificate would be removed. : name of the certificate to be removed.", arity = "1") private List arguments; @Override diff --git a/src/main/java/gyro/azure/keyvault/RemoveVaultSecretCommand.java b/src/main/java/gyro/azure/keyvault/RemoveVaultSecretCommand.java index 14722ec8..6e038352 100644 --- a/src/main/java/gyro/azure/keyvault/RemoveVaultSecretCommand.java +++ b/src/main/java/gyro/azure/keyvault/RemoveVaultSecretCommand.java @@ -5,13 +5,13 @@ import com.microsoft.azure.management.keyvault.Vault; import gyro.core.GyroCore; import gyro.core.GyroException; -import io.airlift.airline.Arguments; -import io.airlift.airline.Command; +import picocli.CommandLine.Command; +import picocli.CommandLine.Parameters; -@Command(name = "remove-secret", description = "Remove a secret from an Azure key vault") +@Command(name = "remove-secret", description = "Remove a secret from an Azure key vault.", mixinStandardHelpOptions = true) public class RemoveVaultSecretCommand extends AbstractVaultCommand { - @Arguments(description = "The command requires two arguments. : the key-vault resource name used in the config from which the secret would be removed. : name of the secret to be removed.", required = true) + @Parameters(description = "The command requires two arguments. : the key-vault resource name used in the config from which the secret would be removed. : name of the secret to be removed.", arity = "1") private List arguments; @Override diff --git a/src/main/java/gyro/azure/network/AbstractApplicationGatewayCommand.java b/src/main/java/gyro/azure/network/AbstractApplicationGatewayCommand.java index ed4a91d0..ace86dba 100644 --- a/src/main/java/gyro/azure/network/AbstractApplicationGatewayCommand.java +++ b/src/main/java/gyro/azure/network/AbstractApplicationGatewayCommand.java @@ -1,18 +1,12 @@ package gyro.azure.network; -import java.util.ArrayList; -import java.util.List; - import com.microsoft.azure.management.Azure; import com.microsoft.azure.management.network.ApplicationGateway; import gyro.azure.AbstractAzureCommand; -import gyro.azure.AzureCommand; import gyro.core.GyroException; import gyro.core.command.GyroCommand; import gyro.core.resource.Resource; import gyro.core.scope.RootScope; -import io.airlift.airline.Cli; -import io.airlift.airline.Help; public abstract class AbstractApplicationGatewayCommand extends AbstractAzureCommand implements GyroCommand { @@ -33,16 +27,9 @@ ApplicationGateway getApplicationGateway(String applicationGatewayResourceName) return applicationGateway; } else { - throw new GyroException(String.format("No 'application-gateway' resource found with name - %s", applicationGatewayResourceName)); + throw new GyroException(String.format( + "No 'application-gateway' resource found with name - %s", + applicationGatewayResourceName)); } } - - public static void setApplicationGatewayCommand(Cli.CliBuilder builder) { - List> subTypesOf = new ArrayList<>(AzureCommand.getReflections().getSubTypesOf(AbstractApplicationGatewayCommand.class)); - - builder.withGroup("application-gateway") - .withDescription("Manage azure application gateway certificates") - .withDefaultCommand(Help.class) - .withCommands(subTypesOf); - } } diff --git a/src/main/java/gyro/azure/network/AddApplicationGatewayCertificateCommand.java b/src/main/java/gyro/azure/network/AddApplicationGatewayCertificateCommand.java index 9a52ed5a..c9192689 100644 --- a/src/main/java/gyro/azure/network/AddApplicationGatewayCertificateCommand.java +++ b/src/main/java/gyro/azure/network/AddApplicationGatewayCertificateCommand.java @@ -7,17 +7,17 @@ import com.psddev.dari.util.ObjectUtils; import gyro.core.GyroCore; import gyro.core.GyroException; -import io.airlift.airline.Arguments; -import io.airlift.airline.Command; -import io.airlift.airline.Option; +import picocli.CommandLine.Command; +import picocli.CommandLine.Option; +import picocli.CommandLine.Parameters; -@Command(name = "add-certificate", description = "Add a certificate to an Azure application gateway") +@Command(name = "add-certificate", description = "Add a certificate to an Azure application gateway.", mixinStandardHelpOptions = true) public class AddApplicationGatewayCertificateCommand extends AbstractApplicationGatewayCommand { - @Arguments(description = "The command requires two arguments. : the application gateway resource name used in the config to which the certificate would be added. : name of the certificate to be added. : the path to the certificate file (.pfx)", required = true) + @Parameters(description = "The command requires two arguments. : the application gateway resource name used in the config to which the certificate would be added. : name of the certificate to be added. : the path to the certificate file (.pfx)", arity = "3") private List arguments; - @Option(name = { "--password" }, description = "Password used to encrypt the certificate file") + @Option(names = "--password", description = "Password used to encrypt the certificate file.", arity = "0..1", interactive = true) private String password; @Override @@ -37,7 +37,8 @@ public void execute() throws Exception { GyroCore.ui().write("\nCertificate added."); } else { - throw new GyroException("'add-certificate' needs exactly three arguments, "); + throw new GyroException( + "'add-certificate' needs exactly three arguments, "); } } } diff --git a/src/main/java/gyro/azure/network/AzureApplicationGatewayCommand.java b/src/main/java/gyro/azure/network/AzureApplicationGatewayCommand.java new file mode 100644 index 00000000..0642c6b3 --- /dev/null +++ b/src/main/java/gyro/azure/network/AzureApplicationGatewayCommand.java @@ -0,0 +1,13 @@ +package gyro.azure.network; + +import gyro.core.command.GyroCommandGroup; +import picocli.CommandLine; + +@CommandLine.Command(name = "application-gateway", description = "Manage azure application gateway certificate.", mixinStandardHelpOptions = true, subcommands = { + AddApplicationGatewayCertificateCommand.class, + ImportApplicationGatewayCertificateCommand.class, + ListApplicationGatewayCertificateCommand.class, + RemoveApplicationGatewayCertificateCommand.class}) +public class AzureApplicationGatewayCommand implements GyroCommandGroup { + +} diff --git a/src/main/java/gyro/azure/network/ImportApplicationGatewayCertificateCommand.java b/src/main/java/gyro/azure/network/ImportApplicationGatewayCertificateCommand.java index 4bf87219..97d910f6 100644 --- a/src/main/java/gyro/azure/network/ImportApplicationGatewayCertificateCommand.java +++ b/src/main/java/gyro/azure/network/ImportApplicationGatewayCertificateCommand.java @@ -8,13 +8,13 @@ import gyro.azure.keyvault.AbstractVaultCommand; import gyro.core.GyroCore; import gyro.core.GyroException; -import io.airlift.airline.Arguments; -import io.airlift.airline.Command; +import picocli.CommandLine.Command; +import picocli.CommandLine.Parameters; -@Command(name = "import-certificate", description = "Import a certificate from an Azure vault to an application gateway") +@Command(name = "import-certificate", description = "Import a certificate from an Azure vault to an application gateway.", mixinStandardHelpOptions = true) public class ImportApplicationGatewayCertificateCommand extends AbstractApplicationGatewayCommand { - @Arguments(description = "The command requires four arguments. : the application gateway resource name used in the config to which the certificate would be imported to. : name of the certificate to be created on the application gateway. : the key-vault resource name used in the config from which to import the certificate from. : name of the certificate in the vault to be imported.", required = true) + @Parameters(description = "The command requires four arguments. : the application gateway resource name used in the config to which the certificate would be imported to. : name of the certificate to be created on the application gateway. : the key-vault resource name used in the config from which to import the certificate from. : name of the certificate in the vault to be imported.", arity = "1") private List arguments; @Override diff --git a/src/main/java/gyro/azure/network/ListApplicationGatewayCertificateCommand.java b/src/main/java/gyro/azure/network/ListApplicationGatewayCertificateCommand.java index b1ba57d9..50f3bdbe 100644 --- a/src/main/java/gyro/azure/network/ListApplicationGatewayCertificateCommand.java +++ b/src/main/java/gyro/azure/network/ListApplicationGatewayCertificateCommand.java @@ -23,20 +23,20 @@ import com.microsoft.azure.management.network.ApplicationGatewaySslCertificate; import gyro.core.GyroCore; import gyro.core.GyroException; -import io.airlift.airline.Arguments; -import io.airlift.airline.Command; -import io.airlift.airline.Option; +import picocli.CommandLine.Command; +import picocli.CommandLine.Option; +import picocli.CommandLine.Parameters; -@Command(name = "list-certificate", description = "List all certificates present in an Azure application gateway") +@Command(name = "list-certificate", description = "List all certificates present in an Azure application gateway.", mixinStandardHelpOptions = true) public class ListApplicationGatewayCertificateCommand extends AbstractApplicationGatewayCommand { - @Arguments(description = "The command requires one argument. : the application gateway resource name used in the config whose certificates would be listed", required = true) + @Parameters(description = "The command requires one argument. : the application gateway resource name used in the config whose certificates would be listed.", arity = "1") private List arguments; - @Option(name = "--show-data", description = "Show data of the certificate") + @Option(names = "--show-data", description = "Show data of the certificate.") private boolean showData; - @Option(name = "--show-secret-id", description = "Show secret id of the certificate") + @Option(names = "--show-secret-id", description = "Show secret id of the certificate.") private boolean showSecretId; @Override @@ -50,7 +50,7 @@ public void execute() throws Exception { .values()); if (!sslCertificates.isEmpty()) { - for (ApplicationGatewaySslCertificate certificate: sslCertificates) { + for (ApplicationGatewaySslCertificate certificate : sslCertificates) { StringBuilder sb = new StringBuilder(); sb.append("\n***********************"); sb.append(String.format("\nName: %s", certificate.name())); diff --git a/src/main/java/gyro/azure/network/RemoveApplicationGatewayCertificateCommand.java b/src/main/java/gyro/azure/network/RemoveApplicationGatewayCertificateCommand.java index 212e2567..8793514b 100644 --- a/src/main/java/gyro/azure/network/RemoveApplicationGatewayCertificateCommand.java +++ b/src/main/java/gyro/azure/network/RemoveApplicationGatewayCertificateCommand.java @@ -6,13 +6,13 @@ import com.microsoft.azure.management.network.ApplicationGatewayListener; import gyro.core.GyroCore; import gyro.core.GyroException; -import io.airlift.airline.Arguments; -import io.airlift.airline.Command; +import picocli.CommandLine.Command; +import picocli.CommandLine.Parameters; -@Command(name = "remove-certificate", description = "Remove a certificate from an Azure application gateway") +@Command(name = "remove-certificate", description = "Remove a certificate from an Azure application gateway.", mixinStandardHelpOptions = true) public class RemoveApplicationGatewayCertificateCommand extends AbstractApplicationGatewayCommand { - @Arguments(description = "The command requires two arguments. : the application gateway resource name used in the config from which the certificate would be removed. : name of the certificate to be removed.", required = true) + @Parameters(description = "The command requires two arguments. : the application gateway resource name used in the config from which the certificate would be removed. : name of the certificate to be removed.", arity = "1") private List arguments; @Override @@ -34,12 +34,15 @@ public void execute() throws Exception { applicationGateway.update().withoutSslCertificate(certificateName).apply(); GyroCore.ui().write("\nCertificate removed."); } else { - throw new GyroException(String.format("Certificate '%s' cannot be removed as it is being used by listener '%s'.", certificateName, listener.name())); + throw new GyroException(String.format( + "Certificate '%s' cannot be removed as it is being used by listener '%s'.", + certificateName, + listener.name())); } - } else { - throw new GyroException("'remove-certificate' needs exactly two arguments, and "); + throw new GyroException( + "'remove-certificate' needs exactly two arguments, and "); } } } From e6060368e8e59c9ac8c2363a20decc3b02006b20 Mon Sep 17 00:00:00 2001 From: Deepanjan Bhattacharyya Date: Mon, 17 Aug 2020 17:53:10 -0400 Subject: [PATCH 2/7] Clean up old implementation code --- src/main/java/gyro/azure/AzureCommand.java | 46 ------------------- .../azure/keyvault/AbstractVaultCommand.java | 10 +++- .../AbstractApplicationGatewayCommand.java | 10 +++- 3 files changed, 18 insertions(+), 48 deletions(-) diff --git a/src/main/java/gyro/azure/AzureCommand.java b/src/main/java/gyro/azure/AzureCommand.java index b7e437b2..930f156d 100644 --- a/src/main/java/gyro/azure/AzureCommand.java +++ b/src/main/java/gyro/azure/AzureCommand.java @@ -16,64 +16,18 @@ package gyro.azure; -import java.util.List; - -import gyro.azure.keyvault.AbstractVaultCommand; import gyro.azure.keyvault.AzureKeyVaultCommand; -import gyro.azure.network.AbstractApplicationGatewayCommand; import gyro.azure.network.AzureApplicationGatewayCommand; import gyro.core.command.GyroCommand; -import org.reflections.Reflections; -import org.reflections.util.ClasspathHelper; import picocli.CommandLine.Command; -import picocli.CommandLine.Parameters; @Command(name = "azure", description = "CLI command for all things azure.", mixinStandardHelpOptions = true, subcommands = { AzureKeyVaultCommand.class, AzureApplicationGatewayCommand.class }) public class AzureCommand implements GyroCommand { - public static Reflections reflections; - - @Parameters(description = "", arity = "1") - private List arguments; - - public static Reflections getReflections() { - if (reflections == null) { - reflections = new Reflections(new org.reflections.util.ConfigurationBuilder() - .setUrls(ClasspathHelper.forPackage("gyro.azure"))); - } - - return reflections; - } - @Override public void execute() throws Exception { - /*Cli.CliBuilder builder = Cli.builder("azure") - .withDescription("CLI command for all things azure") - .withDefaultCommand(Help.class) - .withCommands(Help.class); - - // Vault command loader - AbstractVaultCommand.setVaultCommand(builder); - - // Application gateway command loader - AbstractApplicationGatewayCommand.setApplicationGatewayCommand(builder); - - Cli gitParser = builder.build(); - - Object command = gitParser.parse(arguments); - if (command instanceof Runnable) { - ((Runnable) command).run(); - } else if (command instanceof GyroCommand) { - ((GyroCommand) command).execute(); - } else { - throw new IllegalStateException(String.format( - "[%s] must be an instance of [%s] or [%s]!", - command.getClass().getName(), - Runnable.class.getName(), - GyroCommand.class.getName())); - }*/ } } diff --git a/src/main/java/gyro/azure/keyvault/AbstractVaultCommand.java b/src/main/java/gyro/azure/keyvault/AbstractVaultCommand.java index 7ba905ae..1ae025e1 100644 --- a/src/main/java/gyro/azure/keyvault/AbstractVaultCommand.java +++ b/src/main/java/gyro/azure/keyvault/AbstractVaultCommand.java @@ -16,6 +16,8 @@ package gyro.azure.keyvault; +import java.util.concurrent.Callable; + import com.microsoft.azure.management.Azure; import com.microsoft.azure.management.keyvault.Vault; import gyro.azure.AbstractAzureCommand; @@ -24,7 +26,7 @@ import gyro.core.resource.Resource; import gyro.core.scope.RootScope; -public abstract class AbstractVaultCommand extends AbstractAzureCommand implements GyroCommand { +public abstract class AbstractVaultCommand extends AbstractAzureCommand implements GyroCommand, Callable { public static Vault getVault(String vaultResourceName, RootScope scope, Azure client) { Resource resource = scope.findResource("azure::key-vault::" + vaultResourceName); @@ -48,4 +50,10 @@ Vault getVault(String vaultResourceName) { Azure client = getClient(); return getVault(vaultResourceName, scope, client); } + + @Override + public Integer call() throws Exception { + execute(); + return 0; + } } diff --git a/src/main/java/gyro/azure/network/AbstractApplicationGatewayCommand.java b/src/main/java/gyro/azure/network/AbstractApplicationGatewayCommand.java index ace86dba..f193776b 100644 --- a/src/main/java/gyro/azure/network/AbstractApplicationGatewayCommand.java +++ b/src/main/java/gyro/azure/network/AbstractApplicationGatewayCommand.java @@ -1,5 +1,7 @@ package gyro.azure.network; +import java.util.concurrent.Callable; + import com.microsoft.azure.management.Azure; import com.microsoft.azure.management.network.ApplicationGateway; import gyro.azure.AbstractAzureCommand; @@ -8,7 +10,7 @@ import gyro.core.resource.Resource; import gyro.core.scope.RootScope; -public abstract class AbstractApplicationGatewayCommand extends AbstractAzureCommand implements GyroCommand { +public abstract class AbstractApplicationGatewayCommand extends AbstractAzureCommand implements GyroCommand, Callable { ApplicationGateway getApplicationGateway(String applicationGatewayResourceName) { RootScope scope = getScope(); @@ -32,4 +34,10 @@ ApplicationGateway getApplicationGateway(String applicationGatewayResourceName) applicationGatewayResourceName)); } } + + @Override + public Integer call() throws Exception { + execute(); + return 0; + } } From 8d59422da228ef7b12ea345c51d9d1e589014e9a Mon Sep 17 00:00:00 2001 From: Deepanjan Bhattacharyya Date: Mon, 24 Aug 2020 17:02:32 -0400 Subject: [PATCH 3/7] Improve help output a bit to make help more legible --- src/main/java/gyro/azure/AzureCommand.java | 20 +++++++++++-- .../keyvault/AddVaultCertificateCommand.java | 7 ++++- .../azure/keyvault/AddVaultSecretCommand.java | 7 ++++- .../azure/keyvault/AzureKeyVaultCommand.java | 28 ++++++++++++++----- .../keyvault/ListVaultCertificateCommand.java | 7 ++++- .../keyvault/ListVaultSecretCommand.java | 7 ++++- .../RemoveVaultCertificateCommand.java | 7 ++++- .../keyvault/RemoveVaultSecretCommand.java | 9 ++++-- ...dApplicationGatewayCertificateCommand.java | 7 ++++- ...tApplicationGatewayCertificateCommand.java | 7 ++++- ...tApplicationGatewayCertificateCommand.java | 7 ++++- ...eApplicationGatewayCertificateCommand.java | 7 ++++- 12 files changed, 99 insertions(+), 21 deletions(-) diff --git a/src/main/java/gyro/azure/AzureCommand.java b/src/main/java/gyro/azure/AzureCommand.java index 930f156d..acf921bc 100644 --- a/src/main/java/gyro/azure/AzureCommand.java +++ b/src/main/java/gyro/azure/AzureCommand.java @@ -19,11 +19,25 @@ import gyro.azure.keyvault.AzureKeyVaultCommand; import gyro.azure.network.AzureApplicationGatewayCommand; import gyro.core.command.GyroCommand; +import gyro.core.command.VersionCommand; import picocli.CommandLine.Command; -@Command(name = "azure", description = "CLI command for all things azure.", mixinStandardHelpOptions = true, subcommands = { - AzureKeyVaultCommand.class, - AzureApplicationGatewayCommand.class }) +@Command(name = "azure", + description = "Manage azure assets.", + synopsisHeading = "%n", + header = "Add, remove, or list assets part of key-vault and application-gateway.", + descriptionHeading = "%nDescription:%n%n", + parameterListHeading = "%nParameters:%n", + optionListHeading = "%nOptions:%n", + commandListHeading = "%nCommands:%n", + usageHelpWidth = 100, + mixinStandardHelpOptions = true, + versionProvider = VersionCommand.class, + subcommands = { + AzureKeyVaultCommand.class, + AzureApplicationGatewayCommand.class + } +) public class AzureCommand implements GyroCommand { @Override diff --git a/src/main/java/gyro/azure/keyvault/AddVaultCertificateCommand.java b/src/main/java/gyro/azure/keyvault/AddVaultCertificateCommand.java index 26275424..990198ee 100644 --- a/src/main/java/gyro/azure/keyvault/AddVaultCertificateCommand.java +++ b/src/main/java/gyro/azure/keyvault/AddVaultCertificateCommand.java @@ -30,7 +30,12 @@ import picocli.CommandLine.Option; import picocli.CommandLine.Parameters; -@Command(name = "add-certificate", description = "Add a certificate to an Azure key vault.", mixinStandardHelpOptions = true) +@Command(name = "add-certificate", + header = "Add a certificate to an Azure key vault.", + synopsisHeading = "%n", + parameterListHeading = "%nParameters:%n", + optionListHeading = "%nOptions:%n", + usageHelpWidth = 100) public class AddVaultCertificateCommand extends AbstractVaultCommand { @Parameters(description = "The command requires three arguments. : the key-vault resource name used in the config to which the certificate would be added. : name of the certificate to be added. : the path to the certificate file (.pfx)", arity = "1") diff --git a/src/main/java/gyro/azure/keyvault/AddVaultSecretCommand.java b/src/main/java/gyro/azure/keyvault/AddVaultSecretCommand.java index 0fac0feb..c553c154 100644 --- a/src/main/java/gyro/azure/keyvault/AddVaultSecretCommand.java +++ b/src/main/java/gyro/azure/keyvault/AddVaultSecretCommand.java @@ -13,7 +13,12 @@ import picocli.CommandLine.Option; import picocli.CommandLine.Parameters; -@Command(name = "add-secret", description = "Add a secret to an Azure key vault.", mixinStandardHelpOptions = true) +@Command(name = "add-secret", + header = "Add a secret to an Azure key vault.", + synopsisHeading = "%n", + parameterListHeading = "%nParameters:%n", + optionListHeading = "%nOptions:%n", + usageHelpWidth = 100) public class AddVaultSecretCommand extends AbstractVaultCommand { @Parameters(description = "The command requires three arguments. : the key-vault resource name used in the config to which the secret would be added. : name of the secret to be added. : the secret value", arity = "1") diff --git a/src/main/java/gyro/azure/keyvault/AzureKeyVaultCommand.java b/src/main/java/gyro/azure/keyvault/AzureKeyVaultCommand.java index 366d6ef5..d7ca7ca4 100644 --- a/src/main/java/gyro/azure/keyvault/AzureKeyVaultCommand.java +++ b/src/main/java/gyro/azure/keyvault/AzureKeyVaultCommand.java @@ -1,15 +1,29 @@ package gyro.azure.keyvault; import gyro.core.command.GyroCommandGroup; +import gyro.core.command.VersionCommand; import picocli.CommandLine; -@CommandLine.Command(name = "key-vault", description = "Manage azure key-vault secrets, keys and certificates.", mixinStandardHelpOptions = true, subcommands = { - AddVaultCertificateCommand.class, - AddVaultSecretCommand.class, - ListVaultCertificateCommand.class, - ListVaultSecretCommand.class, - RemoveVaultCertificateCommand.class, - RemoveVaultSecretCommand.class}) +@CommandLine.Command(name = "key-vault", + description = "Manage azure key-vault secrets, keys and certificates.", + synopsisHeading = "%n", + header = "Add, remove, or list certificates and secrets of key-vault.", + descriptionHeading = "%nDescription:%n%n", + parameterListHeading = "%nParameters:%n", + optionListHeading = "%nOptions:%n", + commandListHeading = "%nCommands:%n", + usageHelpWidth = 100, + mixinStandardHelpOptions = true, + versionProvider = VersionCommand.class, + subcommands = { + AddVaultCertificateCommand.class, + AddVaultSecretCommand.class, + ListVaultCertificateCommand.class, + ListVaultSecretCommand.class, + RemoveVaultCertificateCommand.class, + RemoveVaultSecretCommand.class + } +) public class AzureKeyVaultCommand implements GyroCommandGroup { } diff --git a/src/main/java/gyro/azure/keyvault/ListVaultCertificateCommand.java b/src/main/java/gyro/azure/keyvault/ListVaultCertificateCommand.java index 866fd601..78acee39 100644 --- a/src/main/java/gyro/azure/keyvault/ListVaultCertificateCommand.java +++ b/src/main/java/gyro/azure/keyvault/ListVaultCertificateCommand.java @@ -27,7 +27,12 @@ import picocli.CommandLine.Option; import picocli.CommandLine.Parameters; -@Command(name = "list-certificate", description = "List all certificates present in an Azure key vault.", mixinStandardHelpOptions = true) +@Command(name = "list-certificate", + header = "List all certificates present in an Azure key vault.", + synopsisHeading = "%n", + parameterListHeading = "%nParameters:%n", + optionListHeading = "%nOptions:%n", + usageHelpWidth = 100) public class ListVaultCertificateCommand extends AbstractVaultCommand { @Parameters(description = "The command requires one argument. : the key-vault resource name used in the config whose certificates would be listed.", arity = "1") diff --git a/src/main/java/gyro/azure/keyvault/ListVaultSecretCommand.java b/src/main/java/gyro/azure/keyvault/ListVaultSecretCommand.java index 556b538e..ca9c7747 100644 --- a/src/main/java/gyro/azure/keyvault/ListVaultSecretCommand.java +++ b/src/main/java/gyro/azure/keyvault/ListVaultSecretCommand.java @@ -10,7 +10,12 @@ import picocli.CommandLine.Command; import picocli.CommandLine.Parameters; -@Command(name = "list-secret", description = "List all secrets present in an Azure key vault.", mixinStandardHelpOptions = true) +@Command(name = "list-secret", + header = "List all secrets present in an Azure key vault.", + synopsisHeading = "%n", + parameterListHeading = "%nParameters:%n", + optionListHeading = "%nOptions:%n", + usageHelpWidth = 100) public class ListVaultSecretCommand extends AbstractVaultCommand { @Parameters(description = "The command requires one argument. : the key-vault resource name used in the config whose secrets would be listed.", arity = "1") diff --git a/src/main/java/gyro/azure/keyvault/RemoveVaultCertificateCommand.java b/src/main/java/gyro/azure/keyvault/RemoveVaultCertificateCommand.java index b6e5bb20..70cde37f 100644 --- a/src/main/java/gyro/azure/keyvault/RemoveVaultCertificateCommand.java +++ b/src/main/java/gyro/azure/keyvault/RemoveVaultCertificateCommand.java @@ -24,7 +24,12 @@ import picocli.CommandLine.Command; import picocli.CommandLine.Parameters; -@Command(name = "remove-certificate", description = "Remove a certificate from an Azure key vault", mixinStandardHelpOptions = true) +@Command(name = "remove-certificate", + description = "Remove a certificate from an Azure key vault", + synopsisHeading = "%n", + parameterListHeading = "%nParameters:%n", + optionListHeading = "%nOptions:%n", + usageHelpWidth = 100) public class RemoveVaultCertificateCommand extends AbstractVaultCommand { @Parameters(description = "The command requires two arguments. : the key-vault resource name used in the config from which the certificate would be removed. : name of the certificate to be removed.", arity = "1") diff --git a/src/main/java/gyro/azure/keyvault/RemoveVaultSecretCommand.java b/src/main/java/gyro/azure/keyvault/RemoveVaultSecretCommand.java index 6e038352..50392adb 100644 --- a/src/main/java/gyro/azure/keyvault/RemoveVaultSecretCommand.java +++ b/src/main/java/gyro/azure/keyvault/RemoveVaultSecretCommand.java @@ -8,7 +8,12 @@ import picocli.CommandLine.Command; import picocli.CommandLine.Parameters; -@Command(name = "remove-secret", description = "Remove a secret from an Azure key vault.", mixinStandardHelpOptions = true) +@Command(name = "remove-secret", + header = "Remove a secret from an Azure key vault.", + synopsisHeading = "%n", + parameterListHeading = "%nParameters:%n", + optionListHeading = "%nOptions:%n", + usageHelpWidth = 100) public class RemoveVaultSecretCommand extends AbstractVaultCommand { @Parameters(description = "The command requires two arguments. : the key-vault resource name used in the config from which the secret would be removed. : name of the secret to be removed.", arity = "1") @@ -29,4 +34,4 @@ public void execute() throws Exception { throw new GyroException("'remove-secret' needs exactly two arguments, "); } } -} \ No newline at end of file +} diff --git a/src/main/java/gyro/azure/network/AddApplicationGatewayCertificateCommand.java b/src/main/java/gyro/azure/network/AddApplicationGatewayCertificateCommand.java index c9192689..488933e1 100644 --- a/src/main/java/gyro/azure/network/AddApplicationGatewayCertificateCommand.java +++ b/src/main/java/gyro/azure/network/AddApplicationGatewayCertificateCommand.java @@ -11,7 +11,12 @@ import picocli.CommandLine.Option; import picocli.CommandLine.Parameters; -@Command(name = "add-certificate", description = "Add a certificate to an Azure application gateway.", mixinStandardHelpOptions = true) +@Command(name = "add-certificate", + header = "Add a certificate to an Azure application gateway.", + synopsisHeading = "%n", + parameterListHeading = "%nParameters:%n", + optionListHeading = "%nOptions:%n", + usageHelpWidth = 100) public class AddApplicationGatewayCertificateCommand extends AbstractApplicationGatewayCommand { @Parameters(description = "The command requires two arguments. : the application gateway resource name used in the config to which the certificate would be added. : name of the certificate to be added. : the path to the certificate file (.pfx)", arity = "3") diff --git a/src/main/java/gyro/azure/network/ImportApplicationGatewayCertificateCommand.java b/src/main/java/gyro/azure/network/ImportApplicationGatewayCertificateCommand.java index 97d910f6..e7bc23ea 100644 --- a/src/main/java/gyro/azure/network/ImportApplicationGatewayCertificateCommand.java +++ b/src/main/java/gyro/azure/network/ImportApplicationGatewayCertificateCommand.java @@ -11,7 +11,12 @@ import picocli.CommandLine.Command; import picocli.CommandLine.Parameters; -@Command(name = "import-certificate", description = "Import a certificate from an Azure vault to an application gateway.", mixinStandardHelpOptions = true) +@Command(name = "import-certificate", + header = "Import a certificate from an Azure vault to an application gateway.", + synopsisHeading = "%n", + parameterListHeading = "%nParameters:%n", + optionListHeading = "%nOptions:%n", + usageHelpWidth = 100) public class ImportApplicationGatewayCertificateCommand extends AbstractApplicationGatewayCommand { @Parameters(description = "The command requires four arguments. : the application gateway resource name used in the config to which the certificate would be imported to. : name of the certificate to be created on the application gateway. : the key-vault resource name used in the config from which to import the certificate from. : name of the certificate in the vault to be imported.", arity = "1") diff --git a/src/main/java/gyro/azure/network/ListApplicationGatewayCertificateCommand.java b/src/main/java/gyro/azure/network/ListApplicationGatewayCertificateCommand.java index 50f3bdbe..4d56ecd0 100644 --- a/src/main/java/gyro/azure/network/ListApplicationGatewayCertificateCommand.java +++ b/src/main/java/gyro/azure/network/ListApplicationGatewayCertificateCommand.java @@ -27,7 +27,12 @@ import picocli.CommandLine.Option; import picocli.CommandLine.Parameters; -@Command(name = "list-certificate", description = "List all certificates present in an Azure application gateway.", mixinStandardHelpOptions = true) +@Command(name = "list-certificate", + header = "List all certificates present in an Azure application gateway.", + synopsisHeading = "%n", + parameterListHeading = "%nParameters:%n", + optionListHeading = "%nOptions:%n", + usageHelpWidth = 100) public class ListApplicationGatewayCertificateCommand extends AbstractApplicationGatewayCommand { @Parameters(description = "The command requires one argument. : the application gateway resource name used in the config whose certificates would be listed.", arity = "1") diff --git a/src/main/java/gyro/azure/network/RemoveApplicationGatewayCertificateCommand.java b/src/main/java/gyro/azure/network/RemoveApplicationGatewayCertificateCommand.java index 8793514b..8e88f791 100644 --- a/src/main/java/gyro/azure/network/RemoveApplicationGatewayCertificateCommand.java +++ b/src/main/java/gyro/azure/network/RemoveApplicationGatewayCertificateCommand.java @@ -9,7 +9,12 @@ import picocli.CommandLine.Command; import picocli.CommandLine.Parameters; -@Command(name = "remove-certificate", description = "Remove a certificate from an Azure application gateway.", mixinStandardHelpOptions = true) +@Command(name = "remove-certificate", + header = "Remove a certificate from an Azure application gateway.", + synopsisHeading = "%n", + parameterListHeading = "%nParameters:%n", + optionListHeading = "%nOptions:%n", + usageHelpWidth = 100) public class RemoveApplicationGatewayCertificateCommand extends AbstractApplicationGatewayCommand { @Parameters(description = "The command requires two arguments. : the application gateway resource name used in the config from which the certificate would be removed. : name of the certificate to be removed.", arity = "1") From 614f607a7efc331d3e72633eb2d96e191595a96a Mon Sep 17 00:00:00 2001 From: Deepanjan Bhattacharyya Date: Mon, 24 Aug 2020 17:08:30 -0400 Subject: [PATCH 4/7] Remove mixin help options from azure commands --- src/main/java/gyro/azure/AzureCommand.java | 3 --- .../gyro/azure/keyvault/AzureKeyVaultCommand.java | 3 --- .../network/AzureApplicationGatewayCommand.java | 14 +++++++++----- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main/java/gyro/azure/AzureCommand.java b/src/main/java/gyro/azure/AzureCommand.java index acf921bc..24c09503 100644 --- a/src/main/java/gyro/azure/AzureCommand.java +++ b/src/main/java/gyro/azure/AzureCommand.java @@ -19,7 +19,6 @@ import gyro.azure.keyvault.AzureKeyVaultCommand; import gyro.azure.network.AzureApplicationGatewayCommand; import gyro.core.command.GyroCommand; -import gyro.core.command.VersionCommand; import picocli.CommandLine.Command; @Command(name = "azure", @@ -31,8 +30,6 @@ optionListHeading = "%nOptions:%n", commandListHeading = "%nCommands:%n", usageHelpWidth = 100, - mixinStandardHelpOptions = true, - versionProvider = VersionCommand.class, subcommands = { AzureKeyVaultCommand.class, AzureApplicationGatewayCommand.class diff --git a/src/main/java/gyro/azure/keyvault/AzureKeyVaultCommand.java b/src/main/java/gyro/azure/keyvault/AzureKeyVaultCommand.java index d7ca7ca4..bc2164c0 100644 --- a/src/main/java/gyro/azure/keyvault/AzureKeyVaultCommand.java +++ b/src/main/java/gyro/azure/keyvault/AzureKeyVaultCommand.java @@ -1,7 +1,6 @@ package gyro.azure.keyvault; import gyro.core.command.GyroCommandGroup; -import gyro.core.command.VersionCommand; import picocli.CommandLine; @CommandLine.Command(name = "key-vault", @@ -13,8 +12,6 @@ optionListHeading = "%nOptions:%n", commandListHeading = "%nCommands:%n", usageHelpWidth = 100, - mixinStandardHelpOptions = true, - versionProvider = VersionCommand.class, subcommands = { AddVaultCertificateCommand.class, AddVaultSecretCommand.class, diff --git a/src/main/java/gyro/azure/network/AzureApplicationGatewayCommand.java b/src/main/java/gyro/azure/network/AzureApplicationGatewayCommand.java index 0642c6b3..9d9e054e 100644 --- a/src/main/java/gyro/azure/network/AzureApplicationGatewayCommand.java +++ b/src/main/java/gyro/azure/network/AzureApplicationGatewayCommand.java @@ -3,11 +3,15 @@ import gyro.core.command.GyroCommandGroup; import picocli.CommandLine; -@CommandLine.Command(name = "application-gateway", description = "Manage azure application gateway certificate.", mixinStandardHelpOptions = true, subcommands = { - AddApplicationGatewayCertificateCommand.class, - ImportApplicationGatewayCertificateCommand.class, - ListApplicationGatewayCertificateCommand.class, - RemoveApplicationGatewayCertificateCommand.class}) +@CommandLine.Command(name = "application-gateway", + description = "Manage azure application gateway certificate.", + subcommands = { + AddApplicationGatewayCertificateCommand.class, + ImportApplicationGatewayCertificateCommand.class, + ListApplicationGatewayCertificateCommand.class, + RemoveApplicationGatewayCertificateCommand.class + } +) public class AzureApplicationGatewayCommand implements GyroCommandGroup { } From 4f6e25cc0fcaf26f510b8c4346995f0402c88923 Mon Sep 17 00:00:00 2001 From: Deepanjan Bhattacharyya Date: Tue, 25 Aug 2020 14:30:44 -0400 Subject: [PATCH 5/7] Update readme to reflect 0.99.2 release --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 829e41b9..db36db5d 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Load the Azure provider in your project by consuming it as a `plugin` directive ```shell @repository: 'https://artifactory.psdops.com/gyro-releases' -@plugin: 'gyro:gyro-azure-provider:0.99.0' +@plugin: 'gyro:gyro-azure-provider:0.99.2' ``` #### Authentication #### From d790c1b24e0ec5ff5f8bdffe24b2fbdd4828fedf Mon Sep 17 00:00:00 2001 From: Deepanjan Bhattacharyya Date: Tue, 25 Aug 2020 14:31:31 -0400 Subject: [PATCH 6/7] Update package-info.java --- src/main/java/gyro/azure/package-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gyro/azure/package-info.java b/src/main/java/gyro/azure/package-info.java index 920ad918..32e14e02 100644 --- a/src/main/java/gyro/azure/package-info.java +++ b/src/main/java/gyro/azure/package-info.java @@ -29,7 +29,7 @@ * .. code:: shell * * {@literal @}repository: 'https://artifactory.psdops.com/gyro-releases' - * {@literal @}plugin: 'gyro:gyro-azure-provider:0.99.1' + * {@literal @}plugin: 'gyro:gyro-azure-provider:0.99.2' * * This lets Gyro load the Azure provider plugin and lets you start managing Azure resources using Gyro. * From a0b3089e0c15b6f2ce159830644fa4f7ac6e149e Mon Sep 17 00:00:00 2001 From: Deepanjan Bhattacharyya Date: Tue, 25 Aug 2020 14:35:17 -0400 Subject: [PATCH 7/7] Update CHANGELOG.md --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e2e2603..c265fe46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ -## 0.99.2 (Unreleased) +## 0.99.2 (August 25th, 2020) + +ENHANCEMENTS: + +* [126](https://github.com/perfectsense/gyro-azure-provider/issues/126): Support subscription from auth properties file. +* [128](https://github.com/perfectsense/gyro-azure-provider/issues/128): Support remote file backend +* [130](https://github.com/perfectsense/gyro-azure-provider/issues/130): Add `exists(String file)` and `copy(String source, String dest)` methods to FileBackend. ## 0.99.1 (July 6th, 2020)