com.netflix.spinnaker.fiat.providers.ResourcePermissionSource Maven / Gradle / Ivy
/*
* Copyright 2019 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.netflix.spinnaker.fiat.providers;
import com.netflix.spinnaker.fiat.model.resources.Permissions;
import com.netflix.spinnaker.fiat.model.resources.Resource;
import javax.annotation.Nonnull;
/**
* A ResourcePermissionSource is capable of resolving the Permissions for a specified Resource from
* a specified single source.
*
* Note that while the API signature matches ResourcePermissionProvider the intent of
* ResourcePermissionSource is to model a single source of Permissions (for example CloudDriver as a
* source of Account permissions), while ResourcePermissionProvider is responsible for supplying the
* computed Permission considering all available ResourcePermissionSources.
*
* @param the type of Resource this ResourcePermissionSource will supply Permissions for
*/
public interface ResourcePermissionSource {
/**
* Retrieves Permissions for the supplied resource.
*
* @param resource the resource for which to get permissions (never null)
* @return the Permissions for the resource (never null - use Permissions.EMPTY or apply some
* restriction)
*/
@Nonnull
Permissions getPermissions(@Nonnull T resource);
}