def describe_resources()

in source/state_machine_handler.py [0:0]


    def describe_resources(self):
        try:
            self.logger.info("Executing: " + self.__class__.__name__ + "/" + inspect.stack()[0][3])
            # check if the event is coming from STNO Management Console
            if self.event.get('AdminAction') is None:
                # extract subnet id from the ARN
                resource_id = self._extract_resource_id()
                # if event is from VPC tagging
                if resource_id.startswith("vpc"):
                    self.logger.info('Tag Change on VPC: {}'.format(resource_id))
                    self.event.update({'VpcId': resource_id})
                    self.event.update({'TagEventSource': 'vpc'})
                    # get VPC details
                    self._describe_vpc()
                # if event from Subnet tagging
                elif resource_id.startswith("subnet"):
                    self.logger.info('Tag Change on Subnet: {}'.format(resource_id))
                    self.event.update({'SubnetId': resource_id})
                    self.event.update({'TagEventSource': 'subnet'})
                    # get subnet details
                    self._describe_subnet()
                    # get VPC details
                    self._describe_vpc()
                else:
                    self.logger.info('Resource Id is neither a VPC nor a subnet.')
                    raise Exception('Application Exception: Resource Id is neither a VPC nor a subnet.')
            elif self.event.get('TagEventSource') == 'vpc':
                self._set_event_variables()
                # get VPC details
                self._describe_vpc()
            elif self.event.get('TagEventSource') == 'subnet':
                self._set_event_variables()
                # get subnet details
                self._describe_subnet()
                # get VPC details
                self._describe_vpc()

            if self.event.get('time') is None:
                self.event.update({'time': current_time()})
            return self.event
        except Exception as e:
            message = self._message(inspect.stack()[0][3], e)
            self.logger.exception(message)
            self._update_ddb_failed(e)
            raise