public class ClusterResourceProvider 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.
|
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 RequestStatus |
deleteResourcesAuthorized(Request request,
Predicate predicate)
Delete the resources selected by the given predicate if the authenticated user is authorized
to do so.
|
protected Set<String> |
getPKPropertyIds()
Get the set of property ids that uniquely identify the resources
of this provider.
|
Set<Resource> |
getResources(Request request,
Predicate predicate)
Get a set of
resources based on the given request and predicate
information. |
protected static ServiceConfigVersionRequest |
getServiceConfigVersionRequest(String parentCategory,
Map<String,Object> properties)
Helper method for creating rollback request
|
static void |
init(TopologyManager manager,
TopologyRequestFactory requestFactory,
SecurityConfigurationFactory securityFactory,
com.google.gson.Gson instance)
Inject the blueprint data access object which is used to obtain blueprint entities.
|
protected boolean |
isAuthorizedToCreateResources(org.springframework.security.core.Authentication authentication,
Request request)
Tests authorization to create resources.
|
protected boolean |
isAuthorizedToDeleteResources(org.springframework.security.core.Authentication authentication,
Predicate predicate)
Tests authorization to delete resources.
|
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, getResourcesAuthorized, getResourceType, 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_ID
public static final String CLUSTER_NAME
public static final String VERSION
public static final String PROVISIONING_STATE
public static final String SECURITY_TYPE
public static final String DESIRED_CONFIGS
public static final String DESIRED_SERVICE_CONFIG_VERSIONS
public static final String TOTAL_HOSTS
public static final String HEALTH_REPORT
public static final String CREDENTIAL_STORE_PROPERTIES
public static final String REPO_VERSION
public static final String CLUSTER_ID_PROPERTY_ID
public static final String CLUSTER_NAME_PROPERTY_ID
public static final String CLUSTER_VERSION_PROPERTY_ID
public static final String CLUSTER_PROVISIONING_STATE_PROPERTY_ID
public static final String CLUSTER_SECURITY_TYPE_PROPERTY_ID
public static final String CLUSTER_DESIRED_CONFIGS_PROPERTY_ID
public static final String CLUSTER_DESIRED_SERVICE_CONFIG_VERSIONS_PROPERTY_ID
public static final String CLUSTER_TOTAL_HOSTS_PROPERTY_ID
public static final String CLUSTER_HEALTH_REPORT_PROPERTY_ID
public static final String CLUSTER_CREDENTIAL_STORE_PROPERTIES_PROPERTY_ID
public static final String CLUSTER_STATE_PROPERTY_ID
public static final String SECURITY
public static final String CREDENTIALS
public static final String GET_IGNORE_PERMISSIONS_PROPERTY_ID
protected static final Map<Resource.Type,String> keyPropertyIds
protected Set<String> getPKPropertyIds()
AbstractResourceProvider
getPKPropertyIds
in class AbstractResourceProvider
public Set<String> checkPropertyIds(Set<String> propertyIds)
checkPropertyIds
in interface ResourceProvider
checkPropertyIds
in class BaseProvider
protected boolean isAuthorizedToCreateResources(org.springframework.security.core.Authentication authentication, Request request)
AbstractAuthorizedResourceProvider
isAuthorizedToCreateResources
in class AbstractAuthorizedResourceProvider
authentication
- the authenticated user and associated access privilegesrequest
- the request object which defines the set of properties for the resources to be createdprotected boolean isAuthorizedToDeleteResources(org.springframework.security.core.Authentication authentication, Predicate predicate) throws SystemException
AbstractAuthorizedResourceProvider
isAuthorizedToDeleteResources
in class AbstractAuthorizedResourceProvider
authentication
- the authenticated user and associated access privilegespredicate
- the predicate object which can be used to filter which resources are deletedSystemException
- if an internal system exception occurredprotected 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)
public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException
AbstractAuthorizedResourceProvider
resources
based on the given request and predicate
information.
Note that it is not required for this resource provider to completely filter
the set of resources based on the given predicate. It may not be possible
since some of the properties involved may be provided by another
provider
. This partial filtering is allowed because
the predicate will always be applied by the calling cluster controller. The
predicate is made available at this level so that some pre-filtering can be done
as an optimization.
A simple implementation of a resource provider may choose to just return all of
the resources of a given type and allow the calling cluster controller to filter
based on the predicate.
This implementation attempts to authorize the authenticated user before performing the requested
operation. If authorization fails, an AuthorizationException will be thrown.
This method may be overwritten by implementing classes to avoid performing authorization checks
to get resources.getResources
in interface ResourceProvider
getResources
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 operationUnsupportedPropertyException
- the request contains unsupported property idsNoSuchResourceException
- the requested resource instance doesn't existNoSuchParentResourceException
- a parent resource of the requested resource doesn't existprotected 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 static void init(TopologyManager manager, TopologyRequestFactory requestFactory, SecurityConfigurationFactory securityFactory, com.google.gson.Gson instance)
manager
- topology managerrequestFactory
- request factoryinstance
- protected static ServiceConfigVersionRequest getServiceConfigVersionRequest(String parentCategory, Map<String,Object> properties)
Copyright © 2022 Apache Software Foundation. All rights reserved.