Mitch Garnaat

Begin updates to README. Also, introduce a version attribute in the config file …

…and use that, as well as the environment, to name resources.  Also use this name for the zip file and eliminate zipfile_name from config.
...@@ -42,8 +42,11 @@ Kappa is a command line tool. The basic command format is: ...@@ -42,8 +42,11 @@ Kappa is a command line tool. The basic command format is:
42 42
43 Where ``command`` is one of: 43 Where ``command`` is one of:
44 44
45 -* create - creates the IAM policy (if necessary), the IAM role, and zips and 45 +* deploy - does whatever is required to deploy the current version of your
46 - uploads the Lambda function code to the Lambda service 46 + Lambda function such as creating/updating policies and roles and creating or
47 + updating the function itself
48 +* delete - delete the Lambda function, remove any event sources, delete the IAM
49 + policy and role
47 * invoke - make a synchronous call to your Lambda function, passing test data 50 * invoke - make a synchronous call to your Lambda function, passing test data
48 and display the resulting log data 51 and display the resulting log data
49 * invoke_async - make an asynchronous call to your Lambda function passing test 52 * invoke_async - make an asynchronous call to your Lambda function passing test
...@@ -53,9 +56,6 @@ Where ``command`` is one of: ...@@ -53,9 +56,6 @@ Where ``command`` is one of:
53 * tail - display the most recent log events for the function (remember that it 56 * tail - display the most recent log events for the function (remember that it
54 can take several minutes before log events are available from CloudWatch) 57 can take several minutes before log events are available from CloudWatch)
55 * add_event_sources - hook up an event source to your Lambda function 58 * add_event_sources - hook up an event source to your Lambda function
56 -* delete - delete the Lambda function, remove any event sources, delete the IAM
57 - policy and role
58 -* update_code - Upload new code for your Lambda function
59 * update_event_sources - Update the event sources based on the information in 59 * update_event_sources - Update the event sources based on the information in
60 your kappa config file 60 your kappa config file
61 * status - display summary information about functions, stacks, and event 61 * status - display summary information about functions, stacks, and event
...@@ -76,9 +76,9 @@ The basic workflow is: ...@@ -76,9 +76,9 @@ The basic workflow is:
76 * Create any custom IAM policy you need to execute your Lambda function 76 * Create any custom IAM policy you need to execute your Lambda function
77 * Create some sample data 77 * Create some sample data
78 * Create the YAML config file with all of the information 78 * Create the YAML config file with all of the information
79 -* Run ``kappa <path-to-config> create`` to create roles and upload function 79 +* Run ``kappa <path-to-config> deploy`` to create roles and upload function
80 -* Run ``kappa <path-to-config> invoke`` to invoke the function with test data 80 +* Run ``kappa <path-to-config> test`` to invoke the function with test data
81 -* Run ``kappa <path-to-config> update_code`` to upload new code for your Lambda 81 +* Run ``kappa <path-to-config> deploy`` to upload new code for your Lambda
82 function 82 function
83 * Run ``kappa <path-to-config> add_event_sources`` to hook your function up to the event source 83 * Run ``kappa <path-to-config> add_event_sources`` to hook your function up to the event source
84 * Run ``kappa <path-to-config> tail`` to see more output 84 * Run ``kappa <path-to-config> tail`` to see more output
......
...@@ -66,7 +66,17 @@ class Context(object): ...@@ -66,7 +66,17 @@ class Context(object):
66 66
67 @property 67 @property
68 def name(self): 68 def name(self):
69 - return self.config.get('name', None) 69 + return '{}-{}-v{}'.format(self.base_name,
70 + self.environment,
71 + self.version)
72 +
73 + @property
74 + def base_name(self):
75 + return self.config.get('base_name')
76 +
77 + @property
78 + def version(self):
79 + return self.config.get('version')
70 80
71 @property 81 @property
72 def profile(self): 82 def profile(self):
...@@ -78,11 +88,11 @@ class Context(object): ...@@ -78,11 +88,11 @@ class Context(object):
78 88
79 @property 89 @property
80 def record_path(self): 90 def record_path(self):
81 - return self.config.get('record_path', None) 91 + return self.config.get('record_path')
82 92
83 @property 93 @property
84 def lambda_config(self): 94 def lambda_config(self):
85 - return self.config.get('lambda', None) 95 + return self.config.get('lambda')
86 96
87 @property 97 @property
88 def exec_role_arn(self): 98 def exec_role_arn(self):
......
...@@ -62,7 +62,7 @@ class Function(object): ...@@ -62,7 +62,7 @@ class Function(object):
62 62
63 @property 63 @property
64 def zipfile_name(self): 64 def zipfile_name(self):
65 - return self._config['zipfile_name'] 65 + return '{}.zip'.format(self._context.name)
66 66
67 @property 67 @property
68 def path(self): 68 def path(self):
......
...@@ -35,7 +35,7 @@ class Policy(object): ...@@ -35,7 +35,7 @@ class Policy(object):
35 35
36 @property 36 @property
37 def name(self): 37 def name(self):
38 - return '{}-{}-policy'.format(self._context.name, self.environment) 38 + return self._context.name
39 39
40 @property 40 @property
41 def description(self): 41 def description(self):
......
...@@ -45,8 +45,7 @@ class Role(object): ...@@ -45,8 +45,7 @@ class Role(object):
45 45
46 @property 46 @property
47 def name(self): 47 def name(self):
48 - return '{}-{}-role'.format( 48 + return self._context.name
49 - self._context.name, self._context.environment)
50 49
51 @property 50 @property
52 def arn(self): 51 def arn(self):
......