コード例 #1
0
ファイル: processing.py プロジェクト: kmn/tonicdnscli
def deleteRecords(server, token, data):
    # ContentType: application/json
    # x-authentication-token: token
    method = 'DELETE'
    uri = 'https://' + server + '/zone'
    for i in data:
        conn.tonicDNSClient(uri, method, token, i)
コード例 #2
0
ファイル: processing.py プロジェクト: kmn/tonicdnscli
def createRecords(server, token, domain, data):
    # ContentType: application/json
    # x-authentication-token: token
    method = 'PUT'
    uri = 'https://' + server + '/zone/' + domain
    for i in data:
        conn.tonicDNSClient(uri, method, token, i)
コード例 #3
0
ファイル: processing.py プロジェクト: kmn/tonicdnscli
def updateSerial(server, token, domain):
    # x-authentication-token: token

    # Get SOA record
    # `cur_soa` is current SOA record.
    # `new_soa` is incremental serial SOA record.
    method = 'GET'
    uri = 'https://' + server + '/zone/' + domain
    cur_soa, new_soa = conn.tonicDNSClient(uri, method, token, data=False,
                                           keyword='serial', domain=domain)
    # set JSON
    from converter import JSONConvert
    cur_o = JSONConvert(domain)
    new_o = JSONConvert(domain)
    cur_o.records = [cur_soa]
    new_o.records = [new_soa]
    cur_o.genData(False)
    new_o.genData(True)

    # Create new SOA record
    uri = 'https://' + server + '/zone/' + domain
    method = 'PUT'
    conn.tonicDNSClient(uri, method, token, new_o.dict_records[0])

    # Delete current SOA record why zone has only one SOA record.
    method = 'DELETE'
    uri = 'https://' + server + '/zone'
    conn.tonicDNSClient(uri, method, token, cur_o.dict_records[0])
コード例 #4
0
ファイル: processing.py プロジェクト: kmn/tonicdnscli
def createZoneRecords(server, token, domain, data, identifier):
    # ContentType: application/json
    # x-authentication-token: token
    method = 'PUT'
    uri = 'https://' + server + '/zone'

    for i, v in enumerate(data):

        if i == 0:
            from converter import JSONConvert
            obj = JSONConvert(domain)
            zone = obj.generateZone(domain, identifier, v)
            conn.tonicDNSClient(uri, method, token, zone)

        else:
            # method: PUT
            uri = 'https://' + server + '/zone/' + domain
            conn.tonicDNSClient(uri, method, token, v)
コード例 #5
0
ファイル: processing.py プロジェクト: kmn/tonicdnscli
def updateTemplate(server, token, identifier, template):
    # ContentType: application/json
    # x-authentication-token: token
    method = 'POST'
    uri = 'https://' + server + '/template/' + identifier
    conn.tonicDNSClient(uri, method, token, data=template)
コード例 #6
0
ファイル: processing.py プロジェクト: kmn/tonicdnscli
def getAllZone(server, token):
    # x-authentication-token: token
    method = 'GET'
    uri = 'https://' + server + '/zone'
    conn.tonicDNSClient(uri, method, token, data=False)
コード例 #7
0
ファイル: processing.py プロジェクト: kmn/tonicdnscli
def getZone(server, token, domain, keyword=''):
    # x-authentication-token: token
    method = 'GET'
    uri = 'https://' + server + '/zone/' + domain
    conn.tonicDNSClient(uri, method, token, data=False, keyword=keyword)
コード例 #8
0
ファイル: processing.py プロジェクト: kmn/tonicdnscli
def getTemplate(server, token, template):
    # x-authentication-token: token
    method = 'GET'
    uri = 'https://' + server + '/template/' + template
    conn.tonicDNSClient(uri, method, token, data=False)
コード例 #9
0
ファイル: tdauth.py プロジェクト: kmn/tonicdnscli
 def getToken(self):
     method = 'PUT'
     import connect as conn
     self.token = conn.tonicDNSClient(self.uri, method,
                                      self.token, data=self.setInfo())