BcmClient

BCM

  • Function Release Records
  • Product Announcement
    • Site Monitor Billing Announcement
  • Product Description
    • Product Introduction
    • Core concepts
    • Product advantages
    • Product features
  • Product pricing
    • Product pricing
    • Site Monitor Pricing
  • Quick Start
  • Operation guide
    • Enter Cloud Monitor
    • Dashboard
      • Overview
      • Management Dashboard Charts
      • Management Dashboard
    • Alarm Service
      • Overview
      • Alarm strategy
      • Alarm history
      • Alarm Template
      • Alarm Notification Template
      • Alarm callback
    • Cloud product monitor
      • Instance monitor
      • Instance Group
      • View Metrics
    • Site Monitor
      • Timed Detection (Formerly Site Monitor)
        • Overview
        • Manage Timed Probe Tasks
        • Purchase Guide
        • View timed probe tasks
      • IP advanced fault diagnosis
        • Manage IP Advanced Fault Diagnosis Tasks
        • View IP Advanced Fault Diagnosis Tasks
      • Instant probe
        • Overview
        • Manage instant probe tasks
    • Event Monitor
    • Event Bus
      • Event Delivery History
      • Overview
      • Event summary
      • Event Set
      • Event Rules
        • Event Rules
        • Event content conversion
        • Event pattern
  • API Reference
    • Overview
    • Service domain
    • Error response
    • Query Monitoring Data for Partial Dimensions
    • Dashboard API
    • Common Request and Response Headers
    • Alarm Management API
    • Alarm Management Interface V2
    • Alarm history
    • Push Data API
    • Event Bus Push
    • Application Monitor
    • Dimension Value TopN and Monitoring Data Query Interface
    • Batch Query Monitoring Data Interface V2
    • Dimension Value TopN Query Interface
    • Instance Group Interface
    • Site Monitor
    • Query Latest Metric Data for Partial Dimensions
    • General Description
    • Query Data API
    • Event Monitor
    • Instant Probe
    • Event Alarm History
    • Notification Template
  • Java-SDK
    • Overview
    • Initialization
    • Install the SDK Package
    • BcmClient
    • Query Monitoring Data for Partial Dimensions
    • Dimension Value TopN and Monitoring Data Query Interface
    • Batch Query Monitoring Data Interface V2
    • Dimension Value TopN Query Interface
    • Query Latest Metric Data for Partial Dimensions
    • Query Data API
    • Alarm Strategy-related APIs
    • Batch Query Data Interface
    • Alarm History-related APIs
  • Python-SDK
    • Overview
    • Initialization
    • Install SDK
    • BcmClient
    • Query Monitoring Data for Partial Dimensions
    • Batch Query Monitoring Data Interface V2
    • Dimension Value TopN Query Interface
    • Query Latest Metric Data for Partial Dimensions
    • Query Data API
    • Alarm Strategy List API
    • Batch Data Query Interface
  • Go-SDK
    • Overview
    • Initialization
    • Install the SDK Package
    • BcmClient
    • Query Monitoring Data for Partial Dimensions
    • Dimension Value TopN and Monitoring Data Query Interface
    • Batch Query Monitoring Data Interface V2
    • Dimension Value TopN Query Interface
    • Query Latest Metric Data for Partial Dimensions
    • Query Data API
    • Alarm Strategy-related APIs
    • Alarm History-related APIs
    • Batch Data Query Interface
  • BCM-Agent
    • Functions
    • Monitoring Trend Chart
    • BCM-Agent-Frequently Asked Questions
    • Appendix
  • FAQs
    • Common Questions Overview
    • Fault-related questions
    • Configuration-related questions
    • Performance-related questions
  • Cloud Product Monitor List
    • Cloud Product Metric List (Legacy Version Hidden)
    • Cloud Product Monitor Object Type List
    • Cloud Product Event List
    • Cloud Product Metric List
      • Database
        • Cloud Database TableStorage
        • Cloud Database DocDB for MongoDB
        • Data transmission service (DTS)
        • Cloud native database GaiaDB
        • Vector Database (VectorDB)
        • Dedicated Database Cluster (DDC)
        • Cloud Database Redis
        • Cloud database RDS
        • Cloud Database HBase
      • Enterprise Application
        • Message Service for RabbitMQ
      • Network
        • Service Network Interface Card (SNIC)
        • Peering Connections
        • IPv6 gateway
        • NAT Gateway
        • Load Balancer Dedicated Cluster LBDC
        • Baidu Load Balance (BLB)
        • Network probe NP
        • Dedicated channel
        • Elastic IP EIP
        • Elastic Network Interface Card (ENIC)
        • Cloud Smart Network (CSN)
        • Dedicated gateway
        • Virtual Private Network (VPN) Gateway
        • Layer 2 Gateway LTGW
        • Physical dedicated line
      • Intelligent Big Data
        • MapReduce BMR
        • Message service for Kafka-dedicated
        • Message Service for RocketMQ
        • Baidu Stream Computing (BSC)
        • Baidu Elasticsearch
        • Log Service BLS
        • Data warehouse DORIS
      • Cloud native
        • Cloud Function Computing
        • Baidu container instance (BCI)
      • Compute
        • Baidu Cloud Compute (BCC)
        • Elastic Baremetal Compute BBC
      • Storage and CDN
        • Parallel Filesystem Service (PFS)
        • Cloud File System (CFS)
        • Content delivery network (CDN)
        • Baidu object storage (BOS)
        • Cloud Disk Server (CDS)
        • Baidu edge computing (BEC)
      • Website service
        • Baidu Cloud Virtual Host (BCH)
      • Large Model Platform
        • Qianfan Large Model Platform ModelBuilder
  • Typical Practices
    • Scenarios for Batch Creation of Alarm Strategies
    • Usage Scenarios for Different Notification Channels
  • Service Level Agreement (SLA)
    • Site Monitor Service Level Agreement SLA
  • BCM-Tool
    • Uninstallation Method
    • Installation method
    • BCM-Tool-Frequently Asked Questions
    • Functions
    • Multi-Region Service
    • Application method
