Skip to content

Commit

Permalink
rename class from new tower-java-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeSeqLabs committed Oct 13, 2023
1 parent 09136c9 commit 2149949
Show file tree
Hide file tree
Showing 28 changed files with 75 additions and 75 deletions.
2 changes: 1 addition & 1 deletion conf/reflect-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2796,7 +2796,7 @@
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"setLabel","parameterTypes":["java.lang.String"] }, {"name":"setUrl","parameterTypes":["java.lang.String"] }]
},
{
"name":"io.seqera.tower.model.OrgAndWorkspaceDbDto",
"name":"io.seqera.tower.model.OrgAndWorkspaceDto",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true,
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/io/seqera/tower/cli/commands/AbstractApiCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import io.seqera.tower.model.ComputeEnvResponseDto;
import io.seqera.tower.model.ListComputeEnvsResponseEntry;
import io.seqera.tower.model.ListWorkspacesAndOrgResponse;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import io.seqera.tower.model.PipelineDbDto;
import io.seqera.tower.model.PipelineQueryAttribute;
import io.seqera.tower.model.UserDbDto;
Expand Down Expand Up @@ -224,7 +224,7 @@ protected Long workspaceId(String workspaceRef) throws ApiException {
if (wspRefs.length != 2) {
throw new InvalidWorkspaceParameterException(workspaceRef);
}
OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = this.findOrgAndWorkspaceByName(wspRefs[0].strip(), wspRefs[1].strip());
OrgAndWorkspaceDto orgAndWorkspaceDbDto = this.findOrgAndWorkspaceByName(wspRefs[0].strip(), wspRefs[1].strip());
if (orgAndWorkspaceDbDto != null) {
workspaceName = orgAndWorkspaceDbDto.getWorkspaceName();
workspaceId = orgAndWorkspaceDbDto.getWorkspaceId();
Expand Down Expand Up @@ -282,7 +282,7 @@ protected String token() {
return app().token;
}

protected OrgAndWorkspaceDbDto findOrgAndWorkspaceByName(String organizationName, String workspaceName) throws ApiException {
protected OrgAndWorkspaceDto findOrgAndWorkspaceByName(String organizationName, String workspaceName) throws ApiException {
ListWorkspacesAndOrgResponse workspacesAndOrgResponse = api().listWorkspacesUser(userId());

if (workspacesAndOrgResponse == null || workspacesAndOrgResponse.getOrgsAndWorkspaces() == null) {
Expand All @@ -293,7 +293,7 @@ protected OrgAndWorkspaceDbDto findOrgAndWorkspaceByName(String organizationName
throw new WorkspaceNotFoundException(workspaceName, organizationName);
}

List<OrgAndWorkspaceDbDto> orgAndWorkspaceDbDtoList = workspacesAndOrgResponse
List<OrgAndWorkspaceDto> orgAndWorkspaceDbDtoList = workspacesAndOrgResponse
.getOrgsAndWorkspaces()
.stream()
.filter(
Expand All @@ -312,14 +312,14 @@ protected OrgAndWorkspaceDbDto findOrgAndWorkspaceByName(String organizationName
return orgAndWorkspaceDbDtoList.stream().findFirst().orElse(null);
}

protected OrgAndWorkspaceDbDto findOrganizationByRef(String organizationRef) throws ApiException {
protected OrgAndWorkspaceDto findOrganizationByRef(String organizationRef) throws ApiException {
ListWorkspacesAndOrgResponse workspacesAndOrgResponse = api().listWorkspacesUser(userId());

if (workspacesAndOrgResponse.getOrgsAndWorkspaces() == null) {
throw new OrganizationNotFoundException(organizationRef);
}

List<OrgAndWorkspaceDbDto> orgAndWorkspaceDbDtoList = workspacesAndOrgResponse
List<OrgAndWorkspaceDto> orgAndWorkspaceDbDtoList = workspacesAndOrgResponse
.getOrgsAndWorkspaces()
.stream()
.filter(
Expand All @@ -337,7 +337,7 @@ private void loadUser() throws ApiException {
}

private void loadOrgAndWorkspaceFromIds(Long workspaceId) throws ApiException {
for (OrgAndWorkspaceDbDto ow : api().listWorkspacesUser(userId()).getOrgsAndWorkspaces()) {
for (OrgAndWorkspaceDto ow : api().listWorkspacesUser(userId()).getOrgsAndWorkspaces()) {
if ((workspaceId == null && ow.getWorkspaceId() == null) || (workspaceId != null && workspaceId.equals(ow.getWorkspaceId()))) {
workspaceName = ow.getWorkspaceName();
orgId = ow.getOrgId();
Expand All @@ -352,7 +352,7 @@ private void loadOrgAndWorkspaceFromIds(Long workspaceId) throws ApiException {
private void loadOrgAndWorkspaceFromNames(Long workspaceId) throws ApiException {
String wName = workspaceName(workspaceId);
String oName = orgName(workspaceId);
for (OrgAndWorkspaceDbDto ow : api().listWorkspacesUser(userId()).getOrgsAndWorkspaces()) {
for (OrgAndWorkspaceDto ow : api().listWorkspacesUser(userId()).getOrgsAndWorkspaces()) {
if (wName.equalsIgnoreCase(ow.getWorkspaceName()) && oName.equalsIgnoreCase(ow.getOrgName())) {
workspaceName = ow.getWorkspaceName();
orgName = ow.getOrgName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io.seqera.tower.cli.responses.collaborators.CollaboratorsList;
import io.seqera.tower.cli.utils.PaginationInfo;
import io.seqera.tower.model.ListMembersResponse;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import picocli.CommandLine;

import java.io.IOException;
Expand All @@ -42,7 +42,7 @@ protected Response exec() throws ApiException, IOException {
Integer max = PaginationOptions.getMax(paginationOptions);
Integer offset = PaginationOptions.getOffset(paginationOptions, max);

OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);

ListMembersResponse response = api().listOrganizationCollaborators(orgAndWorkspaceDbDto.getOrgId(), max, offset, startsWith);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.seqera.tower.cli.responses.members.MembersAdded;
import io.seqera.tower.model.AddMemberRequest;
import io.seqera.tower.model.AddMemberResponse;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import picocli.CommandLine;

import java.io.IOException;
Expand All @@ -35,7 +35,7 @@ public class AddCmd extends AbstractMembersClass {

@Override
protected Response exec() throws ApiException, IOException {
OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);

AddMemberRequest request = new AddMemberRequest();
request.setUser(user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.members.MembersDeleted;
import io.seqera.tower.model.MemberDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import picocli.CommandLine;

import java.io.IOException;
Expand All @@ -34,7 +34,7 @@ public class DeleteCmd extends AbstractMembersClass{

@Override
protected Response exec() throws ApiException, IOException {
OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);

MemberDbDto member = findMemberByUser(orgAndWorkspaceDbDto.getOrgId(), user);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import io.seqera.tower.ApiException;
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.members.MembersLeave;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import picocli.CommandLine;

import java.io.IOException;
Expand All @@ -30,7 +30,7 @@ public class LeaveCmd extends AbstractMembersClass {

@Override
protected Response exec() throws ApiException, IOException {
OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);

api().leaveOrganization(orgAndWorkspaceDbDto.getOrgId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.members.MembersList;
import io.seqera.tower.model.ListMembersResponse;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import picocli.CommandLine;

import java.io.IOException;
Expand All @@ -41,7 +41,7 @@ protected Response exec() throws ApiException, IOException {
Integer max = PaginationOptions.getMax(paginationOptions);
Integer offset = PaginationOptions.getOffset(paginationOptions, max);

OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);

ListMembersResponse response = api().listOrganizationMembers(orgAndWorkspaceDbDto.getOrgId(), max, offset, startsWith);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.members.MembersUpdate;
import io.seqera.tower.model.MemberDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import io.seqera.tower.model.OrgRole;
import io.seqera.tower.model.UpdateMemberRoleRequest;
import picocli.CommandLine;
Expand All @@ -39,7 +39,7 @@ public class UpdateCmd extends AbstractMembersClass {

@Override
protected Response exec() throws ApiException, IOException {
OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);

MemberDbDto member = findMemberByUser(orgAndWorkspaceDbDto.getOrgId(), user);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.seqera.tower.cli.exceptions.OrganizationNotFoundException;
import io.seqera.tower.model.DescribeOrganizationResponse;
import io.seqera.tower.model.ListWorkspacesAndOrgResponse;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import picocli.CommandLine;

import java.util.List;
Expand All @@ -29,14 +29,14 @@ public class AbstractOrganizationsCmd extends AbstractApiCmd {
public AbstractOrganizationsCmd() {
}

protected OrgAndWorkspaceDbDto organizationByName(String organizationName) throws ApiException {
protected OrgAndWorkspaceDto organizationByName(String organizationName) throws ApiException {
ListWorkspacesAndOrgResponse workspacesAndOrgResponse = api().listWorkspacesUser(userId());

if (workspacesAndOrgResponse.getOrgsAndWorkspaces() == null) {
throw new OrganizationNotFoundException(organizationName);
}

List<OrgAndWorkspaceDbDto> orgAndWorkspaceDbDtoList = workspacesAndOrgResponse
List<OrgAndWorkspaceDto> orgAndWorkspaceDbDtoList = workspacesAndOrgResponse
.getOrgsAndWorkspaces()
.stream()
.filter(
Expand All @@ -57,7 +57,7 @@ protected DescribeOrganizationResponse fetchOrganization(OrganizationRefOptions
if(organizationRefOptions.organization.organizationId != null){
response = api().describeOrganization(organizationRefOptions.organization.organizationId);
} else {
OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = organizationByName(organizationRefOptions.organization.organizationName);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = organizationByName(organizationRefOptions.organization.organizationName);
response = api().describeOrganization(orgAndWorkspaceDbDto.getOrgId());
}

Expand All @@ -69,7 +69,7 @@ protected void deleteOrgById(Long orgId) throws OrganizationNotFoundException, A
}

protected void deleteOrgByName(String orgName) throws OrganizationNotFoundException, ApiException {
OrgAndWorkspaceDbDto org = organizationByName(orgName);
OrgAndWorkspaceDto org = organizationByName(orgName);
deleteOrgById(org.getOrgId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.seqera.tower.cli.exceptions.TowerException;
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.organizations.OrganizationsDeleted;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import picocli.CommandLine;

import java.io.IOException;
Expand All @@ -38,7 +38,7 @@ protected Response exec() throws ApiException, IOException {
id = organizationRefOptions.organization.organizationId;
ref = id.toString();
} else {
OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = organizationByName(organizationRefOptions.organization.organizationName);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = organizationByName(organizationRefOptions.organization.organizationName);
id = orgAndWorkspaceDbDto.getOrgId();
ref = orgAndWorkspaceDbDto.getOrgName();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.organizations.OrganizationsList;
import io.seqera.tower.model.ListWorkspacesAndOrgResponse;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import picocli.CommandLine;

import java.io.IOException;
Expand All @@ -35,7 +35,7 @@ protected Response exec() throws ApiException, IOException {


if (response.getOrgsAndWorkspaces() != null) {
List<OrgAndWorkspaceDbDto> responseOrg = response.getOrgsAndWorkspaces()
List<OrgAndWorkspaceDto> responseOrg = response.getOrgsAndWorkspaces()
.stream()
.filter(item -> Objects.equals(item.getWorkspaceId(), null))
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import io.seqera.tower.model.ListMembersResponse;
import io.seqera.tower.model.ListTeamResponse;
import io.seqera.tower.model.MemberDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import io.seqera.tower.model.TeamDbDto;
import picocli.CommandLine.Command;

Expand Down Expand Up @@ -62,7 +62,7 @@ public TeamDbDto findTeamByName(Long orgId, String teamName) throws ApiException
}

public void deleteTeamById(Long teamId, String orgRef) throws OrganizationNotFoundException, ApiException {
OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = findOrganizationByRef(orgRef);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = findOrganizationByRef(orgRef);
deleteTeamById(teamId, orgAndWorkspaceDbDto.getOrgId());
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/seqera/tower/cli/commands/teams/AddCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.teams.TeamAdded;
import io.seqera.tower.model.CreateTeamRequest;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import io.seqera.tower.model.Team;
import io.seqera.tower.model.TeamDbDto;
import picocli.CommandLine;
Expand All @@ -43,7 +43,7 @@ public class AddCmd extends AbstractTeamsCmd {

@Override
protected Response exec() throws ApiException, IOException {
OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);

Team team = new Team();
team.setName(teamName);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/seqera/tower/cli/commands/teams/ListCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io.seqera.tower.cli.responses.teams.TeamsList;
import io.seqera.tower.cli.utils.PaginationInfo;
import io.seqera.tower.model.ListTeamResponse;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import picocli.CommandLine;

import java.io.IOException;
Expand All @@ -39,7 +39,7 @@ protected Response exec() throws ApiException, IOException {
Integer max = PaginationOptions.getMax(paginationOptions);
Integer offset = PaginationOptions.getOffset(paginationOptions, max);

OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);

ListTeamResponse teamResponse = api().listOrganizationTeams(orgAndWorkspaceDbDto.getOrgId(), max, offset, null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.teams.members.TeamMembersList;
import io.seqera.tower.model.ListMembersResponse;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import io.seqera.tower.model.TeamDbDto;
import picocli.CommandLine;

Expand All @@ -42,7 +42,7 @@ public class MembersCmd extends AbstractTeamsCmd {

@Override
protected Response exec() throws ApiException, IOException {
OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = findOrganizationByRef(organizationRef);

TeamDbDto team = findTeamByName(orgAndWorkspaceDbDto.getOrgId(), teamName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import io.seqera.tower.cli.responses.teams.members.TeamMembersAdd;
import io.seqera.tower.model.AddTeamMemberResponse;
import io.seqera.tower.model.CreateTeamMemberRequest;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import io.seqera.tower.model.TeamDbDto;
import picocli.CommandLine;

Expand All @@ -38,7 +38,7 @@ public class AddCmd extends AbstractApiCmd {

@Override
protected Response exec() throws ApiException, IOException {
OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = findOrganizationByRef(parent.organizationRef);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = findOrganizationByRef(parent.organizationRef);

TeamDbDto team = parent.findTeamByName(orgAndWorkspaceDbDto.getOrgId(), parent.teamName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.teams.members.TeamMemberDeleted;
import io.seqera.tower.model.MemberDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import io.seqera.tower.model.OrgAndWorkspaceDto;
import io.seqera.tower.model.TeamDbDto;
import picocli.CommandLine;

Expand All @@ -37,7 +37,7 @@ public class DeleteCmd extends AbstractApiCmd {

@Override
protected Response exec() throws ApiException, IOException {
OrgAndWorkspaceDbDto orgAndWorkspaceDbDto = findOrganizationByRef(parent.organizationRef);
OrgAndWorkspaceDto orgAndWorkspaceDbDto = findOrganizationByRef(parent.organizationRef);

TeamDbDto team = parent.findTeamByName(orgAndWorkspaceDbDto.getOrgId(), parent.teamName);

Expand Down
Loading

0 comments on commit 2149949

Please sign in to comment.