diff --git a/src/spaceone/inventory/conf/cloud_service_conf.py b/src/spaceone/inventory/conf/cloud_service_conf.py index f6987bd9..d22b6c81 100644 --- a/src/spaceone/inventory/conf/cloud_service_conf.py +++ b/src/spaceone/inventory/conf/cloud_service_conf.py @@ -12,34 +12,34 @@ DEFAULT_VULNERABLE_PORTS = "22,3306" CLOUD_SERVICE_GROUP_MAP = { - "IAM": "IAMConnectorManager", - "DynamoDB": "DynamoDBConnectorManager", - "Lambda": "LambdaConnectorManager", - "CloudFront": "CloudFrontConnectorManager", - "RDS": "RDSConnectorManager", - "Route53": "Route53ConnectorManager", - "S3": "S3ConnectorManager", - "ElastiCache": "ElastiCacheConnectorManager", - "APIGateway": "APIGatewayConnectorManager", - "DirectConnect": "DirectConnectConnectorManager", - "EFS": "EFSConnectorManager", - "DocumentDB": "DocumentDBConnectorManager", - "ECS": "ECSConnectorManager", - "Redshift": "RedshiftConnectorManager", - "EKS": "EKSConnectorManager", - "SQS": "SQSConnectorManager", - "KMS": "KMSConnectorManager", - "ECR": "ECRConnectorManager", - "CloudTrail": "CloudTrailConnectorManager", - "SNS": "SNSConnectorManager", - "SecretsManager": "SecretsManagerConnectorManager", - "ELB": "ELBConnectorManager", - "VPC": "VPCConnectorManager", - "ACM": "ACMConnectorManager", - "KinesisDataStream": "KinesisDataStreamConnectorManager", - "MSK": "MSKConnectorManager", - "KinesisFirehose": "KinesisFirehoseConnectorManager", - "Lightsail": "LightsailConnectorManager", + # "IAM": "IAMConnectorManager", + # "DynamoDB": "DynamoDBConnectorManager", + # "Lambda": "LambdaConnectorManager", + # "CloudFront": "CloudFrontConnectorManager", + # "RDS": "RDSConnectorManager", + # "Route53": "Route53ConnectorManager", + # "S3": "S3ConnectorManager", + # "ElastiCache": "ElastiCacheConnectorManager", + # "APIGateway": "APIGatewayConnectorManager", + # "DirectConnect": "DirectConnectConnectorManager", + # "EFS": "EFSConnectorManager", + # "DocumentDB": "DocumentDBConnectorManager", + # "ECS": "ECSConnectorManager", + # "Redshift": "RedshiftConnectorManager", + # "EKS": "EKSConnectorManager", + # "SQS": "SQSConnectorManager", + # "KMS": "KMSConnectorManager", + # "ECR": "ECRConnectorManager", + # "CloudTrail": "CloudTrailConnectorManager", + # "SNS": "SNSConnectorManager", + # "SecretsManager": "SecretsManagerConnectorManager", + # "ELB": "ELBConnectorManager", + # "VPC": "VPCConnectorManager", + # "ACM": "ACMConnectorManager", + # "KinesisDataStream": "KinesisDataStreamConnectorManager", + # "MSK": "MSKConnectorManager", + # "KinesisFirehose": "KinesisFirehoseConnectorManager", + # "Lightsail": "LightsailConnectorManager", "CloudWatch": "CloudWatchConnectorManager", # Not used services # "EC2": "EC2ConnectorManager", diff --git a/src/spaceone/inventory/connector/aws_cloud_watch_connector/connector.py b/src/spaceone/inventory/connector/aws_cloud_watch_connector/connector.py index efddca84..ad8f0fce 100644 --- a/src/spaceone/inventory/connector/aws_cloud_watch_connector/connector.py +++ b/src/spaceone/inventory/connector/aws_cloud_watch_connector/connector.py @@ -86,6 +86,7 @@ def request_alarms_data(self, region_name: str) -> List[Table]: self._set_alarm_conditions(raw_alarm) self._set_alarm_actions(raw_alarm) self._set_alarm_history(raw_alarm) + tags = self._get_alarms_tags(raw_alarm.get("AlarmArn")) alarms_vo = Alarms(raw_alarm, strict=False) self.alarms.append(alarms_vo) @@ -94,6 +95,7 @@ def request_alarms_data(self, region_name: str) -> List[Table]: "data": alarms_vo, "name": alarms_vo.name, "account": self.account_id, + "tags": self.convert_tags_to_dict_type(tags) } except Exception as e: @@ -177,6 +179,10 @@ def _set_alarm_history(self, raw_alarm: Alarms) -> None: } ) + def _get_alarms_tags(self, alarm_arn: str): + response = self.client.list_tags_for_resource(ResourceARN=alarm_arn) + return response["Tags"] + @staticmethod def _convert_int_type(value): if isinstance(value, float) and value.is_integer():