Add iam.delete_open_id_connect_provider
This commit is contained in:
parent
c492c5c228
commit
f4af9a1d54
@ -3193,7 +3193,7 @@
|
||||
- [ ] delete_group_policy
|
||||
- [ ] delete_instance_profile
|
||||
- [X] delete_login_profile
|
||||
- [ ] delete_open_id_connect_provider
|
||||
- [X] delete_open_id_connect_provider
|
||||
- [X] delete_policy
|
||||
- [X] delete_policy_version
|
||||
- [X] delete_role
|
||||
|
@ -1352,6 +1352,9 @@ class IAMBackend(BaseBackend):
|
||||
self.open_id_providers[open_id_provider.arn] = open_id_provider
|
||||
return open_id_provider
|
||||
|
||||
def delete_open_id_connect_provider(self, arn):
|
||||
self.open_id_providers.pop(arn, None)
|
||||
|
||||
def get_open_id_connect_provider(self, arn):
|
||||
open_id_provider = self.open_id_providers.get(arn)
|
||||
|
||||
|
@ -765,6 +765,14 @@ class IamResponse(BaseResponse):
|
||||
template = self.response_template(CREATE_OPEN_ID_CONNECT_PROVIDER_TEMPLATE)
|
||||
return template.render(open_id_provider=open_id_provider)
|
||||
|
||||
def delete_open_id_connect_provider(self):
|
||||
open_id_provider_arn = self._get_param('OpenIDConnectProviderArn')
|
||||
|
||||
iam_backend.delete_open_id_connect_provider(open_id_provider_arn)
|
||||
|
||||
template = self.response_template(DELETE_OPEN_ID_CONNECT_PROVIDER_TEMPLATE)
|
||||
return template.render()
|
||||
|
||||
def get_open_id_connect_provider(self):
|
||||
open_id_provider_arn = self._get_param('OpenIDConnectProviderArn')
|
||||
|
||||
@ -2004,6 +2012,13 @@ CREATE_OPEN_ID_CONNECT_PROVIDER_TEMPLATE = """<CreateOpenIDConnectProviderRespon
|
||||
</CreateOpenIDConnectProviderResponse>"""
|
||||
|
||||
|
||||
DELETE_OPEN_ID_CONNECT_PROVIDER_TEMPLATE = """<DeleteOpenIDConnectProviderResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">
|
||||
<ResponseMetadata>
|
||||
<RequestId>b5e49e29-4f64-11e4-aefa-bfd6aEXAMPLE</RequestId>
|
||||
</ResponseMetadata>
|
||||
</DeleteOpenIDConnectProviderResponse>"""
|
||||
|
||||
|
||||
GET_OPEN_ID_CONNECT_PROVIDER_TEMPLATE = """<GetOpenIDConnectProviderResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">
|
||||
<GetOpenIDConnectProviderResult>
|
||||
<ThumbprintList>
|
||||
|
@ -1699,6 +1699,32 @@ def test_create_open_id_connect_provider_errors():
|
||||
)
|
||||
|
||||
|
||||
@mock_iam
|
||||
def test_delete_open_id_connect_provider():
|
||||
client = boto3.client('iam', region_name='us-east-1')
|
||||
response = client.create_open_id_connect_provider(
|
||||
Url='https://example.com',
|
||||
ThumbprintList=[]
|
||||
)
|
||||
open_id_arn = response['OpenIDConnectProviderArn']
|
||||
|
||||
client.delete_open_id_connect_provider(
|
||||
OpenIDConnectProviderArn=open_id_arn
|
||||
)
|
||||
|
||||
client.get_open_id_connect_provider.when.called_with(
|
||||
OpenIDConnectProviderArn=open_id_arn
|
||||
).should.throw(
|
||||
ClientError,
|
||||
'OpenIDConnect Provider not found for arn {}'.format(open_id_arn)
|
||||
)
|
||||
|
||||
# deleting a non existing provider should be successful
|
||||
client.delete_open_id_connect_provider(
|
||||
OpenIDConnectProviderArn=open_id_arn
|
||||
)
|
||||
|
||||
|
||||
@freeze_time('2019-01-01 00:00:00')
|
||||
@mock_iam
|
||||
def test_get_open_id_connect_provider():
|
||||
@ -1730,7 +1756,7 @@ def test_get_open_id_connect_provider():
|
||||
|
||||
@mock_iam
|
||||
def test_get_open_id_connect_provider_errors():
|
||||
client = boto3.client('iam', region_name = 'us-east-1')
|
||||
client = boto3.client('iam', region_name='us-east-1')
|
||||
response = client.create_open_id_connect_provider(
|
||||
Url='https://example.com',
|
||||
ThumbprintList=[
|
||||
@ -1743,7 +1769,7 @@ def test_get_open_id_connect_provider_errors():
|
||||
open_id_arn = response['OpenIDConnectProviderArn']
|
||||
|
||||
client.get_open_id_connect_provider.when.called_with(
|
||||
OpenIDConnectProviderArn = open_id_arn + '-not-existing'
|
||||
OpenIDConnectProviderArn=open_id_arn + '-not-existing'
|
||||
).should.throw(
|
||||
ClientError,
|
||||
'OpenIDConnect Provider not found for arn {}'.format(open_id_arn + '-not-existing')
|
||||
|
Loading…
Reference in New Issue
Block a user