public class HostResourceProvider extends AbstractControllerResourceProvider
AbstractResourceProvider.Command<T>
PROPERTIES_ATTRIBUTES_REGEX
Modifier and Type | Method and Description |
---|---|
Set<String> |
checkPropertyIds(Set<String> propertyIds)
Check whether the set of given property ids is supported by this resource
provider.
|
void |
createHosts(Request request)
Accepts a request with registered hosts and if the request contains a cluster name then will map all of the
hosts onto that cluster.
|
protected RequestStatus |
createResourcesAuthorized(Request request)
Create the resources defined by the properties in the given request object if authorization was
granted to the authenticated user.
|
protected DeleteStatusMetaData |
deleteHosts(Set<HostRequest> requests,
boolean dryRun) |
protected RequestStatus |
deleteResourcesAuthorized(Request request,
Predicate predicate)
Delete the resources selected by the given predicate if the authenticated user is authorized
to do so.
|
static String |
getHostNameFromProperties(Map<String,Object> properties)
Obtain the hostname from the request properties.
|
protected static Set<HostResponse> |
getHosts(AmbariManagementController controller,
HostRequest request,
OsFamily osFamily) |
protected Set<HostResponse> |
getHosts(Set<HostRequest> requests) |
protected Set<String> |
getPKPropertyIds()
Get the set of property ids that uniquely identify the resources
of this provider.
|
protected Set<Resource> |
getResourcesAuthorized(Request request,
Predicate predicate)
Get a set of
resources based on the given request and predicate
information if the authenticated user is authorized to do so. |
RequestStatusResponse |
install(String cluster,
String hostname,
Collection<String> skipInstallForComponents,
Collection<String> dontSkipInstallForComponents,
boolean skipFailure,
boolean useClusterHostInfo) |
static void |
setTopologyManager(TopologyManager topologyManager) |
RequestStatusResponse |
start(String cluster,
String hostname) |
protected void |
updateHosts(Set<HostRequest> requests) |
protected RequestStatus |
updateResourcesAuthorized(Request request,
Predicate predicate)
Update the resources selected by the given predicate with the properties from the given request
object if the authenticated user is authorized to do so.
|
getClusterId, getClusterResourceId, getClusterResourceId, getManagementController, getResourceProvider, getResourceProvider, init
createResources, deleteResources, getRequiredCreateAuthorizations, getRequiredDeleteAuthorizations, getRequiredGetAuthorizations, getRequiredUpdateAuthorizations, getResourceId, getResources, getResourceType, isAuthorizedToCreateResources, isAuthorizedToDeleteResources, isAuthorizedToGetResources, isAuthorizedToUpdateResources, setRequiredCreateAuthorizations, setRequiredDeleteAuthorizations, setRequiredGetAuthorizations, setRequiredUpdateAuthorizations, updateResources
addObserver, createResources, getConfigurationRequests, getKeyPropertyIds, getPropertyMaps, getPropertyMaps, getQueryParameterValue, getRequestStatus, getRequestStatus, getRequestStatus, getResources, modifyResources, notifyCreate, notifyDelete, notifyUpdate, parseProperties, updateObservers
checkCategory, checkConfigPropertyIds, containsArguments, getCategoryIds, getPropertyIds, getRegexEntry, getRegexGroups, getRequestPropertyIds, isPatternKey, isPropertyCategoryRequested, isPropertyEntryRequested, isPropertyRequested, setResourceProperty
public static final String RESPONSE_KEY
public static final String ALL_PROPERTIES
public static final String CLUSTER_NAME_PROPERTY_ID
public static final String CPU_COUNT_PROPERTY_ID
public static final String DESIRED_CONFIGS_PROPERTY_ID
public static final String DISK_INFO_PROPERTY_ID
public static final String HOST_HEALTH_REPORT_PROPERTY_ID
public static final String HOST_NAME_PROPERTY_ID
public static final String HOST_STATUS_PROPERTY_ID
public static final String IP_PROPERTY_ID
public static final String LAST_AGENT_ENV_PROPERTY_ID
public static final String LAST_HEARTBEAT_TIME_PROPERTY_ID
public static final String LAST_REGISTRATION_TIME_PROPERTY_ID
public static final String MAINTENANCE_STATE_PROPERTY_ID
public static final String OS_ARCH_PROPERTY_ID
public static final String OS_FAMILY_PROPERTY_ID
public static final String OS_TYPE_PROPERTY_ID
public static final String PHYSICAL_CPU_COUNT_PROPERTY_ID
public static final String PUBLIC_NAME_PROPERTY_ID
public static final String RACK_INFO_PROPERTY_ID
public static final String RECOVERY_REPORT_PROPERTY_ID
public static final String RECOVERY_SUMMARY_PROPERTY_ID
public static final String STATE_PROPERTY_ID
public static final String TOTAL_MEM_PROPERTY_ID
public static final String ATTRIBUTES_PROPERTY_ID
public static final String HOST_CLUSTER_NAME_PROPERTY_ID
public static final String HOST_CPU_COUNT_PROPERTY_ID
public static final String HOST_DESIRED_CONFIGS_PROPERTY_ID
public static final String HOST_DISK_INFO_PROPERTY_ID
public static final String HOST_HOST_HEALTH_REPORT_PROPERTY_ID
public static final String HOST_HOST_STATUS_PROPERTY_ID
public static final String HOST_IP_PROPERTY_ID
public static final String HOST_LAST_AGENT_ENV_PROPERTY_ID
public static final String HOST_LAST_HEARTBEAT_TIME_PROPERTY_ID
public static final String HOST_LAST_REGISTRATION_TIME_PROPERTY_ID
public static final String HOST_MAINTENANCE_STATE_PROPERTY_ID
public static final String HOST_HOST_NAME_PROPERTY_ID
public static final String HOST_OS_ARCH_PROPERTY_ID
public static final String HOST_OS_FAMILY_PROPERTY_ID
public static final String HOST_OS_TYPE_PROPERTY_ID
public static final String HOST_PHYSICAL_CPU_COUNT_PROPERTY_ID
public static final String HOST_PUBLIC_NAME_PROPERTY_ID
public static final String HOST_RACK_INFO_PROPERTY_ID
public static final String HOST_RECOVERY_REPORT_PROPERTY_ID
public static final String HOST_RECOVERY_SUMMARY_PROPERTY_ID
public static final String HOST_STATE_PROPERTY_ID
public static final String HOST_TOTAL_MEM_PROPERTY_ID
public static final String HOST_ATTRIBUTES_PROPERTY_ID
public static final String BLUEPRINT_PROPERTY_ID
public static final String HOST_GROUP_PROPERTY_ID
public static final String HOST_COUNT_PROPERTY_ID
public static final String HOST_PREDICATE_PROPERTY_ID
public static final Map<Resource.Type,String> keyPropertyIds
protected RequestStatus createResourcesAuthorized(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException
AbstractAuthorizedResourceProvider
AbstractAuthorizedResourceProvider.createResources(Request)
is not overwritten.createResourcesAuthorized
in class AbstractAuthorizedResourceProvider
request
- the request object which defines the set of properties for the resources to be createdSystemException
- an internal system exception occurredAuthorizationException
- if the authenticated user is not authorized to perform this operationUnsupportedPropertyException
- the request contains unsupported property idsResourceAlreadyExistsException
- attempted to create a resource which already existsNoSuchParentResourceException
- a parent resource of the resource to create doesn't existAbstractAuthorizedResourceProvider.createResources(Request)
protected Set<Resource> getResourcesAuthorized(Request request, Predicate predicate) throws SystemException, NoSuchResourceException, NoSuchParentResourceException
AbstractAuthorizedResourceProvider
resources
based on the given request and predicate
information if the authenticated user is authorized to do so.
This method must be overwritten if AbstractAuthorizedResourceProvider.getResources(Request, Predicate)
is not overwritten.getResourcesAuthorized
in class AbstractAuthorizedResourceProvider
request
- the request object which defines the desired set of propertiespredicate
- the predicate object which can be used to filter which resources are returnedSystemException
- an internal system exception occurredAuthorizationException
- if the authenticated user is not authorized to perform this operationNoSuchResourceException
- the requested resource instance doesn't existNoSuchParentResourceException
- a parent resource of the requested resource doesn't existAbstractAuthorizedResourceProvider.getResources(Request, Predicate)
protected RequestStatus updateResourcesAuthorized(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException
AbstractAuthorizedResourceProvider
AbstractAuthorizedResourceProvider.updateResources(Request, Predicate)
is not overwritten.updateResourcesAuthorized
in class AbstractAuthorizedResourceProvider
request
- the request object which defines the set of properties for the resources to be updatedpredicate
- the predicate object which can be used to filter which resources are updatedSystemException
- an internal system exception occurredAuthorizationException
- if the authenticated user is not authorized to perform this operationUnsupportedPropertyException
- the request contains unsupported property idsNoSuchResourceException
- the resource instance to be updated doesn't existNoSuchParentResourceException
- a parent resource of the resource doesn't existAbstractAuthorizedResourceProvider.updateResources(Request, Predicate)
protected RequestStatus deleteResourcesAuthorized(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException
AbstractAuthorizedResourceProvider
ResourceProvider.deleteResources(Request, Predicate)
is not overwritten.deleteResourcesAuthorized
in class AbstractAuthorizedResourceProvider
predicate
- the predicate object which can be used to filter which resources are deletedSystemException
- an internal system exception occurredAuthorizationException
- if the authenticated user is not authorized to perform this operationUnsupportedPropertyException
- the request contains unsupported property idsNoSuchResourceException
- the resource instance to be deleted doesn't existNoSuchParentResourceException
- a parent resource of the resource doesn't existResourceProvider.deleteResources(Request, Predicate)
public Set<String> checkPropertyIds(Set<String> propertyIds)
ResourceProvider
checkPropertyIds
in interface ResourceProvider
checkPropertyIds
in class BaseProvider
protected Set<String> getPKPropertyIds()
AbstractResourceProvider
getPKPropertyIds
in class AbstractResourceProvider
public void createHosts(Request request) throws org.apache.ambari.server.AmbariException, AuthorizationException
request
- Request that must contain registered hosts, and optionally a cluster.org.apache.ambari.server.AmbariException
AuthorizationException
public RequestStatusResponse install(String cluster, String hostname, Collection<String> skipInstallForComponents, Collection<String> dontSkipInstallForComponents, boolean skipFailure, boolean useClusterHostInfo) throws SystemException, NoSuchParentResourceException, UnsupportedPropertyException
public RequestStatusResponse start(String cluster, String hostname) throws SystemException, NoSuchParentResourceException, UnsupportedPropertyException
protected Set<HostResponse> getHosts(Set<HostRequest> requests) throws org.apache.ambari.server.AmbariException
org.apache.ambari.server.AmbariException
protected static Set<HostResponse> getHosts(AmbariManagementController controller, HostRequest request, OsFamily osFamily) throws org.apache.ambari.server.AmbariException
osFamily
- provides OS to OS family lookup; may be null if OS family is ignored anyway (eg. for liveness check)org.apache.ambari.server.AmbariException
protected void updateHosts(Set<HostRequest> requests) throws org.apache.ambari.server.AmbariException, AuthorizationException
org.apache.ambari.server.AmbariException
AuthorizationException
protected DeleteStatusMetaData deleteHosts(Set<HostRequest> requests, boolean dryRun) throws org.apache.ambari.server.AmbariException
org.apache.ambari.server.AmbariException
public static String getHostNameFromProperties(Map<String,Object> properties)
properties
- request propertiespublic static void setTopologyManager(TopologyManager topologyManager)
Copyright © 2022 Apache Software Foundation. All rights reserved.