当前位置: 首页>>代码示例>>Python>>正文


Python ProfitBricksService.get_datacenter方法代码示例

本文整理汇总了Python中profitbricks.client.ProfitBricksService.get_datacenter方法的典型用法代码示例。如果您正苦于以下问题:Python ProfitBricksService.get_datacenter方法的具体用法?Python ProfitBricksService.get_datacenter怎么用?Python ProfitBricksService.get_datacenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在profitbricks.client.ProfitBricksService的用法示例。


在下文中一共展示了ProfitBricksService.get_datacenter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestDatacenter

# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import get_datacenter [as 别名]
class TestDatacenter(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.resource = resource()
        self.client = ProfitBricksService(
            username=configuration.USERNAME,
            password=configuration.PASSWORD,
            headers=configuration.HEADERS)

        # Create test datacenter.
        self.datacenter = self.client.create_datacenter(
            datacenter=Datacenter(**self.resource['datacenter']))

    @classmethod
    def tearDownClass(self):
        self.client.delete_datacenter(datacenter_id=self.datacenter['id'])

    def test_list(self):
        datacenters = self.client.list_datacenters()

        self.assertGreater(len(datacenters), 0)
        self.assertEqual(datacenters['items'][0]['type'], 'datacenter')

    def test_get(self):
        datacenter = self.client.get_datacenter(
            datacenter_id=self.datacenter['id'])

        assertRegex(self, datacenter['id'], self.resource['uuid_match'])
        self.assertEqual(datacenter['type'], 'datacenter')
        self.assertEqual(datacenter['id'], self.datacenter['id'])
        self.assertEqual(datacenter['properties']['name'], self.resource['datacenter']['name'])
        self.assertEqual(datacenter['properties']['description'], self.resource['datacenter']['description'])
        self.assertEqual(datacenter['properties']['location'], self.resource['datacenter']['location'])

    def test_delete(self):
        datacenter = self.client.create_datacenter(
            datacenter=Datacenter(**self.resource['datacenter']))
        wait_for_completion(self.client, datacenter, 'create_datacenter')

        response = self.client.delete_datacenter(
            datacenter_id=datacenter['id'])

        self.assertTrue(response)

    def test_update(self):
        datacenter = self.client.update_datacenter(
            datacenter_id=self.datacenter['id'],
            description=self.resource['datacenter']['name']+' - RENAME')
        wait_for_completion(self.client, datacenter, 'update_datacenter')
        datacenter = self.client.get_datacenter(datacenter_id=self.datacenter['id'])

        assertRegex(self, datacenter['id'], self.resource['uuid_match'])
        self.assertEqual(datacenter['id'], self.datacenter['id'])
        self.assertEqual(datacenter['properties']['name'], self.resource['datacenter']['name'])
        self.assertEqual(datacenter['properties']['description'], self.resource['datacenter']['name']+' - RENAME')
        self.assertEqual(datacenter['properties']['location'], self.resource['datacenter']['location'])
        self.assertGreater(datacenter['properties']['version'], 1)

    def test_create_simple(self):
        datacenter = self.client.create_datacenter(
            datacenter=Datacenter(**self.resource['datacenter']))
        wait_for_completion(self.client, datacenter, 'create_datacenter')

        assertRegex(self, datacenter['id'], self.resource['uuid_match'])
        self.assertEqual(datacenter['properties']['name'], self.resource['datacenter']['name'])
        self.assertEqual(datacenter['properties']['description'], self.resource['datacenter']['description'])
        self.assertEqual(datacenter['properties']['location'], self.resource['datacenter']['location'])

        response = self.client.delete_datacenter(
            datacenter_id=datacenter['id'])
        self.assertTrue(response)
开发者ID:fbrehm,项目名称:profitbricks-sdk-python,代码行数:73,代码来源:test_datacenter_live.py

示例2: main

# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import get_datacenter [as 别名]
def main(argv=None):
    """Parse command line options and dump a datacenter to snapshots and file."""

    if argv is None:
        argv = sys.argv
    else:
        sys.argv.extend(argv)

    program_name = os.path.basename(sys.argv[0])
    program_version = "v%s" % __version__
    program_build_date = str(__updated__)
    program_version_message = "%%(prog)s %s (%s)" % (program_version, program_build_date)
    program_shortdesc = __import__("__main__").__doc__.split("\n")[1]
    program_license = """%s

  Created by J. Buchhammer on %s.
  Copyright 2016 ProfitBricks GmbH. All rights reserved.

  Licensed under the Apache License 2.0
  http://www.apache.org/licenses/LICENSE-2.0

  Distributed on an "AS IS" basis without warranties
  or conditions of any kind, either express or implied.

USAGE
""" % (
        program_shortdesc,
        str(__date__),
    )

    try:
        # Setup argument parser
        parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter)
        parser.add_argument("-u", "--user", dest="user", help="the login name")
        parser.add_argument("-p", "--password", dest="password", help="the login password")
        parser.add_argument("-L", "--Login", dest="loginfile", default=None, help="the login file to use")
        parser.add_argument(
            "-d", "--datacenterid", dest="dc_id", required=True, default=None, help="datacenter ID of the server"
        )
        parser.add_argument(
            "-o",
            "--outfile",
            dest="outfile",
            default="dc-def_" + datetime.now().strftime("%Y-%m-%d_%H%M%S"),
            help="the output file name",
        )
        parser.add_argument(
            "-S", "--Stopalways", dest="stopalways", action="store_true", help="power off even when VM is running"
        )
        parser.add_argument(
            "-v",
            "--verbose",
            dest="verbose",
            action="count",
            default=0,
            help="set verbosity level [default: %(default)s]",
        )
        parser.add_argument("-V", "--version", action="version", version=program_version_message)

        # Process arguments
        args = parser.parse_args()
        global verbose
        verbose = args.verbose

        if verbose > 0:
            print("Verbose mode on")
            print("start {} with args {}".format(program_name, str(args)))

        outfile = args.outfile
        if outfile.endswith(".json"):
            outfile = os.path.splitext(outfile)
        print("Using output file base name '{}'".format(outfile))

        (user, password) = getLogin(args.loginfile, args.user, args.password)
        if user is None or password is None:
            raise ValueError("user or password resolved to None")
        pbclient = ProfitBricksService(user, password)

        dc_id = args.dc_id

        # first get all server's VM and OS state to see if we can start
        srv_info = getServerInfo(pbclient, dc_id)
        srvon = 0
        for server in srv_info:
            if server["vmstate"] != "SHUTOFF":
                print("VM {} is in state {}, but should be SHUTOFF".format(server["name"], server["vmstate"]))
                srvon += 1
        # end for(srv_info)
        if srvon > 0 and not args.stopalways:
            print("shutdown running OS before trying again")
            return 1
        # now power off all VMs before starting the snapshots
        for server in srv_info:
            controlServerState(pbclient, dc_id, server["id"], action="POWEROFF")

        # now let's go
        dcdef = pbclient.get_datacenter(dc_id, 5)
        print("starting dump of datacenter {}".format(dcdef["properties"]["name"]))
        dcdef_file = outfile + "_source.json"
        print("write source dc to {}".format(dcdef_file))
#.........这里部分代码省略.........
开发者ID:fbrehm,项目名称:profitbricks-sdk-python,代码行数:103,代码来源:pb_snapshotDatacenter.py

示例3: TestDatacenter

# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import get_datacenter [as 别名]
class TestDatacenter(unittest.TestCase):
    def setUp(self):
        self.datacenter = ProfitBricksService(username="username", password="password")

    def test_get_all(self):
        datacenters = self.datacenter.list_datacenters()

        self.assertEqual(len(datacenters), 4)
        self.assertEqual(datacenters["items"][0]["id"], datacenter_id)
        # self.assertEqual(
        #     datacenters['items'][0]['properties']['name'], 'datacenter1')
        # self.assertEqual(
        #     datacenters['items'][0]['properties']['description'], 'Description of my DC')
        # self.assertEqual(
        #     datacenters['items'][0]['properties']['location'], 'de/fkb')
        # self.assertEqual(
        #     datacenters['items'][0]['properties']['version'], 4)

    def test_get(self):
        datacenter = self.datacenter.get_datacenter(datacenter_id=datacenter_id)

        self.assertEqual(datacenter["id"], datacenter_id)
        self.assertEqual(datacenter["properties"]["name"], "datacenter1")
        self.assertEqual(datacenter["properties"]["description"], "Description of my DC")
        self.assertEqual(datacenter["properties"]["version"], 4)
        self.assertEqual(datacenter["properties"]["location"], "de/fkb")

    def test_delete(self):
        datacenter = self.datacenter.delete_datacenter(datacenter_id=datacenter_id)

        self.assertTrue(datacenter)

    def test_update(self):
        datacenter = self.datacenter.update_datacenter(
            datacenter_id=datacenter_id, name="Partially updated datacenter name"
        )

        self.assertEqual(datacenter["id"], datacenter_id)
        self.assertEqual(datacenter["properties"]["name"], "datacenter1")
        self.assertEqual(datacenter["properties"]["description"], "Description of my DC")
        self.assertEqual(datacenter["properties"]["version"], 4)
        self.assertEqual(datacenter["properties"]["location"], "de/fkb")

    def test_create_simple(self):
        i = Datacenter(name="datacenter1", description="My New Datacenter", location="de/fkb")

        response = self.datacenter.create_datacenter(datacenter=i)

        self.assertEqual(response["id"], datacenter_id)
        self.assertEqual(response["properties"]["name"], "datacenter1")
        self.assertEqual(response["properties"]["description"], "My New Datacenter")
        self.assertEqual(response["properties"]["version"], 4)
        self.assertEqual(response["properties"]["location"], "de/fkb")

    def test_create_complex(self):
        """
        Creates a complex Datacenter in a single request.

        """
        fwrule1 = FirewallRule(
            name="Open SSH port", protocol="TCP", source_mac="01:23:45:67:89:00", port_range_start=22
        )

        fwrule2 = FirewallRule(name="Allow PING", protocol="ICMP", icmp_type=8, icmp_code=0)

        fw_rules = [fwrule1, fwrule2]

        nic1 = NIC(name="nic1", ips=["10.2.2.3"], dhcp="true", lan=1, firewall_active=True, firewall_rules=fw_rules)

        nic2 = NIC(name="nic2", ips=["10.2.3.4"], dhcp="true", lan=1, firewall_active=True, firewall_rules=fw_rules)

        nics = [nic1, nic2]

        volume1 = Volume(name="volume1", size=56, image="<IMAGE/SNAPSHOT-ID>", bus="VIRTIO")

        volume2 = Volume(name="volume2", size=56, image="<IMAGE/SNAPSHOT-ID>", bus="VIRTIO")

        volumes = [volume2]

        server1 = Server(name="server1", ram=4096, cores=4, nics=nics, create_volumes=[volume1])

        servers = [server1]

        balancednics = ["<NIC-ID-1>", "<NIC-ID-2>"]

        loadbalancer1 = LoadBalancer(name="My LB", balancednics=balancednics)

        loadbalancers = [loadbalancer1]

        lan1 = LAN(name="public Lan 4", public=True)

        lan2 = LAN(name="public Lan 4", public=True)

        lans = [lan1, lan2]

        d = Datacenter(
            name="datacenter1",
            description="my DC",
            location="de/fkb",
            servers=servers,
#.........这里部分代码省略.........
开发者ID:jbuchhammer,项目名称:profitbricks-sdk-python,代码行数:103,代码来源:test_datacenter.py

示例4: main

# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import get_datacenter [as 别名]
def main(argv=None):                # IGNORE:C0111
    '''Command line options.'''

    if argv is None:
        argv = sys.argv
    else:
        sys.argv.extend(argv)

    program_name = os.path.basename(sys.argv[0])
    program_version = "v%s" % __version__
    program_build_date = str(__updated__)
    program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date)
    program_shortdesc = __import__('__main__').__doc__.split("\n")[1]
    program_license = '''%s

  Created by J.Buchhammer on %s.
  Copyright 2016 ProfitBricks GmbH. All rights reserved.

  Licensed under the Apache License 2.0
  http://www.apache.org/licenses/LICENSE-2.0

  Distributed on an "AS IS" basis without warranties
  or conditions of any kind, either express or implied.

USAGE
''' % (program_shortdesc, str(__date__))

    try:
        # Setup argument parser
        parser = ArgumentParser(
            description=program_license,
            formatter_class=RawDescriptionHelpFormatter)
        parser.add_argument(
            '-u', '--user', dest='user', required=True, help='the login name')
        parser.add_argument(
            '-p', '--password', dest='password', help='the login password')
        parser.add_argument(
            '-d', '--datacenter', '--datacenterid', dest='datacenterid', nargs='?', const='*',
            help='show server/storage of datacenter(s)')
        parser.add_argument(
            '-i', '--image', dest='show_images', action="store_true",
            help='show images and snapshots')
        parser.add_argument(
            '-b', '--ipblock', dest='show_ipblocks', action="store_true",
            help='show reserved IP blocks')
        parser.add_argument(
            '-n', '--network', dest='show_networks', action="store_true",
            help='show network assignments')
