-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a93504e
commit 55c8282
Showing
3 changed files
with
73 additions
and
0 deletions.
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
32 changes: 32 additions & 0 deletions
32
src/main/java/io/seqera/tower/cli/commands/credentials/add/AddGiteaCmd.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 (c) 2021, Seqera Labs. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* | ||
* This Source Code Form is "Incompatible With Secondary Licenses", as | ||
* defined by the Mozilla Public License, v. 2.0. | ||
*/ | ||
|
||
package io.seqera.tower.cli.commands.credentials.add; | ||
|
||
import io.seqera.tower.cli.commands.credentials.providers.CredentialsProvider; | ||
import io.seqera.tower.cli.commands.credentials.providers.GiteaProvider; | ||
import picocli.CommandLine.Command; | ||
import picocli.CommandLine.Mixin; | ||
|
||
@Command( | ||
name = "gitea", | ||
description = "Add new Gitea workspace credentials." | ||
) | ||
public class AddGiteaCmd extends AbstractAddCmd { | ||
|
||
@Mixin | ||
GiteaProvider provider; | ||
|
||
@Override | ||
protected CredentialsProvider getProvider() { | ||
return provider; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/io/seqera/tower/cli/commands/credentials/providers/GiteaProvider.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,39 @@ | ||
/* | ||
* Copyright (c) 2021, Seqera Labs. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* | ||
* This Source Code Form is "Incompatible With Secondary Licenses", as | ||
* defined by the Mozilla Public License, v. 2.0. | ||
*/ | ||
|
||
package io.seqera.tower.cli.commands.credentials.providers; | ||
|
||
import io.seqera.tower.model.Credentials.ProviderEnum; | ||
import io.seqera.tower.model.GiteaSecurityKeys; | ||
import picocli.CommandLine.Option; | ||
|
||
import java.io.IOException; | ||
|
||
public class GiteaProvider extends AbstractGitProvider<GiteaSecurityKeys> { | ||
|
||
@Option(names = {"-u", "--username"}, description = "Gitea username.", required = true) | ||
public String userName; | ||
|
||
// NOTE: setting 'arity' + 'interactive' allows both passing value as param and prompting user for input | ||
@Option(names = {"-p", "--password"}, description = "Gitea account password.", arity = "0..1", interactive = true, required = true) | ||
public String password; | ||
|
||
public GiteaProvider() { | ||
super(ProviderEnum.GITEA); | ||
} | ||
|
||
@Override | ||
public GiteaSecurityKeys securityKeys() throws IOException { | ||
return new GiteaSecurityKeys() | ||
.username(userName) | ||
.password(password); | ||
} | ||
} |