comparison env/lib/python3.7/site-packages/boto/cloudsearch/layer2.py @ 5:9b1c78e6ba9c draft default tip

"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
author shellac
date Mon, 01 Jun 2020 08:59:25 -0400
parents 79f47841a781
children
comparison
equal deleted inserted replaced
4:79f47841a781 5:9b1c78e6ba9c
1 # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
2 # Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
3 # All Rights Reserved
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish, dis-
9 # tribute, sublicense, and/or sell copies of the Software, and to permit
10 # persons to whom the Software is furnished to do so, subject to the fol-
11 # lowing conditions:
12 #
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
18 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
19 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 # IN THE SOFTWARE.
23 #
24
25 from boto.cloudsearch.layer1 import Layer1
26 from boto.cloudsearch.domain import Domain
27
28
29 class Layer2(object):
30
31 def __init__(self, aws_access_key_id=None, aws_secret_access_key=None,
32 is_secure=True, port=None, proxy=None, proxy_port=None,
33 host=None, debug=0, session_token=None, region=None,
34 validate_certs=True):
35 self.layer1 = Layer1(
36 aws_access_key_id=aws_access_key_id,
37 aws_secret_access_key=aws_secret_access_key,
38 is_secure=is_secure,
39 port=port,
40 proxy=proxy,
41 proxy_port=proxy_port,
42 host=host,
43 debug=debug,
44 security_token=session_token,
45 region=region,
46 validate_certs=validate_certs)
47
48 def list_domains(self, domain_names=None):
49 """
50 Return a list of :class:`boto.cloudsearch.domain.Domain`
51 objects for each domain defined in the current account.
52 """
53 domain_data = self.layer1.describe_domains(domain_names)
54 return [Domain(self.layer1, data) for data in domain_data]
55
56 def create_domain(self, domain_name):
57 """
58 Create a new CloudSearch domain and return the corresponding
59 :class:`boto.cloudsearch.domain.Domain` object.
60 """
61 data = self.layer1.create_domain(domain_name)
62 return Domain(self.layer1, data)
63
64 def lookup(self, domain_name):
65 """
66 Lookup a single domain
67 :param domain_name: The name of the domain to look up
68 :type domain_name: str
69
70 :return: Domain object, or None if the domain isn't found
71 :rtype: :class:`boto.cloudsearch.domain.Domain`
72 """
73 domains = self.list_domains(domain_names=[domain_name])
74 if len(domains) > 0:
75 return domains[0]