All documents
menu
No results found, please re-enter

BCM

  • Function Release Records
  • Product Announcement
    • Site Monitor Billing Announcement
  • Product Description
    • Product Introduction
    • Core concepts
    • Product advantages
    • Product features
  • Product pricing
    • Product pricing
    • Site Monitor Pricing
  • Quick Start
  • Operation guide
    • Enter Cloud Monitor
    • Dashboard
      • Overview
      • Management Dashboard Charts
      • Management Dashboard
    • Alarm Service
      • Overview
      • Alarm strategy
      • Alarm history
      • Alarm Template
      • Alarm Notification Template
      • Alarm callback
    • Cloud product monitor
      • Instance monitor
      • Instance Group
      • View Metrics
    • Site Monitor
      • Timed Detection (Formerly Site Monitor)
        • Overview
        • Manage Timed Probe Tasks
        • Purchase Guide
        • View timed probe tasks
      • IP advanced fault diagnosis
        • Manage IP Advanced Fault Diagnosis Tasks
        • View IP Advanced Fault Diagnosis Tasks
      • Instant probe
        • Overview
        • Manage instant probe tasks
    • Event Monitor
    • Event Bus
      • Event Delivery History
      • Overview
      • Event summary
      • Event Set
      • Event Rules
        • Event Rules
        • Event content conversion
        • Event pattern
  • API Reference
    • Overview
    • Service domain
    • Error response
    • Query Monitoring Data for Partial Dimensions
    • Dashboard API
    • Common Request and Response Headers
    • Alarm Management API
    • Alarm Management Interface V2
    • Alarm history
    • Push Data API
    • Event Bus Push
    • Application Monitor
    • Dimension Value TopN and Monitoring Data Query Interface
    • Batch Query Monitoring Data Interface V2
    • Dimension Value TopN Query Interface
    • Instance Group Interface
    • Site Monitor
    • Query Latest Metric Data for Partial Dimensions
    • General Description
    • Query Data API
    • Event Monitor
    • Instant Probe
    • Event Alarm History
    • Notification Template
  • Java-SDK
    • Overview
    • Initialization
    • Install the SDK Package
    • BcmClient
    • Query Monitoring Data for Partial Dimensions
    • Dimension Value TopN and Monitoring Data Query Interface
    • Batch Query Monitoring Data Interface V2
    • Dimension Value TopN Query Interface
    • Query Latest Metric Data for Partial Dimensions
    • Query Data API
    • Alarm Strategy-related APIs
    • Batch Query Data Interface
    • Alarm History-related APIs
  • Python-SDK
    • Overview
    • Initialization
    • Install SDK
    • BcmClient
    • Query Monitoring Data for Partial Dimensions
    • Batch Query Monitoring Data Interface V2
    • Dimension Value TopN Query Interface
    • Query Latest Metric Data for Partial Dimensions
    • Query Data API
    • Alarm Strategy List API
    • Batch Data Query Interface
  • Go-SDK
    • Overview
    • Initialization
    • Install the SDK Package
    • BcmClient
    • Query Monitoring Data for Partial Dimensions
    • Dimension Value TopN and Monitoring Data Query Interface
    • Batch Query Monitoring Data Interface V2
    • Dimension Value TopN Query Interface
    • Query Latest Metric Data for Partial Dimensions
    • Query Data API
    • Alarm Strategy-related APIs
    • Alarm History-related APIs
    • Batch Data Query Interface
  • BCM-Agent
    • Functions
    • Monitoring Trend Chart
    • BCM-Agent-Frequently Asked Questions
    • Appendix
  • FAQs
    • Common Questions Overview
    • Fault-related questions
    • Configuration-related questions
    • Performance-related questions
  • Cloud Product Monitor List
    • Cloud Product Metric List (Legacy Version Hidden)
    • Cloud Product Monitor Object Type List
    • Cloud Product Event List
    • Cloud Product Metric List
      • Database
        • Cloud Database TableStorage
        • Cloud Database DocDB for MongoDB
        • Data transmission service (DTS)
        • Cloud native database GaiaDB
        • Vector Database (VectorDB)
        • Dedicated Database Cluster (DDC)
        • Cloud Database Redis
        • Cloud database RDS
        • Cloud Database HBase
      • Enterprise Application
        • Message Service for RabbitMQ
      • Network
        • Service Network Interface Card (SNIC)
        • Peering Connections
        • IPv6 gateway
        • NAT Gateway
        • Load Balancer Dedicated Cluster LBDC
        • Baidu Load Balance (BLB)
        • Network probe NP
        • Dedicated channel
        • Elastic IP EIP
        • Elastic Network Interface Card (ENIC)
        • Cloud Smart Network (CSN)
        • Dedicated gateway
        • Virtual Private Network (VPN) Gateway
        • Layer 2 Gateway LTGW
        • Physical dedicated line
      • Intelligent Big Data
        • MapReduce BMR
        • Message service for Kafka-dedicated
        • Message Service for RocketMQ
        • Baidu Stream Computing (BSC)
        • Baidu Elasticsearch
        • Log Service BLS
        • Data warehouse DORIS
      • Cloud native
        • Cloud Function Computing
        • Baidu container instance (BCI)
      • Compute
        • Baidu Cloud Compute (BCC)
        • Elastic Baremetal Compute BBC
      • Storage and CDN
        • Parallel Filesystem Service (PFS)
        • Cloud File System (CFS)
        • Content delivery network (CDN)
        • Baidu object storage (BOS)
        • Cloud Disk Server (CDS)
        • Baidu edge computing (BEC)
      • Website service
        • Baidu Cloud Virtual Host (BCH)
      • Large Model Platform
        • Qianfan Large Model Platform ModelBuilder
  • Typical Practices
    • Scenarios for Batch Creation of Alarm Strategies
    • Usage Scenarios for Different Notification Channels
  • Service Level Agreement (SLA)
    • Site Monitor Service Level Agreement SLA
  • BCM-Tool
    • Uninstallation Method
    • Installation method
    • BCM-Tool-Frequently Asked Questions
    • Functions
    • Multi-Region Service
    • Application method
  • Document center
  • arrow
  • BCM
  • arrow
  • Java-SDK
  • arrow
  • BcmClient
Table of contents on this page
  • Create BcmClient
  • Create a new BcmClient with AK/SK
  • Configure HTTPS access to BCM
  • Configure BcmClient
  • Use a proxy
  • Set network parameters

BcmClient

Updated at:2025-11-03

BcmClient serves as the client for BCM services, offering developers various methods to interact with BCM services.

Create BcmClient

Create a new BcmClient with AK/SK

Users can refer to the following code to create a new BcmClient to access BCC with AK/SK:

Java
1public class Sample {
2public static void main(String[] args) {
3 String ACCESS_KEY_ID =<your-access-key-id>;                   // User’s Access Key ID
4 String SECRET_ACCESS_KEY =<your-secret-access-key>;           // User’s Secret Access Key
5        
6 // Initialize a BcmClient
7    BcmClientConfiguration config = new BcmClientConfiguration();
8    config.setCredentials(new DefaultBceCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY));
9    BcmClient client = new BcmClient(config);
10    }
11}

In the code above, ACCESS_KEY_ID corresponds to “Access Key ID” in the console. SECRET_ACCESS_KEY corresponds to “Access Key Secret” in the console. For the method to retrieve them, refer to the Guide - [Manage ACCESSKEY](Reference/Retrieve AK and SK/How to Obtain AKSK.md).

The method above uses the default domain as the BCM service address. To use a custom domain, pass the ENDPOINT parameter.

Java
1String ACCESS_KEY_ID =<your-access-key-id>;                   // User’s Access Key ID
2 String SECRET_ACCESS_KEY =<your-secret-access-key>;           // User’s Secret Access Key
3 String ENDPOINT = <domain-name>;                               // User-defined domain name
4BcmClientConfiguration config = new BcmClientConfiguration();
5config.setCredentials(new DefaultBceCredentials(ACCESS_KEY_ID,SECRET_ACCESS_KEY));
6config.setEndpoint(ENDPOINT);
7BcmClient client = new BcmClient(config);

Note:The ENDPOINT parameter must use region-specific domains (e.g., http://aihc.bj.baidubce.com for Beijing). If unspecified, it defaults to the Beijing regionhttp://bcm.bj.baidubce.com.

Configure HTTPS access to BCM

BCM supports HTTPS transport protocol. You can use HTTPS to access the BCM service in the BCM Java SDK in the following two ways:

  • Specify HTTPS in the endpoint:

    Java
    1String endpoint = "https://bcm.bj.baidubce.com";
    2String ak = "ak";
    3String sk = "sk";
    4BcmClientConfiguration config = new BcmClientConfiguration();
    5config.setCredentials(new DefaultBceCredentials(ak, sk));
    6BcmClient client = new BcmClient(config);
  • Configure HTTPS by calling setProtocol:

    Java
    1String endpoint = "bcm.bj.baidubce.com"; // endpoint without protocol
    2String ak = "ak";
    3String sk = "sk";
    4BcmClientConfiguration config = new BcmClientConfiguration();
    5config.setCredentials(new DefaultBceCredentials(ak, sk));
    6config.setEndpoint(ENDPOINT);
    7 config.setProtocol(Protocol.HTTPS); // Defaults to HTTP if unspecified
    8BcmClient client = new BcmClient(config);
    Plain Text
    1> **Note:** If the endpoint already includes a protocol, the protocol in the endpoint will take precedence, and the setProtocol() method will be ignored.
    Java
    1String endpoint = "http://bcm.bj.baidubce.com";
    2String ak = "ak";
    3String sk = "sk";
    4BcmClientConfiguration config = new BcmClientConfiguration();
    5config.setCredentials(new DefaultBceCredentials(ak, sk));
    6config.setEndpoint(ENDPOINT);    
    7 config.setProtocol(Protocol.HTTPS); // Invalid operation if specified in endpoint, applicable to HTTP cases
    8BcmClient client = new BcmClient(config);

Configure BcmClient

If users need to configure detailed parameters for BcmClient, they can specify the BcmClientConfiguration object when creating BcmClient. BcmClientConfiguration is the configuration class for BCM services, allowing configuration of parameters like proxies or the maximum number of client connections.

Use a proxy

The following code snippet enables the client to access BCM service using a proxy:

Java
1String ACCESS_KEY_ID =<your-access-key-id>;                   // User’s Access Key ID
2 String SECRET_ACCESS_KEY =<your-secret-access-key>;           // User’s Secret Access Key
3 String ENDPOINT = <domain-name>;                               // User-defined domain name
4 // Create BcmClientConfiguration instance
5BcmClientConfiguration config = new BcmClientConfiguration();
6 // Configure proxy to local port 8080
7config.setProxyHost("127.0.0.1");
8config.setProxyPort(8080);
9 // Create BCM client
10config.setCredentials(new DefaultBceCredentials(ACCESS_KEY_ID,SECRET_ACCESS_KEY));
11config.setEndpoint(ENDPOINT);
12BcmClient client = new BcmClient(config);

All client requests will then be routed through the proxy at 127.0.0.1:8080.

For verified proxies, configure credentials:

Java
1// Create BcmClientConfiguration instance
2BcmClientConfiguration config = new BcmClientConfiguration();
3    
4 // Configure proxy to local port 8080
5config.setProxyHost("127.0.0.1");
6config.setProxyPort(8080);
7    
8 // Set username and password
9 config.setProxyUsername(<username>);                             // Username
10 config.setProxyPassword(<password>);                             // Password

Set network parameters

Users may set the basic network parameters with BcmClientConfiguration:

Java
1BcmClientConfiguration config = new BcmClientConfiguration();
2    
3 // Set maximum number of HTTP connections to 10
4config.setMaxConnections(10);
5    
6 // Set TCP connection timeout to 5,000 milliseconds
7config.setConnectionTimeoutInMillis(5000);
8    
9 // Set timeout for Socket data transmission to 2,000 milliseconds
10config.setSocketTimeout(2000);

Parameter description

The following parameters can be configured via BcmClientConfiguration:

Parameters Description
CnameEnabled Use CNAME to access BCM resources
ConnectionTimeoutInMillis Timeout for establishing TCP connections (unit: ms)
Credentials Client credentials for signing HTTP requests with BCE
EnableHttpAsyncPut Asynchronous put
Endpoint Access a domain name
LocalAddress Local address
MaxConnections Maximum allowable HTTP connections
Protocol Connection protocol type
ProxyDomain Windows domain for NTLM-verified proxy
ProxyHost Proxy server host address
ProxyPassword Proxy verification password
ProxyPort Proxy server port
ProxyPreemptiveAuthenticationEnabled Enable user agent verification or not
ProxyUsername Proxy verification username
ProxyWorkstation NTLM proxy workstation name
Region Region
RetryPolicy Retry policy for connections
SocketBufferSizeInBytes Buffer size for socket operations
SocketTimeoutInMillis Timeout for socket data transmission (unit: ms)
StreamBufferSize Stream file buffer size
UserAgent User agent, refers to HTTP’s User-Agent header
RedirectsEnabled Whether HTTP redirection is enabled. Enabled by default.

Previous
Install the SDK Package
Next
Query Monitoring Data for Partial Dimensions