def to_cloudformation(self, **kwargs):
resources = []<EOL>function = kwargs.get('<STR_LIT>')<EOL>if not function:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if self.Method is not None:<EOL><INDENT>self.Method = self.Method.lower()<EOL><DEDENT>resources.extend(self._get_permissions(kwargs))<EOL>explicit_api = kwargs['<STR_LIT>']<EOL>if explicit_api.get("<STR_LIT>"):<EOL><INDENT>self._add_swagger_integration(explicit_api, function)<EOL><DEDENT>return resources<EOL>
If the Api event source has a RestApi property, then simply return the Lambda Permission resource allowing
        API Gateway to call the function. If no RestApi is provided, then additionally inject the path, method, and the
        x-amazon-apigateway-integration into the Swagger body for a provided implicit API.

        :param dict kwargs: a dict containing the implicit RestApi to be modified, should no explicit RestApi \
                be provided.
        :returns: a list of vanilla CloudFormation Resources, to which this Api event expands
        :rtype: list