Tabnine Logo
ServiceId.getProgram
Code IndexAdd Tabnine to your IDE (free)

How to use
getProgram
method
in
co.cask.cdap.proto.id.ServiceId

Best Java code snippets using co.cask.cdap.proto.id.ServiceId.getProgram (Showing top 13 results out of 315)

origin: caskdata/cdap

public static Map<String, String> service(ServiceId serviceId) {
 return ImmutableMap.of(
  Constants.Metrics.Tag.NAMESPACE, serviceId.getNamespace(),
  Constants.Metrics.Tag.APP, serviceId.getApplication(),
  Constants.Metrics.Tag.SERVICE, serviceId.getProgram());
}
origin: caskdata/cdap

 public static Map<String, String> serviceHandler(ServiceId id, String handlerId) {
  return ImmutableMap.of(
   Constants.Metrics.Tag.NAMESPACE, id.getNamespace(),
   Constants.Metrics.Tag.APP, id.getApplication(),
   Constants.Metrics.Tag.SERVICE, id.getProgram(),
   Constants.Metrics.Tag.HANDLER, handlerId);
 }
}
origin: co.cask.cdap/cdap-common

public static Map<String, String> service(ServiceId serviceId) {
 return ImmutableMap.of(
  Constants.Metrics.Tag.NAMESPACE, serviceId.getNamespace(),
  Constants.Metrics.Tag.APP, serviceId.getApplication(),
  Constants.Metrics.Tag.SERVICE, serviceId.getProgram());
}
origin: co.cask.cdap/cdap-common

 public static Map<String, String> serviceHandler(ServiceId id, String handlerId) {
  return ImmutableMap.of(
   Constants.Metrics.Tag.NAMESPACE, id.getNamespace(),
   Constants.Metrics.Tag.APP, id.getApplication(),
   Constants.Metrics.Tag.SERVICE, id.getProgram(),
   Constants.Metrics.Tag.HANDLER, handlerId);
 }
}
origin: caskdata/cdap

 public static Service fromEntityId(ServiceId serviceId) {
  return new Service(Id.Application.fromEntityId(serviceId.getParent()), serviceId.getProgram());
 }
}
origin: co.cask.cdap/cdap-common

 public static Service fromEntityId(ServiceId serviceId) {
  return new Service(Id.Application.fromEntityId(serviceId.getParent()), serviceId.getProgram());
 }
}
origin: caskdata/cdap

@Override
public void perform(Arguments arguments, PrintStream output) throws Exception {
 ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE));
 String appName = serviceId.getApplication();
 String serviceName = serviceId.getProgram();
 serviceClient.deleteRouteConfig(serviceId);
 output.printf("Successfully deleted route configuration of %s '%s' of application '%s'\n",
        ElementType.SERVICE.getName(), serviceName, appName);
}
origin: co.cask.cdap/cdap-cli

@Override
public void perform(Arguments arguments, PrintStream output) throws Exception {
 ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE));
 String appName = serviceId.getApplication();
 String serviceName = serviceId.getProgram();
 serviceClient.deleteRouteConfig(serviceId);
 output.printf("Successfully deleted route configuration of %s '%s' of application '%s'\n",
        ElementType.SERVICE.getName(), serviceName, appName);
}
origin: caskdata/cdap

/**
 * Checks whether the {@link Service} is active.
 *
 * @param service ID of the service
 * @throws IOException if a network error occurred
 * @throws UnauthenticatedException if the request is not authorized successfully in the gateway server
 * @throws NotFoundException if the app or service could not be found
 * @throws ServiceUnavailableException if the service is not available
 */
