Example #1
0
    def test_load_regions(self):
        # Just the defaults.
        endpoints = load_regions()
        self.assertTrue("us-east-1" in endpoints["ec2"])
        self.assertFalse("test-1" in endpoints["ec2"])

        # With ENV overrides.
        os.environ["BOTO_ENDPOINTS"] = os.path.join(os.path.dirname(__file__), "test_endpoints.json")
        self.addCleanup(os.environ.pop, "BOTO_ENDPOINTS")
        endpoints = load_regions()
        self.assertTrue("us-east-1" in endpoints["ec2"])
        self.assertTrue("test-1" in endpoints["ec2"])
        self.assertEqual(endpoints["ec2"]["test-1"], "ec2.test-1.amazonaws.com")
    def test_load_regions(self):
        # Just the defaults.
        endpoints = load_regions()
        self.assertTrue('us-east-1' in endpoints['ec2'])
        self.assertFalse('test-1' in endpoints['ec2'])

        # With ENV overrides.
        os.environ['BOTO_ENDPOINTS'] = os.path.join(os.path.dirname(__file__),
                                                    'test_endpoints.json')
        self.addCleanup(os.environ.pop, 'BOTO_ENDPOINTS')
        endpoints = load_regions()
        self.assertTrue('us-east-1' in endpoints['ec2'])
        self.assertTrue('test-1' in endpoints['ec2'])
        self.assertEqual(endpoints['ec2']['test-1'],
                         'ec2.test-1.amazonaws.com')
Example #3
0
    def test_load_regions(self):
        # Just the defaults.
        endpoints = load_regions()
        self.assertTrue('us-east-1' in endpoints['ec2'])
        self.assertFalse('test-1' in endpoints['ec2'])

        # With ENV overrides.
        os.environ['BOTO_ENDPOINTS'] = os.path.join(
            os.path.dirname(__file__),
            'test_endpoints.json'
        )
        self.addCleanup(os.environ.pop, 'BOTO_ENDPOINTS')
        endpoints = load_regions()
        self.assertTrue('us-east-1' in endpoints['ec2'])
        self.assertTrue('test-1' in endpoints['ec2'])
        self.assertEqual(endpoints['ec2']['test-1'], 'ec2.test-1.amazonaws.com')
Example #4
0
from boto.regioninfo import RegionInfo, get_regions, load_regions
from boto.ec2.autoscale.request import Request
from boto.ec2.autoscale.launchconfig import LaunchConfiguration
from boto.ec2.autoscale.group import AutoScalingGroup
from boto.ec2.autoscale.group import ProcessType
from boto.ec2.autoscale.activity import Activity
from boto.ec2.autoscale.policy import AdjustmentType
from boto.ec2.autoscale.policy import MetricCollectionTypes
from boto.ec2.autoscale.policy import ScalingPolicy
from boto.ec2.autoscale.policy import TerminationPolicies
from boto.ec2.autoscale.instance import Instance
from boto.ec2.autoscale.scheduled import ScheduledUpdateGroupAction
from boto.ec2.autoscale.tag import Tag
from boto.ec2.autoscale.limits import AccountLimits

RegionData = load_regions().get('autoscaling', {})


def regions():
    """
    Get all available regions for the Auto Scaling service.

    :rtype: list
    :return: A list of :class:`boto.RegionInfo` instances
    """
    return get_regions('autoscaling', connection_cls=AutoScaleConnection)


def connect_to_region(region_name, **kw_params):
    """
    Given a valid region name, return a
Example #5
0
# IN THE SOFTWARE.
#
"""
This module provides an interface to the Elastic Compute Cloud (EC2)
load balancing service from AWS.
"""
from boto.connection import AWSQueryConnection
from boto.ec2.instanceinfo import InstanceInfo
from boto.ec2.elb.loadbalancer import LoadBalancer, LoadBalancerZones
from boto.ec2.elb.instancestate import InstanceState
from boto.ec2.elb.healthcheck import HealthCheck
from boto.regioninfo import RegionInfo, get_regions, load_regions
import boto
from boto.compat import six

RegionData = load_regions().get('elasticloadbalancing', {})


def regions():
    """
    Get all available regions for the ELB service.

    :rtype: list
    :return: A list of :class:`boto.RegionInfo` instances
    """
    return get_regions('elasticloadbalancing', connection_cls=ELBConnection)


def connect_to_region(region_name, **kw_params):
    """
    Given a valid region name, return a
Example #6
0
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
"""
This module provides an interface to the Elastic Compute Cloud (EC2)
CloudWatch service from AWS.
"""
from boto.compat import json
from boto.connection import AWSQueryConnection
from boto.ec2.cloudwatch.metric import Metric
from boto.ec2.cloudwatch.alarm import MetricAlarm, MetricAlarms, AlarmHistoryItem
from boto.ec2.cloudwatch.datapoint import Datapoint
from boto.regioninfo import RegionInfo, get_regions, load_regions
import boto

RegionData = load_regions().get('cloudwatch', {})


def regions():
    """
    Get all available regions for the CloudWatch service.

    :rtype: list
    :return: A list of :class:`boto.RegionInfo` instances
    """
    return get_regions('cloudwatch', connection_cls=CloudWatchConnection)


def connect_to_region(region_name, **kw_params):
    """
    Given a valid region name, return a
Example #7
0
from boto.regioninfo import RegionInfo, get_regions, load_regions
from boto.ec2.autoscale.request import Request
from boto.ec2.autoscale.launchconfig import LaunchConfiguration
from boto.ec2.autoscale.group import AutoScalingGroup
from boto.ec2.autoscale.group import ProcessType
from boto.ec2.autoscale.activity import Activity
from boto.ec2.autoscale.policy import AdjustmentType
from boto.ec2.autoscale.policy import MetricCollectionTypes
from boto.ec2.autoscale.policy import ScalingPolicy
from boto.ec2.autoscale.policy import TerminationPolicies
from boto.ec2.autoscale.instance import Instance
from boto.ec2.autoscale.scheduled import ScheduledUpdateGroupAction
from boto.ec2.autoscale.tag import Tag
from boto.ec2.autoscale.limits import AccountLimits

RegionData = load_regions().get('autoscaling', {})


def regions():
    """
    Get all available regions for the Auto Scaling service.

    :rtype: list
    :return: A list of :class:`boto.RegionInfo` instances
    """
    return get_regions('autoscaling', connection_cls=AutoScaleConnection)


def connect_to_region(region_name, **kw_params):
    """
    Given a valid region name, return a
Example #8
0
# IN THE SOFTWARE.
#
"""
This module provides an interface to the Elastic Compute Cloud (EC2)
CloudWatch service from AWS.
"""
from boto.compat import json, map, six, zip
from boto.connection import AWSQueryConnection
from boto.ec2.cloudwatch.metric import Metric
from boto.ec2.cloudwatch.alarm import MetricAlarm, MetricAlarms, AlarmHistoryItem
from boto.ec2.cloudwatch.datapoint import Datapoint
from boto.regioninfo import RegionInfo, get_regions, load_regions
from boto.regioninfo import connect
import boto

RegionData = load_regions().get('cloudwatch', {})


def regions():
    """
    Get all available regions for the CloudWatch service.
    :rtype: list
    :return: A list of :class:`boto.RegionInfo` instances
    """
    return get_regions('cloudwatch', connection_cls=CloudWatchConnection)


def connect_to_region(region_name, **kw_params):
    """
    Given a valid region name, return a
    :class:`boto.ec2.cloudwatch.CloudWatchConnection`.
Example #9
0
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

from connection import CloudFormationConnection
from boto.regioninfo import RegionInfo, get_regions, load_regions

RegionData = load_regions().get("cloudformation")


def regions():
    """
    Get all available regions for the CloudFormation service.

    :rtype: list
    :return: A list of :class:`boto.RegionInfo` instances
    """
    return get_regions("cloudformation", connection_cls=CloudFormationConnection)


def connect_to_region(region_name, **kw_params):
    """
    Given a valid region name, return a
Example #10
0
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#

from boto.ec2.regioninfo import RegionInfo
from boto.regioninfo import get_regions, load_regions
from boto.regioninfo import connect
import boto.swf.layer1

REGION_ENDPOINTS = load_regions().get('swf', {})


def regions(**kw_params):
    """
    Get all available regions for the Amazon Simple Workflow service.

    :rtype: list
    :return: A list of :class:`boto.regioninfo.RegionInfo`
    """
    return get_regions('swf', connection_cls=boto.swf.layer1.Layer1)


def connect_to_region(region_name, **kw_params):
    return connect('swf',
                   region_name,
Example #11
0
"""
NOTE: on a failed request for a bucket in another region, you can get the correct
      region using the 'x-amz-region' header returned in the error response
"""

__author__ = 'greg'

import os

from boto.exception import S3ResponseError
from boto.s3.connection import S3Connection
from boto.regioninfo import load_regions

_S3_ENDPOINT_LOOKUP = load_regions()['s3']


###############################################################################
class _BotoConnectionRequestHook(object):
    def __init__(self, existing_hook=None):
        self.request = None
        self.response = None
        self.error = False

        self.existing_hook = existing_hook

    def handle_request_data(self, request, response, error=None):
        self.request = request
        self.response = response
        self.error = error

        if self.existing_hook is not None:
"""
NOTE: on a failed request for a bucket in another region, you can get the correct
      region using the 'x-amz-region' header returned in the error response
"""

__author__ = 'greg'

import os

from boto.exception import S3ResponseError
from boto.s3.connection import S3Connection
from boto.regioninfo import load_regions
import boto

_S3_ENDPOINT_LOOKUP = load_regions()['s3']


###############################################################################
class _BotoConnectionRequestHook(object):
    def __init__(self, existing_hook=None):
        self.request = None
        self.response = None
        self.error = False

        self.existing_hook = existing_hook

    def handle_request_data(self, request, response, error=None):
        self.request = request
        self.response = response
        self.error = error
Example #13
0
# IN THE SOFTWARE.
#
"""
This module provides an interface to the Elastic Compute Cloud (EC2)
load balancing service from AWS.
"""
from boto.connection import AWSQueryConnection
from boto.ec2.instanceinfo import InstanceInfo
from boto.ec2.elb.loadbalancer import LoadBalancer, LoadBalancerZones
from boto.ec2.elb.instancestate import InstanceState
from boto.ec2.elb.healthcheck import HealthCheck
from boto.regioninfo import RegionInfo, get_regions, load_regions
import boto
from boto.compat import six

RegionData = load_regions().get("elasticloadbalancing", {})


def regions():
    """
    Get all available regions for the ELB service.

    :rtype: list
    :return: A list of :class:`boto.RegionInfo` instances
    """
    return get_regions("elasticloadbalancing", connection_cls=ELBConnection)


def connect_to_region(region_name, **kw_params):
    """
    Given a valid region name, return a
Example #14
0
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
"""
This module provides an interface to the Elastic Compute Cloud (EC2)
service from AWS.
"""
from boto.ec2.connection import EC2Connection
from boto.regioninfo import RegionInfo, get_regions, load_regions

RegionData = load_regions().get('ec2', {})


def regions(**kw_params):
    """
    Get all available regions for the EC2 service.
    You may pass any of the arguments accepted by the EC2Connection
    object's constructor as keyword arguments and they will be
    passed along to the EC2Connection object.

    :rtype: list
    :return: A list of :class:`boto.ec2.regioninfo.RegionInfo`
    """
    return get_regions('ec2', connection_cls=EC2Connection)

Example #15
0
from boto.ec2.autoscale.request import Request
from boto.ec2.autoscale.launchconfig import LaunchConfiguration
from boto.ec2.autoscale.group import AutoScalingGroup
from boto.ec2.autoscale.group import ProcessType
from boto.ec2.autoscale.activity import Activity
from boto.ec2.autoscale.policy import AdjustmentType
from boto.ec2.autoscale.policy import MetricCollectionTypes
from boto.ec2.autoscale.policy import ScalingPolicy
from boto.ec2.autoscale.policy import TerminationPolicies
from boto.ec2.autoscale.instance import Instance
from boto.ec2.autoscale.scheduled import ScheduledUpdateGroupAction
from boto.ec2.autoscale.tag import Tag
from boto.ec2.autoscale.limits import AccountLimits
from boto.compat import six

RegionData = load_regions().get("autoscaling", {})


def regions():
    """
    Get all available regions for the Auto Scaling service.

    :rtype: list
    :return: A list of :class:`boto.RegionInfo` instances
    """
    return get_regions("autoscaling", connection_cls=AutoScaleConnection)


def connect_to_region(region_name, **kw_params):
    """
    Given a valid region name, return a
Example #16
0
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

from boto.cloudformation.connection import CloudFormationConnection
from boto.regioninfo import RegionInfo, get_regions, load_regions
from boto.regioninfo import connect

RegionData = load_regions().get('cloudformation')


def regions():
    """
    Get all available regions for the CloudFormation service.

    :rtype: list
    :return: A list of :class:`boto.RegionInfo` instances
    """
    return get_regions(
        'cloudformation',
        connection_cls=CloudFormationConnection
    )

Example #17
0
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#

from boto.ec2.regioninfo import RegionInfo
from boto.regioninfo import get_regions, load_regions
from boto.regioninfo import connect
import boto.swf.layer1

REGION_ENDPOINTS = load_regions().get('swf', {})


def regions(**kw_params):
    """
    Get all available regions for the Amazon Simple Workflow service.

    :rtype: list
    :return: A list of :class:`boto.regioninfo.RegionInfo`
    """
    return get_regions('swf', connection_cls=boto.swf.layer1.Layer1)


def connect_to_region(region_name, **kw_params):
    return connect('swf', region_name,
                   connection_cls=boto.swf.layer1.Layer1, **kw_params)
Example #18
0
# IN THE SOFTWARE.
#
"""
This module provides an interface to the Elastic Compute Cloud (EC2)
load balancing service from AWS.
"""
from boto.connection import AWSQueryConnection
from boto.ec2.instanceinfo import InstanceInfo
from boto.ec2.elb.loadbalancer import LoadBalancer, LoadBalancerZones
from boto.ec2.elb.instancestate import InstanceState
from boto.ec2.elb.healthcheck import HealthCheck
from boto.regioninfo import RegionInfo, get_regions, load_regions
import boto
from boto.compat import six

RegionData = load_regions().get('elasticloadbalancing', {})


def regions():
    """
    Get all available regions for the ELB service.

    :rtype: list
    :return: A list of :class:`boto.RegionInfo` instances
    """
    return get_regions('elasticloadbalancing', connection_cls=ELBConnection)


def connect_to_region(region_name, **kw_params):
    """
    Given a valid region name, return a
Example #19
0
File: __init__.py Project: 10sr/hue
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
"""
This module provides an interface to the Elastic Compute Cloud (EC2)
service from AWS.
"""
from boto.ec2.connection import EC2Connection
from boto.regioninfo import RegionInfo, get_regions, load_regions


RegionData = load_regions().get('ec2', {})


def regions(**kw_params):
    """
    Get all available regions for the EC2 service.
    You may pass any of the arguments accepted by the EC2Connection
    object's constructor as keyword arguments and they will be
    passed along to the EC2Connection object.

    :rtype: list
    :return: A list of :class:`boto.ec2.regioninfo.RegionInfo`
    """
    return get_regions('ec2', connection_cls=EC2Connection)