Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): Add Halyard Maven Artifact account support (#1210)
- Loading branch information
1 parent
6a17b5b
commit 9906f59
Showing
10 changed files
with
243 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...innaker/halyard/cli/command/v1/config/artifacts/maven/MavenAddArtifactAccountCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
.../spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenArtifactAccountCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...innaker/halyard/cli/command/v1/config/artifacts/maven/MavenArtifactCommandProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`"; | ||
} |
32 changes: 32 additions & 0 deletions
32
...spinnaker/halyard/cli/command/v1/config/artifacts/maven/MavenArtifactProviderCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...nnaker/halyard/cli/command/v1/config/artifacts/maven/MavenEditArtifactAccountCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<MavenArtifactAccount> { | ||
@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"; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...a/com/netflix/spinnaker/halyard/config/model/v1/artifacts/maven/MavenArtifactAccount.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
30 changes: 30 additions & 0 deletions
30
.../com/netflix/spinnaker/halyard/config/model/v1/artifacts/maven/MavenArtifactProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<MavenArtifactAccount> { | ||
@Override | ||
public ProviderType providerType() { | ||
return ProviderType.MAVEN; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters