Пример #1
0
    def get(cls, client, name="", option_=""):
        """Use this API to fetch all the policyevaluation resources that are configured on netscaler.

        :param client: 
        :param name:  (Default value = "")
        :param option_:  (Default value = "")

        """
        try:
            if type(name) == cls:
                if type(name) is not list:
                    option_ = options()
                    option_.args = nitro_util.object_to_string_withoutquotes(
                        name)
                    response = name.get_resource(client, option_)
                else:
                    if name and len(name) > 0:
                        response = [
                            policyevaluation() for _ in range(len(name))
                        ]
                        for i in range(len(name)):
                            option_ = options()
                            option_.args = nitro_util.object_to_string_withoutquotes(
                                name[i])
                            response[i] = name[i].get_resource(client, option_)
                return response
        except Exception as e:
            raise e
Пример #2
0
    def get(self, service, obj):
        """Use this API to fetch a snmptrap_binding resource.

        :param service: 
        :param obj: 

        """
        try:
            if type(obj) is not list:
                option_ = options()
                option_.args = nitro_util.object_to_string_withoutquotes(obj)
                response = obj.get_resource(service, option_)
            else:
                if obj and len(obj) > 0:
                    for i in range(len(obj)):
                        option_ = options()
                        option_.args = nitro_util.object_to_string_withoutquotes(
                            obj[i])
                        response[i] = obj[i].get_resource(service, option_)
            return response
        except Exception as e:
            raise e
    def get(cls, service, obj):
        """Use this API to fetch a snmptrap_snmpuser_binding resources.

        :param service: 
        :param obj: 

        """
        try:
            option_ = options()
            option_.args = nitro_util.object_to_string_withoutquotes(obj)
            response = obj.get_resources(service, option_)
            return response
        except Exception as e:
            raise e
Пример #4
0
    def get_args(cls, client, args):
        """Use this API to fetch all the policyevaluation resources that are configured on netscaler.
            # This uses policyevaluation_args which is a way to provide additional arguments while fetching the resources.

        :param client: 
        :param args: 

        """
        try:
            obj = policyevaluation()
            option_ = options()
            option_.args = nitro_util.object_to_string_withoutquotes(args)
            response = obj.get_resources(client, option_)
            return response
        except Exception as e:
            raise e
Пример #5
0
    def get(cls, service, name="", option_=""):
        """Use this API to fetch the statistics of all servicegroupmember_stats resources that are configured on netscaler.

        :param service: 
        :param name:  (Default value = "")
        :param option_:  (Default value = "")

        """
        try:
            obj = servicegroupmember_stats()
            option_ = options()
            option_.args = nitro_util.object_to_string_withoutquotes(name)
            response = obj.stat_resource(service, option_)
            return response
        except Exception as e:
            raise e
Пример #6
0
    def count(cls, client, obj):
        """Use this API to count the policyevaluation resources configured on NetScaler.

        :param client: 
        :param obj: 

        """
        try:
            option_ = options()
            option_.count = True
            option_.args = nitro_util.object_to_string_withoutquotes(obj)
            response = obj.get_resources(client, option_)
            if response:
                return response[0].__dict__['___count']
            return 0
        except Exception as e:
            raise e
Пример #7
0
    def get_filtered(cls, client, filter_, obj):
        """Use this API to fetch filtered set of policyevaluation resources.
        filter string should be in JSON format.eg: "port:80,servicetype:HTTP".

        :param client: 
        :param filter_: 
        :param obj: 

        """
        try:
            option_ = options()
            option_.filter = filter_
            option_.args = nitro_util.object_to_string_withoutquotes(obj)
            response = obj.getfiltered(client, option_)
            return response
        except Exception as e:
            raise e
Пример #8
0
    def get(cls, client, name="", option_="") :
        """Use this API to fetch all the protocolhttpband resources that are configured on netscaler.

        :param client: 
        :param name:  (Default value = "")
        :param option_:  (Default value = "")

        """
        try :
            if type(name) == cls :
                if type(name) is not list :
                    option_ = options()
                    option_.args = nitro_util.object_to_string_withoutquotes(name)
                    response = name.get_resource(client, option_)
                return response
        except Exception as e :
            raise e
Пример #9
0
    def count(cls, service, obj) :
        """Use this API to count clusternodegroup_clusternode_binding resources configued on NetScaler.

        :param service: 
        :param obj: 

        """
        try :
            option_ = options()
            option_.count = True
            option_.args = nitro_util.object_to_string_withoutquotes(obj)
            response = obj.get_resources(service, option_)
            if response :
                return response[0].__dict__['___count']
            return 0
        except Exception as e:
            raise e
Пример #10
0
    def get_filtered(cls, service, obj, filter_) :
        """Use this API to fetch filtered set of clusternodegroup_clusternode_binding resources.
        Filter string should be in JSON format.eg: "port:80,servicetype:HTTP".

        :param service: 
        :param obj: 
        :param filter_: 

        """
        try :
            option_ = options()
            option_.filter = filter_
            option_.args = nitro_util.object_to_string_withoutquotes(obj)
            response = obj.getfiltered(service, option_)
            return response
        except Exception as e:
            raise e
Пример #11
0
    def delete_resource(self, service):
        """Use this method to perform a delete operation on netscaler resource.

        :param service: nitro_service object
        :returns: status of the operation performed.
        
        Throws:

        """
        try:
            if not service.isLogin():
                service.login()
            str_ = nitro_util.object_to_string_withoutquotes(self)
            response = self.delete_request(service, str_)
            return response
        except Exception as e:
            raise e
Пример #12
0
    def count_filtered(cls, client, filter_, obj):
        """Use this API to count filtered the set of policyevaluation resources.
        Filter string should be in JSON format.eg: "port:80,servicetype:HTTP".

        :param client: 
        :param filter_: 
        :param obj: 

        """
        try:
            option_ = options()
            option_.count = True
            option_.filter = filter_
            option_.args = nitro_util.object_to_string_withoutquotes(obj)
            response = obj.getfiltered(client, option_)
            if response:
                return response[0].__dict__['___count']
            return 0
        except Exception as e:
            raise e
    def count_filtered(cls, service, obj, filter_) :
        """Use this API to count the filtered set of streamidentifier_streamsession_binding resources.
        Filter string should be in JSON format.eg: "port:80,servicetype:HTTP".

        :param service: 
        :param obj: 
        :param filter_: 

        """
        try :
            option_ = options()
            option_.count = True
            option_.filter = filter_
            option_.args = nitro_util.object_to_string_withoutquotes(obj)
            response = obj.getfiltered(service, option_)
            if response :
                return response[0].__dict__['___count']
            return 0
        except Exception as e:
            raise e