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


Python ApiCli.getArguments方法代码示例

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


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

示例1: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
 def getArguments(self):
     '''
     Extracts the specific arguments of this CLI
     '''
     ApiCli.getArguments(self)
     if self.args.pluginName != None:
         self.pluginName = self.args.pluginName
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:9,代码来源:plugin_base.py

示例2: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.metricName is not None:
            self.metricName = self.args.metricName

        if self.args.source is not None:
            self.source = self.args.source
        else:
            self.source = ""

        if self.args.aggregate is not None:
            self.aggregate = self.args.aggregate
        else:
            self.aggregate = "avg"

        start_time = int(self.parse_time_date(self.args.start).strftime("%s"))

        # If the end time is not specified then
        # default to the current time
        if self.args.end is None:
            stop_time = int(self.now.strftime("%s"))
        else:
            stop_time = int(self.parse_time_date(self.args.end).strftime("%s"))

        # Convert to epoch time in milli-seconds
        start_time *= 1000
        stop_time *= 1000

        self.path = "v1/measurements/{0}".format(self.metricName)
        self.url_parameters = {"source": self.source, "start": str(start_time), "end": str(stop_time),
                               "agg": self.aggregate}
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:36,代码来源:measurement_get.py

示例3: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.plugin_name is not None:
            self.plugin_name = self.args.plugin_name

        self.path = "v1/plugins/{0}".format(self.plugin_name)
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:11,代码来源:plugin_get.py

示例4: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.alarmId is not None:
            self.alarmId = self.args.alarmId

        self.path = "v1/alarm/{0}".format(self.alarmId)
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:11,代码来源:alarm_delete.py

示例5: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.hostGroupId is not None:
            self.hostGroupId = self.args.hostGroupId

        self.path = "v1/hostgroup/{0}".format(str(self.hostGroupId))
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:11,代码来源:host_group_get.py

示例6: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
    def getArguments(self):
        '''
        Extracts the specific arguments of this CLI
        '''
        ApiCli.getArguments(self)
        if self.args.metricName != None:
            self.metricName = self.args.metricName

        self.path = "v1/metrics/{0}".format(self.metricName)
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:11,代码来源:metric_delete.py

示例7: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
 def getArguments(self):
     '''
     Extracts the specific arguments of this CLI
     '''
     ApiCli.getArguments(self)
     if self.args.metricName != None:
         self.metricName = self.args.metricName            
    
     self.data = {'metric': self.metricName}
     self.headers = {'Content-Type': 'application/json'}
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:12,代码来源:metric_ref.py

示例8: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
    def getArguments(self):
        ApiCli.getArguments(self)

        if self.args.file_path is None:
            self.file_path = 'plugin.json'
        else:
            self.file_path = self.args.file_path

        self.path = "v1/metrics"

        self.load()
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:13,代码来源:metric_markdown.py

示例9: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.hostGroupId is not None:
            self.hostGroupId = self.args.hostGroupId
        if self.args.force is not None:
            self.force = self.args.force

        if self.force:
            self.url_parameters = {"forceRemove": True}

        self.path = "v1/hostgroup/{0}".format(str(self.hostGroupId))
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:16,代码来源:host_group_delete.py

示例10: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)

        if self.args.alarmName is not None:
            self.alarmName = self.args.alarmName

        if self.args.alarmId is not None:
            self.alarmId = self.args.alarmId

        if self.alarmId is not None:
            self.path = "v1/alarm/{0}".format(self.alarmId)

        if self.alarmName is not None:
            self.path = "v1/alarms/search"
            self.url_parameters={"name": self.alarmName}
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:20,代码来源:alarm_get.py

示例11: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)

        # Get the list of sources separated by commas
        if self.args.sources is not None:
            self.sources = self.args.sources

        payload = {"names": []}
        if self.sources is not None:
            source_list = str.split(self.sources, ',')
            for s in source_list:
                payload['names'].append(s)

        self.data = json.dumps(payload, sort_keys=True)
        self.headers = {'Content-Type': 'application/json', "Accept": "application/json"}
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:20,代码来源:source_delete.py

