Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An ability for extenders to login/logout API ML service via Zowe Explorer API #2851

Open
roman-kupriyanov opened this issue Apr 16, 2024 · 1 comment
Labels
enhancement New feature or request priority-low Legit issue but cosmetic or nice-to-have

Comments

@roman-kupriyanov
Copy link
Contributor

Is your feature request related to a problem? Please describe.

As it stands, Explorer for Endevor extension which relies only on the dynamically imported Zowe Extenders API to get the custom profiles list, cannot login or logout to APIML using those profiles, even though they are defined to work under API ML service.

Describe the solution you'd like

It would be nice if extenders can login and logout to API ML without having to add the Zowe code as a static dependency to their project. This means having the login and logout methods exposed through the IApiExplorerExtender interface somehow.

This is a really high level example of how it may look like (might be adjusted if necessary):

  /**
  * This interface can be used by other VS Code Extensions to access an alternative
  * profile types that can be employed in conjunction with the primary profile to provide
  * alternative support.
  *
  */
  export interface IApiExplorerExtender {
  /**

  * Allows extenders access to the profiles loaded into Zowe Explorer.
  * This includes profiles of other extenders. Called reloadProfiles()
  * in case other extensions might have registered themselves before accessing.
  * See the ProfilesCache class for the available accessors. When making changes
  * to the profile in this cache remember that it shared with Zowe Explorer and
  * all other Zowe Explorer extensions
  * @version 1.18 or newer of Zowe Explorer
  * @returns {ProfilesCache}
  */
  getProfilesCache(): ProfilesCache;
  
  /**
  * After an extenders registered all its API extensions it
  * might want to request that profiles should get reloaded
  * to make them automatically appears in the Explorer drop-
  * down dialogs.
  */
  reloadProfiles(profileType?: string): Promise<void>;
  
  /**
  * After an extenders registered all its API extensions it
  * might want to check for an existing profile folder with meta-file
  * or to create them automatically if it is non-existant.
  */
  initForZowe(type: string, profileTypeConfigurations?: zowe.imperative.ICommandProfileTypeConfiguration[]): Promise<void>;
  
  /** PROPOSED PART **/
  
  /**
  * Register Common API for the alternative profile type
  */
  registerCommonAPI(
    profileType: string, 
    api: ZoweExplorerApi.ICommon): Promise<void>
  ): Promise<void>
  
  /**
  * Login to API ML service, using the alternative profile name
  */
  loginApiMl(profileName?: string): Promise<void>;
  
  /**
  * Logout from API ML service, using the alternative profile name
  */
  logoutApiMl(profileName?: string): Promise<void>;
  
  /** PROPOSED PART END */
  }

Suggested steps to use the new API:

  1. Together with registration of the custom profile type, an implementation of ICommon interface is also registered for the same profile type with registerCommonApi() call. Minimally it includes the getSession() implementation and getProfileTypeName() calls to let the API know how to create a session from the custom profile properly. The login/logout calls should be reused from the existing API’s if not overridden.
  2. Anytime the extension has to login or logout the API ML service, we can call loginApiMl() or logoutApiMl() with the profile name we want to use. The calls can throw errors if the profile cannot be used to login/logout, or it is not the API ML service.
  3. If no Common API is registered for this type of profile, try the default session creation (Zosmf profile API may be used or something different).

Describe alternatives you've considered

The only way to login to API ML service for the extenders easily at the moment is to use Zowe Explorer’s other profiles like Zosmf or Uss which also configured to be used with the same API ML endpoint, since only through those we can leverage the login/logout procedures. Alternatively, using Zowe CLI login/logout too. But we would prefer to avoid the users switching contexts all the time.

Additional context

It would be also nice if the login call will provide all the necessary prompting for extenders, like username/password to authenticate, that already exist in Zowe Explorer and can be nicely reused.

@roman-kupriyanov roman-kupriyanov added the enhancement New feature or request label Apr 16, 2024
Copy link

Thank you for raising this enhancement request.
The community has 90 days to vote on it.
If the enhancement receives at least 10 upvotes, it is added to our development backlog.
If it receives fewer votes, the issue is closed.

@JTonda JTonda added the priority-low Legit issue but cosmetic or nice-to-have label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority-low Legit issue but cosmetic or nice-to-have
Projects
Status: Low Priority
Development

No branches or pull requests

2 participants