public void checkAvailability(ServiceId service) throws IOException, UnauthenticatedException, NotFoundException,
 ServiceUnavailableException, UnauthorizedException {
 URL url = config.resolveNamespacedURLV3(service.getNamespaceId(),
                     String.format("apps/%s/versions/%s/services/%s/available",
                            service.getApplication(), service.getVersion(),
                            service.getProgram()));
 HttpResponse response = restClient.execute(HttpMethod.GET, url, config.getAccessToken(),
                       HttpURLConnection.HTTP_NOT_FOUND, HttpURLConnection.HTTP_BAD_REQUEST,
                       HttpURLConnection.HTTP_UNAVAILABLE);
 if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
  throw new NotFoundException(service);
 }
 if (response.getResponseCode() == HttpURLConnection.HTTP_UNAVAILABLE) {
  throw new ServiceUnavailableException(service.getProgram());
 }
}
origin: caskdata/cdap

@Override
public void perform(Arguments arguments, PrintStream output) throws Exception {
 ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE));
 String routeConfig = arguments.get(ArgumentName.ROUTE_CONFIG.getName());
 serviceClient.storeRouteConfig(serviceId, ArgumentParser.parseStringIntegerMap(
  routeConfig, ArgumentName.ROUTE_CONFIG.toString()));
 output.printf("Successfully set route configuration of %s '%s' of application '%s' to '%s'\n",
        ElementType.SERVICE.getName(), serviceId.getProgram(), serviceId.getApplication(), routeConfig);
}
origin: co.cask.cdap/cdap-cli

@Override
public void perform(Arguments arguments, PrintStream output) throws Exception {
 ServiceId serviceId = new ServiceId(parseProgramId(arguments, ElementType.SERVICE));
 String routeConfig = arguments.get(ArgumentName.ROUTE_CONFIG.getName());
 serviceClient.storeRouteConfig(serviceId, ArgumentParser.parseStringIntegerMap(
  routeConfig, ArgumentName.ROUTE_CONFIG.toString()));
 output.printf("Successfully set route configuration of %s '%s' of application '%s' to '%s'\n",
        ElementType.SERVICE.getName(), serviceId.getProgram(), serviceId.getApplication(), routeConfig);
}
origin: caskdata/cdap

/**
 * Sets the number of instances of a service.
 *
 * @param service the service
 * @param instances number of instances for the service
 * @throws IOException if a network error occurred
 * @throws NotFoundException if the application or service could not be found
 * @throws UnauthenticatedException if the request is not authorized successfully in the gateway server
 */
public void setServiceInstances(ServiceId service, int instances)
 throws IOException, NotFoundException, UnauthenticatedException, UnauthorizedException {
 URL url = config.resolveNamespacedURLV3(service.getNamespaceId(),
                     String.format("apps/%s/services/%s/instances",
                            service.getApplication(),
                            service.getProgram()));
 HttpRequest request = HttpRequest.put(url).withBody(GSON.toJson(new Instances(instances))).build();
 HttpResponse response = restClient.execute(request, config.getAccessToken(), HttpURLConnection.HTTP_NOT_FOUND);
 if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
  throw new NotFoundException(service);
 }
}
origin: caskdata/cdap

/**
 * Gets the number of instances of a service.
 *
 * @param service the service
 * @return number of instances of the service handler
 * @throws IOException if a network error occurred
 * @throws NotFoundException if the application or service could not found
 * @throws UnauthenticatedException if the request is not authorized successfully in the gateway server
 */
public int getServiceInstances(ServiceId service)
 throws IOException, NotFoundException, UnauthenticatedException, UnauthorizedException {
 URL url = config.resolveNamespacedURLV3(service.getNamespaceId(),
                     String.format("apps/%s/services/%s/instances",
                            service.getApplication(),
                            service.getProgram()));
 HttpResponse response = restClient.execute(HttpMethod.GET, url, config.getAccessToken(),
                       HttpURLConnection.HTTP_NOT_FOUND);
 if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
  throw new NotFoundException(service);
 }
 return ObjectResponse.fromJsonBody(response, Instances.class).getResponseObject().getInstances();
}
co.cask.cdap.proto.idServiceIdgetProgram

Popular methods of ServiceId

  • <init>
  • getApplication
  • getEntityName
  • getNamespace
  • getNamespaceId
  • getParent
  • getVersion
  • run
  • toMetadataEntity

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • compareTo (BigDecimal)
  • putExtra (Intent)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now