#        parser.add_argument(
#            '-r', '--request', dest='show_requests', action="store_true",
#            help='show requests')
        parser.add_argument(
            "-v", "--verbose", dest="verbose", action="count", default=0,
            help="set verbosity level [default: %(default)s]")
        parser.add_argument(
            '-V', '--version', action='version', version=program_version_message)

        # Process arguments
        args = parser.parse_args()
        global verbose
        verbose = args.verbose   # this is a global to be used in methods
        user = args.user
        password = args.password
        datacenterid = args.datacenterid

        print("Welcome to PB-API %s\n" % user)
        if password is None:
            password = getpass()
        if verbose > 0:
            print("Verbose mode on")
            print("using python ", sys.version_info)

        pbclient = ProfitBricksService(user, password)

        if datacenterid is not None:
            datacenters = {}
            if datacenterid == '*':
                # the default depth=1 is sufficient, higher values don't provide more details
                datacenters = pbclient.list_datacenters()
            else:
                datacenters['items'] = []
                datacenters['items'] = [pbclient.get_datacenter(datacenterid, 1)]
            if verbose > 1:
                print(pp(datacenters))
            print("retrieved %i datacenters " % len(datacenters['items']))

            # dump inventory to file
            with open("pb_datacenter_inventory.csv", 'w') as csvfile:
                csvwriter = csv.writer(csvfile, delimiter=';', lineterminator='\n')
                csvwriter.writerow([
                    'DCID', 'DCName', 'Loc', 'RscType', 'RscID', 'RscName', 'State', 'LicType',
                    'Cores', 'RAM', '# NICs', '# Volumes', '(Total) Storage', 'Connected to',
                    'Created', 'Modified'
                ])
                for dc in datacenters['items']:
                    try:
                        dc_inv = get_dc_inventory(pbclient, dc)
                        if verbose:
                            print("DC %s has %i inventory entries" % (dc['id'], len(dc_inv)))
                        for row in dc_inv:
