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


Python RequisicaoVips.update方法代码示例

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


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

示例1: update_vip_request

# 需要导入模块: from networkapi.requisicaovips.models import RequisicaoVips [as 别名]
# 或者: from networkapi.requisicaovips.models.RequisicaoVips import update [as 别名]
def update_vip_request(vip_id, vip_map, user):

    log = Log('update_vip_request')

    if not has_perm(user,
                    AdminPermission.VIPS_REQUEST,
                    AdminPermission.WRITE_OPERATION):
        raise UserNotAuthorizedError(
            None, u'Usuário não tem permissão para executar a operação.')

    healthcheck_expect_id = vip_map.get('id_healthcheck_expect')
    if healthcheck_expect_id is not None:
        if not is_valid_int_greater_zero_param(healthcheck_expect_id):
            log.error(
                u'The healthcheck_expect_id parameter is not a valid value: %s.', healthcheck_expect_id)
            raise InvalidValueError(
                None, 'healthcheck_expect_id', healthcheck_expect_id)
        else:
            healthcheck_expect_id = int(healthcheck_expect_id)

    ip_id = vip_map.get('id_ip')
    if not is_valid_int_greater_zero_param(ip_id):
        log.error(u'The ip_id parameter is not a valid value: %s.', ip_id)
        raise InvalidValueError(None, 'ip_id', ip_id)
    else:
        ip_id = int(ip_id)

    validated = vip_map.get('validado')
    if validated is None:
        return 246
    if validated == '0':
        validated = False
    elif validated == '1':
        validated = True
    else:
        return 244

    vip_created = vip_map.get('vip_criado')
    if vip_created is None:
        return 247
    if vip_created == '0':
        vip_created = False
    elif vip_created == '1':
        vip_created = True
    else:
        return 245

    # Valid maxcon
    if not is_valid_int_greater_equal_zero_param(vip_map.get('maxcon')):
        log.error(
            u'The maxcon parameter is not a valid value: %s.', vip_map.get('maxcon'))
        raise InvalidValueError(None, 'maxcon', vip_map.get('maxcon'))

    code = RequisicaoVips.update(user,
                                 vip_id,
                                 vip_map,
                                 healthcheck_expect_id=healthcheck_expect_id,
                                 ip_id=ip_id,
                                 vip_criado=vip_created,
                                 validado=validated)

    if code is not None:
        return code

    return 0
开发者ID:andrewsmedina,项目名称:GloboNetworkAPI,代码行数:67,代码来源:RequisicaoVipsResource.py


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