/** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(
      ConfigRuleEvaluationStatus configRuleEvaluationStatus, JSONWriter jsonWriter) {
    if (configRuleEvaluationStatus == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (configRuleEvaluationStatus.getConfigRuleName() != null) {
        jsonWriter.key("ConfigRuleName").value(configRuleEvaluationStatus.getConfigRuleName());
      }

      if (configRuleEvaluationStatus.getConfigRuleArn() != null) {
        jsonWriter.key("ConfigRuleArn").value(configRuleEvaluationStatus.getConfigRuleArn());
      }

      if (configRuleEvaluationStatus.getConfigRuleId() != null) {
        jsonWriter.key("ConfigRuleId").value(configRuleEvaluationStatus.getConfigRuleId());
      }

      if (configRuleEvaluationStatus.getLastSuccessfulInvocationTime() != null) {
        jsonWriter
            .key("LastSuccessfulInvocationTime")
            .value(configRuleEvaluationStatus.getLastSuccessfulInvocationTime());
      }

      if (configRuleEvaluationStatus.getLastFailedInvocationTime() != null) {
        jsonWriter
            .key("LastFailedInvocationTime")
            .value(configRuleEvaluationStatus.getLastFailedInvocationTime());
      }

      if (configRuleEvaluationStatus.getFirstActivatedTime() != null) {
        jsonWriter
            .key("FirstActivatedTime")
            .value(configRuleEvaluationStatus.getFirstActivatedTime());
      }

      if (configRuleEvaluationStatus.getLastErrorCode() != null) {
        jsonWriter.key("LastErrorCode").value(configRuleEvaluationStatus.getLastErrorCode());
      }

      if (configRuleEvaluationStatus.getLastErrorMessage() != null) {
        jsonWriter.key("LastErrorMessage").value(configRuleEvaluationStatus.getLastErrorMessage());
      }

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

    if (describeConfigurationRecordersRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<DescribeConfigurationRecordersRequest> request =
        new DefaultRequest<DescribeConfigurationRecordersRequest>(
            describeConfigurationRecordersRequest, "AmazonConfig");
    request.addHeader("X-Amz-Target", "StarlingDoveService.DescribeConfigurationRecorders");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator();

      jsonGenerator.writeStartObject();

      com.amazonaws.internal.SdkInternalList<String> configurationRecorderNamesList =
          (com.amazonaws.internal.SdkInternalList<String>)
              describeConfigurationRecordersRequest.getConfigurationRecorderNames();
      if (!configurationRecorderNamesList.isEmpty()
          || !configurationRecorderNamesList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("ConfigurationRecorderNames");
        jsonGenerator.writeStartArray();
        for (String configurationRecorderNamesListValue : configurationRecorderNamesList) {
          if (configurationRecorderNamesListValue != null) {
            jsonGenerator.writeValue(configurationRecorderNamesListValue);
          }
        }
        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;
  }
コード例 #3
0
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(Scope scope, JSONWriter jsonWriter) {
    if (scope == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      com.amazonaws.internal.SdkInternalList<String> complianceResourceTypesList =
          (com.amazonaws.internal.SdkInternalList<String>) scope.getComplianceResourceTypes();
      if (!complianceResourceTypesList.isEmpty()
          || !complianceResourceTypesList.isAutoConstruct()) {
        jsonWriter.key("ComplianceResourceTypes");
        jsonWriter.array();
        for (String complianceResourceTypesListValue : complianceResourceTypesList) {
          if (complianceResourceTypesListValue != null) {
            jsonWriter.value(complianceResourceTypesListValue);
          }
        }
        jsonWriter.endArray();
      }

      if (scope.getTagKey() != null) {
        jsonWriter.key("TagKey").value(scope.getTagKey());
      }

      if (scope.getTagValue() != null) {
        jsonWriter.key("TagValue").value(scope.getTagValue());
      }

      if (scope.getComplianceResourceId() != null) {
        jsonWriter.key("ComplianceResourceId").value(scope.getComplianceResourceId());
      }

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

    if (deleteDeliveryChannelRequest == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    Request<DeleteDeliveryChannelRequest> request =
        new DefaultRequest<DeleteDeliveryChannelRequest>(
            deleteDeliveryChannelRequest, "AmazonConfig");
    request.addHeader("X-Amz-Target", "StarlingDoveService.DeleteDeliveryChannel");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      final StructuredJsonGenerator jsonGenerator = protocolFactory.createGenerator();

      jsonGenerator.writeStartObject();

      if (deleteDeliveryChannelRequest.getDeliveryChannelName() != null) {
        jsonGenerator
            .writeFieldName("DeliveryChannelName")
            .writeValue(deleteDeliveryChannelRequest.getDeliveryChannelName());
      }

      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;
  }