|
| 1 | +# Copyright (c) 2014 Scopely, Inc. |
| 2 | +# Copyright (c) 2015 Mitch Garnaat |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"). You |
| 5 | +# may not use this file except in compliance with the License. A copy of |
| 6 | +# the License is located at |
| 7 | +# |
| 8 | +# http://aws.amazon.com/apache2.0/ |
| 9 | +# |
| 10 | +# or in the "license" file accompanying this file. This file is |
| 11 | +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF |
| 12 | +# ANY KIND, either express or implied. See the License for the specific |
| 13 | +# language governing permissions and limitations under the License. |
| 14 | + |
| 15 | +import jmespath |
| 16 | + |
| 17 | +from skew.resources.aws import AWSResource |
| 18 | + |
| 19 | + |
| 20 | +class ElasticsearchDomain(AWSResource): |
| 21 | + |
| 22 | + class Meta(object): |
| 23 | + service = 'es' |
| 24 | + type = 'domain' |
| 25 | + enum_spec = ('list_domain_names', 'DomainNames[].DomainName', None) |
| 26 | + tags_spec = None |
| 27 | + detail_spec = ('describe_elasticsearch_domain', 'DomainName', 'DomainStatus') |
| 28 | + id = 'DomainName' |
| 29 | + filter_name = None |
| 30 | + name = 'DomainName' |
| 31 | + date = None |
| 32 | + dimension = 'DomainName' |
| 33 | + |
| 34 | + def __init__(self, client, data, query=None): |
| 35 | + super(ElasticsearchDomain, self).__init__(client, data, query) |
| 36 | + self._id = data |
| 37 | + detail_op, param_name, detail_path = self.Meta.detail_spec |
| 38 | + params = {param_name: self.id} |
| 39 | + data = client.call(detail_op, **params) |
| 40 | + self.data = jmespath.search(detail_path, data) |
0 commit comments