Skip to content

Commit 492f6fd

Browse files
author
Trevor Robinson
committed
Add basic support for enumerating Elasticsearch domains
1 parent 225bf02 commit 492f6fd

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

skew/resources/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
'aws.elasticbeanstalk.application': 'aws.elasticbeanstalk.Application',
4343
'aws.elasticbeanstalk.environment': 'aws.elasticbeanstalk.Environment',
4444
'aws.elb.loadbalancer': 'aws.elb.LoadBalancer',
45+
'aws.es.domain': 'aws.es.ElasticsearchDomain',
4546
'aws.firehose.deliverystream': 'aws.firehose.DeliveryStream',
4647
'aws.iam.group': 'aws.iam.Group',
4748
'aws.iam.instance-profile': 'aws.iam.InstanceProfile',

skew/resources/aws/es.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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

Comments
 (0)