Esempio n. 1
0
def SetDomainRecordStatus(sldomain, status):
    clt = client.AcsClient(accesskey['accesskeyid'],
                           accesskey['accesskeysecret'], 'cn-hangzhou')
    setRequest = SetDomainRecordStatusRequest.SetDomainRecordStatusRequest()
    setRequest.set_RecordId(sldomain)
    setRequest.set_Status(status)
    setResult = clt.do_action_with_exception(setRequest)
    return setResult
Esempio n. 2
0
 def set_dns_status(self, recordId, status):
     request = SetDomainRecordStatusRequest.SetDomainRecordStatusRequest()
     request.set_accept_format("json")
     request.set_RecordId(recordId)
     request.set_Status(status)
     result = json.loads(self.clt.do_action(request))
     print(result)
     return result
Esempio n. 3
0
def set_record_status(recordid, status):
    request = SetDomainRecordStatusRequest.SetDomainRecordStatusRequest()
    request.set_RecordId(recordid)
    request.set_Status(status)
    result = send_request(request)
    if 'RecordId' in result:
        checkresult = get_record_from_id(recordid)
        return [checkresult]
    return False
Esempio n. 4
0
def set_domain_record_status(record_id, status):
    """
    启用/暂停一条特定的记录
    :param record_id:
    :param status:
    :return:
    """
    request = SetDomainRecordStatusRequest.SetDomainRecordStatusRequest()
    request.set_RecordId(record_id)
    request.set_Status(status.capitalize())
    client = _client()
    result = client.do_action_with_exception(request)
    result_dict = json.loads(result)
    return result_dict
Esempio n. 5
0
def set_dns_record(DomainName, hostname, status):
    DomainRecords = DescribeDomainRecordsRequest.DescribeDomainRecordsRequest()
    DomainRecords.set_accept_format('json')
    DomainRecords.set_DomainName(DomainName)
    DomainRecordsJson = json.loads(client.do_action_with_exception(DomainRecords))
    for x in DomainRecordsJson['DomainRecords']['Record']:
        if hostname == x['RR']:
                RecordId = x['RecordId']
                SetDomainRecord = SetDomainRecordStatusRequest.SetDomainRecordStatusRequest()
                SetDomainRecord.set_accept_format('json')
                SetDomainRecord.set_RecordId(RecordId)
                SetDomainRecord.set_Status(status)
                SetDomainRecordJson = json.loads(client.do_action_with_exception(SetDomainRecord))
                print SetDomainRecordJson
Esempio n. 6
0
#!/usr/bin/python

from aliyunsdkcore import client
from aliyunsdkalidns.request.v20150109 import DescribeDomainRecordsRequest
from aliyunsdkalidns.request.v20150109 import UpdateDomainRecordRequest
from aliyunsdkalidns.request.v20150109 import AddDomainRecordRequest
from aliyunsdkalidns.request.v20150109 import DeleteDomainRecordRequest
from aliyunsdkalidns.request.v20150109 import SetDomainRecordStatusRequest

AccessKeyID = "xxx"
AccessKeySecret = "xxx"

import json
import sys
clt = client.AcsClient(AccessKeyID, AccessKeySecret, 'cn-hangzhou')

setRequest = SetDomainRecordStatusRequest.SetDomainRecordStatusRequest()
setRequest.set_RecordId(sys.argv[1])
setRequest.set_Status(sys.argv[2])
setResult = clt.do_action(setRequest)
#setResult2 = json.loads(setResult)
print setResult


Esempio n. 7
0
 def __init__(self):
     self.clt = client.AcsClient(current_app.config['DNSACCESSKEYID'],
                                 current_app.config['DNSACCESSKEYSECRET'])
     self.request = SetDomainRecordStatusRequest.SetDomainRecordStatusRequest(
     )
     self.request.set_accept_format('json')