#.........这里部分代码省略.........
开发者ID:fbrehm,项目名称:profitbricks-sdk-python,代码行数:103,代码来源:pb_datacenter_inventory.py

示例5: main

# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import get_datacenter [as 别名]
def main(argv=None):
    '''Command line options.'''

    if argv is None:
        argv = sys.argv
    else:
        sys.argv.extend(argv)

    program_name = os.path.basename(sys.argv[0])
    program_version = "v%s" % __version__
    program_build_date = str(__updated__)
    program_version_message = '%%(prog)s %s (%s)' % (program_version,
                                                     program_build_date)
    program_shortdesc = __import__('__main__').__doc__.split("\n")[1]
    program_license = '''%s

  Created by Jürgen Buchhammer on %s.
  Copyright 2016 ProfitBricks GmbH. All rights reserved.

  Licensed under the Apache License 2.0
  http://www.apache.org/licenses/LICENSE-2.0

  Distributed on an "AS IS" basis without warranties
  or conditions of any kind, either express or implied.

USAGE
''' % (program_shortdesc, str(__date__))

    try:
        # Setup argument parser
        parser = ArgumentParser(description=program_license,
                                formatter_class=RawDescriptionHelpFormatter)
        parser.add_argument('-u', '--user', dest='user', help='the login name')
        parser.add_argument('-p', '--password', dest='password',
                            help='the login password')
        parser.add_argument('-L', '--Login', dest='loginfile', default=None,
                            help='the login file to use')
        parser.add_argument('-t', '--type', dest='metatype',
                            default="OVF",
                            help='type of VM meta data')
        parser.add_argument('-m', '--metadata', dest='metafile',
                            required=True, default=None,
                            help='meta data file')
        parser.add_argument('-d', '--datacenterid', dest='datacenterid',
                            default=None,
                            help='datacenter of the new server')
        parser.add_argument('-D', '--DCname', dest='dcname', default=None,
                            help='new datacenter name')
        parser.add_argument('-l', '--location', dest='location', default=None,
                            help='location for new datacenter')
        parser.add_argument('-v', '--verbose', dest="verbose", action="count",
                            default=0,
                            help="set verbosity level [default: %(default)s]")
        parser.add_argument('-V', '--version', action='version',
                            version=program_version_message)

        # Process arguments
        args = parser.parse_args()
        global verbose
        verbose = args.verbose

        if verbose > 0:
            print("Verbose mode on")
            print("start {} with args {}".format(program_name, str(args)))

        (user, password) = getLogin(args.loginfile, args.user, args.password)
        if user is None or password is None:
            raise ValueError("user or password resolved to None")
        pbclient = ProfitBricksService(user, password)

        if args.metatype == 'OVF':
            metadata = OFVData(args.metafile)
            metadata.parse()
        else:
            sys.stderr.write("Metadata type '{}' is not supported"
                             .format(args.metatype))
            return 1

        # we need the DC first to have the location defined
        dc_id = None
        if args.datacenterid is None:
            if args.dcname is None or args.location is None:
                sys.stderr.write("Either '-d <id>' or '-D <name> -l <loc>'  must be specified")
                return 1
            # else: we will create the DC later after parsing the meta data
        else:
            dc_id = args.datacenterid

        if dc_id is None:
            location = args.location
            dc = Datacenter(name=args.dcname, location=location,
                            description="created by pb_importVM")
            print("create new DC {}".format(str(dc)))
            response = pbclient.create_datacenter(dc)
            dc_id = response['id']
            result = wait_for_request(pbclient, response['requestId'])
            print("wait loop returned {}".format(result))
        else:
            dc = pbclient.get_datacenter(dc_id)
            location = dc['properties']['location']
