Skip to content

ajmaradiaga/steampipe-plugin-btp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image

SAP BTP plugin for Steampipe

Use SQL to query your SAP BTP account details.

Quick start

Install

Download and install the latest SAP BTP plugin:

steampipe plugin install ajmaradiaga/btp

Configure your credentials and config file.

Configure your account details in ~/.steampipe/config/btp.spc:

connection "btp" {
  plugin = "ajmaradiaga/btp"

  # User email used to log in to SAP BTP. Required.
  # This can also be set via the `BTP_USERNAME` environment variable.
  # username = "user@domain.com"

  # User password used to log in to SAP BTP. Required.
  # This can also be set via the `BTP_PASSWORD` environment variable.
  # password = "My-BTP-Passw0rd"

  # You will need to create a service key for the Cloud Management Service. Required.
  # You can get the instructions on how to get an access token for the SAP Cloud Management Service APIs here: https://help.sap.com/docs/btp/sap-business-technology-platform/getting-access-token-for-sap-cloud-management-service-apis.
  # This can also be set via the `BTP_CIS_SERVICE_KEY_PATH` environment variable. Required.
  # cis_service_key_path = "~/service_keys/cis_global.json"

  # URL of the Accounts Service. Optional.
  # This can also be set via the `BTP_CIS_ACCOUNTS_SERVICE_URL` environment variable.
  # cis_accounts_service_url = "https://accounts-service.cfapps.[region].hana.ondemand.com"
  
  # URL of the Entitlements Service. Optional.
  # This can also be set via the `BTP_CIS_ENTITLEMENTS_SERVICE_URL` environment variable.
  # cis_entitlements_service_url = "https://entitlements-service.cfapps.[region].hana.ondemand.com"

  # Access token to communicate with the Cloud Management Service APIs. Optional.
  # You can get the instructions on how to get an access token for the SAP Cloud Management Service APIs here: https://help.sap.com/docs/btp/sap-business-technology-platform/getting-access-token-for-sap-cloud-management-service-apis. 
  # If no access token is provided, the plugin will try getting an access token using the details provided in cis_client_id, cis_client_secret, cis_token_url, username, password.
  # This can also be set via the `BTP_CIS_ACCESS_TOKEN` environment variable.
  # cis_access_token = "eyJhbGciOiDBNsO0JxFoAaodkDJ3Pmk7cFEsEr5ml5BwNWEafrEjy8Hsxt2mVACpD8B4AIPpRuMoGE71qXGoPcW0vCugceTwN4C3xM8qYmH7DLQrdVIlSX6kydYxnRNjSO8je56ckA4oTC8wm2E2clClPhinDBN6DxHhXlB0eVJnerl4ONpxaH43PYXmHjIsArTuBGK6nCFtApIGN1OvMDPmjHFtOjNgcPCPC5GDXTt5oaB6M2gUrfD5QQVGA7L6yFQlXYPvF6BSyMxpoQXywMUwYA6oqV"

  # A service key (https://help.sap.com/docs/btp/sap-business-technology-platform/creating-service-keys) for the Central Management Service is required to get an access token.  
  # The values for cis_client_id, cis_client_secret, cis_token_url can be retrieved from it. 

  # OAuth 2.0 Client ID (field in the service key: uua.clientid). Optional.
  # This can also be set via the `BTP_CIS_CLIENT_ID` environment variable.
  # cis_client_id = "sb-ut-6y0m0wr1-ai10-1a56-4bv1-52m478h011g6-clone!b017880|cis-central!b14"

  # OAuth 2.0 Client Secret (field in the service key: uua.clientsecret). Optional.
  # This can also be set via the `BTP_CIS_CLIENT_SECRET` environment variable. Optional.
  # cis_client_secret = "44s32264-285r-7101-g2n0-g036p1m214us$vm2_UCHAN_mX1FOW0lklBj2-igBsOUG77G-nE1TWsEu="

  # OAuth 2.0 Token URL (field in the service key: uua.url). Optional.
  # The value in the service key doesn't contain the path, /oauth/token, if not specified the plugin will append it automatically.
  # This can also be set via the `BTP_CIS_TOKEN_URL` environment variable. Optional.
  # cis_token_url = "https://[global-account-subdomain].authentication.[region].hana.ondemand.com"
}

