Search in sources :

Example 1 with CreateResourceParams

use of bio.terra.cli.serialization.userfacing.input.CreateResourceParams in project terra-cli by DataBiosphere.

the class GcsObject method execute.

/**
 * Add a referenced GCS bucket object to the workspace.
 */
@Override
protected void execute() {
    workspaceOption.overrideIfSpecified();
    // build the resource object to add
    CreateResourceParams.Builder createResourceParams = resourceCreationOptions.populateMetadataFields().stewardshipType(StewardshipType.REFERENCED);
    AddGcsObjectParams.Builder createParams = new AddGcsObjectParams.Builder().resourceFields(createResourceParams.build()).bucketName(bucketNameOption.getBucketName()).objectName(objectName);
    bio.terra.cli.businessobject.resource.GcsObject addedResource = bio.terra.cli.businessobject.resource.GcsObject.addReferenced(createParams.build());
    formatOption.printReturnValue(new UFGcsObject(addedResource), GcsObject::printText);
}
Also used : UFGcsObject(bio.terra.cli.serialization.userfacing.resource.UFGcsObject) AddGcsObjectParams(bio.terra.cli.serialization.userfacing.input.AddGcsObjectParams) CreateResourceParams(bio.terra.cli.serialization.userfacing.input.CreateResourceParams) UFGcsObject(bio.terra.cli.serialization.userfacing.resource.UFGcsObject) WorkspaceOverride(bio.terra.cli.command.shared.options.WorkspaceOverride)

Example 2 with CreateResourceParams

use of bio.terra.cli.serialization.userfacing.input.CreateResourceParams in project terra-cli by DataBiosphere.

the class GitRepo method execute.

/**
 * Add a referenced git repo to the workspace.
 */
@Override
protected void execute() {
    workspaceOption.overrideIfSpecified();
    // build the resource object to add
    CreateResourceParams.Builder createResourceParams = resourceCreationOptions.populateMetadataFields().stewardshipType(StewardshipType.REFERENCED);
    AddGitRepoParams.Builder createParams = new AddGitRepoParams.Builder().resourceFields(createResourceParams.build()).gitRepoUrl(repoUrl);
    bio.terra.cli.businessobject.resource.GitRepo addedResource = bio.terra.cli.businessobject.resource.GitRepo.addReferenced(createParams.build());
    formatOption.printReturnValue(new UFGitRepo(addedResource), GitRepo::printText);
}
Also used : UFGitRepo(bio.terra.cli.serialization.userfacing.resource.UFGitRepo) CreateResourceParams(bio.terra.cli.serialization.userfacing.input.CreateResourceParams) UFGitRepo(bio.terra.cli.serialization.userfacing.resource.UFGitRepo) AddGitRepoParams(bio.terra.cli.serialization.userfacing.input.AddGitRepoParams) WorkspaceOverride(bio.terra.cli.command.shared.options.WorkspaceOverride)

Example 3 with CreateResourceParams

use of bio.terra.cli.serialization.userfacing.input.CreateResourceParams in project terra-cli by DataBiosphere.

the class BqDataset method execute.

/**
 * Add a referenced BigQuery dataset to the workspace.
 */
@Override
protected void execute() {
    workspaceOption.overrideIfSpecified();
    // build the resource object to add
    CreateResourceParams.Builder createResourceParams = resourceCreationOptions.populateMetadataFields().stewardshipType(StewardshipType.REFERENCED);
    CreateBqDatasetParams.Builder createParams = new CreateBqDatasetParams.Builder().resourceFields(createResourceParams.build()).projectId(bigQueryIds.getGcpProjectId()).datasetId(bigQueryIds.getBigQueryDatasetId());
    bio.terra.cli.businessobject.resource.BqDataset createdResource = bio.terra.cli.businessobject.resource.BqDataset.addReferenced(createParams.build());
    formatOption.printReturnValue(new UFBqDataset(createdResource), BqDataset::printText);
}
Also used : UFBqDataset(bio.terra.cli.serialization.userfacing.resource.UFBqDataset) CreateResourceParams(bio.terra.cli.serialization.userfacing.input.CreateResourceParams) CreateBqDatasetParams(bio.terra.cli.serialization.userfacing.input.CreateBqDatasetParams) UFBqDataset(bio.terra.cli.serialization.userfacing.resource.UFBqDataset) WorkspaceOverride(bio.terra.cli.command.shared.options.WorkspaceOverride)

Example 4 with CreateResourceParams

