Ejemplo n.º 1
0
 def from_dict(d):
     return GroupChange(new_group=Group.from_dict(d['newGroup']),
                        change_type=d['changeType'],
                        user_id=d['userId'],
                        old_group=map_option(d.get('oldGroup'),
                                             Group.from_dict),
                        id=d['id'],
                        created=map_option(d.get('created'),
                                           parse_datetime))
Ejemplo n.º 2
0
 def from_dict(d):
     return RecordSetChange(zone=Zone.from_dict(d['zone']),
                            record_set=RecordSet.from_dict(d['recordSet']),
                            user_id=d['userId'],
                            change_type=d['changeType'],
                            status=d['status'],
                            created=map_option(d.get('created'),
                                               parse_datetime),
                            system_message=d.get('systemMessage'),
                            updates=map_option(d.get('updates'),
                                               RecordSet.from_dict),
                            id=d['id'],
                            user_name=d.get('userName'))
Ejemplo n.º 3
0
 def from_dict(d):
     return Member(id=d['id'],
                   user_name=d.get('userName'),
                   first_name=d.get('firstName'),
                   last_name=d.get('lastName'),
                   email=d.get('email'),
                   created=map_option(d.get('created'), parse_datetime),
                   is_admin=d.get('isAdmin', False))
Ejemplo n.º 4
0
 def from_dict(d):
     return BatchChangeRequest(
         comments=d.get('comments'),
         changes=[
             BatchChangeRequest.change_type_converters[elem['changeType']](
                 elem) for elem in d.get('changes', [])
         ],
         owner_group_id=d.get('ownerGroupId'),
         scheduled_time=map_option(d.get('scheduledTime'), parse_datetime))
Ejemplo n.º 5
0
 def from_dict(d):
     return Group(
         name=d['name'],
         email=d['email'],
         description=d.get('description'),
         created=map_option(d.get('created'), parse_datetime),
         members=[User.from_dict(ud) for ud in d.get('members', [])],
         admins=[User.from_dict(ud) for ud in d.get('admins', [])],
         id=d.get('id'))
Ejemplo n.º 6
0
 def from_dict(d):
     created = map_option(d.get('created'), parse_datetime)
     return User(id=d['id'],
                 user_name=d.get('userName'),
                 first_name=d.get('firstName'),
                 last_name=d.get('lastName'),
                 email=d.get('email'),
                 created=created,
                 lock_status=d.get('lockStatus', UserLockStatus.Unlocked))
Ejemplo n.º 7
0
 def from_dict(d):
     zone = Zone.from_dict(d['zone'])
     created = map_option(d.get('created'), parse_datetime)
     return ZoneChange(zone=zone,
                       user_id=d['userId'],
                       change_type=d['changeType'],
                       status=d['status'],
                       created=created,
                       system_message=d.get('systemMessage'),
                       id=d['id'])
Ejemplo n.º 8
0
 def from_dict(d):
     return BatchChange(
         user_id=d['userId'],
         user_name=d['userName'],
         comments=d.get('comments'),
         created_timestamp=map_option(d.get('createdTimestamp'), parse_datetime),
         changes=[BatchChange.change_type_converters[elem['changeType']](elem) for elem in d.get('changes', [])],
         id=d['id'],
         owner_group_id=d.get('ownerGroupId')
     )
Ejemplo n.º 9
0
 def from_dict(d):
     return RecordSet(
         zone_id=d['zoneId'],
         name=d['name'],
         type=d['type'],
         ttl=d['ttl'],
         status=d.get('status'),
         created=map_option(d.get('created'), parse_datetime),
         updated=d.get('updated'),
         records=[rdata_converters[d['type']](rd) for rd in d.get('records', [])],
         id=d.get('id')
     )
Ejemplo n.º 10
0
 def from_dict(d):
     return BatchChange(
         user_id=d['userId'],
         user_name=d['userName'],
         comments=d.get('comments'),
         created_timestamp=map_option(d.get('createdTimestamp'),
                                      parse_datetime),
         changes=[
             BatchChange.change_type_converters[elem['changeType']](elem)
             for elem in d.get('changes', [])
         ],
         id=d['id'],
         status=d['status'],
         owner_group_id=d.get('ownerGroupId'),
         owner_group_name=d.get('ownerGroupName'),
         approval_status=d['approvalStatus'],
         reviewer_id=d.get('reviewerId'),
         reviewer_user_name=d.get('reviewerUserName'),
         review_comment=d.get('reviewComment'),
         review_timestamp=map_option(d.get('reviewTimestamp'),
                                     parse_datetime),
         scheduled_time=map_option(d.get('scheduledTime'), parse_datetime))
Ejemplo n.º 11
0
 def from_dict(d):
     return BatchChangeSummary(
         user_id=d['userId'],
         user_name=d['userName'],
         comments=d.get('comments'),
         created_timestamp=parse_datetime(d['createdTimestamp']),
         total_changes=d['totalChanges'],
         status=d['status'],
         id=d['id'],
         owner_group_id=d.get('ownerGroupId'),
         owner_group_name=d.get('ownerGroupName'),
         approval_status=d['approvalStatus'],
         reviewer_id=d.get('reviewerId'),
         reviewer_user_name=d.get('reviewerUserName'),
         review_comment=d.get('reviewComment'),
         review_timestamp=d.get('reviewTimestamp'),
         scheduled_time=map_option(d.get('scheduledTime'), parse_datetime))
Ejemplo n.º 12
0
 def from_dict(d):
     return DeleteRecordSetChange(
         zone_id=d['zoneId'],
         zone_name=d['zoneName'],
         record_name=d['recordName'],
         input_name=d['inputName'],
         type=d['type'],
         record=map_option(d.get('record'), rdata_converters[d['type']]),
         status=d['status'],
         id=d['id'],
         system_message=d.get('systemMessage'),
         record_change_id=d.get('recordChangeId'),
         record_set_id=d.get('recordSetId'),
         validation_errors=[
             ValidationError.from_dict(elem)
             for elem in d.get('validationErrors', [])
         ])
Ejemplo n.º 13
0
 def from_dict(d):
     """
     from_dicts the string formatted json into a zone
     :param d: A dictionary built from json
     :return: A populated zone
     """
     return Zone(id=d['id'],
                 name=d['name'],
                 email=d['email'],
                 admin_group_id=d['adminGroupId'],
                 status=d.get('status'),
                 created=map_option(d.get('created'), parse_datetime),
                 updated=map_option(d.get('updated'), parse_datetime),
                 connection=map_option(d.get('connection'),
                                       ZoneConnection.from_dict),
                 transfer_connection=map_option(d.get('transferConnection'),
                                                ZoneConnection.from_dict),
                 acl=map_option(d.get('acl'), ZoneACL.from_dict),
                 latest_sync=map_option(d.get('latestSync'),
                                        parse_datetime),
                 is_test=d.get('isTest', False),
                 shared=d['shared'],
                 backend_id=d.get('backendId'))
Ejemplo n.º 14
0
 def from_dict(d):
     return DeleteRecordSet(input_name=d['inputName'],
                            type=d['type'],
                            record=map_option(d.get('record'),
                                              rdata_converters[d['type']]))