com.citrix.netscaler.nitro.resource.config.tm.tmtrafficpolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nitro Show documentation
Show all versions of nitro Show documentation
The Citrix® NetScaler® NITRO client for Java allows you to configure and monitor the NetScaler appliance programmatically in Java based applications. Source code taken from Build 121 of NetScaler release 10.1
The newest version!
/*
* Copyright (c) 2008-2015 Citrix Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.citrix.netscaler.nitro.resource.config.tm;
import com.citrix.netscaler.nitro.resource.base.*;
import com.citrix.netscaler.nitro.service.nitro_service;
import com.citrix.netscaler.nitro.service.options;
import com.citrix.netscaler.nitro.util.*;
import com.citrix.netscaler.nitro.exception.nitro_exception;
class tmtrafficpolicy_response extends base_response
{
public tmtrafficpolicy[] tmtrafficpolicy;
}
/**
* Configuration for TM traffic policy resource.
*/
public class tmtrafficpolicy extends base_resource
{
private String name;
private String rule;
private String action;
//------- Read only Parameter ---------;
private Long hits;
private Long __count;
/**
*
* Name for the traffic policy. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. Cannot be changed after the policy is created.
The following requirement applies only to the NetScaler CLI:
If the name includes one or more spaces, enclose the name in double or single quotation marks (for example, "my policy" or 'my policy').
Minimum length = 1
*
*/
public void set_name(String name) throws Exception{
this.name = name;
}
/**
*
* Name for the traffic policy. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. Cannot be changed after the policy is created.
The following requirement applies only to the NetScaler CLI:
If the name includes one or more spaces, enclose the name in double or single quotation marks (for example, "my policy" or 'my policy').
Minimum length = 1
*
*/
public String get_name() throws Exception {
return this.name;
}
/**
*
* Expression, against which traffic is evaluated. Written in the classic syntax.
Maximum length of a string literal in the expression is 255 characters. A longer string can be split into smaller strings of up to 255 characters each, and the smaller strings concatenated with the + operator. For example, you can create a 500-character string as follows: '"" + ""'
The following requirements apply only to the NetScaler CLI:
* If the expression includes one or more spaces, enclose the entire expression in double quotation marks.
* If the expression itself includes double quotation marks, escape the quotations by using the \ character.
* Alternatively, you can use single quotation marks to enclose the rule, in which case you do not have to escape the double quotation marks.
*
*/
public void set_rule(String rule) throws Exception{
this.rule = rule;
}
/**
*
* Expression, against which traffic is evaluated. Written in the classic syntax.
Maximum length of a string literal in the expression is 255 characters. A longer string can be split into smaller strings of up to 255 characters each, and the smaller strings concatenated with the + operator. For example, you can create a 500-character string as follows: '"" + ""'
The following requirements apply only to the NetScaler CLI:
* If the expression includes one or more spaces, enclose the entire expression in double quotation marks.
* If the expression itself includes double quotation marks, escape the quotations by using the \ character.
* Alternatively, you can use single quotation marks to enclose the rule, in which case you do not have to escape the double quotation marks.
*
*/
public String get_rule() throws Exception {
return this.rule;
}
/**
*
* Name of the action to apply to requests or connections that match this policy.
Minimum length = 1
*
*/
public void set_action(String action) throws Exception{
this.action = action;
}
/**
*
* Name of the action to apply to requests or connections that match this policy.
Minimum length = 1
*
*/
public String get_action() throws Exception {
return this.action;
}
/**
*
* Number of hits.
*
*/
public Long get_hits() throws Exception {
return this.hits;
}
/**
*
* converts nitro response into object and returns the object array in case of get request.
*
*/
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception{
tmtrafficpolicy_response result = (tmtrafficpolicy_response) service.get_payload_formatter().string_to_resource(tmtrafficpolicy_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
return result.tmtrafficpolicy;
}
/**
*
* Returns the value of object identifier argument
*
*/
protected String get_object_name() {
return this.name;
}
/**
* Use this API to add tmtrafficpolicy.
*/
public static base_response add(nitro_service client, tmtrafficpolicy resource) throws Exception {
tmtrafficpolicy addresource = new tmtrafficpolicy();
addresource.name = resource.name;
addresource.rule = resource.rule;
addresource.action = resource.action;
return addresource.add_resource(client);
}
/**
* Use this API to add tmtrafficpolicy resources.
*/
public static base_responses add(nitro_service client, tmtrafficpolicy resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
tmtrafficpolicy addresources[] = new tmtrafficpolicy[resources.length];
for (int i=0;i 0) {
tmtrafficpolicy deleteresources[] = new tmtrafficpolicy[name.length];
for (int i=0;i 0) {
tmtrafficpolicy deleteresources[] = new tmtrafficpolicy[resources.length];
for (int i=0;i 0) {
tmtrafficpolicy updateresources[] = new tmtrafficpolicy[resources.length];
for (int i=0;i 0) {
tmtrafficpolicy unsetresources[] = new tmtrafficpolicy[name.length];
for (int i=0;i 0) {
tmtrafficpolicy unsetresources[] = new tmtrafficpolicy[resources.length];
for (int i=0;i0) {
tmtrafficpolicy response[] = new tmtrafficpolicy[name.length];
tmtrafficpolicy obj[] = new tmtrafficpolicy[name.length];
for (int i=0;i