Examples of ApiRole


Examples of com.cloudera.api.model.ApiRole

         ApiService newService = new ApiService();
         newService.setName(service.getName());
         newService.setType(service.getType());
         List<ApiRole> newRoles = new ArrayList<ApiRole>();
         for (ApiRole role : service.getRoles()) {
            ApiRole newRole = new ApiRole();
            newRole.setName(UUID.randomUUID().toString());
            newRole.setType(role.getType());
            newRole.setHostRef(role.getHostRef());
            newRole.setRoleState(ApiRoleState.STOPPED);
            newRoles.add(newRole);
         }
         newService.setRoles(newRoles);
         services.add(newService);
         RolesResourceV6 rolesResourceV6 = new FakeRolesResource(newRoles);
View Full Code Here

Examples of com.cloudera.api.model.ApiRole

               }
            }
            if (!roleDefs.isEmpty()) {
               List<ApiRole> newRoles = new ArrayList<>();
               for (CmRoleDef roleDef : roleDefs) {
                  ApiRole apiRole = createApiRole(roleDef);
                  newRoles.add(apiRole);
               }
               String action = "Configuring service " + apiService.getDisplayName();
               cluster.getCurrentReport().setNodesAction(action, addedNodeNames);
               reportQueue.addClusterReport(cluster.getCurrentReport().clone());

               logger.debug("Creating roles " + newRoles);
               ApiRoleList roleList =
                     apiResourceRootV6.getClustersResource()
                     .getServicesResource(cluster.getName())
                     .getRolesResource(apiService.getName())
                     .createRoles(new ApiRoleList(newRoles));
               result.get(apiService.getName()).addAll(roleList.getRoles());
            }
         }
         logger.info("Finished configure services");

         syncRolesId(cluster);

         preDeployConfig(cluster);

         // deploy client config for new added roles only
         for (String serviceName : result.keySet()) {
            final ApiRoleNameList roleNameList = new ApiRoleNameList();
            final String sName = serviceName;
            List<String> roleNames = new ArrayList<>();
            for (ApiRole apiRole : result.get(serviceName)) {
               roleNames.add(apiRole.getName());
            }
            roleNameList.setRoleNames(roleNames);
            retry(5, new Retriable() {
               @Override
               public void doWork() throws Exception {
View Full Code Here

Examples of com.cloudera.api.model.ApiRole

         throw SoftwareManagementPluginException.CONFIGURE_SERVICE_FAILED(e);
      }
   }

   private ApiRole createApiRole(CmRoleDef role) {
      ApiRole apiRole = new ApiRole();
      apiRole.setType(role.getType().getName());
      apiRole.setHostRef(new ApiHostRef(role.getNodeRef()));
      ApiConfigList roleConfigList = new ApiConfigList();
      if (role.getConfiguration() != null) {
         for (String key : role.getConfiguration().keySet()) {
            roleConfigList.add(new ApiConfig(key, role.getConfiguration().get(key)));
         }
      }
      apiRole.setConfig(roleConfigList);
      return apiRole;
   }
View Full Code Here

Examples of com.cloudera.api.model.ApiRole

      apiService.setConfig(apiServiceConfig);

      List<ApiRole> apiRoles = new ArrayList<ApiRole>();
      for (CmRoleDef roleDef : serviceDef.getRoles()) {
         ApiRole apiRole = createApiRole(roleDef);

            /*
            update configs of this role if services already exist,
            the roleDef's roleName is already synced up at the beginning of this function
             */
         if (servicesConfigured
               && apiResourceRootV6.getClustersResource().getServicesResource(cluster.getName()).readService(serviceDef.getName()) != null
               && apiResourceRootV6.getClustersResource().getServicesResource(cluster.getName()).getRolesResource(serviceDef.getName()).readRole(roleDef.getName()) != null) {
            apiResourceRootV6.getClustersResource().getServicesResource(cluster.getName()).getRolesResource(serviceDef.getName())
                  .updateRoleConfig(roleDef.getName(), "update config for role " + roleDef.getDisplayName(), apiRole.getConfig());
            logger.info("Finished reconfigure role " + roleDef.getDisplayName());
         }

         apiRoles.add(apiRole);
      }
View Full Code Here

Examples of com.cloudera.api.model.ApiRole

      ApiServiceList apiServiceList = new ApiServiceList();
      apiServiceList.setServices(serviceList);
      Mockito.when(servicesResourceV6.readServices((DataView) anyObject())).thenReturn(apiServiceList);

      List<ApiRole> roleList = new ArrayList<>();
      ApiRole role = new ApiRole();
      role.setName("NAMENODE");
      role.setRoleState(ApiRoleState.STARTED);
      role.setType(role.getName());
      ApiHostRef hostRef = new ApiHostRef("host1");
      role.setHostRef(hostRef);
      roleList.add(role);
      RolesResourceV6 rolesResourceV6 = new FakeRolesResource(roleList);
      Mockito.when(servicesResourceV6.getRolesResource(hdfs.getName())).thenReturn(rolesResourceV6);
      Mockito.when(resourceV6.getServicesResource(blueprint.getName())).thenReturn(servicesResourceV6);
View Full Code Here

Examples of com.cloudera.api.model.ApiRole

      ApiServiceList apiServiceList = new ApiServiceList();
      apiServiceList.setServices(serviceList);
      Mockito.when(servicesResourceV6.readServices((DataView) anyObject())).thenReturn(apiServiceList);

      List<ApiRole> roleList = new ArrayList<>();
      ApiRole role = new ApiRole();
      role.setName("NAMENODE");
      role.setRoleState(ApiRoleState.STOPPED);
      role.setType(role.getName());
      ApiHostRef hostRef = new ApiHostRef("host1");
      role.setHostRef(hostRef);
      roleList.add(role);
      RolesResourceV6 rolesResourceV6 = new FakeRolesResource(roleList);
      Mockito.when(servicesResourceV6.getRolesResource(hdfs.getName())).thenReturn(rolesResourceV6);
      Mockito.when(resourceV6.getServicesResource(blueprint.getName())).thenReturn(servicesResourceV6);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.