Repository: cloud-custodian/cloud-custodian

Issue:
Missing required parameter in input: "Enable" when using c7n-guardian
I am running the command:

```c7n-guardian enable --config guard-duty-accounts.yaml --master <account1_id>```

with the following config:

```
accounts:
 - name: account1_name
 email: xxxx1@yyy.com
 account_id: "accountid1"
 role: "arn:aws:iam::accountid1:role/CustodianGuardDuty"
 - name: account2_name
 email: xxxx2@yyy.com
 account_id: "accountid2"
 role: "arn:aws:iam::accountid2:role/CustodianGuardDuty"
```

I am using the following versions:
    "C7NVersion": "0.8.32.1",
    "C7NOrgVersion": "0.5.0",
    "C7NGuardianVersion": "0.3"



Discussion:
sorry i guess the stack trace would help...

Traceback (most recent call last):
 File "/usr/local/bin/c7n-guardian", line 11, in <module>
 sys.exit(cli())
 File "/usr/local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
 return self.main(*args, **kwargs)
 File "/usr/local/lib/python2.7/site-packages/click/core.py", line 717, in main
 rv = self.invoke(ctx)
 File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
 return _process_result(sub_ctx.command.invoke(sub_ctx))
 File "/usr/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
 return ctx.invoke(self.callback, **ctx.params)
 File "/usr/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
 return callback(*args, **kwargs)
 File "/usr/local/lib/python2.7/site-packages/c7n_guardian/cli.py", line 202, in enable
 enable_region(master_info, accounts_config, executor, message, r)
 File "/usr/local/lib/python2.7/site-packages/c7n_guardian/cli.py", line 212, in enable_region
 detector_id = get_or_create_detector_id(master_client)
 File "/usr/local/lib/python2.7/site-packages/c7n_guardian/cli.py", line 327, in get_or_create_detector_id
 return client.create_detector().get('DetectorId')
 File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 320, in _api_call
 return self._make_api_call(operation_name, kwargs)
 File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 597, in _make_api_call
 api_params, operation_model, context=request_context)
 File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 633, in _convert_to_request_dict
 api_params, operation_model)
 File "/usr/local/lib/python2.7/site-packages/botocore/validate.py", line 297, in serialize_to_request
 raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Missing required parameter in input: "Enable"
 [Container] 2018/12/05 10:49:21 Command did not exit successfully c7n-guardian enable --config guard-duty-accounts.yaml --master accountid1
hmm.. thanks, for the bug report

Resolving patch:
diff --git a/tools/c7n_guardian/c7n_guardian/cli.py b/tools/c7n_guardian/c7n_guardian/cli.py
--- a/tools/c7n_guardian/c7n_guardian/cli.py
+++ b/tools/c7n_guardian/c7n_guardian/cli.py
@@ -340,7 +340,7 @@ def get_or_create_detector_id(client):
     if detectors:
         return detectors[0]
     else:
-        return client.create_detector().get('DetectorId')
+        return client.create_detector(Enable=True).get('DetectorId')
 
 
 def get_master_info(accounts_config, master):


Test patch: