コード例 #1
0
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(WebACL webACL, JSONWriter jsonWriter) {
    if (webACL == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (webACL.getWebACLId() != null) {
        jsonWriter.key("WebACLId").value(webACL.getWebACLId());
      }

      if (webACL.getName() != null) {
        jsonWriter.key("Name").value(webACL.getName());
      }

      if (webACL.getMetricName() != null) {
        jsonWriter.key("MetricName").value(webACL.getMetricName());
      }

      if (webACL.getDefaultAction() != null) {
        jsonWriter.key("DefaultAction");
        WafActionJsonMarshaller.getInstance().marshall(webACL.getDefaultAction(), jsonWriter);
      }

      java.util.List<ActivatedRule> rulesList = webACL.getRules();
      if (rulesList != null) {
        jsonWriter.key("Rules");
        jsonWriter.array();
        for (ActivatedRule rulesListValue : rulesList) {
          if (rulesListValue != null) {

            ActivatedRuleJsonMarshaller.getInstance().marshall(rulesListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
コード例 #2
0
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(SqlInjectionMatchSet sqlInjectionMatchSet, JSONWriter jsonWriter) {
    if (sqlInjectionMatchSet == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (sqlInjectionMatchSet.getSqlInjectionMatchSetId() != null) {
        jsonWriter
            .key("SqlInjectionMatchSetId")
            .value(sqlInjectionMatchSet.getSqlInjectionMatchSetId());
      }

      if (sqlInjectionMatchSet.getName() != null) {
        jsonWriter.key("Name").value(sqlInjectionMatchSet.getName());
      }

      java.util.List<SqlInjectionMatchTuple> sqlInjectionMatchTuplesList =
          sqlInjectionMatchSet.getSqlInjectionMatchTuples();
      if (sqlInjectionMatchTuplesList != null) {
        jsonWriter.key("SqlInjectionMatchTuples");
        jsonWriter.array();
        for (SqlInjectionMatchTuple sqlInjectionMatchTuplesListValue :
            sqlInjectionMatchTuplesList) {
          if (sqlInjectionMatchTuplesListValue != null) {

            SqlInjectionMatchTupleJsonMarshaller.getInstance()
                .marshall(sqlInjectionMatchTuplesListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }