com.cloudimpl.outstack.spring.service.iam.UpdatePolicyStatement Maven / Gradle / Ivy
/*
* Copyright 2021 nuwan.
*
* 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.cloudimpl.outstack.spring.service.iam;
import com.cloudimpl.outstack.core.Inject;
import com.cloudimpl.outstack.runtime.EntityCommandHandler;
import com.cloudimpl.outstack.runtime.EntityContext;
import com.cloudimpl.outstack.runtime.ResourceHelper;
import com.cloudimpl.outstack.runtime.RootEntityContext;
import com.cloudimpl.outstack.runtime.domain.PolicyStatementCreated;
import com.cloudimpl.outstack.runtime.domain.PolicyStatement;
import com.cloudimpl.outstack.runtime.domain.PolicyStatementRequest;
import com.cloudimpl.outstack.runtime.iam.PolicyStatementParser;
import com.cloudimpl.outstack.runtime.iam.ResourceDescriptor;
import java.util.Collection;
import java.util.stream.Collectors;
/**
*
* @author nuwan
*/
public class UpdatePolicyStatement extends EntityCommandHandler{
@Inject
private ResourceHelper helper;
@Override
protected PolicyStatement execute(EntityContext context, PolicyStatementRequest command) {
PolicyStatementCreated stmt = parseStatement(command);
PolicyStatementParser.validate(helper,(RootEntityContext) context, stmt);
return context.update(stmt.getSid(), stmt);
}
private PolicyStatementCreated parseStatement(PolicyStatementRequest req)
{
return PolicyStatementParser.parseStatement(helper.getDomainOwner(),helper.getDomainContext(),req);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy