Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 2.18 KB

API.md

File metadata and controls

49 lines (35 loc) · 2.18 KB

API

Supported protocol requests

Lens 4.2 introduced a new custom Lens protocol handler. This means Lens can now respond to lens:// URL requests made in the browser, and this extension can now support some interesting requests that enable tighter integration between Mirantis Container Cloud instances and Lens.

💬 Note that this integration is a one-way street: Container Cloud -> Lens. It does not work the other way around. Reverse integration is achieved simply by making Container Cloud API requests from Lens, which is much easier to achieve, and has been used by this extension since its inception.

The base URL for requests that this extension can respond to is:

lens://extensions/@mirantis/lens-extension-cc

The following APIs are currently supported by this extension, from the base URL above:

Protocol - Activate cluster

Activates a cluster already added to Lens.

GET /activateCluster
  ?cloudUrl={string}
  &namespace={string}
  &clusterName={string}
  &clusterId={string}
  • cloudUrl: URL to the instance, e.g. https://container-cloud.my-company.com
  • namespace: ID of the Container Cloud namespace containing the cluster to activate.
  • clusterName: Name of the cluster to activate.
  • clusterId: ID of the cluster (in namespace) to activate.

Protocol - SSO OAuth Code

Allow the extension to use the system's default browser to broker an OAuth authorization code with a Keycloak client in a Container Cloud instance. This is used both for general access (to list clusters) as well as specific cluster access to generate kubeConfig files to add to Lens.

GET /oauth/code
  ?code={string}
  [ &state={string} ]
  [ &error={string} ]
  [ &error_description={string} ]
  • code: Temporary authorization code to exchange for API tokens.
  • state (Optional): Used to differentiate between requests for general access and specific access. The value is generated by the extension as part of the request and should come back as part of the response.
  • error (Optional): OAuth error message, if an error occurs.
  • error_description (Optional): OAuth error description, if an error occurs.