| 1 |
# Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"). You |
| 4 |
# may not use this file except in compliance with the License. A copy of |
| 5 |
# the License is located at |
| 6 |
# |
| 7 |
# https://aws.amazon.com/apache2.0/ |
| 8 |
# |
| 9 |
# or in the "license" file accompanying this file. This file is |
| 10 |
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF |
| 11 |
# ANY KIND, either express or implied. See the License for the specific |
| 12 |
# language governing permissions and limitations under the License. |
| 13 |
from boto3.resources.action import CustomModeledAction |
| 14 |
|
| 15 |
|
| 16 |
def inject_delete_tags(event_emitter, **kwargs): |
| 17 |
action_model = { |
| 18 |
'request': { |
| 19 |
'operation': 'DeleteTags', |
| 20 |
'params': [ |
| 21 |
{ |
| 22 |
'target': 'Resources[0]', |
| 23 |
'source': 'identifier', |
| 24 |
'name': 'Id', |
| 25 |
} |
| 26 |
], |
| 27 |
} |
| 28 |
} |
| 29 |
action = CustomModeledAction( |
| 30 |
'delete_tags', action_model, delete_tags, event_emitter |
| 31 |
) |
| 32 |
action.inject(**kwargs) |
| 33 |
|
| 34 |
|
| 35 |
def delete_tags(self, **kwargs): |
| 36 |
kwargs['Resources'] = [self.id] |
| 37 |
return self.meta.client.delete_tags(**kwargs) |