softlayer / softlayer-python

A set of Python libraries that assist in calling the SoftLayer API.
http://softlayer.github.io/softlayer-python/
MIT License
154 stars 192 forks source link

RIR View Contact #1374

Closed allmightyspiff closed 3 years ago

allmightyspiff commented 3 years ago

slcli registration person-detail

Basically this page: https://cloud.ibm.com/classic/network/rir/edit/51990

Should have 2 tables.

Contact Details.

A simple keyValue table

Field Value
property.propertyType.keyName property.value

Registered Subnets

Subnet Person Status Notes
192.168.1.0/24 Chris None A note if there is one

API Calls

This will require 2 API calls. One to get the Person/Contact properties, and One to get the registration details. Use iter=True on the API calls since there may be a lot of properties.

slcli --format=json call-api SoftLayer_Account_Regional_Registry_Detail getProperties 
    --id=51990 
    --mask="mask[propertyType]"

[
    {
        "createDate": "2014-03-18T15:26:55-07:00",
        "id": 85644,
        "modifyDate": "2020-11-09T16:15:29-06:00",
        "propertyType": {
            "createDate": null,
            "id": 2,
            "keyName": "FIRST_NAME",
            "modifyDate": null,
            "name": "FIRST_NAME",
            "valueExpression": ".*"
        },
        "propertyTypeId": 2,
        "registrationDetailId": 51990,
        "sequencePosition": 0,
        "value": "Chris"
    },

PRETTY sure only REGISTRATION_COMPLETE are showing up in the portal. I don't think we need to show the other statuses...

$ slcli --format=json call-api SoftLayer_Account_Regional_Registry_Detail getDetails 
    --id=51990 
    --mask="mask[registration[status]]" 
    --json-filter='{"details":{"registration":{"status":{"keyName":{"operation":"REGISTRATION_COMPLETE"}}}}}'

[
    {
        "createDate": "2015-05-27T17:24:25-07:00",
        "detailId": 51990,
        "id": 664915,
        "modifyDate": null,
        "registration": {
            "accountId": 307608,
            "cidr": 27,
            "createDate": "2015-05-27T17:24:25-07:00",
            "id": 398957,
            "modifyDate": "2015-05-27T17:26:59-07:00",
            "networkHandle": "159.122.23.224 - 159.122.23.255",
            "networkIdentifier": "159.122.23.224",
            "regionalInternetRegistryHandleId": 428289,
            "regionalInternetRegistryId": 4,
            "statusId": 3,
            "status": {
                "createDate": null,
                "id": 3,
                "keyName": "REGISTRATION_COMPLETE",
                "modifyDate": null,
                "name": "Registration Complete"
            }
        },
        "registrationId": 398957
    }
]
allmightyspiff commented 3 years ago
$ ./slcli --format=table -v reg person-detail 1634037
Calling: SoftLayer_Account_Regional_Registry_Detail::getProperties(id=1634037, mask='mask[propertyType]', filter='None', args=(), limit=100, offset=0))
Calling: SoftLayer_Account_Regional_Registry_Detail::getDetails(id=1634037, mask='mask[registration[status]]', filter='{'details': {'registration': {'status': {'keyName': {'operation': 'REGISTRATION_COMPLETE'}}}}}', args=(), limit=100, offset=0))
:.......................................:
:            Contact Details            :
:................:......................:
:          Field : Value                :
:................:......................:
: INTERNAL_LABEL : IBM Cloud            :
:  EMAIL_ADDRESS : test@es.ibm.com :
:     FIRST_NAME : Test:
:      LAST_NAME : Chaparro             :
:        ADDRESS : AAA Diagonal 571 :
:           CITY : Barcelona            :
:          STATE : OT                   :
:    POSTAL_CODE : 08029                :
:        COUNTRY : ES                   :
:    ABUSE_EMAIL : abuse@ripe.net       :
:          PHONE : 620881761            :
:................:......................:
:..................................:
:        Registered Subnets        :
:........:........:........:.......:
: Subnet : Person : Status : Notes :
:........:........:........:.......:
:........:........:........:.......: