# Path: lamvery/actions/base.py
# class BaseAction:
# 
#     __metaclass__ = ABCMeta
# 
#     _logger = None
# 
#     def __init__(self, args):
#         self._config = Config(args.conf_file)
#         self._dry_run = False
#         self._alias = None
# 
#         if hasattr(args, 'alias'):
#             self._alias = args.alias
# 
#         logger_name = 'lamvery'
#         if hasattr(args, 'dry_run'):
#             self._dry_run = args.dry_run
#             if self._dry_run:
#                 logger_name = '(Dry run) lamvery'
# 
#         self._logger = get_logger(logger_name)
# 
#     @abstractmethod
#     def action(self):
#         raise NotImplementedError
# 
#     def _get_client(self, cls):
#         return cls(
#             region=self._config.get_region(),
#             profile=self._config.get_profile(),
#             dry_run=self._dry_run)
# 
#     def get_lambda_client(self):
#         return self._get_client(LambdaClient)
# 
#     def get_kms_client(self):
#         return self._get_client(KmsClient)
# 
#     def get_events_client(self):
#         return self._get_client(EventsClient)
# 
#     def get_logs_client(self):
#         return self._get_client(LogsClient)
# 
#     def get_apigateway_client(self):
#         return self._get_client(ApiGatewayClient)
# 
#     def get_alias_name(self):
#         if self._alias is not None:
#             return self._alias
#         return self._config.get_default_alias()
# 
#     def _get_diff(self, remote, local, keys):
#         diff = {}
#         for k in keys:
#             r = remote.get(k[0])
#             l = local.get(k[1])
#             if r == l:
#                 diff[k[1]] = None
#             else:
#                 diff[k[1]] = (r, l,)
#         return diff
# 
#     def _print_diff(self, prefix, remote, local, keys):
#         diff = self._get_diff(remote, local, keys)
#         for k, v in diff.items():
#             if v is not None:
#                 self._logger.warn(
#                     '{p} {k}: {r} -> {l}'.format(p=prefix, k=k, r=v[0], l=v[1]))


import json
import re
import hashlib
from datetime import datetime
from datadiff import diff
from lamvery.actions.base import BaseAction
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import TerminalFormatter
"stage-variables" : {
#foreach($key in $stageVariables.keySet())
"$key" : "$util.escapeJavaScript($stageVariables.get($key))"
    #if($foreach.hasNext),#end
#end
},
"context" : {
    "account-id" : "$context.identity.accountId",
    "api-id" : "$context.apiId",
    "api-key" : "$context.identity.apiKey",
    "authorizer-principal-id" : "$context.authorizer.principalId",
    "caller" : "$context.identity.caller",
    "cognito-authentication-provider" : "$context.identity.cognitoAuthenticationProvider",
    "cognito-authentication-type" : "$context.identity.cognitoAuthenticationType",
    "cognito-identity-id" : "$context.identity.cognitoIdentityId",
    "cognito-identity-pool-id" : "$context.identity.cognitoIdentityPoolId",
    "http-method" : "$context.httpMethod",
    "stage" : "$context.stage",
    "source-ip" : "$context.identity.sourceIp",
    "user" : "$context.identity.user",
    "user-agent" : "$context.identity.userAgent",
    "user-arn" : "$context.identity.userArn",
    "request-id" : "$context.requestId",
    "resource-id" : "$context.resourceId",
    "resource-path" : "$context.resourcePath"
    }
}
'''



# Path: lamvery/actions/base.py
# class BaseAction:
# 
#     __metaclass__ = ABCMeta
# 
#     _logger = None
# 
#     def __init__(self, args):
#         self._config = Config(args.conf_file)
#         self._dry_run = False
#         self._alias = None
# 
#         if hasattr(args, 'alias'):
#             self._alias = args.alias
# 
#         logger_name = 'lamvery'
#         if hasattr(args, 'dry_run'):
#             self._dry_run = args.dry_run
#             if self._dry_run:
#                 logger_name = '(Dry run) lamvery'
# 
#         self._logger = get_logger(logger_name)
# 
#     @abstractmethod
#     def action(self):
#         raise NotImplementedError
# 
#     def _get_client(self, cls):
#         return cls(
#             region=self._config.get_region(),
#             profile=self._config.get_profile(),
#             dry_run=self._dry_run)
# 
#     def get_lambda_client(self):
#         return self._get_client(LambdaClient)
# 
#     def get_kms_client(self):
#         return self._get_client(KmsClient)
# 
#     def get_events_client(self):
#         return self._get_client(EventsClient)
# 
#     def get_logs_client(self):
#         return self._get_client(LogsClient)
# 
#     def get_apigateway_client(self):
#         return self._get_client(ApiGatewayClient)
# 
#     def get_alias_name(self):
#         if self._alias is not None:
#             return self._alias
#         return self._config.get_default_alias()
# 
#     def _get_diff(self, remote, local, keys):
#         diff = {}
#         for k in keys:
#             r = remote.get(k[0])
#             l = local.get(k[1])
#             if r == l:
#                 diff[k[1]] = None
#             else:
#                 diff[k[1]] = (r, l,)
#         return diff
# 
#     def _print_diff(self, prefix, remote, local, keys):
#         diff = self._get_diff(remote, local, keys)
#         for k, v in diff.items():
#             if v is not None:
#                 self._logger.warn(
#                     '{p} {k}: {r} -> {l}'.format(p=prefix, k=k, r=v[0], l=v[1]))


# Path: lamvery/actions/api.py
import json
import re
import hashlib
from datetime import datetime
from datadiff import diff
from lamvery.actions.base import BaseAction
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import TerminalFormatter

"stage-variables" : {
#foreach($key in $stageVariables.keySet())
"$key" : "$util.escapeJavaScript($stageVariables.get($key))"
    #if($foreach.hasNext),#end
#end
},
"context" : {
    "account-id" : "$context.identity.accountId",
    "api-id" : "$context.apiId",
    "api-key" : "$context.identity.apiKey",
    "authorizer-principal-id" : "$context.authorizer.principalId",
    "caller" : "$context.identity.caller",
    "cognito-authentication-provider" : "$context.identity.cognitoAuthenticationProvider",
    "cognito-authentication-type" : "$context.identity.cognitoAuthenticationType",
    "cognito-identity-id" : "$context.identity.cognitoIdentityId",
    "cognito-identity-pool-id" : "$context.identity.cognitoIdentityPoolId",
    "http-method" : "$context.httpMethod",
    "stage" : "$context.stage",
    "source-ip" : "$context.identity.sourceIp",
    "user" : "$context.identity.user",
    "user-agent" : "$context.identity.userAgent",
    "user-arn" : "$context.identity.userArn",
    "request-id" : "$context.requestId",
    "resource-id" : "$context.resourceId",
    "resource-path" : "$context.resourcePath"
    }
}
'''



class ApiAction(BaseAction):