#.........这里部分代码省略.........
开发者ID:fbrehm,项目名称:profitbricks-sdk-python,代码行数:103,代码来源:pb_importVM.py

示例6: ProfitBricksService

# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import get_datacenter [as 别名]
"""List Datacenters
"""
from profitbricks.client import ProfitBricksService

client = ProfitBricksService(
    username='username', password='password')

datacenters = client.list_datacenters()

for d in datacenters['items']:
    vdc = client.get_datacenter(d['id'])
    name = vdc['properties']['name']
    if name is


for d in datacenters['items']:
    vdc = client.get_datacenter(d['id'])
    vdc['properties']['name']
    if dc_name == vdc['properties']['name']:


"""Get Datacenter
"""
from profitbricks.client import ProfitBricksService

datacenter_id = '700e1cab-99b2-4c30-ba8c-1d273ddba022'

client = ProfitBricksService(
    username='username', password='password')

datacenter = client.get_datacenter(
开发者ID:grandvizier,项目名称:profitbricks-sdk-python,代码行数:33,代码来源:datacenter_example.py

示例7: ProfitBricksService

# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import get_datacenter [as 别名]
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#
#

from datetime import datetime, timedelta
import config
from slugify import slugify
from pprint import pprint

from profitbricks.client import ProfitBricksService
client = ProfitBricksService( username=config.PB_USERNAME, password=config.PB_PASSWORD) 


# Get the PB Datacenter object
datacenter = client.get_datacenter(datacenter_id=config.DATACENTER_ID)

# Get a list of snapshots; this is global so can be done here
snapshots = client.list_snapshots()

# Process all found entities (servers) in 
for entity in datacenter['entities']['servers']['items']:
  # If this entity is not a server, continue (could be gateway, loadbalancer etc)
  if not entity['type'] == 'server':
   continue

  # Get this entitys server object from API
  server = client.get_server(datacenter_id=config.DATACENTER_ID,server_id=entity['id'])

  # Set the servername
  servername = server['properties']['name']
开发者ID:infernix,项目名称:pbsnappy,代码行数:33,代码来源:pbsnappy.py

示例8: TestDatacenter

# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import get_datacenter [as 别名]
class TestDatacenter(unittest.TestCase):
    def setUp(self):
        self.datacenter = ProfitBricksService(
            username='username', password='password')

    def test_get_all(self):
        datacenters = self.datacenter.list_datacenters()

        self.assertEqual(len(datacenters), 4)
        self.assertEqual(datacenters['items'][0]['id'], datacenter_id)
        # self.assertEqual(
        #     datacenters['items'][0]['properties']['name'], 'datacenter1')
        # self.assertEqual(
        #     datacenters['items'][0]['properties']['description'], 'Description of my DC')
        # self.assertEqual(
        #     datacenters['items'][0]['properties']['location'], 'de/fkb')
        # self.assertEqual(
        #     datacenters['items'][0]['properties']['version'], 4)

    def test_get(self):
        datacenter = self.datacenter.get_datacenter(
            datacenter_id=datacenter_id)

        self.assertEqual(datacenter['id'], datacenter_id)
        self.assertEqual(datacenter['properties']['name'], 'datacenter1')
        self.assertEqual(datacenter['properties']['description'], 'Description of my DC')
        self.assertEqual(datacenter['properties']['version'], 4)
        self.assertEqual(datacenter['properties']['location'], 'de/fkb')

    def test_delete(self):
        datacenter = self.datacenter.delete_datacenter(
            datacenter_id=datacenter_id)

        self.assertTrue(datacenter)

    def test_update(self):
        datacenter = self.datacenter.update_datacenter(
            datacenter_id=datacenter_id,
            name='Partially updated datacenter name')

        self.assertEqual(datacenter['id'], datacenter_id)
        self.assertEqual(datacenter['properties']['name'], 'datacenter1')
        self.assertEqual(datacenter['properties']['description'], 'Description of my DC')
        self.assertEqual(datacenter['properties']['version'], 4)
        self.assertEqual(datacenter['properties']['location'], 'de/fkb')

    def test_create_simple(self):
        i = Datacenter(
            name='datacenter1',
            description='My New Datacenter',
            location='de/fkb'
            )

        response = self.datacenter.create_datacenter(datacenter=i)

        self.assertEqual(response['id'], datacenter_id)
        self.assertEqual(response['properties']['name'], 'My New Datacenter')
        self.assertEqual(response['properties']['description'], 'Production environment')
        self.assertEqual(response['properties']['version'], 4)
        self.assertEqual(response['properties']['location'], 'de/fkb')

    def test_create_complex(self):
        """
        Creates a complex Datacenter in a single request.

        """
        fwrule1 = FirewallRule(
            name='Open SSH port',
            protocol='TCP',
            source_mac='01:23:45:67:89:00',
            port_range_start=22
            )

        fwrule2 = FirewallRule(
            name='Allow PING',
            protocol='ICMP',
            icmp_type=8,
            icmp_code=0
            )

        fw_rules = [fwrule1, fwrule2]

        nic1 = NIC(
            name='nic1',
            ips=['10.2.2.3'],
            dhcp='true',
            lan=1,
            firewall_active=True,
            firewall_rules=fw_rules
            )

        nic2 = NIC(
            name='nic2',
            ips=['10.2.3.4'],
            dhcp='true',
            lan=1,
            firewall_active=True,
            firewall_rules=fw_rules
            )

#.........这里部分代码省略.........
开发者ID:grandvizier,项目名称:profitbricks-sdk-python,代码行数:103,代码来源:test_datacenter.py


注:本文中的profitbricks.client.ProfitBricksService.get_datacenter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。