All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.gs2.cdk.identifier.model.Statement Maven / Gradle / Ivy

The newest version!
package io.gs2.cdk.identifier.model;

import java.util.*;

public class Statement {

    String effect;
    List actions;

    public static Statement allow(
            List actions
    ) {
        var statement = new Statement();
        statement.effect = "Allow";
        statement.actions = actions;
        return statement;
    }

    public static Statement allowAll() {
        var statement = new Statement();
        statement.effect = "Allow";
        statement.actions = List.of("*");
        return statement;
    }

    public static Statement deny(
            List actions
    ) {
        var statement = new Statement();
        statement.effect = "Deny";
        statement.actions = actions;
        return statement;
    }

    public static Statement denyAll() {
        var statement = new Statement();
        statement.effect = "Deny";
        statement.actions = List.of("*");
        return statement;
    }

    public Statement action(String action) {
        this.actions.add(action);
        return this;
    }

    public Map properties() {
        return new HashMap<>() {
            {
                put("Effect", effect);
                put("Actions", actions);
                put("Resources", List.of("*"));
            }
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy