Support Questions
Find answers, ask questions, and share your expertise

CM API returns error

CM API returns error

New Contributor

from cm_api.api_client import ApiResource
from cm_api.endpoints.types import *

TARGET_CM_HOST = "http://10.xxx.xx.xx:7180/"

api_root = ApiResource(TARGET_CM_HOST, username="admin", password="auth")
cm = api_root.get_cloudera_manager()

ACCESS_KEY=<accessKey>
SECRET_KEY=<SecretKey>
TYPE_NAME = 'AWS_ACCESS_KEY_AUTH'
account_configs ={'aws_access_key': ACCESS_KEY,'aws_secret_key': SECRET_KEY}

cm.api.create_external_account("cloudAccount1","cloudAccount1",TYPE_NAME,account_configs=account_configs)

 

 

This program return AttributeError: 'ClouderaManager' object has no attribute 'api'

 

Please suggest the version which contains attribute 'api' in it.

1 REPLY 1

Re: CM API returns error

Rising Star

@AK_ 

 

The target_cm_host should have the value as below. Could you please update this and let us know if this helps.

TARGET_CM_HOST = "target.cm.cloudera.com"

 Also, please review the below documentation to automate BDR

https://docs.cloudera.com/documentation/enterprise/latest/topics/cm_bdr_howto_api.html#bdr_api_1

 

I hope this helps.

 

Regards,

Tarun

 

Was your question answered? Make sure to mark the answer as the accepted solution.

If you find a reply useful, say thanks by clicking on the thumbs up button.