use of bio.terra.cli.businessobject.resource.GcpNotebook in project terra-cli by DataBiosphere.
the class NotebookInstance method toInstanceName.
public InstanceName toInstanceName() {
Workspace workspace = Context.requireWorkspace();
if (argGroup.resourceName != null) {
Resource resource = workspace.getResource(argGroup.resourceName);
if (!resource.getResourceType().equals(Resource.Type.AI_NOTEBOOK)) {
throw new UserActionableException("Only able to use notebook commands on notebook resources, but specified resource is " + resource.getResourceType());
}
GcpNotebook gcpNotebook = (GcpNotebook) resource;
return InstanceName.builder().projectId(gcpNotebook.getProjectId()).location(gcpNotebook.getLocation()).instanceId(gcpNotebook.getInstanceId()).build();
} else {
return InstanceName.builder().projectId(workspace.getGoogleProjectId()).location(location).instanceId(argGroup.instanceId).build();
}
}
Aggregations