IAM delete_server_certificate (#1380)
* IAM delete_server_certificate * flake8 fixes
This commit is contained in:
parent
0c01c7f495
commit
52ce8d378f
@ -1906,7 +1906,7 @@
|
|||||||
- [X] delete_role
|
- [X] delete_role
|
||||||
- [X] delete_role_policy
|
- [X] delete_role_policy
|
||||||
- [ ] delete_saml_provider
|
- [ ] delete_saml_provider
|
||||||
- [ ] delete_server_certificate
|
- [X] delete_server_certificate
|
||||||
- [ ] delete_service_linked_role
|
- [ ] delete_service_linked_role
|
||||||
- [ ] delete_service_specific_credential
|
- [ ] delete_service_specific_credential
|
||||||
- [ ] delete_signing_certificate
|
- [ ] delete_signing_certificate
|
||||||
|
@ -663,6 +663,20 @@ class IAMBackend(BaseBackend):
|
|||||||
"The Server Certificate with name {0} cannot be "
|
"The Server Certificate with name {0} cannot be "
|
||||||
"found.".format(name))
|
"found.".format(name))
|
||||||
|
|
||||||
|
def delete_server_certificate(self, name):
|
||||||
|
cert_id = None
|
||||||
|
for key, cert in self.certificates.items():
|
||||||
|
if name == cert.cert_name:
|
||||||
|
cert_id = key
|
||||||
|
break
|
||||||
|
|
||||||
|
if cert_id is None:
|
||||||
|
raise IAMNotFoundException(
|
||||||
|
"The Server Certificate with name {0} cannot be "
|
||||||
|
"found.".format(name))
|
||||||
|
|
||||||
|
self.certificates.pop(cert_id, None)
|
||||||
|
|
||||||
def create_group(self, group_name, path='/'):
|
def create_group(self, group_name, path='/'):
|
||||||
if group_name in self.groups:
|
if group_name in self.groups:
|
||||||
raise IAMConflictException(
|
raise IAMConflictException(
|
||||||
|
@ -271,6 +271,12 @@ class IamResponse(BaseResponse):
|
|||||||
template = self.response_template(GET_SERVER_CERTIFICATE_TEMPLATE)
|
template = self.response_template(GET_SERVER_CERTIFICATE_TEMPLATE)
|
||||||
return template.render(certificate=cert)
|
return template.render(certificate=cert)
|
||||||
|
|
||||||
|
def delete_server_certificate(self):
|
||||||
|
cert_name = self._get_param('ServerCertificateName')
|
||||||
|
iam_backend.delete_server_certificate(cert_name)
|
||||||
|
template = self.response_template(GENERIC_EMPTY_TEMPLATE)
|
||||||
|
return template.render(name="DeleteServerCertificate")
|
||||||
|
|
||||||
def create_group(self):
|
def create_group(self):
|
||||||
group_name = self._get_param('GroupName')
|
group_name = self._get_param('GroupName')
|
||||||
path = self._get_param('Path')
|
path = self._get_param('Path')
|
||||||
|
@ -58,6 +58,19 @@ def test_upload_server_cert():
|
|||||||
"arn:aws:iam::123456789012:server-certificate/certname")
|
"arn:aws:iam::123456789012:server-certificate/certname")
|
||||||
|
|
||||||
|
|
||||||
|
@mock_iam_deprecated()
|
||||||
|
def test_delete_server_cert():
|
||||||
|
conn = boto.connect_iam()
|
||||||
|
|
||||||
|
conn.upload_server_cert("certname", "certbody", "privatekey")
|
||||||
|
conn.get_server_certificate("certname")
|
||||||
|
conn.delete_server_cert("certname")
|
||||||
|
with assert_raises(BotoServerError):
|
||||||
|
conn.get_server_certificate("certname")
|
||||||
|
with assert_raises(BotoServerError):
|
||||||
|
conn.delete_server_cert("certname")
|
||||||
|
|
||||||
|
|
||||||
@mock_iam_deprecated()
|
@mock_iam_deprecated()
|
||||||
@raises(BotoServerError)
|
@raises(BotoServerError)
|
||||||
def test_get_role__should_throw__when_role_does_not_exist():
|
def test_get_role__should_throw__when_role_does_not_exist():
|
||||||
|
Loading…
Reference in New Issue
Block a user