#     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 libcloud.compute.types import Provider as NodeProvider
from libcloud.compute.providers import get_driver as get_node_driver
from libcloud.loadbalancer.providers import get_driver
from libcloud.loadbalancer.base import Algorithm, Member
from libcloud.loadbalancer.types import Provider

SLBDriver = get_driver(Provider.ALIYUN_SLB)
ECSDriver = get_node_driver(NodeProvider.ALIYUN_ECS)

region = 'cn-hangzhou'

your_access_key_id = ''
your_access_key_secret = ''
slb = SLBDriver(your_access_key_id, your_access_key_secret, region=region)
ecs = ECSDriver(your_access_key_id, your_access_key_secret, region=region)

protos = slb.list_protocols()
print('Found %d protocols: %s' % (len(protos), protos))

balancers = slb.list_balancers()
print('Found %d load balancers' % len(balancers))
print(balancers)
示例#2
0
 def test_current_aws_ami_exists(self):
     from seed.profiles.aws.constants import i386
     node_driver = get_node_driver(Provider.EC2)(AWS_ACCESS, AWS_SECRET)
     assert node_driver.list_images(ex_image_ids=[i386.ami])
示例#3
0
 def test_current_aws_creds_work(self):
     from seed.profiles.aws.constants import i386
     node_driver = get_node_driver(Provider.EC2)(AWS_ACCESS, AWS_SECRET)
     node_driver.list_nodes()
示例#4
0
#     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 libcloud.compute.types import Provider as NodeProvider
from libcloud.compute.providers import get_driver as get_node_driver
from libcloud.loadbalancer.providers import get_driver
from libcloud.loadbalancer.base import Algorithm, Member
from libcloud.loadbalancer.types import Provider

SLBDriver = get_driver(Provider.ALIYUN_SLB)
ECSDriver = get_node_driver(NodeProvider.ALIYUN_ECS)

region = "cn-hangzhou"

your_access_key_id = ""
your_access_key_secret = ""
slb = SLBDriver(your_access_key_id, your_access_key_secret, region=region)
ecs = ECSDriver(your_access_key_id, your_access_key_secret, region=region)

protos = slb.list_protocols()
print("Found %d protocols: %s" % (len(protos), protos))

balancers = slb.list_balancers()
print("Found %d load balancers" % len(balancers))
print(balancers)
示例#5
0
文件: aws.py 项目: jslusher/miniseed
    def test_current_aws_ami_exists(self):
        from seed.profiles.aws.constants import i386

        node_driver = get_node_driver(Provider.EC2)(AWS_ACCESS, AWS_SECRET)
        assert node_driver.list_images(ex_image_ids=[i386.ami])
示例#6
0
文件: aws.py 项目: jslusher/miniseed
    def test_current_aws_creds_work(self):
        from seed.profiles.aws.constants import i386

        node_driver = get_node_driver(Provider.EC2)(AWS_ACCESS, AWS_SECRET)
        node_driver.list_nodes()