Or through environment variables:

export BTP_USERNAME=user@domain.com
export BTP_PASSWORD=My-BTP-Passw0rd
export BTP_CIS_SERVICE_KEY_PATH=~/service_keys/cis_global.json
export BTP_CIS_ACCOUNTS_SERVICE_URL=https://accounts-service.cfapps.eu10.hana.ondemand.com
export BTP_CIS_ENTITLEMENTS_SERVICE_URL=https://entitlements-service.cfapps.eu10.hana.ondemand.com
export BTP_CIS_ACCESS_TOKEN=eyJhbGciOiDBNsO0JxFoAaodkDJ3Pmk7cFEsEr5ml5BwNWEafrEjy8Hsxt2mVACpD8B4AIPpRuMoGE71qXGoPcW0vCugceTwN4C3xM8qYmH7DLQ

Run steampipe:

steampipe query

List your SAP BTP Global account details:

select
   guid,
   display_name,
   created_date,
   modified_date 
from
   btp_accounts_global_account;
+--------------------------------------+-----------------------+---------------+---------------+
| guid                                 | display_name          | created_date  | modified_date |
+--------------------------------------+-----------------------+---------------+---------------+
| 010788v8-7s64-1801-6680-l6g2253646b2 | My BTP global account | 1638221010619 | 1693587625761 |
+--------------------------------------+-----------------------+---------------+---------------+

Engines

This plugin is available for the following engines:

Engine Description
Steampipe The Steampipe CLI exposes APIs and services as a high-performance relational database, giving you the ability to write SQL-based queries to explore dynamic data. Mods extend Steampipe's capabilities with dashboards, reports, and controls built with simple HCL. The Steampipe CLI is a turnkey solution that includes its own Postgres database, plugin management, and mod support.
Postgres FDW Steampipe Postgres FDWs are native Postgres Foreign Data Wrappers that translate APIs to foreign tables. Unlike Steampipe CLI, which ships with its own Postgres server instance, the Steampipe Postgres FDWs can be installed in any supported Postgres database version.
SQLite Extension Steampipe SQLite Extensions provide SQLite virtual tables that translate your queries into API calls, transparently fetching information from your API or service as you request it.
Export Steampipe Plugin Exporters provide a flexible mechanism for exporting information from cloud services and APIs. Each exporter is a stand-alone binary that allows you to extract data using Steampipe plugins without a database.
Turbot Pipes Turbot Pipes is the only intelligence, automation & security platform built specifically for DevOps. Pipes provide hosted Steampipe database instances, shared dashboards, snapshots, and more.

Developing

Prerequisites:

Clone:

git clone https://github.com/ajmaradiaga/steampipe-plugin-btp.git
cd steampipe-plugin-btp

Build, which automatically installs the new version to your ~/.steampipe/plugins directory:

make

Configure the plugin:

cp config/* ~/.steampipe/config
vi ~/.steampipe/config/btp.spc

Try it!

steampipe query
> .inspect btp

Further reading:

Open Source & Contributing

This repository is published under the Apache 2.0 (source code) and CC BY-NC-ND (docs) licenses. Please see our code of conduct. We look forward to collaborating with you!

Steampipe is a product produced from this open source software, exclusively by Turbot HQ, Inc. It is distributed under our commercial terms. Others are allowed to make their own distribution of the software, but cannot use any of the Turbot trademarks, cloud services, etc. You can learn more in our Open Source FAQ.

Get Involved

Join #steampipe on Slack →

Want to help but don't know where to start? Pick up one of the help wanted issues: