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


Python DynectSession.get_session方法代码示例

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


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

示例1: delete

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def delete(self, publish='Y'):
     """Delete this HTTPRedirect service from the DynECT System
     publish='N' can be passed into this function to do a soft-delete which
     will be acted upon during a zone publish.
     """
     api_args = {'publish': publish}
     DynectSession.get_session().execute(self.uri, 'DELETE', api_args)
开发者ID:Raz71,项目名称:dyn-python,代码行数:9,代码来源:httpredirect.py

示例2: delete

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def delete(self):
     """Delete this :class:`RegionPoolEntry`"""
     uri = '/RTTMRegionPoolEntry/{}/{}/{}/{}/'.format(self._zone,
                                                      self._fqdn,
                                                      self._region_code,
                                                      self._address)
     DynectSession.get_session().execute(uri, 'DELETE', {})
开发者ID:Raz71,项目名称:dyn-python,代码行数:9,代码来源:rttm.py

示例3: protocol

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def protocol(self, value):
     if value not in self.valid_protocols:
         raise Exception
     self._protocol = value
     api_args = {'monitor': {'protocol': self._protocol}}
     uri = '/Failover/{}/{}/'.format(self.zone, self.fqdn)
     DynectSession.get_session().execute(uri, 'PUT', api_args)
开发者ID:Raz71,项目名称:dyn-python,代码行数:9,代码来源:gslb.py

示例4: delete

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def delete(self):
     """Delete this :class:`AdvancedRedirectRule` service
      from the DynECT System
     """
     self.uri = '/AdvRedirectRule/{}/{}/{}'.format(self._zone,
                                                   self._fqdn,
                                                   self._public_id)
     DynectSession.get_session().execute(self.uri, 'DELETE', {})
开发者ID:anothrNick,项目名称:dyn-python,代码行数:10,代码来源:advanced_redirect.py

示例5: _update

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def _update(self, api_args):
     """Update the Dyn System with data from this
     :class:`PerformanceMonitor`
     """
     uri = '/RTTM/{}/{}/'.format(self.zone, self.fqdn)
     response = DynectSession.get_session().execute(uri, 'PUT', api_args)
     self._build(response['data']['performance_monitor'])
开发者ID:Raz71,项目名称:dyn-python,代码行数:9,代码来源:rttm.py

示例6: _update

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def _update(self, api_args=None):
     """Update an existing :class:`AdvancedRedirect` Service
      on the DynECT System"""
     self.uri = '/AdvRedirect/{}/{}/'.format(self._zone, self._fqdn)
     response = DynectSession.get_session().execute(self.uri, 'PUT',
                                                    api_args)
     self._build(response['data'])
开发者ID:anothrNick,项目名称:dyn-python,代码行数:9,代码来源:advanced_redirect.py

示例7: get_any_records

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def get_any_records(self):
     """Retrieve a list of all :class:`DNSRecord`'s associated with this
     :class:`Zone`
     """
     if self.fqdn is None:
         return
     api_args = {'detail': 'Y'}
     uri = '/ANYRecord/{}/{}/'.format(self._name, self.fqdn)
     response = DynectSession.get_session().execute(uri, 'GET', api_args)
     # Strip out empty record_type lists
     record_lists = {label: rec_list for label, rec_list in
                     response['data'].items() if rec_list != []}
     records = {}
     for key, record_list in record_lists.items():
         search = key.split('_')[0].upper()
         try:
             constructor = RECS[search]
         except KeyError:
             constructor = RECS['UNKNOWN']
         list_records = []
         for record in record_list:
             del record['zone']
             del record['fqdn']
             # Unpack rdata
             for r_key, r_val in record['rdata'].items():
                 record[r_key] = r_val
             record['create'] = False
             list_records.append(constructor(self._name, self.fqdn,
                                             **record))
         records[key] = list_records
     return records
开发者ID:Raz71,项目名称:dyn-python,代码行数:33,代码来源:zones.py

示例8: get_all_records

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def get_all_records(self):
     """Retrieve a list of all record resources for the specified node and
     zone combination as well as all records from any Base_Record below that
     point on the zone hierarchy
     """
     self.records = {}
     uri = '/AllRecord/{}/'.format(self.zone)
     if self.fqdn is not None:
         uri += '{}/'.format(self.fqdn)
     api_args = {'detail': 'Y'}
     response = DynectSession.get_session().execute(uri, 'GET', api_args)
     # Strip out empty record_type lists
     record_lists = {label: rec_list for label, rec_list in
                     response['data'].items() if rec_list != []}
     records = {}
     for key, record_list in record_lists.items():
         search = key.split('_')[0].upper()
         try:
             constructor = RECS[search]
         except KeyError:
             constructor = RECS['UNKNOWN']
         list_records = []
         for record in record_list:
             del record['zone']
             fqdn = record['fqdn']
             del record['fqdn']
             # Unpack rdata
             for r_key, r_val in record['rdata'].items():
                 record[r_key] = r_val
             record['create'] = False
             list_records.append(constructor(self.zone, fqdn, **record))
         records[key] = list_records
     return records
开发者ID:Raz71,项目名称:dyn-python,代码行数:35,代码来源:zones.py

示例9: _post

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def _post(self, pool, serve_count=None, failover_mode=None,
           failover_data=None):
     """Create a new :class:`GSLBRegion` on the DynECT System"""
     self._pool = pool
     self._serve_count = serve_count
     self._failover_mode = failover_mode
     self._failover_data = failover_data
     uri = '/GSLBRegion/{}/{}/'.format(self._zone, self._fqdn)
     api_args = {'pool': self._pool.to_json(),
                 'region_code': self._region_code}
     if serve_count:
         api_args['serve_count'] = self._serve_count
     if self._failover_mode:
         if self._failover_mode not in self.valid_modes:
             raise DynectInvalidArgumentError('failover_mode',
                                              self._failover_mode,
                                              self.valid_modes)
         api_args['failover_mode'] = self._failover_mode
     if self._failover_data:
         if self._failover_data not in self.valid_modes:
             raise DynectInvalidArgumentError('failover_data',
                                              self._failover_data,
                                              self.valid_modes)
         api_args['failover_data'] = self._failover_data
     response = DynectSession.get_session().execute(uri, 'POST', api_args)
     self._build(response['data'])
开发者ID:Raz71,项目名称:dyn-python,代码行数:28,代码来源:gslb.py

示例10: _post

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def _post(self):
     """Create a new :class:`RTTMRegion` on the DynECT System"""
     uri = '/RTTMRegion/{}/{}/'.format(self._zone, self._fqdn)
     api_args = {'region_code': self._region_code,
                 'pool': [poole.to_json() for poole in self._pool]}
     if self._autopopulate:
         if self._autopopulate not in ('Y', 'N'):
             raise DynectInvalidArgumentError('autopopulate',
                                              self._autopopulate,
                                              ('Y', 'N'))
         api_args['autopopulate'] = self._autopopulate
     if self._ep:
         api_args['ep'] = self._ep
     if self._apmc:
         api_args['apmc'] = self._apmc
     if self._epmc:
         api_args['epmc'] = self._epmc
     if self._serve_count:
         api_args['serve_count'] = self._serve_count
     if self._failover_mode:
         if self._failover_mode not in self.valid_modes:
             raise DynectInvalidArgumentError('failover_mode',
                                              self._failover_mode,
                                              self.valid_modes)
         api_args['failover_mode'] = self._failover_mode
     if self._failover_data:
         if self._failover_data not in self.valid_modes:
             raise DynectInvalidArgumentError('failover_data',
                                              self._failover_data,
                                              self.valid_modes)
         api_args['failover_data'] = self._failover_data
     response = DynectSession.get_session().execute(uri, 'POST', api_args)
     self._build(response['data'])
开发者ID:Raz71,项目名称:dyn-python,代码行数:35,代码来源:rttm.py

示例11: get_qps

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
    def get_qps(self, start_ts, end_ts=None, breakdown=None, hosts=None,
                rrecs=None):
        """Generates a report with information about Queries Per Second (QPS)
        for this zone

        :param start_ts: datetime.datetime instance identifying point in time
            for the QPS report
        :param end_ts: datetime.datetime instance indicating the end of the
            data range for the report. Defaults to datetime.datetime.now()
        :param breakdown: By default, most data is aggregated together.
            Valid values ('hosts', 'rrecs', 'zones').
        :param hosts: List of hosts to include in the report.
        :param rrecs: List of record types to include in report.
        :return: A :class:`str` with CSV data
        """
        end_ts = end_ts or datetime.now()
        api_args = {'start_ts': unix_date(start_ts),
                    'end_ts': unix_date(end_ts),
                    'zones': [self.name]}
        if breakdown is not None:
            api_args['breakdown'] = breakdown
        if hosts is not None:
            api_args['hosts'] = hosts
        if rrecs is not None:
            api_args['rrecs'] = rrecs
        response = DynectSession.get_session().execute('/QPSReport/',
                                                       'POST', api_args)
        return response['data']
开发者ID:Raz71,项目名称:dyn-python,代码行数:30,代码来源:zones.py

示例12: _post

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def _post(self, record_type, address, user=None):
     """Create a new DynamicDNS Service on the DynECT System"""
     self._record_type = record_type
     self._address = address
     if user:
         self._user = user
     self.uri = '/DDNS/{}/{}/{}/'.format(self._zone, self._fqdn,
                                         self._record_type)
     api_args = {'address': self._address}
     if user:
         api_args['user'] = self._user
         api_args['full_setup'] = True
     response = DynectSession.get_session().execute(self.uri, 'POST',
                                                    api_args)
     for key, val in response['data'].items():
         if user:
             if key == 'ddns':
                 for ddns_key, ddns_val in val.items():
                     setattr(self, '_' + ddns_key, ddns_val)
             if key == 'new_user':
                 user_name = val['user_name']
                 del val['user_name']
                 self._user = User(user_name, api=False, **val)
         elif key == 'active':
             self._active = Active(val)
         else:
             setattr(self, '_' + key, val)
开发者ID:Raz71,项目名称:dyn-python,代码行数:29,代码来源:ddns.py

示例13: deactivate

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def deactivate(self):
     """Deactivate this Dynamic DNS service"""
     api_args = {'deactivate': True}
     response = DynectSession.get_session().execute(self.uri, 'PUT',
                                                    api_args)
     for key, val in response['data'].items():
         setattr(self, '_' + key, val)
开发者ID:Raz71,项目名称:dyn-python,代码行数:9,代码来源:ddns.py

示例14: reset

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def reset(self):
     """Resets the abuse count on this Dynamic DNS service"""
     api_args = {'reset': True}
     response = DynectSession.get_session().execute(self.uri, 'PUT',
                                                    api_args)
     for key, val in response['data'].items():
         setattr(self, '_' + key, val)
开发者ID:Raz71,项目名称:dyn-python,代码行数:9,代码来源:ddns.py

示例15: _update

# 需要导入模块: from dyn.tm.session import DynectSession [as 别名]
# 或者: from dyn.tm.session.DynectSession import get_session [as 别名]
 def _update(self, api_args):
     """Update this object by making a PUT API call with the provided
     api_args
     """
     response = DynectSession.get_session().execute(self.uri, 'PUT',
                                                    api_args)
     self._build(response['data'])
开发者ID:Raz71,项目名称:dyn-python,代码行数:9,代码来源:reversedns.py


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