You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2016/11/14 23:51:02 UTC
[15/56] [abbrv] libcloud git commit: Removed sdist
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/libcloud/container/utils/docker.py
----------------------------------------------------------------------
diff --git a/apache-libcloud-1.0.0rc2/libcloud/container/utils/docker.py b/apache-libcloud-1.0.0rc2/libcloud/container/utils/docker.py
deleted file mode 100644
index da67516..0000000
--- a/apache-libcloud-1.0.0rc2/libcloud/container/utils/docker.py
+++ /dev/null
@@ -1,177 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from __future__ import with_statement
-
-from base64 import b64encode
-
-from libcloud.common.base import Connection, JsonResponse
-from libcloud.container.base import ContainerImage
-
-__all__ = [
- 'RegistryClient',
- 'HubClient'
-]
-
-
-class DockerHubConnection(Connection):
- responseCls = JsonResponse
-
- def __init__(self, host, username=None, password=None,
- secure=True,
- port=None, url=None, timeout=None,
- proxy_url=None, backoff=None, retry_delay=None):
- super(DockerHubConnection, self).__init__(secure=secure, host=host,
- port=port, url=url,
- timeout=timeout,
- proxy_url=proxy_url,
- backoff=backoff,
- retry_delay=retry_delay)
- self.username = username
- self.password = password
-
- def add_default_headers(self, headers):
- headers['Content-Type'] = 'application/json'
- if self.username is not None:
- authstr = 'Basic ' + str(
- b64encode(
- ('%s:%s' % (self.username,
- self.password))
- .encode('latin1'))
- .strip()
- )
- headers['Authorization'] = authstr
- return headers
-
-
-class RegistryClient(object):
- """
- A client for the Docker v2 registry API
- """
- connectionCls = DockerHubConnection
-
- def __init__(self, host, username=None, password=None, **kwargs):
- """
- Construct a Docker hub client
-
- :param username: (optional) Your Hub account username
- :type username: ``str``
-
- :param password: (optional) Your hub account password
- :type password: ``str``
- """
- self.connection = self.connectionCls(host,
- username,
- password,
- **kwargs)
-
- def list_images(self, repository_name, namespace='library', max_count=100):
- """
- List the tags (versions) in a repository
-
- :param repository_name: The name of the repository e.g. 'ubuntu'
- :type repository_name: ``str``
-
- :param namespace: (optional) The docker namespace
- :type namespace: ``str``
-
- :param max_count: The maximum number of records to return
- :type max_count: ``int``
-
- :return: A list of images
- :rtype: ``list`` of :class:`libcloud.container.base.ContainerImage`
- """
- path = '/v2/repositories/%s/%s/tags/?page=1&page_size=%s' \
- % (namespace, repository_name, max_count)
- response = self.connection.request(path)
- images = []
- for image in response.object['results']:
- images.append(self._to_image(repository_name, image))
- return images
-
- def get_repository(self, repository_name, namespace='library'):
- """
- Get the information about a specific repository
-
- :param repository_name: The name of the repository e.g. 'ubuntu'
- :type repository_name: ``str``
-
- :param namespace: (optional) The docker namespace
- :type namespace: ``str``
-
- :return: The details of the repository
- :rtype: ``object``
- """
- path = '/v2/repositories/%s/%s' % (namespace, repository_name)
- response = self.connection.request(path)
- return response.object
-
- def get_image(self, repository_name, tag='latest', namespace='library'):
- """
- Get an image from a repository with a specific tag
-
- :param repository_name: The name of the repository, e.g. ubuntu
- :type repository_name: ``str``
-
- :param tag: (optional) The image tag (defaults to latest)
- :type tag: ``str``
-
- :param namespace: (optional) The docker namespace
- :type namespace: ``str``
-
- :return: A container image
- :rtype: :class:`libcloud.container.base.ContainerImage`
- """
- path = '/v2/repositories/%s/%s/tags/%s' \
- % (namespace, repository_name, tag)
- response = self.connection.request(path)
- return self._to_image(repository_name, response.object)
-
- def _to_image(self, repository_name, obj):
- path = '%s/%s:%s' % (self.connection.host,
- repository_name,
- obj['name'])
- return ContainerImage(
- id=obj['id'],
- path=path,
- name=path,
- version=obj['name'],
- extra={
- 'full_size': obj['full_size']
- },
- driver=None
- )
-
-
-class HubClient(RegistryClient):
- """
- A client for the Docker Hub API
-
- The hub is based on the v2 registry API
- """
- host = 'registry.hub.docker.com'
-
- def __init__(self, username=None, password=None, **kwargs):
- """
- Construct a Docker hub client
-
- :param username: (optional) Your Hub account username
- :type username: ``str``
-
- :param password: (optional) Your hub account password
- :type password: ``str``
- """
- super(HubClient, self).__init__(self.host, username,
- password, **kwargs)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/libcloud/data/pricing.json
----------------------------------------------------------------------
diff --git a/apache-libcloud-1.0.0rc2/libcloud/data/pricing.json b/apache-libcloud-1.0.0rc2/libcloud/data/pricing.json
deleted file mode 100644
index bb0dac4..0000000
--- a/apache-libcloud-1.0.0rc2/libcloud/data/pricing.json
+++ /dev/null
@@ -1,1038 +0,0 @@
-{
- "compute": {
- "bluebox": {
- "1gb": 0.15,
- "2gb": 0.25,
- "4gb": 0.35,
- "8gb": 0.45
- },
- "cloudsigma_lvs": {
- "high-cpu-extra-large": 0.0,
- "high-cpu-medium": 0.0,
- "high-memory-double-extra-large": 0.0,
- "high-memory-extra-large": 0.0,
- "micro-high-cpu": 0.0,
- "micro-regular": 0.0,
- "standard-extra-large": 0.0,
- "standard-large": 0.0,
- "standard-small": 0.0
- },
- "cloudsigma_zrh": {
- "high-cpu-extra-large": 0.78,
- "high-cpu-medium": 0.211,
- "high-memory-double-extra-large": 1.383,
- "high-memory-extra-large": 0.642,
- "micro-high-cpu": 0.381,
- "micro-regular": 0.0548,
- "standard-extra-large": 0.762,
- "standard-large": 0.381,
- "standard-small": 0.0796
- },
- "ec2_ap_northeast": {
- "c1.medium": "0.158",
- "c1.xlarge": "0.632",
- "c3.large": "0.128",
- "c3.xlarge": "0.255",
- "c3.2xlarge": "0.511",
- "c3.4xlarge": "1.021",
- "c3.8xlarge": "2.043",
- "c4.large": "0.120",
- "c4.xlarge": "0.239",
- "c4.2xlarge": "0.478",
- "c4.4xlarge": "0.955",
- "c4.8xlarge": "1.910",
- "cc2.8xlarge": "2.349",
- "cg1.4xlarge": "N/A",
- "cr1.8xlarge": "4.105",
- "d2.xlarge": "0.844",
- "d2.2xlarge": "1.688",
- "d2.4xlarge": "3.376",
- "d2.8xlarge": "6.752",
- "g2.2xlarge": "0.898",
- "g2.8xlarge": "3.592",
- "hi1.4xlarge": "3.276",
- "hs1.8xlarge": "5.4",
- "i2.xlarge": "1.001",
- "i2.2xlarge": "2.001",
- "i2.4xlarge": "4.002",
- "i2.8xlarge": "8.004",
- "m1.small": "0.061",
- "m1.medium": "0.122",
- "m1.large": "0.243",
- "m1.xlarge": "0.486",
- "m2.xlarge": "0.287",
- "m2.2xlarge": "0.575",
- "m2.4xlarge": "1.15",
- "m3.medium": "0.096",
- "m3.large": "0.193",
- "m3.xlarge": "0.385",
- "m3.2xlarge": "0.77",
- "m4.large": "0.165",
- "m4.xlarge": "0.331",
- "m4.2xlarge": "0.660",
- "m4.4xlarge": "1.321",
- "m4.10xlarge": "3.303",
- "r3.large": "0.200",
- "r3.xlarge": "0.399",
- "r3.2xlarge": "0.798",
- "r3.4xlarge": "1.596",
- "r3.8xlarge": "3.192",
- "t1.micro": "0.026",
- "t2.micro": "0.020",
- "t2.small": "0.040",
- "t2.medium": "0.080",
- "t2.large": "0.160",
- "t2.nano": "0.010"
- },
- "ec2_ap_southeast": {
- "c1.medium": "0.164",
- "c1.xlarge": "0.655",
- "c3.large": "0.132",
- "c3.xlarge": "0.265",
- "c3.2xlarge": "0.529",
- "c3.4xlarge": "1.058",
- "c3.8xlarge": "2.117",
- "c4.large": "0.144",
- "c4.xlarge": "0.289",
- "c4.2xlarge": "0.578",
- "c4.4xlarge": "1.155",
- "c4.8xlarge": "2.31",
- "cc2.8xlarge": "N/A",
- "cg1.4xlarge": "N/A",
- "cr1.8xlarge": "N/A",
- "d2.xlarge": "0.87",
- "d2.2xlarge": "1.74",
- "d2.4xlarge": "3.48",
- "d2.8xlarge": "6.96",
- "g2.2xlarge": "1",
- "g2.8xlarge": "4",
- "hi1.4xlarge": "N/A",
- "hs1.8xlarge": "5.57",
- "i2.xlarge": "1.018",
- "i2.2xlarge": "2.035",
- "i2.4xlarge": "4.07",
- "i2.8xlarge": "8.14",
- "m1.small": "0.058",
- "m1.medium": "0.117",
- "m1.large": "0.233",
- "m1.xlarge": "0.467",
- "m2.xlarge": "0.296",
- "m2.2xlarge": "0.592",
- "m2.4xlarge": "1.183",
- "m3.medium": "0.098",
- "m3.large": "0.196",
- "m3.xlarge": "0.392",
- "m3.2xlarge": "0.784",
- "m4.large": "0.178",
- "m4.xlarge": "0.355",
- "m4.2xlarge": "0.711",
- "m4.4xlarge": "1.421",
- "m4.10xlarge": "3.553",
- "r3.large": "0.2",
- "r3.xlarge": "0.399",
- "r3.2xlarge": "0.798",
- "r3.4xlarge": "1.596",
- "r3.8xlarge": "3.192",
- "t1.micro": "0.02",
- "t2.micro": "0.02",
- "t2.small": "0.04",
- "t2.medium": "0.08",
- "t2.large": "0.16",
- "t2.nano": "0.01"
- },
- "ec2_ap_southeast_2": {
- "c1.medium": "0.164",
- "c1.xlarge": "0.655",
- "c3.large": "0.132",
- "c3.xlarge": "0.265",
- "c3.2xlarge": "0.529",
- "c3.4xlarge": "1.058",
- "c3.8xlarge": "2.117",
- "c4.large": "0.137",
- "c4.xlarge": "0.275",
- "c4.2xlarge": "0.549",
- "c4.4xlarge": "1.097",
- "c4.8xlarge": "2.195",
- "cc2.8xlarge": "N/A",
- "cg1.4xlarge": "N/A",
- "cr1.8xlarge": "N/A",
- "d2.xlarge": "0.87",
- "d2.2xlarge": "1.74",
- "d2.4xlarge": "3.48",
- "d2.8xlarge": "6.96",
- "g2.2xlarge": "0.898",
- "g2.8xlarge": "3.592",
- "hi1.4xlarge": "N/A",
- "hs1.8xlarge": "5.57",
- "i2.xlarge": "1.018",
- "i2.2xlarge": "2.035",
- "i2.4xlarge": "4.07",
- "i2.8xlarge": "8.14",
- "m1.small": "0.058",
- "m1.medium": "0.117",
- "m1.large": "0.233",
- "m1.xlarge": "0.467",
- "m2.xlarge": "0.296",
- "m2.2xlarge": "0.592",
- "m2.4xlarge": "1.183",
- "m3.medium": "0.093",
- "m3.large": "0.186",
- "m3.xlarge": "0.372",
- "m3.2xlarge": "0.745",
- "m4.large": "0.168",
- "m4.xlarge": "0.336",
- "m4.2xlarge": "0.673",
- "m4.4xlarge": "1.345",
- "m4.10xlarge": "3.363",
- "r3.large": "0.2",
- "r3.xlarge": "0.399",
- "r3.2xlarge": "0.798",
- "r3.4xlarge": "1.596",
- "r3.8xlarge": "3.192",
- "t1.micro": "0.02",
- "t2.micro": "0.02",
- "t2.small": "0.04",
- "t2.medium": "0.08",
- "t2.large": "0.16"
- },
- "ec2_eu_central": {
- "c1.medium": "N/A",
- "c1.xlarge": "N/A",
- "c3.large": "0.129",
- "c3.xlarge": "0.258",
- "c3.2xlarge": "0.516",
- "c3.4xlarge": "1.032",
- "c3.8xlarge": "2.064",
- "c4.large": "0.134",
- "c4.xlarge": "0.267",
- "c4.2xlarge": "0.534",
- "c4.4xlarge": "1.069",
- "c4.8xlarge": "2.138",
- "cc2.8xlarge": "N/A",
- "cg1.4xlarge": "N/A",
- "cr1.8xlarge": "N/A",
- "d2.xlarge": "0.794",
- "d2.2xlarge": "1.588",
- "d2.4xlarge": "3.176",
- "d2.8xlarge": "6.352",
- "g2.2xlarge": "0.772",
- "g2.8xlarge": "3.088",
- "hi1.4xlarge": "N/A",
- "hs1.8xlarge": "N/A",
- "i2.xlarge": "1.013",
- "i2.2xlarge": "2.026",
- "i2.4xlarge": "4.051",
- "i2.8xlarge": "8.102",
- "m1.small": "N/A",
- "m1.medium": "N/A",
- "m1.large": "N/A",
- "m1.xlarge": "N/A",
- "m2.xlarge": "N/A",
- "m2.2xlarge": "N/A",
- "m2.4xlarge": "N/A",
- "m3.medium": "0.079",
- "m3.large": "0.158",
- "m3.xlarge": "0.315",
- "m3.2xlarge": "0.632",
- "m4.large": "0.143",
- "m4.xlarge": "0.285",
- "m4.2xlarge": "0.57",
- "m4.4xlarge": "1.14",
- "m4.10xlarge": "2.85",
- "r3.large": "0.2",
- "r3.xlarge": "0.4",
- "r3.2xlarge": "0.8",
- "r3.4xlarge": "1.6",
- "r3.8xlarge": "3.201",
- "t1.micro": "N/A",
- "t2.micro": "0.015",
- "t2.small": "0.03",
- "t2.medium": "0.06",
- "t2.large": "0.12"
- },
- "ec2_eu_west": {
- "c1.medium": "0.148",
- "c1.xlarge": "0.592",
- "c3.large": "0.12",
- "c3.xlarge": "0.239",
- "c3.2xlarge": "0.478",
- "c3.4xlarge": "0.956",
- "c3.8xlarge": "1.912",
- "c4.large": "0.119",
- "c4.xlarge": "0.238",
- "c4.2xlarge": "0.477",
- "c4.4xlarge": "0.953",
- "c4.8xlarge": "1.906",
- "cc2.8xlarge": "2.25",
- "cg1.4xlarge": "2.36",
- "cr1.8xlarge": "3.75",
- "d2.xlarge": "0.735",
- "d2.2xlarge": "1.47",
- "d2.4xlarge": "2.94",
- "d2.8xlarge": "5.88",
- "g2.2xlarge": "0.702",
- "g2.8xlarge": "2.808",
- "hi1.4xlarge": "3.1",
- "hs1.8xlarge": "4.9",
- "i2.xlarge": "0.938",
- "i2.2xlarge": "1.876",
- "i2.4xlarge": "3.751",
- "i2.8xlarge": "7.502",
- "m1.small": "0.047",
- "m1.medium": "0.095",
- "m1.large": "0.19",
- "m1.xlarge": "0.379",
- "m2.xlarge": "0.275",
- "m2.2xlarge": "0.55",
- "m2.4xlarge": "1.1",
- "m3.medium": "0.073",
- "m3.large": "0.146",
- "m3.xlarge": "0.293",
- "m3.2xlarge": "0.585",
- "m4.large": "0.132",
- "m4.xlarge": "0.264",
- "m4.2xlarge": "0.528",
- "m4.4xlarge": "1.056",
- "m4.10xlarge": "2.641",
- "r3.large": "0.185",
- "r3.xlarge": "0.371",
- "r3.2xlarge": "0.741",
- "r3.4xlarge": "1.482",
- "r3.8xlarge": "2.964",
- "t1.micro": "0.02",
- "t2.micro": "0.014",
- "t2.small": "0.028",
- "t2.medium": "0.056",
- "t2.large": "0.112",
- "t2.nano": "0.007"
- },
- "ec2_sa_east": {
- "c1.medium": "0.179",
- "c1.xlarge": "0.718",
- "c3.large": "0.163",
- "c3.xlarge": "0.325",
- "c3.2xlarge": "0.65",
- "c3.4xlarge": "1.3",
- "c3.8xlarge": "2.6",
- "cc2.8xlarge": "N/A",
- "cg1.4xlarge": "N/A",
- "cr1.8xlarge": "N/A",
- "hi1.4xlarge": "N/A",
- "hs1.8xlarge": "N/A",
- "m1.small": "0.058",
- "m1.medium": "0.117",
- "m1.large": "0.233",
- "m1.xlarge": "0.467",
- "m2.xlarge": "0.323",
- "m2.2xlarge": "0.645",
- "m2.4xlarge": "1.291",
- "m3.medium": "0.095",
- "m3.large": "0.19",
- "m3.xlarge": "0.381",
- "m3.2xlarge": "0.761",
- "r3.4xlarge": "2.799",
- "r3.8xlarge": "5.597",
- "t1.micro": "0.027",
- "t2.micro": "0.027",
- "t2.small": "0.054",
- "t2.medium": "0.108",
- "t2.large": "0.216",
- "t2.nano": "0.0135"
- },
- "ec2_us_east": {
- "c1.medium": "0.13",
- "c1.xlarge": "0.52",
- "c3.large": "0.105",
- "c3.xlarge": "0.21",
- "c3.2xlarge": "0.42",
- "c3.4xlarge": "0.84",
- "c3.8xlarge": "1.68",
- "c4.large": "0.105",
- "c4.xlarge": "0.209",
- "c4.2xlarge": "0.419",
- "c4.4xlarge": "0.838",
- "c4.8xlarge": "1.675",
- "cc2.8xlarge": "2",
- "cg1.4xlarge": "2.1",
- "cr1.8xlarge": "3.5",
- "d2.xlarge": "0.69",
- "d2.2xlarge": "1.38",
- "d2.4xlarge": "2.76",
- "d2.8xlarge": "5.52",
- "g2.2xlarge": "0.65",
- "g2.8xlarge": "2.6",
- "hi1.4xlarge": "3.1",
- "hs1.8xlarge": "4.6",
- "i2.xlarge": "0.853",
- "i2.2xlarge": "1.705",
- "i2.4xlarge": "3.41",
- "i2.8xlarge": "6.82",
- "m1.small": "0.044",
- "m1.medium": "0.087",
- "m1.large": "0.175",
- "m1.xlarge": "0.35",
- "m2.xlarge": "0.245",
- "m2.2xlarge": "0.49",
- "m2.4xlarge": "0.98",
- "m3.medium": "0.067",
- "m3.large": "0.133",
- "m3.xlarge": "0.266",
- "m3.2xlarge": "0.532",
- "m4.large": "0.12",
- "m4.xlarge": "0.239",
- "m4.2xlarge": "0.479",
- "m4.4xlarge": "0.958",
- "m4.10xlarge": "2.394",
- "r3.large": "0.166",
- "r3.xlarge": "0.333",
- "r3.2xlarge": "0.665",
- "r3.4xlarge": "1.33",
- "r3.8xlarge": "2.66",
- "t1.micro": "0.02",
- "t2.micro": "0.013",
- "t2.small": "0.026",
- "t2.medium": "0.052",
- "t2.large": "0.104",
- "t2.nano": "0.0065"
- },
- "ec2_us_govwest": {
- "c1.medium": "0.157",
- "c1.xlarge": "0.628",
- "c3.large": "0.126",
- "c3.xlarge": "0.252",
- "c3.2xlarge": "0.504",
- "c3.4xlarge": "1.008",
- "c3.8xlarge": "2.016",
- "cc2.8xlarge": "2.25",
- "cg1.4xlarge": "N/A",
- "cr1.8xlarge": "N/A",
- "d2.xlarge": "0.828",
- "d2.2xlarge": "1.656",
- "d2.4xlarge": "3.312",
- "d2.8xlarge": "6.624",
- "hi1.4xlarge": "N/A",
- "hs1.8xlarge": "5.52",
- "i2.xlarge": "1.023",
- "i2.2xlarge": "2.046",
- "i2.4xlarge": "4.092",
- "i2.8xlarge": "8.184",
- "m1.small": "0.053",
- "m1.medium": "0.106",
- "m1.large": "0.211",
- "m1.xlarge": "0.423",
- "m2.xlarge": "0.293",
- "m2.2xlarge": "0.586",
- "m2.4xlarge": "1.171",
- "m3.medium": "0.084",
- "m3.large": "0.168",
- "m3.xlarge": "0.336",
- "m3.2xlarge": "0.672",
- "r3.large": "0.2",
- "r3.xlarge": "0.399",
- "r3.2xlarge": "0.798",
- "r3.4xlarge": "1.596",
- "r3.8xlarge": "3.192",
- "t1.micro": "0.024",
- "t2.micro": "0.015",
- "t2.small": "0.031",
- "t2.medium": "0.062",
- "t2.large": "0.124",
- "t2.nano": "0.0075"
- },
- "ec2_us_west": {
- "c1.medium": "0.148",
- "c1.xlarge": "0.592",
- "c3.large": "0.12",
- "c3.xlarge": "0.239",
- "c3.2xlarge": "0.478",
- "c3.4xlarge": "0.956",
- "c3.8xlarge": "1.912",
- "c4.large": "0.131",
- "c4.xlarge": "0.262",
- "c4.2xlarge": "0.524",
- "c4.4xlarge": "1.049",
- "c4.8xlarge": "2.098",
- "cc2.8xlarge": "N/A",
- "cg1.4xlarge": "N/A",
- "cr1.8xlarge": "N/A",
- "g2.2xlarge": "0.702",
- "g2.8xlarge": "2.808",
- "hi1.4xlarge": "N/A",
- "hs1.8xlarge": "N/A",
- "i2.xlarge": "0.938",
- "i2.2xlarge": "1.876",
- "i2.4xlarge": "3.751",
- "i2.8xlarge": "7.502",
- "m1.small": "0.047",
- "m1.medium": "0.095",
- "m1.large": "0.19",
- "m1.xlarge": "0.379",
- "m2.xlarge": "0.275",
- "m2.2xlarge": "0.55",
- "m2.4xlarge": "1.1",
- "m3.medium": "0.077",
- "m3.large": "0.154",
- "m3.xlarge": "0.308",
- "m3.2xlarge": "0.616",
- "m4.large": "0.14",
- "m4.xlarge": "0.279",
- "m4.2xlarge": "0.559",
- "m4.4xlarge": "1.117",
- "m4.10xlarge": "2.793",
- "r3.large": "0.185",
- "r3.xlarge": "0.371",
- "r3.2xlarge": "0.741",
- "r3.4xlarge": "1.482",
- "r3.8xlarge": "2.964",
- "t1.micro": "0.025",
- "t2.micro": "0.017",
- "t2.small": "0.034",
- "t2.medium": "0.068",
- "t2.large": "0.136",
- "t2.nano": "0.0085"
- },
- "ec2_us_west_oregon": {
- "c1.medium": "0.13",
- "c1.xlarge": "0.52",
- "c3.large": "0.105",
- "c3.xlarge": "0.21",
- "c3.2xlarge": "0.42",
- "c3.4xlarge": "0.84",
- "c3.8xlarge": "1.68",
- "c4.large": "0.105",
- "c4.xlarge": "0.209",
- "c4.2xlarge": "0.419",
- "c4.4xlarge": "0.838",
- "c4.8xlarge": "1.675",
- "cc2.8xlarge": "2",
- "cg1.4xlarge": "N/A",
- "cr1.8xlarge": "3.5",
- "d2.xlarge": "0.69",
- "d2.2xlarge": "1.38",
- "d2.4xlarge": "2.76",
- "d2.8xlarge": "5.52",
- "g2.2xlarge": "0.65",
- "g2.8xlarge": "2.6",
- "hi1.4xlarge": "3.1",
- "hs1.8xlarge": "4.6",
- "i2.xlarge": "0.853",
- "i2.2xlarge": "1.705",
- "i2.4xlarge": "3.41",
- "i2.8xlarge": "6.82",
- "m1.small": "0.044",
- "m1.medium": "0.087",
- "m1.large": "0.175",
- "m1.xlarge": "0.35",
- "m2.xlarge": "0.245",
- "m2.2xlarge": "0.49",
- "m2.4xlarge": "0.98",
- "m3.medium": "0.067",
- "m3.large": "0.133",
- "m3.xlarge": "0.266",
- "m3.2xlarge": "0.532",
- "m4.large": "0.12",
- "m4.xlarge": "0.239",
- "m4.2xlarge": "0.479",
- "m4.4xlarge": "0.958",
- "m4.10xlarge": "2.394",
- "r3.large": "0.166",
- "r3.xlarge": "0.333",
- "r3.2xlarge": "0.665",
- "r3.4xlarge": "1.33",
- "r3.8xlarge": "2.66",
- "t1.micro": "0.02",
- "t2.micro": "0.013",
- "t2.small": "0.026",
- "t2.medium": "0.052",
- "t2.large": "0.104",
- "t2.nano": "0.0065"
- },
- "elastichosts": {
- "small": 0.1,
- "medium": 0.223,
- "large": 0.378,
- "extra-large": 0.579,
- "high-cpu-extra-large": 0.77,
- "high-cpu-medium": 0.18
- },
- "gandi": {
- "small": 0.02,
- "medium": 0.03,
- "large": 0.06,
- "x-large": 0.12,
- "1": 0.02
- },
- "gogrid": {
- "1GB": 0.19,
- "2GB": 0.38,
- "4GB": 0.76,
- "8GB": 1.52,
- "16GB": 3.04,
- "24GB": 4.56,
- "512MB": 0.095
- },
- "google_asia": {
- "f1-micro": 0.009,
- "f1-micro-preemptible": 0.005,
- "g1-small": 0.03,
- "g1-small-preemptible": 0.01,
- "n1-highcpu-2": 0.084,
- "n1-highcpu-2-preemptible": 0.022,
- "n1-highcpu-4": 0.168,
- "n1-highcpu-4-preemptible": 0.044,
- "n1-highcpu-8": 0.336,
- "n1-highcpu-8-preemptible": 0.088,
- "n1-highcpu-16": 0.672,
- "n1-highcpu-16-preemptible": 0.176,
- "n1-highcpu-32": 1.344,
- "n1-highcpu-32-preemptible": 0.352,
- "n1-highmem-2": 0.139,
- "n1-highmem-2-preemptible": 0.0385,
- "n1-highmem-4": 0.278,
- "n1-highmem-4-preemptible": 0.077,
- "n1-highmem-8": 0.556,
- "n1-highmem-8-preemptible": 0.154,
- "n1-highmem-16": 1.112,
- "n1-highmem-16-preemptible": 0.308,
- "n1-highmem-32": 2.224,
- "n1-highmem-32-preemptible": 0.616,
- "n1-standard-1": 0.055,
- "n1-standard-1-preemptible": 0.0165,
- "n1-standard-2": 0.11,
- "n1-standard-2-preemptible": 0.033,
- "n1-standard-4": 0.22,
- "n1-standard-4-preemptible": 0.066,
- "n1-standard-8": 0.44,
- "n1-standard-8-preemptible": 0.132,
- "n1-standard-16": 0.88,
- "n1-standard-16-preemptible": 0.264,
- "n1-standard-32": 1.76,
- "n1-standard-32-preemptible": 0.528
- },
- "google_europe": {
- "f1-micro": 0.009,
- "f1-micro-preemptible": 0.005,
- "g1-small": 0.03,
- "g1-small-preemptible": 0.01,
- "n1-highcpu-2": 0.084,
- "n1-highcpu-2-preemptible": 0.022,
- "n1-highcpu-4": 0.168,
- "n1-highcpu-4-preemptible": 0.044,
- "n1-highcpu-8": 0.336,
- "n1-highcpu-8-preemptible": 0.088,
- "n1-highcpu-16": 0.672,
- "n1-highcpu-16-preemptible": 0.176,
- "n1-highcpu-32": 1.344,
- "n1-highcpu-32-preemptible": 0.352,
- "n1-highmem-2": 0.139,
- "n1-highmem-2-preemptible": 0.0385,
- "n1-highmem-4": 0.278,
- "n1-highmem-4-preemptible": 0.077,
- "n1-highmem-8": 0.556,
- "n1-highmem-8-preemptible": 0.154,
- "n1-highmem-16": 1.112,
- "n1-highmem-16-preemptible": 0.308,
- "n1-highmem-32": 2.224,
- "n1-highmem-32-preemptible": 0.616,
- "n1-standard-1": 0.055,
- "n1-standard-1-preemptible": 0.0165,
- "n1-standard-2": 0.11,
- "n1-standard-2-preemptible": 0.033,
- "n1-standard-4": 0.22,
- "n1-standard-4-preemptible": 0.066,
- "n1-standard-8": 0.44,
- "n1-standard-8-preemptible": 0.132,
- "n1-standard-16": 0.88,
- "n1-standard-16-preemptible": 0.264,
- "n1-standard-32": 1.76,
- "n1-standard-32-preemptible": 0.528
- },
- "google_us": {
- "f1-micro": 0.008,
- "f1-micro-preemptible": 0.005,
- "g1-small": 0.027,
- "g1-small-preemptible": 0.01,
- "n1-highcpu-2": 0.076,
- "n1-highcpu-2-preemptible": 0.02,
- "n1-highcpu-4": 0.152,
- "n1-highcpu-4-preemptible": 0.04,
- "n1-highcpu-8": 0.304,
- "n1-highcpu-8-preemptible": 0.08,
- "n1-highcpu-16": 0.608,
- "n1-highcpu-16-preemptible": 0.16,
- "n1-highcpu-32": 1.216,
- "n1-highcpu-32-preemptible": 0.32,
- "n1-highmem-2": 0.126,
- "n1-highmem-2-preemptible": 0.035,
- "n1-highmem-4": 0.252,
- "n1-highmem-4-preemptible": 0.07,
- "n1-highmem-8": 0.504,
- "n1-highmem-8-preemptible": 0.14,
- "n1-highmem-16": 1.008,
- "n1-highmem-16-preemptible": 0.28,
- "n1-highmem-32": 2.016,
- "n1-highmem-32-preemptible": 0.56,
- "n1-standard-1": 0.05,
- "n1-standard-1-preemptible": 0.015,
- "n1-standard-2": 0.1,
- "n1-standard-2-preemptible": 0.03,
- "n1-standard-4": 0.2,
- "n1-standard-4-preemptible": 0.06,
- "n1-standard-8": 0.4,
- "n1-standard-8-preemptible": 0.12,
- "n1-standard-16": 0.8,
- "n1-standard-16-preemptible": 0.24,
- "n1-standard-32": 1.6,
- "n1-standard-32-preemptible": 0.48
- },
- "nephoscale": {
- "1": 0.6,
- "3": 0.063,
- "5": 0.031,
- "7": 0.125,
- "9": 0.188,
- "11": 0.35,
- "27": 0.0,
- "46": 0.1,
- "48": 0.15,
- "50": 0.28,
- "52": 0.48,
- "54": 0.938,
- "56": 0.75
- },
- "nimbus": {
- "m1.small": 0.0,
- "m1.large": 0.0,
- "m1.xlarge": 0.0
- },
- "osc_inc_eu_west_1": {
- "c1.medium": "0.230",
- "c1.xlarge": "0.900",
- "cc1.4xlarge": "1.300",
- "cc2.8xlarge": "2.400",
- "cr1.8xlarge": "3.500",
- "m1.small": "0.090",
- "m1.medium": "0.120",
- "m1.large": "0.360",
- "m1.xlarge": "0.730",
- "m2.xlarge": "0.410",
- "m2.2xlarge": "0.820",
- "m2.4xlarge": "1.640",
- "m3.xlarge": "0.780",
- "m3.2xlarge": "1.560",
- "nv1.small": "5.220",
- "nv1.medium": "5.250",
- "nv1.large": "5.490",
- "nv1.xlarge": "5.610",
- "os1.8xlarge": "4.310",
- "t1.micro": "0.040"
- },
- "osc_inc_eu_west_2": {
- "c1.medium": "0.230",
- "c1.xlarge": "0.900",
- "cc1.4xlarge": "1.300",
- "cc2.8xlarge": "2.400",
- "cr1.8xlarge": "3.500",
- "m1.small": "0.090",
- "m1.medium": "0.120",
- "m1.large": "0.360",
- "m1.xlarge": "0.730",
- "m2.xlarge": "0.410",
- "m2.2xlarge": "0.820",
- "m2.4xlarge": "1.640",
- "m3.xlarge": "0.780",
- "m3.2xlarge": "1.560",
- "nv1.small": "5.220",
- "nv1.medium": "5.250",
- "nv1.large": "5.490",
- "nv1.xlarge": "5.610",
- "os1.8xlarge": "4.310",
- "t1.micro": "0.040"
- },
- "osc_inc_eu_west_3": {
- "c1.medium": "0.230",
- "c1.xlarge": "0.900",
- "cc1.4xlarge": "1.300",
- "cc2.8xlarge": "2.400",
- "cr1.8xlarge": "3.500",
- "m1.small": "0.090",
- "m1.medium": "0.120",
- "m1.large": "0.360",
- "m1.xlarge": "0.730",
- "m2.xlarge": "0.410",
- "m2.2xlarge": "0.820",
- "m2.4xlarge": "1.640",
- "m3.xlarge": "0.780",
- "m3.2xlarge": "1.560",
- "nv1.small": "5.220",
- "nv1.medium": "5.250",
- "nv1.large": "5.490",
- "nv1.xlarge": "5.610",
- "os1.8xlarge": "4.310",
- "t1.micro": "0.040"
- },
- "osc_inc_us_east_1": {
- "c1.medium": "0.150",
- "c1.xlarge": "0.580",
- "cc1.4xlarge": "1.610",
- "cc2.8xlarge": "2.400",
- "cr1.8xlarge": "3.500",
- "m1.small": "0.060",
- "m1.medium": "0.180",
- "m1.large": "0.240",
- "m1.xlarge": "0.730",
- "m2.xlarge": "0.410",
- "m2.2xlarge": "1.020",
- "m2.4xlarge": "2.040",
- "m3.xlarge": "0.500",
- "m3.2xlarge": "1.560",
- "nv1.small": "5.190",
- "nv1.medium": "5.250",
- "nv1.large": "5.490",
- "nv1.xlarge": "5.610",
- "os1.8xlarge": "6.400",
- "t1.micro": "0.020"
- },
- "osc_inc_us_east_2": {
- "c1.medium": "0.150",
- "c1.xlarge": "0.580",
- "cc1.4xlarge": "1.610",
- "cc2.8xlarge": "2.400",
- "cr1.8xlarge": "3.500",
- "m1.small": "0.060",
- "m1.medium": "0.180",
- "m1.large": "0.240",
- "m1.xlarge": "0.730",
- "m2.xlarge": "0.410",
- "m2.2xlarge": "1.020",
- "m2.4xlarge": "2.040",
- "m3.xlarge": "0.500",
- "m3.2xlarge": "1.560",
- "nv1.small": "5.190",
- "nv1.medium": "5.250",
- "nv1.large": "5.490",
- "nv1.xlarge": "5.610",
- "os1.8xlarge": "6.400",
- "t1.micro": "0.020"
- },
- "osc_sas_eu_west_1": {
- "c1.medium": "0.230",
- "c1.xlarge": "0.900",
- "cc1.4xlarge": "1.460",
- "cc2.8xlarge": "2.700",
- "cr1.8xlarge": "3.750",
- "m1.small": "0.090",
- "m1.medium": "0.130",
- "m1.large": "0.360",
- "m1.xlarge": "0.730",
- "m2.xlarge": "0.460",
- "m2.2xlarge": "0.920",
- "m2.4xlarge": "1.840",
- "m3.xlarge": "0.780",
- "m3.2xlarge": "1.560",
- "nv1.small": "5.220",
- "nv1.medium": "5.310",
- "nv1.large": "5.490",
- "nv1.xlarge": "5.860",
- "os1.8xlarge": "6.400",
- "t1.micro": "0.040"
- },
- "osc_sas_eu_west_2": {
- "c1.medium": "0.230",
- "c1.xlarge": "0.900",
- "cc1.4xlarge": "1.460",
- "cc2.8xlarge": "2.700",
- "cr1.8xlarge": "3.750",
- "m1.small": "0.090",
- "m1.medium": "0.130",
- "m1.large": "0.360",
- "m1.xlarge": "0.730",
- "m2.xlarge": "0.460",
- "m2.2xlarge": "0.920",
- "m2.4xlarge": "1.840",
- "m3.xlarge": "0.780",
- "m3.2xlarge": "1.560",
- "nv1.small": "5.220",
- "nv1.medium": "5.310",
- "nv1.large": "5.490",
- "nv1.xlarge": "5.860",
- "os1.8xlarge": "6.400",
- "t1.micro": "0.040"
- },
- "osc_sas_eu_west_3": {
- "c1.medium": "0.230",
- "c1.xlarge": "0.900",
- "cc1.4xlarge": "1.460",
- "cc2.8xlarge": "2.700",
- "cr1.8xlarge": "3.750",
- "m1.small": "0.090",
- "m1.medium": "0.130",
- "m1.large": "0.360",
- "m1.xlarge": "0.730",
- "m2.xlarge": "0.460",
- "m2.2xlarge": "0.920",
- "m2.4xlarge": "1.840",
- "m3.xlarge": "0.780",
- "m3.2xlarge": "1.560",
- "nv1.small": "5.220",
- "nv1.medium": "5.310",
- "nv1.large": "5.490",
- "nv1.xlarge": "5.860",
- "os1.8xlarge": "6.400",
- "t1.micro": "0.040"
- },
- "osc_sas_us_east_1": {
- "c1.medium": "0.170",
- "c1.xlarge": "0.660",
- "cc1.4xlarge": "1.610",
- "cc2.8xlarge": "2.700",
- "cr1.8xlarge": "3.750",
- "m1.small": "0.070",
- "m1.medium": "0.180",
- "m1.large": "0.260",
- "m1.xlarge": "0.730",
- "m2.xlarge": "0.460",
- "m2.2xlarge": "1.020",
- "m2.4xlarge": "2.040",
- "m3.xlarge": "0.550",
- "m3.2xlarge": "1.560",
- "nv1.small": "5.220",
- "nv1.medium": "5.310",
- "nv1.large": "5.490",
- "nv1.xlarge": "5.860",
- "os1.8xlarge": "6.400",
- "t1.micro": "0.020"
- },
- "osc_sas_us_east_2": {
- "c1.medium": "0.170",
- "c1.xlarge": "0.660",
- "cc1.4xlarge": "1.610",
- "cc2.8xlarge": "2.700",
- "cr1.8xlarge": "3.750",
- "m1.small": "0.070",
- "m1.medium": "0.180",
- "m1.large": "0.260",
- "m1.xlarge": "0.730",
- "m2.xlarge": "0.460",
- "m2.2xlarge": "1.020",
- "m2.4xlarge": "2.040",
- "m3.xlarge": "0.550",
- "m3.2xlarge": "1.560",
- "nv1.small": "5.220",
- "nv1.medium": "5.310",
- "nv1.large": "5.490",
- "nv1.xlarge": "5.860",
- "os1.8xlarge": "6.400",
- "t1.micro": "0.020"
- },
- "rackspace": {
- "performance1-1": 0.04,
- "performance1-2": 0.08,
- "performance1-4": 0.16,
- "performance1-8": 0.32,
- "performance2-15": 0.68,
- "performance2-30": 1.36,
- "performance2-60": 2.72,
- "performance2-90": 4.08,
- "performance2-120": 5.44,
- "1": 0.015,
- "2": 0.03,
- "3": 0.06,
- "4": 0.12,
- "5": 0.24,
- "6": 0.48,
- "7": 0.96,
- "8": 1.8
- },
- "rackspacenovalon": {
- "performance1-1": 0.04,
- "performance1-2": 0.08,
- "performance1-4": 0.16,
- "performance1-8": 0.32,
- "performance2-15": 0.68,
- "performance2-30": 1.36,
- "performance2-60": 2.72,
- "performance2-90": 4.08,
- "performance2-120": 5.44,
- "2": 0.032,
- "3": 0.064,
- "4": 0.129,
- "5": 0.258,
- "6": 0.516,
- "7": 0.967,
- "8": 1.612
- },
- "rackspacenovasyd": {
- "performance1-1": 0.04,
- "performance1-2": 0.08,
- "performance1-4": 0.16,
- "performance1-8": 0.32,
- "performance2-15": 0.68,
- "performance2-30": 1.36,
- "performance2-60": 2.72,
- "performance2-90": 4.08,
- "performance2-120": 5.44,
- "2": 0.026,
- "3": 0.072,
- "4": 0.144,
- "5": 0.288,
- "6": 0.576,
- "7": 1.08,
- "8": 1.44
- },
- "rackspacenovaus": {
- "performance1-1": 0.04,
- "performance1-2": 0.08,
- "performance1-4": 0.16,
- "performance1-8": 0.32,
- "performance2-15": 0.68,
- "performance2-30": 1.36,
- "performance2-60": 2.72,
- "performance2-90": 4.08,
- "performance2-120": 5.44,
- "2": 0.022,
- "3": 0.06,
- "4": 0.12,
- "5": 0.24,
- "6": 0.48,
- "7": 0.96,
- "8": 1.2
- },
- "serverlove": {
- "small": 0.161,
- "medium": 0.404,
- "large": 0.534,
- "extra-large": 0.615,
- "high-cpu-extra-large": 0.776,
- "high-cpu-medium": 0.291
- },
- "skalicloud": {
- "small": 0.136,
- "medium": 0.301,
- "large": 0.505,
- "extra-large": 0.654,
- "high-cpu-extra-large": 0.936,
- "high-cpu-medium": 0.249
- },
- "softlayer": {
- "0": 0.023,
- "1": 0.024,
- "2": 0.024,
- "3": 0.026,
- "4": 0.045,
- "5": 0.045,
- "6": 0.045,
- "7": 0.09,
- "8": 0.09,
- "9": 0.09,
- "10": 0.09,
- "11": 0.205,
- "12": 0.205
- },
- "vps_net": {
- "1": 0.416
- }
- },
- "storage": {},
- "updated": 1452645090
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/libcloud/dns/__init__.py
----------------------------------------------------------------------
diff --git a/apache-libcloud-1.0.0rc2/libcloud/dns/__init__.py b/apache-libcloud-1.0.0rc2/libcloud/dns/__init__.py
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/libcloud/dns/base.py
----------------------------------------------------------------------
diff --git a/apache-libcloud-1.0.0rc2/libcloud/dns/base.py b/apache-libcloud-1.0.0rc2/libcloud/dns/base.py
deleted file mode 100644
index 6f7cb14..0000000
--- a/apache-libcloud-1.0.0rc2/libcloud/dns/base.py
+++ /dev/null
@@ -1,495 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from __future__ import with_statement
-
-import datetime
-
-from libcloud import __version__
-from libcloud.common.base import ConnectionUserAndKey, BaseDriver
-from libcloud.dns.types import RecordType
-
-__all__ = [
- 'Zone',
- 'Record',
- 'DNSDriver'
-]
-
-
-class Zone(object):
- """
- DNS zone.
- """
-
- def __init__(self, id, domain, type, ttl, driver, extra=None):
- """
- :param id: Zone id.
- :type id: ``str``
-
- :param domain: The name of the domain.
- :type domain: ``str``
-
- :param type: Zone type (master, slave).
- :type type: ``str``
-
- :param ttl: Default TTL for records in this zone (in seconds).
- :type ttl: ``int``
-
- :param driver: DNSDriver instance.
- :type driver: :class:`DNSDriver`
-
- :param extra: (optional) Extra attributes (driver specific).
- :type extra: ``dict``
- """
- self.id = str(id) if id else None
- self.domain = domain
- self.type = type
- self.ttl = ttl or None
- self.driver = driver
- self.extra = extra or {}
-
- def list_records(self):
- return self.driver.list_records(zone=self)
-
- def create_record(self, name, type, data, extra=None):
- return self.driver.create_record(name=name, zone=self, type=type,
- data=data, extra=extra)
-
- def update(self, domain=None, type=None, ttl=None, extra=None):
- return self.driver.update_zone(zone=self, domain=domain, type=type,
- ttl=ttl, extra=extra)
-
- def delete(self):
- return self.driver.delete_zone(zone=self)
-
- def export_to_bind_format(self):
- return self.driver.export_zone_to_bind_format(zone=self)
-
- def export_to_bind_zone_file(self, file_path):
- self.driver.export_zone_to_bind_zone_file(zone=self,
- file_path=file_path)
-
- def __repr__(self):
- return ('<Zone: domain=%s, ttl=%s, provider=%s ...>' %
- (self.domain, self.ttl, self.driver.name))
-
-
-class Record(object):
- """
- Zone record / resource.
- """
-
- def __init__(self, id, name, type, data, zone, driver, ttl=None,
- extra=None):
- """
- :param id: Record id
- :type id: ``str``
-
- :param name: Hostname or FQDN.
- :type name: ``str``
-
- :param type: DNS record type (A, AAAA, ...).
- :type type: :class:`RecordType`
-
- :param data: Data for the record (depends on the record type).
- :type data: ``str``
-
- :param zone: Zone instance.
- :type zone: :class:`Zone`
-
- :param driver: DNSDriver instance.
- :type driver: :class:`DNSDriver`
-
- :param ttl: Record TTL.
- :type ttl: ``int``
-
- :param extra: (optional) Extra attributes (driver specific).
- :type extra: ``dict``
- """
- self.id = str(id) if id else None
- self.name = name
- self.type = type
- self.data = data
- self.zone = zone
- self.driver = driver
- self.ttl = ttl
- self.extra = extra or {}
-
- def update(self, name=None, type=None, data=None, extra=None):
- return self.driver.update_record(record=self, name=name, type=type,
- data=data, extra=extra)
-
- def delete(self):
- return self.driver.delete_record(record=self)
-
- def _get_numeric_id(self):
- record_id = self.id
-
- if record_id.isdigit():
- record_id = int(record_id)
-
- return record_id
-
- def __repr__(self):
- zone = self.zone.domain if self.zone.domain else self.zone.id
- return ('<Record: zone=%s, name=%s, type=%s, data=%s, provider=%s, '
- 'ttl=%s ...>' %
- (zone, self.name, self.type, self.data,
- self.driver.name, self.ttl))
-
-
-class DNSDriver(BaseDriver):
- """
- A base DNSDriver class to derive from
-
- This class is always subclassed by a specific driver.
- """
- connectionCls = ConnectionUserAndKey
- name = None
- website = None
-
- # Map libcloud record type enum to provider record type name
- RECORD_TYPE_MAP = {}
-
- def __init__(self, key, secret=None, secure=True, host=None, port=None,
- **kwargs):
- """
- :param key: API key or username to used (required)
- :type key: ``str``
-
- :param secret: Secret password to be used (required)
- :type secret: ``str``
-
- :param secure: Whether to use HTTPS or HTTP. Note: Some providers
- only support HTTPS, and it is on by default.
- :type secure: ``bool``
-
- :param host: Override hostname used for connections.
- :type host: ``str``
-
- :param port: Override port used for connections.
- :type port: ``int``
-
- :return: ``None``
- """
- super(DNSDriver, self).__init__(key=key, secret=secret, secure=secure,
- host=host, port=port, **kwargs)
-
- def list_record_types(self):
- """
- Return a list of RecordType objects supported by the provider.
-
- :return: ``list`` of :class:`RecordType`
- """
- return list(self.RECORD_TYPE_MAP.keys())
-
- def iterate_zones(self):
- """
- Return a generator to iterate over available zones.
-
- :rtype: ``generator`` of :class:`Zone`
- """
- raise NotImplementedError(
- 'iterate_zones not implemented for this driver')
-
- def list_zones(self):
- """
- Return a list of zones.
-
- :return: ``list`` of :class:`Zone`
- """
- return list(self.iterate_zones())
-
- def iterate_records(self, zone):
- """
- Return a generator to iterate over records for the provided zone.
-
- :param zone: Zone to list records for.
- :type zone: :class:`Zone`
-
- :rtype: ``generator`` of :class:`Record`
- """
- raise NotImplementedError(
- 'iterate_records not implemented for this driver')
-
- def list_records(self, zone):
- """
- Return a list of records for the provided zone.
-
- :param zone: Zone to list records for.
- :type zone: :class:`Zone`
-
- :return: ``list`` of :class:`Record`
- """
- return list(self.iterate_records(zone))
-
- def get_zone(self, zone_id):
- """
- Return a Zone instance.
-
- :param zone_id: ID of the required zone
- :type zone_id: ``str``
-
- :rtype: :class:`Zone`
- """
- raise NotImplementedError(
- 'get_zone not implemented for this driver')
-
- def get_record(self, zone_id, record_id):
- """
- Return a Record instance.
-
- :param zone_id: ID of the required zone
- :type zone_id: ``str``
-
- :param record_id: ID of the required record
- :type record_id: ``str``
-
- :rtype: :class:`Record`
- """
- raise NotImplementedError(
- 'get_record not implemented for this driver')
-
- def create_zone(self, domain, type='master', ttl=None, extra=None):
- """
- Create a new zone.
-
- :param domain: Zone domain name (e.g. example.com)
- :type domain: ``str``
-
- :param type: Zone type (master / slave).
- :type type: ``str``
-
- :param ttl: TTL for new records. (optional)
- :type ttl: ``int``
-
- :param extra: Extra attributes (driver specific). (optional)
- :type extra: ``dict``
-
- :rtype: :class:`Zone`
- """
- raise NotImplementedError(
- 'create_zone not implemented for this driver')
-
- def update_zone(self, zone, domain, type='master', ttl=None, extra=None):
- """
- Update en existing zone.
-
- :param zone: Zone to update.
- :type zone: :class:`Zone`
-
- :param domain: Zone domain name (e.g. example.com)
- :type domain: ``str``
-
- :param type: Zone type (master / slave).
- :type type: ``str``
-
- :param ttl: TTL for new records. (optional)
- :type ttl: ``int``
-
- :param extra: Extra attributes (driver specific). (optional)
- :type extra: ``dict``
-
- :rtype: :class:`Zone`
- """
- raise NotImplementedError(
- 'update_zone not implemented for this driver')
-
- def create_record(self, name, zone, type, data, extra=None):
- """
- Create a new record.
-
- :param name: Record name without the domain name (e.g. www).
- Note: If you want to create a record for a base domain
- name, you should specify empty string ('') for this
- argument.
- :type name: ``str``
-
- :param zone: Zone where the requested record is created.
- :type zone: :class:`Zone`
-
- :param type: DNS record type (A, AAAA, ...).
- :type type: :class:`RecordType`
-
- :param data: Data for the record (depends on the record type).
- :type data: ``str``
-
- :param extra: Extra attributes (driver specific). (optional)
- :type extra: ``dict``
-
- :rtype: :class:`Record`
- """
- raise NotImplementedError(
- 'create_record not implemented for this driver')
-
- def update_record(self, record, name, type, data, extra=None):
- """
- Update an existing record.
-
- :param record: Record to update.
- :type record: :class:`Record`
-
- :param name: Record name without the domain name (e.g. www).
- Note: If you want to create a record for a base domain
- name, you should specify empty string ('') for this
- argument.
- :type name: ``str``
-
- :param type: DNS record type (A, AAAA, ...).
- :type type: :class:`RecordType`
-
- :param data: Data for the record (depends on the record type).
- :type data: ``str``
-
- :param extra: (optional) Extra attributes (driver specific).
- :type extra: ``dict``
-
- :rtype: :class:`Record`
- """
- raise NotImplementedError(
- 'update_record not implemented for this driver')
-
- def delete_zone(self, zone):
- """
- Delete a zone.
-
- Note: This will delete all the records belonging to this zone.
-
- :param zone: Zone to delete.
- :type zone: :class:`Zone`
-
- :rtype: ``bool``
- """
- raise NotImplementedError(
- 'delete_zone not implemented for this driver')
-
- def delete_record(self, record):
- """
- Delete a record.
-
- :param record: Record to delete.
- :type record: :class:`Record`
-
- :rtype: ``bool``
- """
- raise NotImplementedError(
- 'delete_record not implemented for this driver')
-
- def export_zone_to_bind_format(self, zone):
- """
- Export Zone object to the BIND compatible format.
-
- :param zone: Zone to export.
- :type zone: :class:`Zone`
-
- :return: Zone data in BIND compatible format.
- :rtype: ``str``
- """
- if zone.type != 'master':
- raise ValueError('You can only generate BIND out for master zones')
-
- lines = []
-
- # For consistent output, records are sorted based on the id
- records = zone.list_records()
- records = sorted(records, key=Record._get_numeric_id)
-
- date = datetime.datetime.now().strftime('%Y-%m-%d %H:%m:%S')
- values = {'version': __version__, 'date': date}
-
- lines.append('; Generated by Libcloud v%(version)s on %(date)s' %
- values)
- lines.append('$ORIGIN %(domain)s.' % {'domain': zone.domain})
- lines.append('$TTL %(domain_ttl)s\n' % {'domain_ttl': zone.ttl})
-
- for record in records:
- line = self._get_bind_record_line(record=record)
- lines.append(line)
-
- output = '\n'.join(lines)
- return output
-
- def export_zone_to_bind_zone_file(self, zone, file_path):
- """
- Export Zone object to the BIND compatible format and write result to a
- file.
-
- :param zone: Zone to export.
- :type zone: :class:`Zone`
-
- :param file_path: File path where the output will be saved.
- :type file_path: ``str``
- """
- result = self.export_zone_to_bind_format(zone=zone)
-
- with open(file_path, 'w') as fp:
- fp.write(result)
-
- def _get_bind_record_line(self, record):
- """
- Generate BIND record line for the provided record.
-
- :param record: Record to generate the line for.
- :type record: :class:`Record`
-
- :return: Bind compatible record line.
- :rtype: ``str``
- """
- parts = []
-
- if record.name:
- name = '%(name)s.%(domain)s' % {'name': record.name,
- 'domain': record.zone.domain}
- else:
- name = record.zone.domain
-
- name += '.'
-
- ttl = record.extra['ttl'] if 'ttl' in record.extra else record.zone.ttl
- ttl = str(ttl)
- data = record.data
-
- if record.type in [RecordType.CNAME, RecordType.DNAME, RecordType.MX,
- RecordType.PTR, RecordType.SRV]:
- # Make sure trailing dot is present
- if data[len(data) - 1] != '.':
- data += '.'
-
- if record.type in [RecordType.TXT, RecordType.SPF] and ' ' in data:
- # Escape the quotes
- data = data.replace('"', '\\"')
-
- # Quote the string
- data = '"%s"' % (data)
-
- if record.type in [RecordType.MX, RecordType.SRV]:
- priority = str(record.extra['priority'])
- parts = [name, ttl, 'IN', record.type, priority, data]
- else:
- parts = [name, ttl, 'IN', record.type, data]
-
- line = '\t'.join(parts)
- return line
-
- def _string_to_record_type(self, string):
- """
- Return a string representation of a DNS record type to a
- libcloud RecordType ENUM.
-
- :rtype: ``str``
- """
- string = string.upper()
- record_type = getattr(RecordType, string)
- return record_type
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/libcloud/dns/drivers/__init__.py
----------------------------------------------------------------------
diff --git a/apache-libcloud-1.0.0rc2/libcloud/dns/drivers/__init__.py b/apache-libcloud-1.0.0rc2/libcloud/dns/drivers/__init__.py
deleted file mode 100644
index e69de29..0000000
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/libcloud/dns/drivers/auroradns.py
----------------------------------------------------------------------
diff --git a/apache-libcloud-1.0.0rc2/libcloud/dns/drivers/auroradns.py b/apache-libcloud-1.0.0rc2/libcloud/dns/drivers/auroradns.py
deleted file mode 100644
index 658f99c..0000000
--- a/apache-libcloud-1.0.0rc2/libcloud/dns/drivers/auroradns.py
+++ /dev/null
@@ -1,609 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-AuroraDNS DNS Driver
-"""
-
-import base64
-import json
-import hmac
-import datetime
-
-from hashlib import sha256
-
-from libcloud.utils.py3 import httplib
-from libcloud.utils.py3 import b
-
-from libcloud.common.base import ConnectionUserAndKey, JsonResponse
-
-from libcloud.common.types import InvalidCredsError, ProviderError
-from libcloud.common.types import LibcloudError
-
-from libcloud.dns.base import DNSDriver, Zone, Record
-from libcloud.dns.types import RecordType, ZoneDoesNotExistError
-from libcloud.dns.types import ZoneAlreadyExistsError, RecordDoesNotExistError
-
-
-API_HOST = 'api.auroradns.eu'
-
-# Default TTL required by libcloud, but doesn't do anything in AuroraDNS
-DEFAULT_ZONE_TTL = 3600
-DEFAULT_ZONE_TYPE = 'master'
-
-VALID_RECORD_PARAMS_EXTRA = ['ttl', 'prio', 'health_check_id', 'disabled']
-
-
-class AuroraDNSHealthCheckType(object):
- """
- Healthcheck type.
- """
- HTTP = 'HTTP'
- HTTPS = 'HTTPS'
- TCP = 'TCP'
-
-
-class HealthCheckError(LibcloudError):
- error_type = 'HealthCheckError'
-
- def __init__(self, value, driver, health_check_id):
- self.health_check_id = health_check_id
- super(HealthCheckError, self).__init__(value=value, driver=driver)
-
- def __str__(self):
- return self.__repr__()
-
- def __repr__(self):
- return ('<%s in %s, health_check_id=%s, value=%s>' %
- (self.error_type, repr(self.driver),
- self.health_check_id, self.value))
-
-
-class HealthCheckDoesNotExistError(HealthCheckError):
- error_type = 'HealthCheckDoesNotExistError'
-
-
-class AuroraDNSHealthCheck(object):
- """
- AuroraDNS Healthcheck resource.
- """
-
- def __init__(self, id, type, hostname, ipaddress, port, interval, path,
- threshold, health, enabled, zone, driver, extra=None):
- """
- :param id: Healthcheck id
- :type id: ``str``
-
- :param hostname: Hostname or FQDN of the target
- :type hostname: ``str``
-
- :param ipaddress: IPv4 or IPv6 address of the target
- :type ipaddress: ``str``
-
- :param port: The port on the target to monitor
- :type port: ``int``
-
- :param interval: The interval of the health check
- :type interval: ``int``
-
- :param path: The path to monitor on the target
- :type path: ``str``
-
- :param threshold: The threshold of before marking a check as failed
- :type threshold: ``int``
-
- :param health: The current health of the health check
- :type health: ``bool``
-
- :param enabled: If the health check is currently enabled
- :type enabled: ``bool``
-
- :param zone: Zone instance.
- :type zone: :class:`Zone`
-
- :param driver: DNSDriver instance.
- :type driver: :class:`DNSDriver`
-
- :param extra: (optional) Extra attributes (driver specific).
- :type extra: ``dict``
- """
- self.id = str(id) if id else None
- self.type = type
- self.hostname = hostname
- self.ipaddress = ipaddress
- self.port = int(port) if port else None
- self.interval = int(interval)
- self.path = path
- self.threshold = int(threshold)
- self.health = bool(health)
- self.enabled = bool(enabled)
- self.zone = zone
- self.driver = driver
- self.extra = extra or {}
-
- def update(self, type=None, hostname=None, ipaddress=None, port=None,
- interval=None, path=None, threshold=None, enabled=None,
- extra=None):
- return self.driver.ex_update_healthcheck(healthcheck=self, type=type,
- hostname=hostname,
- ipaddress=ipaddress,
- port=port, path=path,
- interval=interval,
- threshold=threshold,
- enabled=enabled, extra=extra)
-
- def delete(self):
- return self.driver.ex_delete_healthcheck(healthcheck=self)
-
- def __repr__(self):
- return ('<AuroraDNSHealthCheck: zone=%s, id=%s, type=%s, hostname=%s, '
- 'ipaddress=%s, port=%d, interval=%d, health=%s, provider=%s'
- '...>' %
- (self.zone.id, self.id, self.type, self.hostname,
- self.ipaddress, self.port, self.interval, self.health,
- self.driver.name))
-
-
-class AuroraDNSResponse(JsonResponse):
- def success(self):
- return self.status in [httplib.OK, httplib.CREATED, httplib.ACCEPTED]
-
- def parse_error(self):
- status = int(self.status)
- error = {'driver': self, 'value': ''}
-
- if status == httplib.UNAUTHORIZED:
- error['value'] = 'Authentication failed'
- raise InvalidCredsError(**error)
- elif status == httplib.FORBIDDEN:
- error['value'] = 'Authorization failed'
- error['http_status'] = status
- raise ProviderError(**error)
- elif status == httplib.NOT_FOUND:
- context = self.connection.context
- if context['resource'] == 'zone':
- error['zone_id'] = context['id']
- raise ZoneDoesNotExistError(**error)
- elif context['resource'] == 'record':
- error['record_id'] = context['id']
- raise RecordDoesNotExistError(**error)
- elif context['resource'] == 'healthcheck':
- error['health_check_id'] = context['id']
- raise HealthCheckDoesNotExistError(**error)
- elif status == httplib.CONFLICT:
- context = self.connection.context
- if context['resource'] == 'zone':
- error['zone_id'] = context['id']
- raise ZoneAlreadyExistsError(**error)
- elif status == httplib.BAD_REQUEST:
- context = self.connection.context
- body = self.parse_body()
- raise ProviderError(value=body['errormsg'],
- http_code=status, driver=self)
-
-
-class AuroraDNSConnection(ConnectionUserAndKey):
- host = API_HOST
- responseCls = AuroraDNSResponse
-
- def calculate_auth_signature(self, secret_key, method, url, timestamp):
- b64_hmac = base64.b64encode(
- hmac.new(b(secret_key),
- b(method) + b(url) + b(timestamp),
- digestmod=sha256).digest()
- )
-
- return b64_hmac.decode('utf-8')
-
- def gen_auth_header(self, api_key, secret_key, method, url, timestamp):
- signature = self.calculate_auth_signature(secret_key, method, url,
- timestamp)
-
- auth_b64 = base64.b64encode(b('%s:%s' % (api_key, signature)))
- return 'AuroraDNSv1 %s' % (auth_b64.decode('utf-8'))
-
- def request(self, action, params=None, data='', headers=None,
- method='GET'):
- if not headers:
- headers = {}
- if not params:
- params = {}
-
- if method in ("POST", "PUT"):
- headers = {'Content-Type': 'application/json; charset=UTF-8'}
-
- t = datetime.datetime.utcnow()
- timestamp = t.strftime('%Y%m%dT%H%M%SZ')
-
- headers['X-AuroraDNS-Date'] = timestamp
- headers['Authorization'] = self.gen_auth_header(self.user_id, self.key,
- method, action,
- timestamp)
-
- return super(AuroraDNSConnection, self).request(action=action,
- params=params,
- data=data,
- method=method,
- headers=headers)
-
-
-class AuroraDNSDriver(DNSDriver):
- name = 'AuroraDNS'
- website = 'https://www.pcextreme.nl/en/aurora/dns'
- connectionCls = AuroraDNSConnection
-
- RECORD_TYPE_MAP = {
- RecordType.A: 'A',
- RecordType.AAAA: 'AAAA',
- RecordType.CNAME: 'CNAME',
- RecordType.MX: 'MX',
- RecordType.NS: 'NS',
- RecordType.SOA: 'SOA',
- RecordType.SPF: 'SPF',
- RecordType.SRV: 'SRV',
- RecordType.TXT: 'TXT',
- }
-
- HEALTHCHECK_TYPE_MAP = {
- AuroraDNSHealthCheckType.HTTP: 'HTTP',
- AuroraDNSHealthCheckType.HTTPS: 'HTTPS',
- AuroraDNSHealthCheckType.TCP: 'TCP'
- }
-
- def list_zones(self):
- zones = []
-
- res = self.connection.request('/zones')
- for zone in res.parse_body():
- zones.append(self.__res_to_zone(zone))
-
- return zones
-
- def list_records(self, zone):
- self.connection.set_context({'resource': 'zone', 'id': zone.id})
- records = []
- res = self.connection.request('/zones/%s/records' % zone.id)
-
- for record in res.parse_body():
- records.append(self.__res_to_record(zone, record))
-
- return records
-
- def get_zone(self, zone_id):
- self.connection.set_context({'resource': 'zone', 'id': zone_id})
- res = self.connection.request('/zones/%s' % zone_id)
- zone = res.parse_body()
- return self.__res_to_zone(zone)
-
- def get_record(self, zone_id, record_id):
- self.connection.set_context({'resource': 'record', 'id': record_id})
- res = self.connection.request('/zones/%s/records/%s' % (zone_id,
- record_id))
- record = res.parse_body()
-
- zone = self.get_zone(zone_id)
-
- return self.__res_to_record(zone, record)
-
- def create_zone(self, domain, type='master', ttl=None, extra=None):
- self.connection.set_context({'resource': 'zone', 'id': domain})
- res = self.connection.request('/zones', method='POST',
- data=json.dumps({'name': domain}))
- zone = res.parse_body()
- return self.__res_to_zone(zone)
-
- def create_record(self, name, zone, type, data, extra=None):
- if name is None:
- name = ""
-
- rdata = {
- 'name': name,
- 'type': self.RECORD_TYPE_MAP[type],
- 'content': data
- }
-
- rdata = self.__merge_extra_data(rdata, extra)
-
- if 'ttl' not in rdata:
- rdata['ttl'] = DEFAULT_ZONE_TTL
-
- self.connection.set_context({'resource': 'zone', 'id': zone.id})
- res = self.connection.request('/zones/%s/records' % zone.id,
- method='POST',
- data=json.dumps(rdata))
-
- record = res.parse_body()
- return self.__res_to_record(zone, record)
-
- def delete_zone(self, zone):
- self.connection.set_context({'resource': 'zone', 'id': zone.id})
- self.connection.request('/zones/%s' % zone.id, method='DELETE')
- return True
-
- def delete_record(self, record):
- self.connection.set_context({'resource': 'record', 'id': record.id})
- self.connection.request('/zones/%s/records/%s' % (record.zone.id,
- record.id),
- method='DELETE')
- return True
-
- def update_record(self, record, name, type, data, extra):
- rdata = {}
-
- if name is not None:
- rdata['name'] = name
-
- if type is not None:
- rdata['type'] = self.RECORD_TYPE_MAP[type]
-
- if data is not None:
- rdata['content'] = data
-
- rdata = self.__merge_extra_data(rdata, extra)
-
- self.connection.set_context({'resource': 'record', 'id': record.id})
- self.connection.request('/zones/%s/records/%s' % (record.zone.id,
- record.id),
- method='PUT',
- data=json.dumps(rdata))
-
- return self.get_record(record.zone.id, record.id)
-
- def ex_list_healthchecks(self, zone):
- """
- List all Health Checks in a zone.
-
- :param zone: Zone to list health checks for.
- :type zone: :class:`Zone`
-
- :return: ``list`` of :class:`AuroraDNSHealthCheck`
- """
- healthchecks = []
- self.connection.set_context({'resource': 'zone', 'id': zone.id})
- res = self.connection.request('/zones/%s/health_checks' % zone.id)
-
- for healthcheck in res.parse_body():
- healthchecks.append(self.__res_to_healthcheck(zone, healthcheck))
-
- return healthchecks
-
- def ex_get_healthcheck(self, zone, health_check_id):
- """
- Get a single Health Check from a zone
-
- :param zone: Zone in which the health check is
- :type zone: :class:`Zone`
-
- :param health_check_id: ID of the required health check
- :type health_check_id: ``str``
-
- :return: :class:`AuroraDNSHealthCheck`
- """
- self.connection.set_context({'resource': 'healthcheck',
- 'id': health_check_id})
- res = self.connection.request('/zones/%s/health_checks/%s'
- % (zone.id, health_check_id))
- check = res.parse_body()
-
- return self.__res_to_healthcheck(zone, check)
-
- def ex_create_healthcheck(self, zone, type, hostname, port, path,
- interval, threshold, ipaddress=None,
- enabled=True, extra=None):
- """
- Create a new Health Check in a zone
-
- :param zone: Zone in which the health check should be created
- :type zone: :class:`Zone`
-
- :param type: The type of health check to be created
- :type type: :class:`AuroraDNSHealthCheckType`
-
- :param hostname: The hostname of the target to monitor
- :type hostname: ``str``
-
- :param port: The port of the target to monitor. E.g. 80 for HTTP
- :type port: ``int``
-
- :param path: The path of the target to monitor. Only used by HTTP
- at this moment. Usually this is simple /.
- :type path: ``str``
-
- :param interval: The interval of checks. 10, 30 or 60 seconds.
- :type interval: ``int``
-
- :param threshold: The threshold of failures before the healthcheck is
- marked as failed.
- :type threshold: ``int``
-
- :param ipaddress: (optional) The IP Address of the target to monitor.
- You can pass a empty string if this is not required.
- :type ipaddress: ``str``
-
- :param enabled: (optional) If this healthcheck is enabled to run
- :type enabled: ``bool``
-
- :param extra: (optional) Extra attributes (driver specific).
- :type extra: ``dict``
-
- :return: :class:`AuroraDNSHealthCheck`
- """
- cdata = {
- 'type': self.HEALTHCHECK_TYPE_MAP[type],
- 'hostname': hostname,
- 'ipaddress': ipaddress,
- 'port': int(port),
- 'interval': int(interval),
- 'path': path,
- 'threshold': int(threshold),
- 'enabled': enabled
- }
-
- self.connection.set_context({'resource': 'zone', 'id': zone.id})
- res = self.connection.request('/zones/%s/health_checks' % zone.id,
- method='POST',
- data=json.dumps(cdata))
-
- healthcheck = res.parse_body()
- return self.__res_to_healthcheck(zone, healthcheck)
-
- def ex_update_healthcheck(self, healthcheck, type=None,
- hostname=None, ipaddress=None, port=None,
- path=None, interval=None, threshold=None,
- enabled=None, extra=None):
- """
- Update an existing Health Check
-
- :param zone: The healthcheck which has to be updated
- :type zone: :class:`AuroraDNSHealthCheck`
-
- :param type: (optional) The type of health check to be created
- :type type: :class:`AuroraDNSHealthCheckType`
-
- :param hostname: (optional) The hostname of the target to monitor
- :type hostname: ``str``
-
- :param ipaddress: (optional) The IP Address of the target to monitor.
- You can pass a empty string if this is not required.
- :type ipaddress: ``str``
-
- :param port: (optional) The port of the target to monitor. E.g. 80
- for HTTP
- :type port: ``int``
-
- :param path: (optional) The path of the target to monitor.
- Only used by HTTP at this moment. Usually just '/'.
- :type path: ``str``
-
- :param interval: (optional) The interval of checks.
- 10, 30 or 60 seconds.
- :type interval: ``int``
-
- :param threshold: (optional) The threshold of failures before the
- healthcheck is marked as failed.
- :type threshold: ``int``
-
- :param enabled: (optional) If this healthcheck is enabled to run
- :type enabled: ``bool``
-
- :param extra: (optional) Extra attributes (driver specific).
- :type extra: ``dict``
-
- :return: :class:`AuroraDNSHealthCheck`
- """
- cdata = {}
-
- if type is not None:
- cdata['type'] = self.HEALTHCHECK_TYPE_MAP[type]
-
- if hostname is not None:
- cdata['hostname'] = hostname
-
- if ipaddress is not None:
- if len(ipaddress) == 0:
- cdata['ipaddress'] = None
- else:
- cdata['ipaddress'] = ipaddress
-
- if port is not None:
- cdata['port'] = int(port)
-
- if path is not None:
- cdata['path'] = path
-
- if interval is not None:
- cdata['interval'] = int(interval)
-
- if threshold is not None:
- cdata['threshold'] = threshold
-
- if enabled is not None:
- cdata['enabled'] = bool(enabled)
-
- self.connection.set_context({'resource': 'healthcheck',
- 'id': healthcheck.id})
-
- self.connection.request('/zones/%s/health_checks/%s'
- % (healthcheck.zone.id,
- healthcheck.id),
- method='PUT',
- data=json.dumps(cdata))
-
- return self.ex_get_healthcheck(healthcheck.zone,
- healthcheck.id)
-
- def ex_delete_healthcheck(self, healthcheck):
- """
- Remove an existing Health Check
-
- :param zone: The healthcheck which has to be removed
- :type zone: :class:`AuroraDNSHealthCheck`
- """
- self.connection.set_context({'resource': 'healthcheck',
- 'id': healthcheck.id})
-
- self.connection.request('/zones/%s/health_checks/%s'
- % (healthcheck.zone.id,
- healthcheck.id),
- method='DELETE')
- return True
-
- def __res_to_record(self, zone, record):
- if len(record['name']) == 0:
- name = None
- else:
- name = record['name']
-
- extra = {}
- extra['created'] = record['created']
- extra['modified'] = record['modified']
- extra['disabled'] = record['disabled']
- extra['ttl'] = record['ttl']
- extra['prio'] = record['prio']
-
- return Record(id=record['id'], name=name,
- type=record['type'],
- data=record['content'], zone=zone,
- driver=self.connection.driver, ttl=record['ttl'],
- extra=extra)
-
- def __res_to_zone(self, zone):
- return Zone(id=zone['id'], domain=zone['name'],
- type=DEFAULT_ZONE_TYPE,
- ttl=DEFAULT_ZONE_TTL, driver=self.connection.driver,
- extra={'created': zone['created'],
- 'servers': zone['servers'],
- 'account_id': zone['account_id'],
- 'cluster_id': zone['cluster_id']})
-
- def __res_to_healthcheck(self, zone, healthcheck):
- return AuroraDNSHealthCheck(id=healthcheck['id'],
- type=healthcheck['type'],
- hostname=healthcheck['hostname'],
- ipaddress=healthcheck['ipaddress'],
- health=healthcheck['health'],
- threshold=healthcheck['threshold'],
- path=healthcheck['path'],
- interval=healthcheck['interval'],
- port=healthcheck['port'],
- enabled=healthcheck['enabled'],
- zone=zone, driver=self.connection.driver)
-
- def __merge_extra_data(self, rdata, extra):
- if extra is not None:
- for param in VALID_RECORD_PARAMS_EXTRA:
- if param in extra:
- rdata[param] = extra[param]
-
- return rdata
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/libcloud/dns/drivers/buddyns.py
----------------------------------------------------------------------
diff --git a/apache-libcloud-1.0.0rc2/libcloud/dns/drivers/buddyns.py b/apache-libcloud-1.0.0rc2/libcloud/dns/drivers/buddyns.py
deleted file mode 100644
index 02af34d..0000000
--- a/apache-libcloud-1.0.0rc2/libcloud/dns/drivers/buddyns.py
+++ /dev/null
@@ -1,153 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-BuddyNS DNS Driver
-"""
-
-import sys
-
-try:
- import simplejson as json
-except ImportError:
- import json
-
-from libcloud.dns.types import Provider, ZoneDoesNotExistError,\
- ZoneAlreadyExistsError
-from libcloud.dns.base import DNSDriver, Zone
-from libcloud.common.buddyns import BuddyNSConnection, BuddyNSResponse,\
- BuddyNSException
-
-__all__ = [
- 'BuddyNSDNSDriver'
-]
-
-
-class BuddyNSDNSResponse(BuddyNSResponse):
- pass
-
-
-class BuddyNSDNSConnection(BuddyNSConnection):
- responseCls = BuddyNSDNSResponse
-
-
-class BuddyNSDNSDriver(DNSDriver):
- name = 'BuddyNS DNS'
- website = 'https://www.buddyns.com'
- type = Provider.BUDDYNS
- connectionCls = BuddyNSDNSConnection
-
- def list_zones(self):
- action = '/api/v2/zone/'
- response = self.connection.request(action=action, method='GET')
- zones = self._to_zones(items=response.parse_body())
-
- return zones
-
- def get_zone(self, zone_id):
- """
- :param zone_id: Zone domain name (e.g. example.com)
- :return: :class:`Zone`
- """
- action = '/api/v2/zone/%s' % zone_id
- try:
- response = self.connection.request(action=action, method='GET')
- except BuddyNSException:
- e = sys.exc_info()[1]
- if e.message == 'Not found':
- raise ZoneDoesNotExistError(value=e.message, driver=self,
- zone_id=zone_id)
- else:
- raise e
- zone = self._to_zone(response.parse_body())
-
- return zone
-
- def create_zone(self, domain, type='master', ttl=None, extra=None):
- """
- :param domain: Zone domain name (e.g. example.com)
- :type domain: ``str``
-
- :param type: Zone type (This is not really used. See API docs for extra
- parameters)
- :type type: ``str``
-
- :param ttl: TTL for new records (This is used through the extra param)
- :type ttl: ``int``
-
- :param extra: Extra attributes that are specific to the driver
- such as ttl.
- :type extra: ``dict``
-
- :rtype: :class:`Zone`
- Do not forget to pass the master in extra,
- extra = {'master':'65.55.37.62'} for example.
- """
- action = '/api/v2/zone/'
- data = {'name': domain}
- if extra is not None:
- data.update(extra)
- post_data = json.dumps(data)
- try:
- response = self.connection.request(action=action, method='POST',
- data=post_data)
- except BuddyNSException:
- e = sys.exc_info()[1]
- if e.message == 'Invalid zone submitted for addition.':
- raise ZoneAlreadyExistsError(value=e.message, driver=self,
- zone_id=domain)
- else:
- raise e
-
- zone = self._to_zone(response.parse_body())
-
- return zone
-
- def delete_zone(self, zone):
- """
- :param zone: Zone to be deleted.
- :type zone: :class:`Zone`
-
- :return: Boolean
- """
- action = '/api/v2/zone/%s' % zone.domain
- try:
- self.connection.request(action=action, method='DELETE')
- except BuddyNSException:
- e = sys.exc_info()[1]
- if e.message == 'Not found':
- raise ZoneDoesNotExistError(value=e.message, driver=self,
- zone_id=zone.id)
- else:
- raise e
-
- return True
-
- def _to_zone(self, item):
- common_keys = ['name', ]
- extra = {}
- for key in item:
- if key not in common_keys:
- extra[key] = item.get(key)
- zone = Zone(domain=item['name'], id=item['name'], type=None,
- extra=extra, ttl=None, driver=self)
-
- return zone
-
- def _to_zones(self, items):
- zones = []
- for item in items:
- zones.append(self._to_zone(item))
-
- return zones