{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### IBM Cloud service instance browser\n", "\n", "This notebook illustrates how to use the IBM Cloud service instance browser app in a Python notebook. For more information about the app refer to https://github.com/ibm-watson-data-lab/cf-service-credential-browser." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "scrolled": true }, "outputs": [], "source": [ "# to install the app (it's not published on PyPi because it's a demo) run\n", "!pip install --upgrade git+https://github.com/ibm-watson-data-lab/cf-service-credential-browser.git#egg=cfservices\n", "# to uninstall run\n", "# ! pip uninstall -y cfservices" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Configure IBM Cloud connectivity\n", "\n", "Configure the [IBM Cloud user api key](https://console.bluemix.net/docs/iam/userid_keys.html#userapikey) or [IBMid/password](https://console.bluemix.net) that the app will use to connect and retrieve information about organizations, spaces and service instances. This app does not store or share any confiential information.\n", "\n", " > Note: if you provide an IBM Cloud user api key and IBMid credentials, the api key will be used. " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# define either \n", "ibm_cloud_user_api_token = None\n", "# or\n", "ibmid = None\n", "password = None" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Load and display service instance information from IBM Cloud\n", "\n", "Run the next cell to launch the service browser. \n", "\n", "> Note: Warnings may be displayed if during data retrieval lookup information (such as service plan names) cannot be found. This is expected if one or more service instances were provisioned using a plan that is no longer available.\n", "\n", "Apply filters to quickly locate a service instance of interest, retrieve its credentials and insert them into the next notebook cell. \n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "pixiedust": { "displayParams": {} } }, "outputs": [], "source": [ "from cfservices.browser import Browser\n", "b = Browser(ibm_cloud_user_api_token=ibm_cloud_user_api_token,\n", " ibmid=ibmid,\n", " password=password)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Optional: review the collected data\n", "\n", "The browser fetches information about organizations, spaces and service instances that the provided credentials have access to and stores it in a Pandas DataFrame. You can access the DataFrame by calling the browser's `getPandasDataFrame()` method.\n", " > **Note: service credentials are retrieved on demand by the browser and not stored in the DataFrame.**" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "pixiedust": { "displayParams": { "handlerId": "tableView" } } }, "outputs": [], "source": [ "import pixiedust\n", "display(b.getPandasDataFrame())" ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.3" } }, "nbformat": 4, "nbformat_minor": 1 }