-
Notifications
You must be signed in to change notification settings - Fork 359
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
Showing
48 changed files
with
765 additions
and
266 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
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
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
2 changes: 1 addition & 1 deletion
2
centaur/src/main/resources/standardTestCases/reference_disk/reference_disk_test.inputs
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"wf_reference_disk_test.check_if_localized_as_symlink.reference_file_input": "gs://gcp-public-data--broad-references/hg19/v0/README" | ||
"wf_reference_disk_test.check_if_localized_as_symlink.reference_file_input": "gs://gcp-public-data--broad-references/hg19/v0/Homo_sapiens_assembly19.tile_db_header.vcf" | ||
} |
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
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
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
77 changes: 77 additions & 0 deletions
77
cromwell-drs-localizer/src/main/scala/drs/localizer/CommandLineParser.scala
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,77 @@ | ||
package drs.localizer | ||
|
||
import common.util.VersionUtil | ||
import drs.localizer.CommandLineParser.AccessTokenStrategy._ | ||
import drs.localizer.CommandLineParser.Usage | ||
|
||
|
||
class CommandLineParser extends scopt.OptionParser[CommandLineArguments](Usage) { | ||
lazy val localizerVersion: String = VersionUtil.getVersion("cromwell-drs-localizer") | ||
|
||
version("version") | ||
|
||
help("help").text("Cromwell DRS Localizer") | ||
|
||
head("cromwell-drs-localizer", localizerVersion) | ||
|
||
arg[String]("drs-object-id").text("DRS object ID").required(). | ||
action((s, c) => | ||
c.copy(drsObject = Option(s))) | ||
arg[String]("container-path").text("Container path").required(). | ||
action((s, c) => | ||
c.copy(containerPath = Option(s))) | ||
arg[String]("requester-pays-project").text("Requester pays project").optional(). | ||
action((s, c) => | ||
c.copy(googleRequesterPaysProject = Option(s))) | ||
opt[String]('t', "access-token-strategy").text(s"Access token strategy, must be one of '$Azure' or '$Google' (default '$Google')"). | ||
action((s, c) => | ||
c.copy(accessTokenStrategy = Option(s.toLowerCase()))) | ||
opt[String]('v', "vault-name").text("Azure vault name"). | ||
action((s, c) => | ||
c.copy(azureVaultName = Option(s))) | ||
opt[String]('s', "secret-name").text("Azure secret name"). | ||
action((s, c) => | ||
c.copy(azureSecretName = Option(s))) | ||
opt[String]('i', "identity-client-id").text("Azure identity client id"). | ||
action((s, c) => | ||
c.copy(azureIdentityClientId = Option(s))) | ||
checkConfig(c => | ||
c.accessTokenStrategy match { | ||
case Some(Azure) if c.googleRequesterPaysProject.isEmpty => Right(()) | ||
case Some(Google) if List(c.azureSecretName, c.azureVaultName, c.azureIdentityClientId).forall(_.isEmpty) => Right(()) | ||
case Some(Azure) => Left(s"Requester pays project is only valid with access token strategy '$Google'") | ||
case Some(Google) => Left(s"One or more specified options are only valid with access token strategy '$Azure'") | ||
case Some(huh) => Left(s"Unrecognized access token strategy '$huh'") | ||
case None => Left("Unspecified access token strategy") | ||
} | ||
) | ||
} | ||
|
||
object CommandLineParser { | ||
/** | ||
* These access token strategies are named simplistically as there is currently only one access token strategy being | ||
* used for each of these cloud vendors. But it is certainly possible that multiple strategies could come into use | ||
* for a particular vendor, in which case the names may need to become more specific for disambiguation. | ||
*/ | ||
object AccessTokenStrategy { | ||
val Azure = "azure" | ||
val Google = "google" | ||
} | ||
|
||
val Usage = | ||
s""" | ||
Usage: | ||
java -jar /path/to/localizer.jar [options] drs://provider/object /local/path/to/file.txt [requester pays project] | ||
|
||
Note that the <requester pays project> optional argument is only valid with access token strategy 'Google'. | ||
""" | ||
|
||
} | ||
|
||
case class CommandLineArguments(accessTokenStrategy: Option[String] = Option(Google), | ||
drsObject: Option[String] = None, | ||
containerPath: Option[String] = None, | ||
googleRequesterPaysProject: Option[String] = None, | ||
azureVaultName: Option[String] = None, | ||
azureSecretName: Option[String] = None, | ||
azureIdentityClientId: Option[String] = None) |
Oops, something went wrong.