/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(IPSet iPSet, StructuredJsonGenerator jsonGenerator) { if (iPSet == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (iPSet.getIPSetId() != null) { jsonGenerator.writeFieldName("IPSetId").writeValue(iPSet.getIPSetId()); } if (iPSet.getName() != null) { jsonGenerator.writeFieldName("Name").writeValue(iPSet.getName()); } java.util.List<IPSetDescriptor> iPSetDescriptorsList = iPSet.getIPSetDescriptors(); if (iPSetDescriptorsList != null) { jsonGenerator.writeFieldName("IPSetDescriptors"); jsonGenerator.writeStartArray(); for (IPSetDescriptor iPSetDescriptorsListValue : iPSetDescriptorsList) { if (iPSetDescriptorsListValue != null) { IPSetDescriptorJsonMarshaller.getInstance() .marshall(iPSetDescriptorsListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(ByteMatchTuple byteMatchTuple, StructuredJsonGenerator jsonGenerator) { if (byteMatchTuple == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (byteMatchTuple.getFieldToMatch() != null) { jsonGenerator.writeFieldName("FieldToMatch"); FieldToMatchJsonMarshaller.getInstance() .marshall(byteMatchTuple.getFieldToMatch(), jsonGenerator); } if (byteMatchTuple.getTargetString() != null) { jsonGenerator.writeFieldName("TargetString").writeValue(byteMatchTuple.getTargetString()); } if (byteMatchTuple.getTextTransformation() != null) { jsonGenerator .writeFieldName("TextTransformation") .writeValue(byteMatchTuple.getTextTransformation()); } if (byteMatchTuple.getPositionalConstraint() != null) { jsonGenerator .writeFieldName("PositionalConstraint") .writeValue(byteMatchTuple.getPositionalConstraint()); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
public Request<UpdateByteMatchSetRequest> marshall( UpdateByteMatchSetRequest updateByteMatchSetRequest) { if (updateByteMatchSetRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<UpdateByteMatchSetRequest> request = new DefaultRequest<UpdateByteMatchSetRequest>(updateByteMatchSetRequest, "AWSWAF"); request.addHeader("X-Amz-Target", "AWSWAF_20150824.UpdateByteMatchSet"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (updateByteMatchSetRequest.getByteMatchSetId() != null) { jsonGenerator .writeFieldName("ByteMatchSetId") .writeValue(updateByteMatchSetRequest.getByteMatchSetId()); } if (updateByteMatchSetRequest.getChangeToken() != null) { jsonGenerator .writeFieldName("ChangeToken") .writeValue(updateByteMatchSetRequest.getChangeToken()); } java.util.List<ByteMatchSetUpdate> updatesList = updateByteMatchSetRequest.getUpdates(); if (updatesList != null) { jsonGenerator.writeFieldName("Updates"); jsonGenerator.writeStartArray(); for (ByteMatchSetUpdate updatesListValue : updatesList) { if (updatesListValue != null) { ByteMatchSetUpdateJsonMarshaller.getInstance() .marshall(updatesListValue, jsonGenerator); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", protocolFactory.getContentType()); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
public Request<CreateWebACLRequest> marshall(CreateWebACLRequest createWebACLRequest) { if (createWebACLRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<CreateWebACLRequest> request = new DefaultRequest<CreateWebACLRequest>(createWebACLRequest, "AWSWAFRegional"); request.addHeader("X-Amz-Target", "AWSWAF_Regional_20161128.CreateWebACL"); request.setHttpMethod(HttpMethodName.POST); request.setResourcePath(""); try { final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator(); jsonGenerator.writeStartObject(); if (createWebACLRequest.getName() != null) { jsonGenerator.writeFieldName("Name").writeValue(createWebACLRequest.getName()); } if (createWebACLRequest.getMetricName() != null) { jsonGenerator.writeFieldName("MetricName").writeValue(createWebACLRequest.getMetricName()); } if (createWebACLRequest.getDefaultAction() != null) { jsonGenerator.writeFieldName("DefaultAction"); WafActionJsonMarshaller.getInstance() .marshall(createWebACLRequest.getDefaultAction(), jsonGenerator); } if (createWebACLRequest.getChangeToken() != null) { jsonGenerator .writeFieldName("ChangeToken") .writeValue(createWebACLRequest.getChangeToken()); } jsonGenerator.writeEndObject(); byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", protocolFactory.getContentType()); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(WafAction wafAction, StructuredJsonGenerator jsonGenerator) { if (wafAction == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (wafAction.getType() != null) { jsonGenerator.writeFieldName("Type").writeValue(wafAction.getType()); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** 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); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(RuleSummary ruleSummary, StructuredJsonGenerator jsonGenerator) { if (ruleSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (ruleSummary.getRuleId() != null) { jsonGenerator.writeFieldName("RuleId").writeValue(ruleSummary.getRuleId()); } if (ruleSummary.getName() != null) { jsonGenerator.writeFieldName("Name").writeValue(ruleSummary.getName()); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }
/** 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); } }
/** Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall( ByteMatchSetUpdate byteMatchSetUpdate, StructuredJsonGenerator jsonGenerator) { if (byteMatchSetUpdate == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (byteMatchSetUpdate.getAction() != null) { jsonGenerator.writeFieldName("Action").writeValue(byteMatchSetUpdate.getAction()); } if (byteMatchSetUpdate.getByteMatchTuple() != null) { jsonGenerator.writeFieldName("ByteMatchTuple"); ByteMatchTupleJsonMarshaller.getInstance() .marshall(byteMatchSetUpdate.getByteMatchTuple(), jsonGenerator); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } }