library/src/main/java/com/kdgregory/aws/utils/iam/PolicyBuilder.java
/**
         *  Internal method to append this statement to an in-process build.
         */
Internal method to append this statement to an in-process build.
Internal method to append this statement to an in - process build .
protected void append(JsonGenerator out)
        throws IOException
        {
            if (effect == null)
                throw new IllegalArgumentException("statement must specify effect");
            if (actions.isEmpty() && notActions.isEmpty())
                throw new IllegalArgumentException("statement must specify actions or not-actions");
            if (! actions.isEmpty() && ! notActions.isEmpty())
                throw new IllegalArgumentException("statement must specify either actions or not-actions, not both");
            if (resources.isEmpty() && notResources.isEmpty())
                throw new IllegalArgumentException("statement must specify resources or not-resources");
            if (! resources.isEmpty() && ! notResources.isEmpty())
                throw new IllegalArgumentException("statement must specify either resources or not-resources, not both");
            out.writeStartObject();
            if (sid != null)
                out.writeStringField("Sid", sid);
            out.writeStringField("Effect", effect);
            if (principal != null)
            {
                principal.appendHeader(out);
                principal.appendBody(out);
            }
            if (! actions.isEmpty())
                appendListField(out, "Action", actions);
            else
                appendListField(out, "NotAction", notActions);
            if (! resources.isEmpty())
                appendListField(out, "Resource", resources);
            else
                appendListField(out, "NotResource", notResources);
            if (! conditions.isEmpty())
            {
                out.writeObjectFieldStart("Condition");
                for (Condition value : conditions.values())
                {
                    value.append(out);
                }
                out.writeEndObject();
            }
            out.writeEndObject();
        }
protected void append ( JsonGenerator out ) throws IOException { if ( effect == null ) throw new IllegalArgumentException ( "statement must specify effect" ) ; if ( actions . isEmpty ( ) && notActions . isEmpty ( ) ) throw new IllegalArgumentException ( "statement must specify actions or not-actions" ) ; if ( ! actions . isEmpty ( ) && ! notActions . isEmpty ( ) ) throw new IllegalArgumentException ( "statement must specify either actions or not-actions, not both" ) ; if ( resources . isEmpty ( ) && notResources . isEmpty ( ) ) throw new IllegalArgumentException ( "statement must specify resources or not-resources" ) ; if ( ! resources . isEmpty ( ) && ! notResources . isEmpty ( ) ) throw new IllegalArgumentException ( "statement must specify either resources or not-resources, not both" ) ; out . writeStartObject ( ) ; if ( sid != null ) out . writeStringField ( "Sid" , sid ) ; out . writeStringField ( "Effect" , effect ) ; if ( principal != null ) { principal . appendHeader ( out ) ; principal . appendBody ( out ) ; } if ( ! actions . isEmpty ( ) ) appendListField ( out , "Action" , actions ) ; else appendListField ( out , "NotAction" , notActions ) ; if ( ! resources . isEmpty ( ) ) appendListField ( out , "Resource" , resources ) ; else appendListField ( out , "NotResource" , notResources ) ; if ( ! conditions . isEmpty ( ) ) { out . writeObjectFieldStart ( "Condition" ) ; for ( Condition value : conditions . values ( ) ) { value . append ( out ) ; } out . writeEndObject ( ) ; } out . writeEndObject ( ) ; }
Internal method to append this statement to an in-process build.
Internal method to append this statement to an in - process build .