use of bio.terra.cli.serialization.userfacing.input.CreateResourceParams in project terra-cli by DataBiosphere.

the class GcsBucket method execute.

/**
 * Add a referenced GCS bucket to the workspace.
 */
@Override
protected void execute() {
    workspaceOption.overrideIfSpecified();
    // build the resource object to add
    CreateResourceParams.Builder createResourceParams = resourceCreationOptions.populateMetadataFields().stewardshipType(StewardshipType.REFERENCED);
    CreateGcsBucketParams.Builder createParams = new CreateGcsBucketParams.Builder().resourceFields(createResourceParams.build()).bucketName(bucketNameOption.getBucketName());
    bio.terra.cli.businessobject.resource.GcsBucket addedResource = bio.terra.cli.businessobject.resource.GcsBucket.addReferenced(createParams.build());
    formatOption.printReturnValue(new UFGcsBucket(addedResource), GcsBucket::printText);
}
Also used : CreateResourceParams(bio.terra.cli.serialization.userfacing.input.CreateResourceParams) UFGcsBucket(bio.terra.cli.serialization.userfacing.resource.UFGcsBucket) CreateGcsBucketParams(bio.terra.cli.serialization.userfacing.input.CreateGcsBucketParams) UFGcsBucket(bio.terra.cli.serialization.userfacing.resource.UFGcsBucket) WorkspaceOverride(bio.terra.cli.command.shared.options.WorkspaceOverride)

Example 5 with CreateResourceParams

use of bio.terra.cli.serialization.userfacing.input.CreateResourceParams in project terra-cli by DataBiosphere.

the class BqDataset method execute.

/**
 * Add a controlled BigQuery dataset to the workspace.
 */
@Override
protected void execute() {
    workspaceOption.overrideIfSpecified();
    // build the resource object to create
    CreateResourceParams.Builder createResourceParams = controlledResourceCreationOptions.populateMetadataFields().stewardshipType(StewardshipType.CONTROLLED);
    CreateBqDatasetParams.Builder createParams = new CreateBqDatasetParams.Builder().resourceFields(createResourceParams.build()).datasetId(bigQueryDatasetId).location(location).defaultPartitionLifetimeSeconds(bqDatasetLifetimeOptions.getDefaultPartitionLifetimeSeconds()).defaultTableLifetimeSeconds(bqDatasetLifetimeOptions.getDefaultTableLifetimeSeconds());
    bio.terra.cli.businessobject.resource.BqDataset createdResource = bio.terra.cli.businessobject.resource.BqDataset.createControlled(createParams.build());
    formatOption.printReturnValue(new UFBqDataset(createdResource), BqDataset::printText);
}
Also used : UFBqDataset(bio.terra.cli.serialization.userfacing.resource.UFBqDataset) CreateResourceParams(bio.terra.cli.serialization.userfacing.input.CreateResourceParams) CreateBqDatasetParams(bio.terra.cli.serialization.userfacing.input.CreateBqDatasetParams) UFBqDataset(bio.terra.cli.serialization.userfacing.resource.UFBqDataset) WorkspaceOverride(bio.terra.cli.command.shared.options.WorkspaceOverride)

Aggregations

WorkspaceOverride (bio.terra.cli.command.shared.options.WorkspaceOverride)7 CreateResourceParams (bio.terra.cli.serialization.userfacing.input.CreateResourceParams)7 CreateBqDatasetParams (bio.terra.cli.serialization.userfacing.input.CreateBqDatasetParams)2 CreateGcsBucketParams (bio.terra.cli.serialization.userfacing.input.CreateGcsBucketParams)2 UFBqDataset (bio.terra.cli.serialization.userfacing.resource.UFBqDataset)2 UFGcsBucket (bio.terra.cli.serialization.userfacing.resource.UFGcsBucket)2 AddGcsObjectParams (bio.terra.cli.serialization.userfacing.input.AddGcsObjectParams)1 AddGitRepoParams (bio.terra.cli.serialization.userfacing.input.AddGitRepoParams)1 CreateGcpNotebookParams (bio.terra.cli.serialization.userfacing.input.CreateGcpNotebookParams)1 UFGcpNotebook (bio.terra.cli.serialization.userfacing.resource.UFGcpNotebook)1 UFGcsObject (bio.terra.cli.serialization.userfacing.resource.UFGcsObject)1 UFGitRepo (bio.terra.cli.serialization.userfacing.resource.UFGitRepo)1