diff --git a/cid/base.py b/cid/base.py index 0086ae86..d14f9570 100644 --- a/cid/base.py +++ b/cid/base.py @@ -21,6 +21,12 @@ def __init__(self, session: Session) -> None: def account_id(self) -> str: return self.awsIdentity.get('Account') + @property + def domain(self) -> str: + if self.region.startswith('cn-'): + return 'amazonaws.cn' + return 'aws.amazon.com' + @property def awsIdentity(self) -> dict: if not self._awsIdentity: diff --git a/cid/common.py b/cid/common.py index 4a7aa831..6c3d82f7 100644 --- a/cid/common.py +++ b/cid/common.py @@ -45,7 +45,7 @@ def __init__(self, **kwargs) -> None: self.plugins = self.__loadPlugins() self._clients = dict() self._visited_views = [] # Views updated in the current session - self.qs_url = 'https://{region}.quicksight.aws.amazon.com/sn/dashboards/{dashboard_id}' + self.qs_url = 'https://{region}.quicksight.{domain}/sn/dashboards/{dashboard_id}' self.all_yes = kwargs.get('yes') self.verbose = kwargs.get('verbose') set_parameters(kwargs, self.all_yes) @@ -75,7 +75,8 @@ def aws_login(self): logger.info(f'AWS profile name: {self.base.session.profile_name}') self.qs_url_params = { 'account_id': self.base.account_id, - 'region': self.base.session.region_name + 'region': self.base.session.region_name, + 'domain': self.base.domain, } except (NoCredentialsError, CredentialRetrievalError): raise CidCritical('Error: Not authenticated, please check AWS credentials')