|
@@ -27,6 +27,7 @@ class IOTClient(IOTObject):
|
|
|
def __init__(self, region_id=1):
|
|
|
|
|
|
if region_id == 1:
|
|
|
+ # 中国宁夏
|
|
|
self.client = boto3.client('iot', region_name=AWS_IOT_SES_ACCESS_CHINA_REGION,
|
|
|
aws_access_key_id=AWS_IOT_SES_ACCESS_CHINA_ID,
|
|
|
aws_secret_access_key=AWS_IOT_SES_ACCESS_CHINA_SECRET)
|
|
@@ -35,6 +36,7 @@ class IOTClient(IOTObject):
|
|
|
self.iotrole = AWS_IOT_SES_ACCESS_CHINA_ROLE
|
|
|
|
|
|
if region_id == 2:
|
|
|
+ # 亚太新加坡
|
|
|
self.client = boto3.client('iot', region_name=AWS_IOT_SES_ACCESS_FOREIGN_REGION_ASIA,
|
|
|
aws_access_key_id=AWS_IOT_SES_ACCESS_FOREIGN_ID,
|
|
|
aws_secret_access_key=AWS_IOT_SES_ACCESS_FOREIGN_SECRET)
|
|
@@ -42,6 +44,7 @@ class IOTClient(IOTObject):
|
|
|
self.iotrole = AWS_IOT_SES_ACCESS_FOREIGN_ROLE
|
|
|
|
|
|
if region_id == 3:
|
|
|
+ # 美东弗吉尼亚
|
|
|
self.client = boto3.client('iot', region_name=AWS_IOT_SES_ACCESS_FOREIGN_REGION_AMERICA,
|
|
|
aws_access_key_id=AWS_IOT_SES_ACCESS_FOREIGN_ID,
|
|
|
aws_secret_access_key=AWS_IOT_SES_ACCESS_FOREIGN_SECRET)
|
|
@@ -49,6 +52,7 @@ class IOTClient(IOTObject):
|
|
|
self.iotrole = AWS_IOT_SES_ACCESS_FOREIGN_ROLE
|
|
|
|
|
|
if region_id == 4:
|
|
|
+ # 西欧爱尔兰
|
|
|
self.client = boto3.client('iot', region_name=AWS_IOT_SES_ACCESS_FOREIGN_REGION_EUROPE,
|
|
|
aws_access_key_id=AWS_IOT_SES_ACCESS_FOREIGN_ID,
|
|
|
aws_secret_access_key=AWS_IOT_SES_ACCESS_FOREIGN_SECRET)
|
|
@@ -70,7 +74,7 @@ class IOTClient(IOTObject):
|
|
|
}
|
|
|
return res
|
|
|
|
|
|
- def create_keys_and_certificate(self, ThingNameSuffix, thingGroup, response):
|
|
|
+ def register_to_iot_core(self, ThingNameSuffix, thingGroup, response):
|
|
|
try:
|
|
|
result = self.client.create_keys_and_certificate(setAsActive=True)
|
|
|
res = {
|