diff --git a/cmd/state/internal/cmdtree/cmdtree.go b/cmd/state/internal/cmdtree/cmdtree.go index 42251d5adf..4721bb1bba 100644 --- a/cmd/state/internal/cmdtree/cmdtree.go +++ b/cmd/state/internal/cmdtree/cmdtree.go @@ -156,11 +156,6 @@ func New(prime *primer.Values, args ...string) *CmdTree { refreshCmd := newRefreshCommand(prime) - orgCmd := newOrganizationsCommand(prime) - orgCmd.AddChildren( - newOrganizationsAddCommand(prime), - ) - stateCmd := newStateCommand(globals, prime) stateCmd.AddChildren( newHelloCommand(prime), @@ -171,7 +166,7 @@ func New(prime *primer.Values, args ...string) *CmdTree { projectsCmd, authCmd, exportCmd, - orgCmd, + newOrganizationsCommand(prime), newRunCommand(prime), newShowCommand(prime), installCmd, diff --git a/cmd/state/internal/cmdtree/organizations.go b/cmd/state/internal/cmdtree/organizations.go index eb4cb27a06..5c52df8b37 100644 --- a/cmd/state/internal/cmdtree/organizations.go +++ b/cmd/state/internal/cmdtree/organizations.go @@ -30,33 +30,3 @@ func newOrganizationsCommand(prime *primer.Values) *captain.Command { return cmd } - -func newOrganizationsAddCommand(prime *primer.Values) *captain.Command { - runner := organizations.NewOrganizationsAdd(prime) - - params := organizations.OrgAddParams{} - - cmd := captain.NewCommand( - "add", - locale.Tl("organizations_add_title", "Creating Organization"), - locale.T("organizations_add_description"), - prime, - []*captain.Flag{}, - []*captain.Argument{ - { - Name: locale.Tl("organizations_add_name", "Name"), - Description: locale.Tl("organizations_add_name_description", "The name of the organization"), - Required: true, - Value: ¶ms.Name, - }, - }, - func(ccmd *captain.Command, _ []string) error { - return runner.Run(¶ms) - }, - ) - - cmd.SetUnstable(true) - cmd.SetHidden(true) // for test use only at this time - - return cmd -} diff --git a/internal/locale/locales/en-us.yaml b/internal/locale/locales/en-us.yaml index 31ef017d14..5191b27bda 100644 --- a/internal/locale/locales/en-us.yaml +++ b/internal/locale/locales/en-us.yaml @@ -281,8 +281,6 @@ organization: other: Organization organizations_description: other: List member organizations on the ActiveState Platform -organizations_add_description: - other: Add a new organization to the ActiveState Platform organizations_err: other: Unable to list member organizations organizations_unknown_tier: diff --git a/internal/runners/organizations/add.go b/internal/runners/organizations/add.go deleted file mode 100644 index 335fa7776b..0000000000 --- a/internal/runners/organizations/add.go +++ /dev/null @@ -1,27 +0,0 @@ -package organizations - -import ( - "github.com/ActiveState/cli/internal/locale" - "github.com/ActiveState/cli/internal/output" - "github.com/ActiveState/cli/pkg/platform/model" -) - -type OrganizationsAdd struct { - out output.Outputer -} - -func NewOrganizationsAdd(prime primeable) *OrganizationsAdd { - return &OrganizationsAdd{prime.Output()} -} - -type OrgAddParams struct { - Name string -} - -func (o *OrganizationsAdd) Run(params *OrgAddParams) error { - if err := model.CreateOrg(params.Name); err != nil { - return locale.WrapError(err, "err_organizations_add", "Could not create organization") - } - o.out.Notice(locale.Tl("organizations_add_success", "Organization created")) - return nil -} diff --git a/internal/testhelpers/e2e/session.go b/internal/testhelpers/e2e/session.go index e75f08d76a..65f05ec54b 100644 --- a/internal/testhelpers/e2e/session.go +++ b/internal/testhelpers/e2e/session.go @@ -379,7 +379,7 @@ func (s *Session) CreateNewUser() (string, string) { password := uid.String()[8:] email := fmt.Sprintf("%s@test.tld", username) - p := s.Spawn("auth", "signup", "--prompt") + p := s.Spawn(tagsuite.Auth, "signup", "--prompt") p.Expect("I accept") p.SendLine("") @@ -396,16 +396,9 @@ func (s *Session) CreateNewUser() (string, string) { s.users = append(s.users, username) - s.CreateOrg(username) // Many of our tests rely on this implicitly also creating an org as that's how the API used to behave - return username, password } -func (s *Session) CreateOrg(name string) { - p := s.Spawn("organizations", "add", name) - p.ExpectExitCode(0) -} - // NotifyProjectCreated indicates that the given project was created on the Platform and needs to // be deleted when the session is closed. // This only needs to be called for projects created by PersistentUsername, not projects created by diff --git a/pkg/platform/model/organizations.go b/pkg/platform/model/organizations.go index 329536ca47..242194e900 100644 --- a/pkg/platform/model/organizations.go +++ b/pkg/platform/model/organizations.go @@ -20,27 +20,6 @@ import ( var ErrMemberNotFound = errs.New("member not found") -func CreateOrg(name string) error { - params := clientOrgs.NewAddOrganizationParams() - params.Organization = &mono_models.OrganizationEditable{ - URLname: name, - DisplayName: name, - } - _, err := authentication.Client().Organizations.AddOrganization(params, authentication.ClientAuth()) - if err != nil { - switch statusCode := api.ErrorCode(err); statusCode { - case 400: - return locale.WrapInputError(err, "", err.Error()) - case 403: - return locale.WrapInputError(err, "err_auth_required") - case 409: - return locale.WrapInputError(err, "err_organization_add_exists", "Organization name already exists") - } - return errs.Wrap(err, "failed to create organization") - } - return nil -} - // FetchOrganizations fetches all organizations for the current user. func FetchOrganizations() ([]*mono_models.Organization, error) { params := clientOrgs.NewListOrganizationsParams()