Package com.citrix.netscaler.nitro.resource.config.gslb

Examples of com.citrix.netscaler.nitro.resource.config.gslb.gslbservice$svrstateEnum


        // create, delete, update, get the GSLB services
        private static void createService(nitro_service client, String serviceName, String serviceType, String serviceIp, String servicePort, String siteName)
                throws ExecutionException {
            try {
                gslbservice service;
                service = getServiceObject(client, serviceName);
                String gslbServerName = generateGslbServerName(serviceIp);

                if (!gslbServerExists(client, gslbServerName)) {
                    base_response apiCallResult;
                    com.citrix.netscaler.nitro.resource.config.basic.server nsServer = new com.citrix.netscaler.nitro.resource.config.basic.server();
                    nsServer.set_name(gslbServerName);
                    nsServer.set_ipaddress(serviceIp);
                    apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.server.add(client, nsServer);
                    if ((apiCallResult.errorcode != 0) && (apiCallResult.errorcode != NitroError.NS_RESOURCE_EXISTS)) {
                        throw new ExecutionException("Failed to add server " + gslbServerName + " due to" + apiCallResult.message);
                    }
                }

                boolean isUpdateSite = false;
                if (service == null) {
                    service = new gslbservice();
                } else {
                    isUpdateSite = true;
                }

                service.set_sitename(siteName);
                service.set_servername(gslbServerName);
                int port = Integer.parseInt(servicePort);
                service.set_port(port);
                service.set_servicename(serviceName);
                service.set_servicetype(serviceType);
                if (isUpdateSite) {
                    service.set_viewip(null);
                    service.set_viewname(null);
                    gslbservice.update(client, service);
                } else {
                    gslbservice.add(client, service);
                }
                if (s_logger.isDebugEnabled()) {
View Full Code Here


            }
        }

        private static void deleteService(nitro_service client, String serviceName) throws ExecutionException {
            try {
                gslbservice service = getServiceObject(client, serviceName);
                if (service != null) {
                    gslbservice.delete(client, serviceName);
                    if (s_logger.isDebugEnabled()) {
                        s_logger.debug("Successfully deleted service: " + serviceName);
                    }
View Full Code Here

        }

        private static void updateService(nitro_service client, String serviceName, String serviceType, String publicIp, String publicPort, String siteName)
                throws ExecutionException {
            try {
                gslbservice service;
                service = getServiceObject(client, serviceName);

                if (service != null) {
                    service.set_sitename(siteName);
                    service.set_publicip(publicIp);
                    service.set_publicport(Integer.getInteger(publicPort));
                    service.set_servicename(serviceName);
                    service.set_servicetype(serviceType);
                    gslbservice.update(client, service);
                    if (s_logger.isDebugEnabled()) {
                        s_logger.debug("Successfully updated service: " + serviceName + " at site: " + siteName);
                    }
                }
View Full Code Here

            }
        }

        private static gslbservice getServiceObject(nitro_service client, String serviceName) {
            try {
                gslbservice service = gslbservice.get(client, serviceName);
                return service;
            } catch (Exception e) {
                return null;
            }
        }
View Full Code Here

        // create, delete, update, get the GSLB services
        private static void createService(nitro_service client, String serviceName, String serviceType, String serviceIp,
                                   String servicePort, String siteName) throws ExecutionException{
            try {
                gslbservice service;
                service = getServiceObject(client, serviceName);
                String gslbServerName = generateGslbServerName(serviceIp);

                if (!gslbServerExists(client, gslbServerName)) {
                    base_response apiCallResult;
                    com.citrix.netscaler.nitro.resource.config.basic.server nsServer = new com.citrix.netscaler.nitro.resource.config.basic.server();
                    nsServer.set_name(gslbServerName);
                    nsServer.set_ipaddress(serviceIp);
                    apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.server.add(client, nsServer);
                    if ((apiCallResult.errorcode != 0) && (apiCallResult.errorcode != NitroError.NS_RESOURCE_EXISTS)) {
                        throw new ExecutionException("Failed to add server " + gslbServerName + " due to" + apiCallResult.message);
                    }
                }

                boolean isUpdateSite = false;
                if (service == null) {
                    service = new gslbservice();
                } else {
                    isUpdateSite = true;
                }

                service.set_sitename(siteName);
                service.set_servername(gslbServerName);
                int port = Integer.parseInt(servicePort);
                service.set_port(port);
                service.set_servicename(serviceName);
                service.set_servicetype(serviceType);
                if (isUpdateSite) {
                    service.set_viewip(null);
                    service.set_viewname(null);
                    gslbservice.update(client, service);
                } else {
                    gslbservice.add(client, service);
                }
                if (s_logger.isDebugEnabled()) {
View Full Code Here

            }
        }

        private static void deleteService(nitro_service client, String serviceName) throws ExecutionException {
            try {
                gslbservice service = getServiceObject(client, serviceName);
                if (service != null) {
                    gslbservice.delete(client, serviceName);
                    if (s_logger.isDebugEnabled()) {
                        s_logger.debug("Successfully deleted service: " + serviceName);
                    }
View Full Code Here

        }

        private static void updateService(nitro_service client, String serviceName, String serviceType, String publicIp,
                                          String publicPort, String siteName) throws ExecutionException {
            try {
                gslbservice service;
                service = getServiceObject(client, serviceName);

                if (service != null) {
                    service.set_sitename(siteName);
                    service.set_publicip(publicIp);
                    service.set_publicport(Integer.getInteger(publicPort));
                    service.set_servicename(serviceName);
                    service.set_servicetype(serviceType);
                    gslbservice.update(client, service);
                    if (s_logger.isDebugEnabled()) {
                        s_logger.debug("Successfully updated service: " + serviceName + " at site: " + siteName);
                    }
                }
View Full Code Here

            }
        }

        private static gslbservice getServiceObject(nitro_service client, String serviceName) {
            try {
                gslbservice service = gslbservice.get(client, serviceName);
                return service;
            } catch (Exception e) {
                return null;
            }
        }
View Full Code Here

                            // Unbind GSLB service with GSLB virtual server
                            GSLB.deleteVserverServiceBinding(_netscalerService, serviceName, vserverName);

                            // delete 'gslbservice' object
                            gslbservice service = GSLB.getServiceObject(_netscalerService, serviceName);
                            GSLB.deleteService(_netscalerService, serviceName);

                            // delete the GSLB service monitor
                            GSLB.deleteGslbServiceMonitor(_netscalerService, monitorName);
                        }
View Full Code Here

TOP

Related Classes of com.citrix.netscaler.nitro.resource.config.gslb.gslbservice$svrstateEnum

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.