From 2149949b9ff90969588f6093661764529a6c15ed Mon Sep 17 00:00:00 2001 From: JaimeSeqLabs Date: Fri, 13 Oct 2023 16:42:06 +0200 Subject: [PATCH] rename class from new tower-java-sdk --- conf/reflect-config.json | 2 +- .../tower/cli/commands/AbstractApiCmd.java | 16 ++++++++-------- .../cli/commands/collaborators/ListCmd.java | 4 ++-- .../tower/cli/commands/members/AddCmd.java | 4 ++-- .../tower/cli/commands/members/DeleteCmd.java | 4 ++-- .../tower/cli/commands/members/LeaveCmd.java | 4 ++-- .../tower/cli/commands/members/ListCmd.java | 4 ++-- .../tower/cli/commands/members/UpdateCmd.java | 4 ++-- .../organizations/AbstractOrganizationsCmd.java | 10 +++++----- .../cli/commands/organizations/DeleteCmd.java | 4 ++-- .../cli/commands/organizations/ListCmd.java | 4 ++-- .../cli/commands/teams/AbstractTeamsCmd.java | 4 ++-- .../seqera/tower/cli/commands/teams/AddCmd.java | 4 ++-- .../seqera/tower/cli/commands/teams/ListCmd.java | 4 ++-- .../tower/cli/commands/teams/MembersCmd.java | 4 ++-- .../tower/cli/commands/teams/members/AddCmd.java | 4 ++-- .../cli/commands/teams/members/DeleteCmd.java | 4 ++-- .../workspaces/AbstractWorkspaceCmd.java | 16 ++++++++-------- .../tower/cli/commands/workspaces/AddCmd.java | 4 ++-- .../tower/cli/commands/workspaces/DeleteCmd.java | 4 ++-- .../tower/cli/commands/workspaces/LeaveCmd.java | 4 ++-- .../tower/cli/commands/workspaces/ListCmd.java | 4 ++-- .../tower/cli/commands/workspaces/UpdateCmd.java | 4 ++-- .../tower/cli/commands/workspaces/ViewCmd.java | 4 ++-- .../organizations/OrganizationsList.java | 6 +++--- .../cli/responses/workspaces/WorkspaceList.java | 6 +++--- .../cli/organizations/OrganizationsCmdTest.java | 6 +++--- .../tower/cli/workspaces/WorkspacesCmdTest.java | 8 ++++---- 28 files changed, 75 insertions(+), 75 deletions(-) diff --git a/conf/reflect-config.json b/conf/reflect-config.json index ba10bdb5..d4bc3540 100644 --- a/conf/reflect-config.json +++ b/conf/reflect-config.json @@ -2796,7 +2796,7 @@ "methods":[{"name":"","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, diff --git a/src/main/java/io/seqera/tower/cli/commands/AbstractApiCmd.java b/src/main/java/io/seqera/tower/cli/commands/AbstractApiCmd.java index c259f6e9..8daeb5d9 100644 --- a/src/main/java/io/seqera/tower/cli/commands/AbstractApiCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/AbstractApiCmd.java @@ -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; @@ -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(); @@ -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) { @@ -293,7 +293,7 @@ protected OrgAndWorkspaceDbDto findOrgAndWorkspaceByName(String organizationName throw new WorkspaceNotFoundException(workspaceName, organizationName); } - List orgAndWorkspaceDbDtoList = workspacesAndOrgResponse + List orgAndWorkspaceDbDtoList = workspacesAndOrgResponse .getOrgsAndWorkspaces() .stream() .filter( @@ -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 orgAndWorkspaceDbDtoList = workspacesAndOrgResponse + List orgAndWorkspaceDbDtoList = workspacesAndOrgResponse .getOrgsAndWorkspaces() .stream() .filter( @@ -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(); @@ -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(); diff --git a/src/main/java/io/seqera/tower/cli/commands/collaborators/ListCmd.java b/src/main/java/io/seqera/tower/cli/commands/collaborators/ListCmd.java index 4b472f99..3e873bfd 100644 --- a/src/main/java/io/seqera/tower/cli/commands/collaborators/ListCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/collaborators/ListCmd.java @@ -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; @@ -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); diff --git a/src/main/java/io/seqera/tower/cli/commands/members/AddCmd.java b/src/main/java/io/seqera/tower/cli/commands/members/AddCmd.java index 1952fa48..2d1cdc0f 100644 --- a/src/main/java/io/seqera/tower/cli/commands/members/AddCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/members/AddCmd.java @@ -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; @@ -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); diff --git a/src/main/java/io/seqera/tower/cli/commands/members/DeleteCmd.java b/src/main/java/io/seqera/tower/cli/commands/members/DeleteCmd.java index 948ad716..8d93be7e 100644 --- a/src/main/java/io/seqera/tower/cli/commands/members/DeleteCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/members/DeleteCmd.java @@ -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; @@ -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); diff --git a/src/main/java/io/seqera/tower/cli/commands/members/LeaveCmd.java b/src/main/java/io/seqera/tower/cli/commands/members/LeaveCmd.java index 7b4e5dd3..f4d9574d 100644 --- a/src/main/java/io/seqera/tower/cli/commands/members/LeaveCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/members/LeaveCmd.java @@ -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; @@ -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()); diff --git a/src/main/java/io/seqera/tower/cli/commands/members/ListCmd.java b/src/main/java/io/seqera/tower/cli/commands/members/ListCmd.java index d26a13b6..2535e836 100644 --- a/src/main/java/io/seqera/tower/cli/commands/members/ListCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/members/ListCmd.java @@ -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; @@ -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); diff --git a/src/main/java/io/seqera/tower/cli/commands/members/UpdateCmd.java b/src/main/java/io/seqera/tower/cli/commands/members/UpdateCmd.java index 069b091d..b0f670a9 100644 --- a/src/main/java/io/seqera/tower/cli/commands/members/UpdateCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/members/UpdateCmd.java @@ -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; @@ -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); diff --git a/src/main/java/io/seqera/tower/cli/commands/organizations/AbstractOrganizationsCmd.java b/src/main/java/io/seqera/tower/cli/commands/organizations/AbstractOrganizationsCmd.java index 0115c8dc..3c83b640 100644 --- a/src/main/java/io/seqera/tower/cli/commands/organizations/AbstractOrganizationsCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/organizations/AbstractOrganizationsCmd.java @@ -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; @@ -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 orgAndWorkspaceDbDtoList = workspacesAndOrgResponse + List orgAndWorkspaceDbDtoList = workspacesAndOrgResponse .getOrgsAndWorkspaces() .stream() .filter( @@ -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()); } @@ -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()); } } diff --git a/src/main/java/io/seqera/tower/cli/commands/organizations/DeleteCmd.java b/src/main/java/io/seqera/tower/cli/commands/organizations/DeleteCmd.java index 466e55f1..5bc259e5 100644 --- a/src/main/java/io/seqera/tower/cli/commands/organizations/DeleteCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/organizations/DeleteCmd.java @@ -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; @@ -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(); } diff --git a/src/main/java/io/seqera/tower/cli/commands/organizations/ListCmd.java b/src/main/java/io/seqera/tower/cli/commands/organizations/ListCmd.java index f4d4a1a7..6fea3d0b 100644 --- a/src/main/java/io/seqera/tower/cli/commands/organizations/ListCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/organizations/ListCmd.java @@ -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; @@ -35,7 +35,7 @@ protected Response exec() throws ApiException, IOException { if (response.getOrgsAndWorkspaces() != null) { - List responseOrg = response.getOrgsAndWorkspaces() + List responseOrg = response.getOrgsAndWorkspaces() .stream() .filter(item -> Objects.equals(item.getWorkspaceId(), null)) .collect(Collectors.toList()); diff --git a/src/main/java/io/seqera/tower/cli/commands/teams/AbstractTeamsCmd.java b/src/main/java/io/seqera/tower/cli/commands/teams/AbstractTeamsCmd.java index 616d9633..cf3d1e80 100644 --- a/src/main/java/io/seqera/tower/cli/commands/teams/AbstractTeamsCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/teams/AbstractTeamsCmd.java @@ -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; @@ -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()); } diff --git a/src/main/java/io/seqera/tower/cli/commands/teams/AddCmd.java b/src/main/java/io/seqera/tower/cli/commands/teams/AddCmd.java index 05fdaa01..947f71d8 100644 --- a/src/main/java/io/seqera/tower/cli/commands/teams/AddCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/teams/AddCmd.java @@ -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; @@ -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); diff --git a/src/main/java/io/seqera/tower/cli/commands/teams/ListCmd.java b/src/main/java/io/seqera/tower/cli/commands/teams/ListCmd.java index fce8dbb3..1c1edbbb 100644 --- a/src/main/java/io/seqera/tower/cli/commands/teams/ListCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/teams/ListCmd.java @@ -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; @@ -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); diff --git a/src/main/java/io/seqera/tower/cli/commands/teams/MembersCmd.java b/src/main/java/io/seqera/tower/cli/commands/teams/MembersCmd.java index bb32ee67..7b6ad8fe 100644 --- a/src/main/java/io/seqera/tower/cli/commands/teams/MembersCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/teams/MembersCmd.java @@ -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; @@ -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); diff --git a/src/main/java/io/seqera/tower/cli/commands/teams/members/AddCmd.java b/src/main/java/io/seqera/tower/cli/commands/teams/members/AddCmd.java index 3c54e171..2d2c1f3d 100644 --- a/src/main/java/io/seqera/tower/cli/commands/teams/members/AddCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/teams/members/AddCmd.java @@ -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; @@ -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); diff --git a/src/main/java/io/seqera/tower/cli/commands/teams/members/DeleteCmd.java b/src/main/java/io/seqera/tower/cli/commands/teams/members/DeleteCmd.java index 9f289319..f6800ae4 100644 --- a/src/main/java/io/seqera/tower/cli/commands/teams/members/DeleteCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/teams/members/DeleteCmd.java @@ -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; @@ -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); diff --git a/src/main/java/io/seqera/tower/cli/commands/workspaces/AbstractWorkspaceCmd.java b/src/main/java/io/seqera/tower/cli/commands/workspaces/AbstractWorkspaceCmd.java index 4914e5fe..f733a970 100644 --- a/src/main/java/io/seqera/tower/cli/commands/workspaces/AbstractWorkspaceCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/workspaces/AbstractWorkspaceCmd.java @@ -16,7 +16,7 @@ import io.seqera.tower.cli.exceptions.TowerException; import io.seqera.tower.cli.exceptions.WorkspaceNotFoundException; import io.seqera.tower.model.ListWorkspacesAndOrgResponse; -import io.seqera.tower.model.OrgAndWorkspaceDbDto; +import io.seqera.tower.model.OrgAndWorkspaceDto; import picocli.CommandLine.Command; import java.util.List; @@ -30,26 +30,26 @@ public abstract class AbstractWorkspaceCmd extends AbstractApiCmd { public AbstractWorkspaceCmd() { } - protected OrgAndWorkspaceDbDto orgAndWorkspaceByName(String workspaceName, String organizationName) throws ApiException { + protected OrgAndWorkspaceDto orgAndWorkspaceByName(String workspaceName, String organizationName) throws ApiException { return findOrgAndWorkspaceByName(organizationName, workspaceName); } - protected OrgAndWorkspaceDbDto organizationByName(String organizationName) throws ApiException { + protected OrgAndWorkspaceDto organizationByName(String organizationName) throws ApiException { return findOrgAndWorkspaceByName(organizationName, null); } - protected OrgAndWorkspaceDbDto workspaceById(Long workspaceId) throws ApiException { + protected OrgAndWorkspaceDto workspaceById(Long workspaceId) throws ApiException { return findOrgAndWorkspaceById(workspaceId).orElse(null); } - private Optional findOrgAndWorkspaceById(Long workspaceId) throws ApiException { + private Optional findOrgAndWorkspaceById(Long workspaceId) throws ApiException { ListWorkspacesAndOrgResponse workspacesAndOrgResponse = api().listWorkspacesUser(userId()); if (workspacesAndOrgResponse == null || workspacesAndOrgResponse.getOrgsAndWorkspaces() == null) { throw new WorkspaceNotFoundException(workspaceId); } - List orgAndWorkspaceDbDtoList = workspacesAndOrgResponse + List orgAndWorkspaceDbDtoList = workspacesAndOrgResponse .getOrgsAndWorkspaces() .stream() .filter( @@ -64,8 +64,8 @@ private Optional findOrgAndWorkspaceById(Long workspaceId) return orgAndWorkspaceDbDtoList.stream().findFirst(); } - protected OrgAndWorkspaceDbDto fetchOrgAndWorkspaceDbDto(WorkspaceRefOptions workspaceRefOptions) throws ApiException { - OrgAndWorkspaceDbDto ws; + protected OrgAndWorkspaceDto fetchOrgAndWorkspaceDbDto(WorkspaceRefOptions workspaceRefOptions) throws ApiException { + OrgAndWorkspaceDto ws; if (workspaceRefOptions.workspace.workspaceId != null) { ws = workspaceById(workspaceRefOptions.workspace.workspaceId); diff --git a/src/main/java/io/seqera/tower/cli/commands/workspaces/AddCmd.java b/src/main/java/io/seqera/tower/cli/commands/workspaces/AddCmd.java index f8b156d0..9b7d94c2 100644 --- a/src/main/java/io/seqera/tower/cli/commands/workspaces/AddCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/workspaces/AddCmd.java @@ -17,7 +17,7 @@ import io.seqera.tower.cli.responses.workspaces.WorkspaceAdded; import io.seqera.tower.model.CreateWorkspaceRequest; import io.seqera.tower.model.CreateWorkspaceResponse; -import io.seqera.tower.model.OrgAndWorkspaceDbDto; +import io.seqera.tower.model.OrgAndWorkspaceDto; import io.seqera.tower.model.Visibility; import io.seqera.tower.model.Workspace; import picocli.CommandLine; @@ -52,7 +52,7 @@ public class AddCmd extends AbstractWorkspaceCmd { @Override protected Response exec() throws ApiException, IOException { - OrgAndWorkspaceDbDto orgWspDto; + OrgAndWorkspaceDto orgWspDto; if (overwrite) { // check also wsp existence orgWspDto = findOrgAndWorkspaceByName(organizationName, workspaceName); tryDeleteWsp(orgWspDto.getWorkspaceId(), orgWspDto.getOrgId()); diff --git a/src/main/java/io/seqera/tower/cli/commands/workspaces/DeleteCmd.java b/src/main/java/io/seqera/tower/cli/commands/workspaces/DeleteCmd.java index 961c1e7a..94878563 100644 --- a/src/main/java/io/seqera/tower/cli/commands/workspaces/DeleteCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/workspaces/DeleteCmd.java @@ -14,7 +14,7 @@ import io.seqera.tower.ApiException; import io.seqera.tower.cli.responses.Response; import io.seqera.tower.cli.responses.workspaces.WorkspaceDeleted; -import io.seqera.tower.model.OrgAndWorkspaceDbDto; +import io.seqera.tower.model.OrgAndWorkspaceDto; import picocli.CommandLine; import picocli.CommandLine.Command; @@ -31,7 +31,7 @@ public class DeleteCmd extends AbstractWorkspaceCmd { @Override protected Response exec() throws ApiException, IOException { - OrgAndWorkspaceDbDto ws = fetchOrgAndWorkspaceDbDto(workspaceRefOptions); + OrgAndWorkspaceDto ws = fetchOrgAndWorkspaceDbDto(workspaceRefOptions); deleteWorkspaceById(ws.getWorkspaceId(), ws.getOrgId()); diff --git a/src/main/java/io/seqera/tower/cli/commands/workspaces/LeaveCmd.java b/src/main/java/io/seqera/tower/cli/commands/workspaces/LeaveCmd.java index 233a99eb..969137b8 100644 --- a/src/main/java/io/seqera/tower/cli/commands/workspaces/LeaveCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/workspaces/LeaveCmd.java @@ -14,7 +14,7 @@ import io.seqera.tower.ApiException; import io.seqera.tower.cli.responses.Response; import io.seqera.tower.cli.responses.participants.ParticipantLeft; -import io.seqera.tower.model.OrgAndWorkspaceDbDto; +import io.seqera.tower.model.OrgAndWorkspaceDto; import picocli.CommandLine; import java.io.IOException; @@ -30,7 +30,7 @@ public class LeaveCmd extends AbstractWorkspaceCmd { @Override protected Response exec() throws ApiException, IOException { - OrgAndWorkspaceDbDto ws = fetchOrgAndWorkspaceDbDto(workspaceRefOptions); + OrgAndWorkspaceDto ws = fetchOrgAndWorkspaceDbDto(workspaceRefOptions); api().leaveWorkspaceParticipant(ws.getOrgId(), ws.getWorkspaceId()); return new ParticipantLeft(ws.getWorkspaceName()); diff --git a/src/main/java/io/seqera/tower/cli/commands/workspaces/ListCmd.java b/src/main/java/io/seqera/tower/cli/commands/workspaces/ListCmd.java index c88f29f9..782c8b26 100644 --- a/src/main/java/io/seqera/tower/cli/commands/workspaces/ListCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/workspaces/ListCmd.java @@ -16,7 +16,7 @@ import io.seqera.tower.cli.responses.Response; import io.seqera.tower.cli.responses.workspaces.WorkspaceList; import io.seqera.tower.model.ListWorkspacesAndOrgResponse; -import io.seqera.tower.model.OrgAndWorkspaceDbDto; +import io.seqera.tower.model.OrgAndWorkspaceDto; import picocli.CommandLine; import picocli.CommandLine.Command; @@ -42,7 +42,7 @@ protected Response exec() throws ApiException, IOException { return new WorkspaceList(userName(), Collections.emptyList(), serverUrl()); } - List responseOrg = response.getOrgsAndWorkspaces() + List responseOrg = response.getOrgsAndWorkspaces() .stream() .filter(v -> v.getWorkspaceId() != null && (organizationName == null || organizationName.equals(v.getOrgName())) ).collect(Collectors.toList()); diff --git a/src/main/java/io/seqera/tower/cli/commands/workspaces/UpdateCmd.java b/src/main/java/io/seqera/tower/cli/commands/workspaces/UpdateCmd.java index 5614312a..22a742c6 100644 --- a/src/main/java/io/seqera/tower/cli/commands/workspaces/UpdateCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/workspaces/UpdateCmd.java @@ -16,7 +16,7 @@ import io.seqera.tower.cli.responses.Response; import io.seqera.tower.cli.responses.workspaces.WorkspaceUpdated; import io.seqera.tower.model.DescribeWorkspaceResponse; -import io.seqera.tower.model.OrgAndWorkspaceDbDto; +import io.seqera.tower.model.OrgAndWorkspaceDto; import io.seqera.tower.model.UpdateWorkspaceRequest; import io.seqera.tower.model.Visibility; import picocli.CommandLine; @@ -57,7 +57,7 @@ protected Response exec() throws ApiException, IOException { throw new ShowUsageException(getSpec(), "Required at least one option to update"); } - OrgAndWorkspaceDbDto ws = workspaceById(workspaceId); + OrgAndWorkspaceDto ws = workspaceById(workspaceId); DescribeWorkspaceResponse response = api().describeWorkspace(ws.getOrgId(), ws.getWorkspaceId()); UpdateWorkspaceRequest request = new UpdateWorkspaceRequest() diff --git a/src/main/java/io/seqera/tower/cli/commands/workspaces/ViewCmd.java b/src/main/java/io/seqera/tower/cli/commands/workspaces/ViewCmd.java index 4957be25..1f283bd1 100644 --- a/src/main/java/io/seqera/tower/cli/commands/workspaces/ViewCmd.java +++ b/src/main/java/io/seqera/tower/cli/commands/workspaces/ViewCmd.java @@ -15,7 +15,7 @@ import io.seqera.tower.cli.responses.Response; import io.seqera.tower.cli.responses.workspaces.WorkspaceView; import io.seqera.tower.model.DescribeWorkspaceResponse; -import io.seqera.tower.model.OrgAndWorkspaceDbDto; +import io.seqera.tower.model.OrgAndWorkspaceDto; import picocli.CommandLine; import picocli.CommandLine.Command; @@ -32,7 +32,7 @@ public class ViewCmd extends AbstractWorkspaceCmd { @Override protected Response exec() throws ApiException, IOException { - OrgAndWorkspaceDbDto ws = fetchOrgAndWorkspaceDbDto(workspaceRefOptions); + OrgAndWorkspaceDto ws = fetchOrgAndWorkspaceDbDto(workspaceRefOptions); DescribeWorkspaceResponse response = api().describeWorkspace(ws.getOrgId(), ws.getWorkspaceId()); diff --git a/src/main/java/io/seqera/tower/cli/responses/organizations/OrganizationsList.java b/src/main/java/io/seqera/tower/cli/responses/organizations/OrganizationsList.java index 13749be8..f5328d21 100644 --- a/src/main/java/io/seqera/tower/cli/responses/organizations/OrganizationsList.java +++ b/src/main/java/io/seqera/tower/cli/responses/organizations/OrganizationsList.java @@ -14,7 +14,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import io.seqera.tower.cli.responses.Response; import io.seqera.tower.cli.utils.TableList; -import io.seqera.tower.model.OrgAndWorkspaceDbDto; +import io.seqera.tower.model.OrgAndWorkspaceDto; import java.io.PrintWriter; import java.util.List; @@ -24,12 +24,12 @@ public class OrganizationsList extends Response { public final String userName; - public final List organizations; + public final List organizations; @JsonIgnore private final String serverUrl; - public OrganizationsList(String userName, List organizations, String serverUrl) { + public OrganizationsList(String userName, List organizations, String serverUrl) { this.userName = userName; this.organizations = organizations; this.serverUrl = serverUrl; diff --git a/src/main/java/io/seqera/tower/cli/responses/workspaces/WorkspaceList.java b/src/main/java/io/seqera/tower/cli/responses/workspaces/WorkspaceList.java index 3ab11fc9..2c009506 100644 --- a/src/main/java/io/seqera/tower/cli/responses/workspaces/WorkspaceList.java +++ b/src/main/java/io/seqera/tower/cli/responses/workspaces/WorkspaceList.java @@ -14,7 +14,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import io.seqera.tower.cli.responses.Response; import io.seqera.tower.cli.utils.TableList; -import io.seqera.tower.model.OrgAndWorkspaceDbDto; +import io.seqera.tower.model.OrgAndWorkspaceDto; import java.io.PrintWriter; import java.util.List; @@ -25,12 +25,12 @@ public class WorkspaceList extends Response { public final String userName; - public final List workspaces; + public final List workspaces; @JsonIgnore private String serverUrl; - public WorkspaceList(String userName, List workspaces, String serverUrl) { + public WorkspaceList(String userName, List workspaces, String serverUrl) { this.userName = userName; this.workspaces = workspaces; this.serverUrl = serverUrl; diff --git a/src/test/java/io/seqera/tower/cli/organizations/OrganizationsCmdTest.java b/src/test/java/io/seqera/tower/cli/organizations/OrganizationsCmdTest.java index 84343ee4..0f5be94c 100644 --- a/src/test/java/io/seqera/tower/cli/organizations/OrganizationsCmdTest.java +++ b/src/test/java/io/seqera/tower/cli/organizations/OrganizationsCmdTest.java @@ -21,7 +21,7 @@ import io.seqera.tower.cli.responses.organizations.OrganizationsList; import io.seqera.tower.cli.responses.organizations.OrganizationsUpdated; import io.seqera.tower.cli.responses.organizations.OrganizationsView; -import io.seqera.tower.model.OrgAndWorkspaceDbDto; +import io.seqera.tower.model.OrgAndWorkspaceDto; import io.seqera.tower.model.OrganizationDbDto; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -65,14 +65,14 @@ void testList(OutputType format, MockServerClient mock) throws JsonProcessingExc " \"orgLogoUrl\": null,\n" + " \"workspaceId\": null,\n" + " \"workspaceName\": null\n" + - " }", OrgAndWorkspaceDbDto.class), + " }", OrgAndWorkspaceDto.class), parseJson(" {\n" + " \"orgId\": 37736513644467,\n" + " \"orgName\": \"organization2\",\n" + " \"orgLogoUrl\": null,\n" + " \"workspaceId\": null,\n" + " \"workspaceName\": null\n" + - " }", OrgAndWorkspaceDbDto.class) + " }", OrgAndWorkspaceDto.class) ), url(mock))); } diff --git a/src/test/java/io/seqera/tower/cli/workspaces/WorkspacesCmdTest.java b/src/test/java/io/seqera/tower/cli/workspaces/WorkspacesCmdTest.java index c7d36a34..74dd2fd1 100644 --- a/src/test/java/io/seqera/tower/cli/workspaces/WorkspacesCmdTest.java +++ b/src/test/java/io/seqera/tower/cli/workspaces/WorkspacesCmdTest.java @@ -22,7 +22,7 @@ import io.seqera.tower.cli.responses.workspaces.WorkspaceList; import io.seqera.tower.cli.responses.workspaces.WorkspaceUpdated; import io.seqera.tower.cli.responses.workspaces.WorkspaceView; -import io.seqera.tower.model.OrgAndWorkspaceDbDto; +import io.seqera.tower.model.OrgAndWorkspaceDto; import io.seqera.tower.model.Visibility; import io.seqera.tower.model.Workspace; import org.junit.jupiter.api.Test; @@ -67,14 +67,14 @@ void testList(OutputType format, MockServerClient mock) throws JsonProcessingExc " \"orgLogoUrl\": null,\n" + " \"workspaceId\": 75887156211589,\n" + " \"workspaceName\": \"workspace1\"\n" + - " }", OrgAndWorkspaceDbDto.class), + " }", OrgAndWorkspaceDto.class), parseJson("{\n" + " \"orgId\": 37736513644467,\n" + " \"orgName\": \"organization2\",\n" + " \"orgLogoUrl\": null,\n" + " \"workspaceId\": 75887156211590,\n" + " \"workspaceName\": \"workspace2\"\n" + - " }", OrgAndWorkspaceDbDto.class) + " }", OrgAndWorkspaceDto.class) ), url(mock))); } @@ -102,7 +102,7 @@ void testListByOrganization(OutputType format, MockServerClient mock) throws Jso " \"orgLogoUrl\": null,\n" + " \"workspaceId\": 75887156211589,\n" + " \"workspaceName\": \"workspace1\"\n" + - " }", OrgAndWorkspaceDbDto.class) + " }", OrgAndWorkspaceDto.class) ), url(mock))); }