diff --git a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/ArtifactProviderCommand.java b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/ArtifactProviderCommand.java index ac8a7a19c0..44830119ba 100644 --- a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/ArtifactProviderCommand.java +++ b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/ArtifactProviderCommand.java @@ -26,6 +26,7 @@ import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.gitlab.GitlabArtifactProviderCommand; import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.helm.HelmArtifactProviderCommand; import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.http.HttpArtifactProviderCommand; +import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.maven.MavenArtifactProviderCommand; import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.oracle.OracleArtifactProviderCommand; import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.s3.S3ArtifactProviderCommand; import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.templates.ArtifactTemplateCommand; @@ -54,6 +55,7 @@ public ArtifactProviderCommand() { registerSubcommand(new HttpArtifactProviderCommand()); registerSubcommand(new HelmArtifactProviderCommand()); registerSubcommand(new S3ArtifactProviderCommand()); + registerSubcommand(new MavenArtifactProviderCommand()); registerSubcommand((new ArtifactTemplateCommand())); } diff --git a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenAddArtifactAccountCommand.java b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenAddArtifactAccountCommand.java new file mode 100644 index 0000000000..74e1b8c584 --- /dev/null +++ b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenAddArtifactAccountCommand.java @@ -0,0 +1,48 @@ +/* + * Copyright 2019 Pivotal, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License") + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.maven; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; +import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.account.AbstractAddArtifactAccountCommand; +import com.netflix.spinnaker.halyard.config.model.v1.artifacts.maven.MavenArtifactAccount; +import com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount; + +@Parameters(separators = "=") +public class MavenAddArtifactAccountCommand extends AbstractAddArtifactAccountCommand { + @Parameter( + names = "--repository-url", + required = true, + description = MavenArtifactCommandProperties.REPOSITORY_URL_DESCRIPTION + ) + private String repositoryUrl; + + @Override + protected ArtifactAccount buildArtifactAccount(String accountName) { + return new MavenArtifactAccount().setName(accountName).setRepositoryUrl(repositoryUrl); + } + + @Override + protected ArtifactAccount emptyArtifactAccount() { + return new MavenArtifactAccount(); + } + + @Override + protected String getArtifactProviderName() { + return "maven"; + } +} diff --git a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenArtifactAccountCommand.java b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenArtifactAccountCommand.java new file mode 100644 index 0000000000..66f004135b --- /dev/null +++ b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenArtifactAccountCommand.java @@ -0,0 +1,33 @@ +/* + * Copyright 2019 Pivotal, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License") + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.maven; + +import com.beust.jcommander.Parameters; +import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.AbstractArtifactAccountCommand; + +@Parameters(separators = "=") +public class MavenArtifactAccountCommand extends AbstractArtifactAccountCommand { + @Override + protected String getArtifactProviderName() { + return "maven"; + } + + public MavenArtifactAccountCommand() { + registerSubcommand(new MavenAddArtifactAccountCommand()); + registerSubcommand(new MavenEditArtifactAccountCommand()); + } +} diff --git a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenArtifactCommandProperties.java b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenArtifactCommandProperties.java new file mode 100644 index 0000000000..676d6334eb --- /dev/null +++ b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenArtifactCommandProperties.java @@ -0,0 +1,22 @@ +/* + * Copyright 2019 Pivotal, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License") + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.maven; + +public class MavenArtifactCommandProperties { + public static final String REPOSITORY_URL_DESCRIPTION = "Full URI for the " + + "Maven repository ie. `http://some.host.com/repository/path`"; +} diff --git a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenArtifactProviderCommand.java b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenArtifactProviderCommand.java new file mode 100644 index 0000000000..e7af4ca8de --- /dev/null +++ b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenArtifactProviderCommand.java @@ -0,0 +1,32 @@ +/* + * Copyright 2019 Pivotal, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License") + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.maven; + +import com.beust.jcommander.Parameters; +import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.AbstractNamedArtifactProviderCommand; + +@Parameters(separators = "=") +public class MavenArtifactProviderCommand extends AbstractNamedArtifactProviderCommand { + @Override + protected String getArtifactProviderName() { + return "maven"; + } + + public MavenArtifactProviderCommand() { + registerSubcommand(new MavenArtifactAccountCommand()); + } +} diff --git a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenEditArtifactAccountCommand.java b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenEditArtifactAccountCommand.java new file mode 100644 index 0000000000..86b9261625 --- /dev/null +++ b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenEditArtifactAccountCommand.java @@ -0,0 +1,44 @@ +/* + * Copyright 2019 Pivotal, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License") + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.maven; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; +import com.netflix.spinnaker.halyard.cli.command.v1.config.artifacts.account.AbstractArtifactEditAccountCommand; +import com.netflix.spinnaker.halyard.config.model.v1.artifacts.maven.MavenArtifactAccount; +import com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount; + +@Parameters(separators = "=") +public class MavenEditArtifactAccountCommand extends AbstractArtifactEditAccountCommand { + @Parameter( + names = "--repository-url", + description = MavenArtifactCommandProperties.REPOSITORY_URL_DESCRIPTION + ) + private String repositoryUrl; + + @Override + protected ArtifactAccount editArtifactAccount(MavenArtifactAccount account) { + account.setRepositoryUrl(isSet(repositoryUrl) ? repositoryUrl : account.getRepositoryUrl()); + + return account; + } + + @Override + protected String getArtifactProviderName() { + return "maven"; + } +} diff --git a/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/artifacts/maven/MavenArtifactAccount.java b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/artifacts/maven/MavenArtifactAccount.java new file mode 100644 index 0000000000..75dbd94cf9 --- /dev/null +++ b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/artifacts/maven/MavenArtifactAccount.java @@ -0,0 +1,28 @@ +/* + * Copyright 2019 Pivotal, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License") + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.netflix.spinnaker.halyard.config.model.v1.artifacts.maven; + +import com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactAccount; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class MavenArtifactAccount extends ArtifactAccount { + String name; + String repositoryUrl; +} diff --git a/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/artifacts/maven/MavenArtifactProvider.java b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/artifacts/maven/MavenArtifactProvider.java new file mode 100644 index 0000000000..f93cada179 --- /dev/null +++ b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/artifacts/maven/MavenArtifactProvider.java @@ -0,0 +1,30 @@ +/* + * Copyright 2019 Pivotal, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License") + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.netflix.spinnaker.halyard.config.model.v1.artifacts.maven; + +import com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactProvider; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class MavenArtifactProvider extends ArtifactProvider { + @Override + public ProviderType providerType() { + return ProviderType.MAVEN; + } +} diff --git a/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/node/ArtifactProvider.java b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/node/ArtifactProvider.java index 311664af22..6df6996226 100644 --- a/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/node/ArtifactProvider.java +++ b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/node/ArtifactProvider.java @@ -56,7 +56,8 @@ public enum ProviderType { GITLAB("gitlab"), HELM("helm"), HTTP("http"), - S3("s3"); + S3("s3"), + MAVEN("maven"); @Getter final private String name; diff --git a/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/node/Artifacts.java b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/node/Artifacts.java index 472a6e8d7f..7178e5071b 100644 --- a/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/node/Artifacts.java +++ b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/node/Artifacts.java @@ -25,6 +25,7 @@ import com.netflix.spinnaker.halyard.config.model.v1.artifacts.gitlab.GitlabArtifactProvider; import com.netflix.spinnaker.halyard.config.model.v1.artifacts.helm.HelmArtifactProvider; import com.netflix.spinnaker.halyard.config.model.v1.artifacts.http.HttpArtifactProvider; +import com.netflix.spinnaker.halyard.config.model.v1.artifacts.maven.MavenArtifactProvider; import com.netflix.spinnaker.halyard.config.model.v1.artifacts.oracle.OracleArtifactProvider; import com.netflix.spinnaker.halyard.config.model.v1.artifacts.s3.S3ArtifactProvider; import lombok.Data; @@ -48,6 +49,7 @@ public class Artifacts extends Node { HttpArtifactProvider http = new HttpArtifactProvider(); HelmArtifactProvider helm = new HelmArtifactProvider(); S3ArtifactProvider s3 = new S3ArtifactProvider(); + MavenArtifactProvider maven = new MavenArtifactProvider(); List templates = new ArrayList<>(); @Override