百度智能云

All Product Document

          Baremetal Compute Sevice

          BbcClient

          BbcClient is the client of the BBC service, which provides a series of methods for developers to interact with the BBC service, including instances, tags, packages, imaging, and operation logs.

          Access BBC via AK/SK

          You can create a BbcClient by referring to the following code:

          class  Sample(): 
              def __init__(self): 
                  # User's Access Key ID 
                  AK = 'your-access-key-id'                  
                  # User's Secret Access Key 
                  SK = 'your-secret-access-key'            
          
                  # Initialize a BbcClient 
                  # Create BbcClientConfiguration 
                  config = BceClientConfiguration(credentials=BceCredentials(AK, SK)) 
                  # New BbcClient 
                  self.client = bbc_client.BbcClient(config)  

          In the above code, the variables AK and SK are assigned to the user by the system, and both are character strings, which are used to identify the user and perform signature verification for accessing the BBC.

          AK corresponds to the "Access Key ID" in the console, and SK to the "Access Key Secret" in the console. Please refer to Get AK/SK

          The above method uses the default domain name as the service address of the BBC. If the user needs to specify the domain name himself, he can specify it by passing in the endpoint parameter.

          class  Sample(): 
              def __init__(self): 
                  # User's Access Key ID 
                  AK = 'your-access-key-id'                  
                  # User's Secret Access Key 
                  SK = 'your-secret-access-key'            
                  # User-specified domain name 
                  HOST = 'domain-name' 
          
                  # Initialize a BbcClient 
                  # Create BbcClientConfiguration 
                  config = BceClientConfiguration(credentials=BceCredentials(AK, SK), endpoint=HOST) 
                  # New BbcClient 
                  client = bbc_client.BbcClient(config) 

          Note: The endpoint parameter can only be defined with the specified domain name of the areas included. If not specified, it defaults to the Beijing area http://bbc.bj.baidubce.com. BCC supports multi region selection. Please refer to the service domain name for details.

          Previous
          Initialization
          Next
          Instance