はじめに
Db2 on Cloud REST APIの説明資料を作る際、Db2 on Cloud REST API DocumentのMethod一覧を入れたくなり、pythonのBeautifulSoup4を使って作りました。
せっかくなので公開しておきます。
ちなみに、Db2 on Cloud REST API Documentの左側のメニュー、「Methods」の下にある一覧のことです。
セクションになっていて全部開くことはできないので、Db2 on Cloud REST API Documentで一覧では見れません。一覧で見たいですよね、たぶん。。。。
Db2 on Cloud REST API できること一覧(Method一覧)
Authentication
- Request a new access token
- Returns public key of Json Web Token
- Sets a new password using dswebToken
Backup and restore
Copy
Connection
Data load
- Lists all data load jobs using Db2 load utility technology
- Creates a data load job
- Returns details about a load job including its progress
- Removes load job from history
- Dowloads log file for a data load job
Db2 update
Disaster recovery
- List disaster recovery enablement information
- Enable disaster recovery
- List disaster recovery remotes pair information
- Perform disaster recovery takeover
- Resync disaster recovery remote pair
- Check current disaster recovery resync status
File storage
- Deletes a file in the Db2 temporary cloud object storage
- Download file from Db2 temporary cloud object storage
- Uploads a file to Db2 temporary cloud object storage
Monitoring
- Returns overall status of system components
- Lists active database connections DB ADMIN ONLY
- Terminates a database connection DB ADMIN ONLY
- Returns current storage usage DB ADMIN ONLY
- Returns storage usage history DB ADMIN ONLY
- Storage utilization by schema DB ADMIN ONLY
- Storage utilization of a schema DB ADMIN ONLY
- Return the number of statements for a specified time frame. DB ADMIN ONLY
- Return the histogram of response time for a specified time frame. DB ADMIN ONLY
- Return the average response time for a specified time frame. DB ADMIN ONLY
- Return the list of average response time for a specified time frame. DB ADMIN ONLY
- Return the average number of statements executed every minutes for a specified time frame. DB ADMIN ONLY
- Return numbers of statements executed every minutes for a specified time frame. DB ADMIN ONLY
- Return the average number of rows read(rows/min) for a specified time frame. DB ADMIN ONLY
- Return the numbers of rows read(rows/min) for a specified time frame. DB ADMIN ONLY
- Return the maximum number of concurrent connections for a specified time frame DB ADMIN ONLY
- Return maximum numbers of concurrent connections for a specified time frame. DB ADMIN ONLY
- Return the maximum lockwaits per minute for a specified time frame. DB ADMIN ONLY
- Return the maximum lockwaits per minute for a specified time frame. DB ADMIN ONLY
- Return the maximum usage percentage of logs for a specified time frame. DB ADMIN ONLY
- Return the maximum usage percentages of logs for a specified time frame. DB ADMIN ONLY
- Return the maximum percent of node CPU usage for a specified time frame. DB ADMIN ONLY
- Return the percent of node CPU usage for a specified time frame. DB ADMIN ONLY
- Return the maximum percent of node memory usage for a specified time frame. DB ADMIN ONLY
- Return the percent of node memory usage for a specified time frame. DB ADMIN ONLY
- Return the maximum usage percent of storage for a specified time frame. DB ADMIN ONLY
- Return the usage percent of storage for a specified time frame. DB ADMIN ONLY
- Return the time spent in each operation for a specified time frame. DB ADMIN ONLY
- Return a table storage usage in a time range DB ADMIN ONLY
- Returns a list for tables storage DB ADMIN ONLY
- Returns a table storage DB ADMIN ONLY
- Returns a list for schemas storage DB ADMIN ONLY
- Return a schema used storage in a time range DB ADMIN ONLY
- Returns a schema storage DB ADMIN ONLY
- Runs a tables storage collection DB ADMIN ONLY
- Returns a list of inflight executions
- Returns a list of current inflight executions
- Returns a infight execution detail
- Terminates a statement DB ADMIN ONLY
- Returns a list of connections
- Returns a list of current connections
- Returns a connection detail
- Terminates a database connection DB ADMIN ONLY
- Returns a list of timeseries of a connection
- Returns performance metrics for schemas DB ADMIN ONLY
- Returns performance metrics for schemas DB ADMIN ONLY
- Returns performance metrics for one schema DB ADMIN ONLY
- Returns performance metrics on all members for one schema DB ADMIN ONLY
- Returns performance metrics timeseries for one schema DB ADMIN ONLY
- Returns performance of tables DB ADMIN ONLY
- Returns current performance of tables DB ADMIN ONLY
- Returns performance of one table DB ADMIN ONLY
- Returns performance on all members for one table DB ADMIN ONLY
- Returns performance timeseries for one table DB ADMIN ONLY
- Returns performance of tables and schemas DB ADMIN ONLY
- Returns current performance of tables and schemas DB ADMIN ONLY
SQL
- Executes SQL statements
- Fetches partial results of a SQL job execution
- Returns the results of a SQL query to CSV
Scaling
- Create a scaling request
- Get supported scaling ranges and current allocated resources
- View scaling history
System information
Tasks
Utilities
Database Objects
- Query the list of object schemas
- Create schema
- Drops an empty schema
- Get single object privilege
- Privilege list of selected objects
- Grant or revoke privileges
- Create a new table
- Drop table
- Get table definition
- Query table data
- Get column detail properties
- Get the metadata type
- Generate table DDL
- Get distributin keys
- Get data distributin property
- Get partition expressions
- Get data partitions
- Query view detail properties
- Drop views
- Query view data
- Get View definition
- Generate view DDL
- Get the dependencies of the object
- Query bufferpool detail properties
- Query constraint detail properties
- Query index detail properties
- Query trigger detail properties
- Query MQT detail properties
- Query UDF detail properties
- Query tablespace detail properties
- Query procedure detail properties
- Query sequence detail properties
- Query package detail properties
- Query UDT detail properties
- Query alias detail properties
- Get table detail properties
- Create alias
- Drop alias
- Generate Alias DDL
- Query alias data
- Get the SQL statement template for creating MQT table
- Delete mqt tables
- Get the definition of MQT table
- Get the data of specified mqt table
- Get authentications through the authid filter
- Get the privieles of auth id
- Get SQL statement of grant or revoke privileges
- Add new role
- Grant or revoke the privilges of role
- Delete one role
- Get the membership of authid
- Get SQL statement of grant or revoke role
- Get SQL statement for grant or revoke privileges
- Grant or revole privileges for multiple objects and objects type
- Get the SQL statement for grant or revoke multiple roles
- Grant or revoke multiple roles
- Generate workload DDL
- Lists workloads
- Drop sequences
- Drop procedures
- Retrieve parameters for procedure
- Generate create procedure template
- Drop functions
- Retrieve parameters for specific udf
- Generate create function template
- Drop User-defined Types
- Retrieve row definition for User-defined Type object
- Generate Create User-defined Types template
Users
- Returns the list of users
- Creates a new user. PLATFORM ADMIN ONLY
- Get a specific user by ID
- Updates an existing user PLATFORM ADMIN ONLY
- Deletes an existing user PLATFORM ADMIN ONLY
- Locks a user account indefinitely. PLATFORM ADMIN ONLY
- Unlocks a user account PLATFORM ADMIN ONLY
リストは以上です。
せっかくなので上記リストを作成したコードです
html読んでどこにあるか見て作りました! マークダウン形式でprintしてます。
import requests
from bs4 import BeautifulSoup
load_url = "https://cloud.ibm.com/apidocs/db2-on-cloud/db2-on-cloud-v4"
html = requests.get(load_url)
soup = BeautifulSoup(html.content, "lxml")
category_list = soup.find_all('li', attrs={ 'class': 'bx--side-nav__item apidocs-sidebar__endpoint has-heading apidocs-sidebar__endpoint-group-linked' })
for category in category_list:
print(f"# {category['title']}")
sub_cat_link_list = category.find_all('a', attrs={ 'class': 'bx--side-nav__link' })
for sub_cat_link in sub_cat_link_list:
sub_cat = sub_cat_link.find('span', attrs={ 'class': 'bx--side-nav__link-text' })
print(f'- [{sub_cat.text}]({load_url}{sub_cat_link["href"]})')
print("")