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


Python NetworkManager.get_rwhois方法代码示例

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


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

示例1: execute

# 需要导入模块: from SoftLayer import NetworkManager [as 别名]
# 或者: from SoftLayer.NetworkManager import get_rwhois [as 别名]
    def execute(self, args):
        mgr = NetworkManager(self.client)
        result = mgr.get_rwhois()

        table = KeyValueTable(['Name', 'Value'])
        table.align['Name'] = 'r'
        table.align['Value'] = 'l'
        table.add_row(['Name', result['firstName'] + ' ' + result['lastName']])
        table.add_row(['Company', result['companyName']])
        table.add_row(['Abuse Email', result['abuseEmail']])
        table.add_row(['Address 1', result['address1']])
        if result.get('address2'):
            table.add_row(['Address 2', result['address2']])
        table.add_row(['City', result['city']])
        table.add_row(['State', result.get('state', '-')])
        table.add_row(['Postal Code', result.get('postalCode', '-')])
        table.add_row(['Country', result['country']])

        return table
开发者ID:TimurNurlygayanov,项目名称:softlayer-python,代码行数:21,代码来源:rwhois.py

示例2: NetworkTests

# 需要导入模块: from SoftLayer import NetworkManager [as 别名]
# 或者: from SoftLayer.NetworkManager import get_rwhois [as 别名]

#.........这里部分代码省略.........
        self.client["Account"].getRwhoisData.return_value = {"id": 954}

        expected = {
            "abuseEmail": "[email protected]",
            "address1": "123 Test Street",
            "address2": "Apt. #31",
            "city": "Anywhere",
            "companyName": "TestLayer",
            "country": "US",
            "firstName": "Bob",
            "lastName": "Bobinson",
            "postalCode": "9ba62",
            "privateResidenceFlag": False,
            "state": "TX",
        }

        self.network.edit_rwhois(
            abuse_email="[email protected]",
            address1="123 Test Street",
            address2="Apt. #31",
            city="Anywhere",
            company_name="TestLayer",
            country="US",
            first_name="Bob",
            last_name="Bobinson",
            postal_code="9ba62",
            private_residence=False,
            state="TX",
        )

        f = self.client["Network_Subnet_Rwhois_Data"].editObject
        f.assert_called_with(expected, id=954)

    def test_get_rwhois(self):
        self.network.get_rwhois()
        self.client["Account"].getRwhoisData.assert_called()

    def test_get_subnet(self):
        id = 9876
        mcall = call(id=id, mask=ANY)
        service = self.client["Network_Subnet"]

        self.network.get_subnet(id)
        service.getObject.assert_has_calls(mcall)

    def test_get_vlan(self):
        id = 1234
        mcall = call(id=id, mask=ANY)
        service = self.client["Network_Vlan"]

        self.network.get_vlan(id)
        service.getObject.assert_has_calls(mcall)

    def test_list_global_ips_default(self):
        mask = "destinationIpAddress[hardware, virtualGuest],ipAddress"
        mcall = call(filter={}, mask=mask)
        service = self.client["Account"]

        self.network.list_global_ips()

        service.getGlobalIpRecords.assert_has_calls(mcall)

    def test_list_global_ips_with_filter(self):
        mask = "destinationIpAddress[hardware, virtualGuest],ipAddress"
        _filter = {"globalIpRecords": {"ipAddress": {"subnet": {"version": {"operation": 4}}}}}
开发者ID:ryanrhanson,项目名称:softlayer-python,代码行数:69,代码来源:network_tests.py

示例3: NetworkTests

# 需要导入模块: from SoftLayer import NetworkManager [as 别名]
# 或者: from SoftLayer.NetworkManager import get_rwhois [as 别名]

#.........这里部分代码省略.........
    def test_edit_rwhois(self):
        self.client['Account'].getRwhoisData.return_value = {'id': 954}

        expected = {
            'abuseEmail': '[email protected]',
            'address1': '123 Test Street',
            'address2': 'Apt. #31',
            'city': 'Anywhere',
            'companyName': 'TestLayer',
            'country': 'US',
            'firstName': 'Bob',
            'lastName': 'Bobinson',
            'postalCode': '9ba62',
            'privateResidenceFlag': False,
            'state': 'TX',
        }

        self.network.edit_rwhois(
            abuse_email='[email protected]',
            address1='123 Test Street',
            address2='Apt. #31',
            city='Anywhere',
            company_name='TestLayer',
            country='US',
            first_name='Bob',
            last_name='Bobinson',
            postal_code='9ba62',
            private_residence=False,
            state='TX')

        f = self.client['Network_Subnet_Rwhois_Data'].editObject
        f.assert_called_with(expected, id=954)

    def test_get_rwhois(self):
        self.network.get_rwhois()
        self.client['Account'].getRwhoisData.assert_called()

    def test_get_subnet(self):
        id = 9876
        mcall = call(id=id, mask=ANY)
        service = self.client['Network_Subnet']

        self.network.get_subnet(id)
        service.getObject.assert_has_calls(mcall)

    def test_get_vlan(self):
        id = 1234
        mcall = call(id=id, mask=ANY)
        service = self.client['Network_Vlan']

        self.network.get_vlan(id)
        service.getObject.assert_has_calls(mcall)

    def test_list_global_ips_default(self):
        mask = 'mask[destinationIpAddress[hardware, virtualGuest],ipAddress]'
        mcall = call(filter={}, mask=mask)
        service = self.client['Account']

        self.network.list_global_ips()

        service.getGlobalIpRecords.assert_has_calls(mcall)

    def test_list_global_ips_with_filter(self):
        mask = 'mask[destinationIpAddress[hardware, virtualGuest],ipAddress]'
        _filter = {
            'globalIpRecords': {
开发者ID:crvidya,项目名称:softlayer-api-python-client,代码行数:70,代码来源:network_tests.py

示例4: NetworkTests

# 需要导入模块: from SoftLayer import NetworkManager [as 别名]
# 或者: from SoftLayer.NetworkManager import get_rwhois [as 别名]

#.........这里部分代码省略.........
        service = self.client['Billing_Item']
        service.cancelService.assert_called_with(id=1056)

    def test_edit_rwhois(self):
        self.network.edit_rwhois(
            abuse_email='[email protected]',
            address1='123 Test Street',
            address2='Apt. #31',
            city='Anywhere',
            company_name='TestLayer',
            country='US',
            first_name='Bob',
            last_name='Bobinson',
            postal_code='9ba62',
            private_residence=False,
            state='TX')

        expected = {
            'abuseEmail': '[email protected]',
            'address1': '123 Test Street',
            'address2': 'Apt. #31',
            'city': 'Anywhere',
            'companyName': 'TestLayer',
            'country': 'US',
            'firstName': 'Bob',
            'lastName': 'Bobinson',
            'postalCode': '9ba62',
            'privateResidenceFlag': False,
            'state': 'TX',
        }
        f = self.client['Network_Subnet_Rwhois_Data'].editObject
        f.assert_called_with(expected, id='id')

    def test_get_rwhois(self):
        self.network.get_rwhois()
        self.client['Account'].getRwhoisData.assert_called()

    def test_get_subnet(self):
        mcall = call(id=9876, mask=ANY)
        service = self.client['Network_Subnet']

        self.network.get_subnet(9876)
        service.getObject.assert_has_calls(mcall)

    def test_get_vlan(self):
        service = self.client['Network_Vlan']

        self.network.get_vlan(1234)
        service.getObject.assert_has_calls(call(id=1234, mask=ANY))

    def test_list_global_ips_default(self):
        self.network.list_global_ips()

        mask = 'destinationIpAddress[hardware, virtualGuest],ipAddress'
        service = self.client['Account']
        service.getGlobalIpRecords.assert_has_calls(call(filter={}, mask=mask))

    def test_list_global_ips_with_filter(self):
        self.network.list_global_ips(version=4)

        mask = 'destinationIpAddress[hardware, virtualGuest],ipAddress'
        _filter = {
            'globalIpRecords': {
                'ipAddress': {
                    'subnet': {
                        'version': {'operation': 4},
开发者ID:MayaY2014,项目名称:softlayer-python,代码行数:70,代码来源:network_tests.py


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