示例12: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.fingerprint_fields is not None:
            self.fingerprint_fields = self.args.fingerprint_fields

        if self.args.title is not None:
            self.title = self.args.title

        if self.args.source is not None:
            self.source = self.args.source

        if self.args.severity is not None:
            self.severity = self.args.severity

        if self.args.message is not None:
            self.message = self.args.message

        event = {
            "title": "foobar",
            "fingerprintFields": ['@title'],
            "source": {"ref": "foo", "type": "bar", "name": "foobar"}
        }

        if self.title is not None:
            event['title'] = self.title

        if self.severity is not None:
            event['severity'] = self.severity

        if self.message is not None:
            event['message'] = self.message

        if self.source is not None:
            event['source'] = self.source

        if self.fingerprint_fields is not None:
            event['fingerprintFields'] = self.fingerprint_fields

        self.data = json.dumps(event, sort_keys=True)
        self.headers = {'Content-Type': 'application/json', "Accept": "application/json"}
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:45,代码来源:event_create.py

示例13: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.metricName is not None:
            self.metricName = self.args.metricName

        if self.args.measurement is not None:
            self.measurement = self.args.measurement

        if self.args.source is not None:
            self.source = self.args.source
        else:
            self.source = socket.gethostname()

        if self.args.timestamp is not None:
            self.timestamp = self.args.timestamp
        else:
            self.timestamp = int(time.time())

        m = {"metric": self.metricName, "measure": self.measurement, "source": self.source, "timestamp": self.timestamp}
        self.data = json.dumps(m, sort_keys=True)
        self.headers = {"Content-Type": "application/json", "Accept": "application/json"}
开发者ID:wcainboundary,项目名称:boundary-api-cli,代码行数:26,代码来源:measurement_create.py

示例14: getArguments

# 需要导入模块: from boundary import ApiCli [as 别名]
# 或者: from boundary.ApiCli import getArguments [as 别名]
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)

        if self.args.alarm_name is not None:
            self.alarm_name = self.args.alarm_name

        if self.args.metric_name is not None:
            self.metric_name = self.args.metric_name

        if self.args.aggregate is not None:
            self.aggregate = self.args.aggregate

        if self.args.operation is not None:
            self.operation = self.args.operation

        if self.args.threshold is not None:
            self.threshold = self.args.threshold

        if self.args.interval is not None:
            self.interval = self.args.interval

        if self.args.host_group_id is not None:
            self.host_group_id = self.args.host_group_id

        if self.args.actions is not None:
            self.actions = self.args.actions

        if self.args.note is not None:
            self.note = self.args.note

        if self.args.per_host_notify is not None:
            self.per_host_notify = self.args.per_host_notify

        if self.args.is_disabled is not None:
            self.is_disabled = self.args.is_disabled

        payload = {}

        # Create trigger predicate dictionary
        predicate = {}

        if self.aggregate is not None:
            predicate['agg'] = self.aggregate

        if self.operation is not None:
            predicate['op'] = self.operation

        if self.threshold is not None:
            predicate['val'] = self.threshold

        if 'agg' in predicate or 'op' in predicate or 'val' in predicate:
            payload['triggerPredicate'] = predicate

        # Create payload dictionary
        if self.alarm_name:
            payload['name'] = self.alarm_name

        if self.host_group_id is not None:
            payload['hostgroupId'] = self.host_group_id

        if self.interval is not None:
            payload['interval'] = self.intervals[self.interval]

        if self.metric_name is not None:
            payload['metricName'] = self.metric_name

        if self.note is not None:
            payload['note'] = self.note

        if self.actions is not None:
            payload['actions'] = self.actions

        if self.per_host_notify is not None:
            payload['perHostNotify'] = True if self.per_host_notify == 'yes' else False

        if self.is_disabled is not None:
            payload['isDisabled'] = True if self.is_disabled == 'yes' else False

        self.data = json.dumps(payload, sort_keys=True)
        self.headers = {'Content-Type': 'application/json'}
开发者ID:GabrielNicolasAvellaneda,项目名称:boundary-api-cli,代码行数:85,代码来源:alarm_modify.py


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