Ejemplo n.º 1
0
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(StepConfig stepConfig, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (stepConfig.getName() != null) {
        jsonGenerator.writeFieldName("Name").writeValue(stepConfig.getName());
      }
      if (stepConfig.getActionOnFailure() != null) {
        jsonGenerator.writeFieldName("ActionOnFailure").writeValue(stepConfig.getActionOnFailure());
      }
      if (stepConfig.getHadoopJarStep() != null) {
        jsonGenerator.writeFieldName("HadoopJarStep");
        HadoopJarStepConfigJsonMarshaller.getInstance()
            .marshall(stepConfig.getHadoopJarStep(), jsonGenerator);
      }

      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(CurrentRevision currentRevision, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (currentRevision.getRevision() != null) {
        jsonGenerator.writeFieldName("revision").writeValue(currentRevision.getRevision());
      }
      if (currentRevision.getChangeIdentifier() != null) {
        jsonGenerator
            .writeFieldName("changeIdentifier")
            .writeValue(currentRevision.getChangeIdentifier());
      }
      if (currentRevision.getCreated() != null) {
        jsonGenerator.writeFieldName("created").writeValue(currentRevision.getCreated());
      }
      if (currentRevision.getRevisionSummary() != null) {
        jsonGenerator
            .writeFieldName("revisionSummary")
            .writeValue(currentRevision.getRevisionSummary());
      }

      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(JobWatermark jobWatermark, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (jobWatermark.getPresetWatermarkId() != null) {
        jsonGenerator
            .writeFieldName("PresetWatermarkId")
            .writeValue(jobWatermark.getPresetWatermarkId());
      }
      if (jobWatermark.getInputKey() != null) {
        jsonGenerator.writeFieldName("InputKey").writeValue(jobWatermark.getInputKey());
      }
      if (jobWatermark.getEncryption() != null) {
        jsonGenerator.writeFieldName("Encryption");
        EncryptionJsonMarshaller.getInstance()
            .marshall(jobWatermark.getEncryption(), jsonGenerator);
      }

      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 SdkJsonGenerator */
  public void marshall(OptionStatus optionStatus, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (optionStatus.getCreationDate() != null) {
        jsonGenerator.writeFieldName("CreationDate").writeValue(optionStatus.getCreationDate());
      }
      if (optionStatus.getUpdateDate() != null) {
        jsonGenerator.writeFieldName("UpdateDate").writeValue(optionStatus.getUpdateDate());
      }
      if (optionStatus.getUpdateVersion() != null) {
        jsonGenerator.writeFieldName("UpdateVersion").writeValue(optionStatus.getUpdateVersion());
      }
      if (optionStatus.getState() != null) {
        jsonGenerator.writeFieldName("State").writeValue(optionStatus.getState());
      }
      if (optionStatus.getPendingDeletion() != null) {
        jsonGenerator
            .writeFieldName("PendingDeletion")
            .writeValue(optionStatus.getPendingDeletion());
      }

      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 SdkJsonGenerator */
  public void marshall(Encryption encryption, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (encryption.getMode() != null) {
        jsonGenerator.writeFieldName("Mode").writeValue(encryption.getMode());
      }
      if (encryption.getKey() != null) {
        jsonGenerator.writeFieldName("Key").writeValue(encryption.getKey());
      }
      if (encryption.getKeyMd5() != null) {
        jsonGenerator.writeFieldName("KeyMd5").writeValue(encryption.getKeyMd5());
      }
      if (encryption.getInitializationVector() != null) {
        jsonGenerator
            .writeFieldName("InitializationVector")
            .writeValue(encryption.getInitializationVector());
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
  public Request<LookupEventsRequest> marshall(LookupEventsRequest lookupEventsRequest) {

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

    Request<LookupEventsRequest> request =
        new DefaultRequest<LookupEventsRequest>(lookupEventsRequest, "AWSCloudTrail");
    request.addHeader(
        "X-Amz-Target", "com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.LookupEvents");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      com.amazonaws.internal.SdkInternalList<LookupAttribute> lookupAttributesList =
          (com.amazonaws.internal.SdkInternalList<LookupAttribute>)
              lookupEventsRequest.getLookupAttributes();
      if (!lookupAttributesList.isEmpty() || !lookupAttributesList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("LookupAttributes");
        jsonGenerator.writeStartArray();
        for (LookupAttribute lookupAttributesListValue : lookupAttributesList) {
          if (lookupAttributesListValue != null) {

            LookupAttributeJsonMarshaller.getInstance()
                .marshall(lookupAttributesListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (lookupEventsRequest.getStartTime() != null) {
        jsonGenerator.writeFieldName("StartTime").writeValue(lookupEventsRequest.getStartTime());
      }
      if (lookupEventsRequest.getEndTime() != null) {
        jsonGenerator.writeFieldName("EndTime").writeValue(lookupEventsRequest.getEndTime());
      }
      if (lookupEventsRequest.getMaxResults() != null) {
        jsonGenerator.writeFieldName("MaxResults").writeValue(lookupEventsRequest.getMaxResults());
      }
      if (lookupEventsRequest.getNextToken() != null) {
        jsonGenerator.writeFieldName("NextToken").writeValue(lookupEventsRequest.getNextToken());
      }

      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;
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(
      SegmentImportResource segmentImportResource, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (segmentImportResource.getExternalId() != null) {
        jsonGenerator
            .writeFieldName("ExternalId")
            .writeValue(segmentImportResource.getExternalId());
      }
      if (segmentImportResource.getFormat() != null) {
        jsonGenerator.writeFieldName("Format").writeValue(segmentImportResource.getFormat());
      }
      if (segmentImportResource.getRoleArn() != null) {
        jsonGenerator.writeFieldName("RoleArn").writeValue(segmentImportResource.getRoleArn());
      }
      if (segmentImportResource.getS3Url() != null) {
        jsonGenerator.writeFieldName("S3Url").writeValue(segmentImportResource.getS3Url());
      }
      if (segmentImportResource.getSize() != null) {
        jsonGenerator.writeFieldName("Size").writeValue(segmentImportResource.getSize());
      }

      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(
      CloudWatchLoggingOptions cloudWatchLoggingOptions, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (cloudWatchLoggingOptions.getEnabled() != null) {
        jsonGenerator.writeFieldName("Enabled").writeValue(cloudWatchLoggingOptions.getEnabled());
      }
      if (cloudWatchLoggingOptions.getLogGroupName() != null) {
        jsonGenerator
            .writeFieldName("LogGroupName")
            .writeValue(cloudWatchLoggingOptions.getLogGroupName());
      }
      if (cloudWatchLoggingOptions.getLogStreamName() != null) {
        jsonGenerator
            .writeFieldName("LogStreamName")
            .writeValue(cloudWatchLoggingOptions.getLogStreamName());
      }

      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(
      CodeDeliveryDetailsType codeDeliveryDetailsType, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (codeDeliveryDetailsType.getDestination() != null) {
        jsonGenerator
            .writeFieldName("Destination")
            .writeValue(codeDeliveryDetailsType.getDestination());
      }
      if (codeDeliveryDetailsType.getDeliveryMedium() != null) {
        jsonGenerator
            .writeFieldName("DeliveryMedium")
            .writeValue(codeDeliveryDetailsType.getDeliveryMedium());
      }
      if (codeDeliveryDetailsType.getAttributeName() != null) {
        jsonGenerator
            .writeFieldName("AttributeName")
            .writeValue(codeDeliveryDetailsType.getAttributeName());
      }

      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 SdkJsonGenerator */
  public void marshall(
      UpdateProvisioningParameter updateProvisioningParameter,
      StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (updateProvisioningParameter.getKey() != null) {
        jsonGenerator.writeFieldName("Key").writeValue(updateProvisioningParameter.getKey());
      }
      if (updateProvisioningParameter.getValue() != null) {
        jsonGenerator.writeFieldName("Value").writeValue(updateProvisioningParameter.getValue());
      }
      if (updateProvisioningParameter.getUsePreviousValue() != null) {
        jsonGenerator
            .writeFieldName("UsePreviousValue")
            .writeValue(updateProvisioningParameter.getUsePreviousValue());
      }

      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 SdkJsonGenerator */
  public void marshall(TransferData transferData, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (transferData.getTransferMessage() != null) {
        jsonGenerator
            .writeFieldName("transferMessage")
            .writeValue(transferData.getTransferMessage());
      }
      if (transferData.getRejectReason() != null) {
        jsonGenerator.writeFieldName("rejectReason").writeValue(transferData.getRejectReason());
      }
      if (transferData.getTransferDate() != null) {
        jsonGenerator.writeFieldName("transferDate").writeValue(transferData.getTransferDate());
      }
      if (transferData.getAcceptDate() != null) {
        jsonGenerator.writeFieldName("acceptDate").writeValue(transferData.getAcceptDate());
      }
      if (transferData.getRejectDate() != null) {
        jsonGenerator.writeFieldName("rejectDate").writeValue(transferData.getRejectDate());
      }

      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 SdkJsonGenerator */
  public void marshall(
      RealtimeEndpointInfo realtimeEndpointInfo, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (realtimeEndpointInfo.getPeakRequestsPerSecond() != null) {
        jsonGenerator
            .writeFieldName("PeakRequestsPerSecond")
            .writeValue(realtimeEndpointInfo.getPeakRequestsPerSecond());
      }
      if (realtimeEndpointInfo.getCreatedAt() != null) {
        jsonGenerator.writeFieldName("CreatedAt").writeValue(realtimeEndpointInfo.getCreatedAt());
      }
      if (realtimeEndpointInfo.getEndpointUrl() != null) {
        jsonGenerator
            .writeFieldName("EndpointUrl")
            .writeValue(realtimeEndpointInfo.getEndpointUrl());
      }
      if (realtimeEndpointInfo.getEndpointStatus() != null) {
        jsonGenerator
            .writeFieldName("EndpointStatus")
            .writeValue(realtimeEndpointInfo.getEndpointStatus());
      }

      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(
      DirectoryVpcSettings directoryVpcSettings, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (directoryVpcSettings.getVpcId() != null) {
        jsonGenerator.writeFieldName("VpcId").writeValue(directoryVpcSettings.getVpcId());
      }

      com.amazonaws.internal.SdkInternalList<String> subnetIdsList =
          (com.amazonaws.internal.SdkInternalList<String>) directoryVpcSettings.getSubnetIds();
      if (!subnetIdsList.isEmpty() || !subnetIdsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("SubnetIds");
        jsonGenerator.writeStartArray();
        for (String subnetIdsListValue : subnetIdsList) {
          if (subnetIdsListValue != null) {
            jsonGenerator.writeValue(subnetIdsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

      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 SdkJsonGenerator */
  public void marshall(
      EventDetailsErrorItem eventDetailsErrorItem, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (eventDetailsErrorItem.getEventArn() != null) {
        jsonGenerator.writeFieldName("eventArn").writeValue(eventDetailsErrorItem.getEventArn());
      }
      if (eventDetailsErrorItem.getErrorName() != null) {
        jsonGenerator.writeFieldName("errorName").writeValue(eventDetailsErrorItem.getErrorName());
      }
      if (eventDetailsErrorItem.getErrorMessage() != null) {
        jsonGenerator
            .writeFieldName("errorMessage")
            .writeValue(eventDetailsErrorItem.getErrorMessage());
      }

      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(LoadBalancer loadBalancer, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (loadBalancer.getLoadBalancerName() != null) {
        jsonGenerator
            .writeFieldName("loadBalancerName")
            .writeValue(loadBalancer.getLoadBalancerName());
      }
      if (loadBalancer.getContainerName() != null) {
        jsonGenerator.writeFieldName("containerName").writeValue(loadBalancer.getContainerName());
      }
      if (loadBalancer.getContainerPort() != null) {
        jsonGenerator.writeFieldName("containerPort").writeValue(loadBalancer.getContainerPort());
      }

      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 SdkJsonGenerator */
  public void marshall(
      MaintenanceWindowFilter maintenanceWindowFilter, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (maintenanceWindowFilter.getKey() != null) {
        jsonGenerator.writeFieldName("Key").writeValue(maintenanceWindowFilter.getKey());
      }

      com.amazonaws.internal.SdkInternalList<String> valuesList =
          (com.amazonaws.internal.SdkInternalList<String>) maintenanceWindowFilter.getValues();
      if (!valuesList.isEmpty() || !valuesList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("Values");
        jsonGenerator.writeStartArray();
        for (String valuesListValue : valuesList) {
          if (valuesListValue != null) {
            jsonGenerator.writeValue(valuesListValue);
          }
        }
        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(ServerEvent serverEvent, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (serverEvent.getCreatedAt() != null) {
        jsonGenerator.writeFieldName("CreatedAt").writeValue(serverEvent.getCreatedAt());
      }
      if (serverEvent.getServerName() != null) {
        jsonGenerator.writeFieldName("ServerName").writeValue(serverEvent.getServerName());
      }
      if (serverEvent.getMessage() != null) {
        jsonGenerator.writeFieldName("Message").writeValue(serverEvent.getMessage());
      }
      if (serverEvent.getLogUrl() != null) {
        jsonGenerator.writeFieldName("LogUrl").writeValue(serverEvent.getLogUrl());
      }

      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(DocumentParameter documentParameter, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (documentParameter.getName() != null) {
        jsonGenerator.writeFieldName("Name").writeValue(documentParameter.getName());
      }
      if (documentParameter.getType() != null) {
        jsonGenerator.writeFieldName("Type").writeValue(documentParameter.getType());
      }
      if (documentParameter.getDescription() != null) {
        jsonGenerator.writeFieldName("Description").writeValue(documentParameter.getDescription());
      }
      if (documentParameter.getDefaultValue() != null) {
        jsonGenerator
            .writeFieldName("DefaultValue")
            .writeValue(documentParameter.getDefaultValue());
      }

      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(OfferingStatus offeringStatus, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (offeringStatus.getType() != null) {
        jsonGenerator.writeFieldName("type").writeValue(offeringStatus.getType());
      }
      if (offeringStatus.getOffering() != null) {
        jsonGenerator.writeFieldName("offering");
        OfferingJsonMarshaller.getInstance().marshall(offeringStatus.getOffering(), jsonGenerator);
      }
      if (offeringStatus.getQuantity() != null) {
        jsonGenerator.writeFieldName("quantity").writeValue(offeringStatus.getQuantity());
      }
      if (offeringStatus.getEffectiveOn() != null) {
        jsonGenerator.writeFieldName("effectiveOn").writeValue(offeringStatus.getEffectiveOn());
      }

      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 SdkJsonGenerator */
  public void marshall(
      FailWorkflowExecutionFailedEventAttributes failWorkflowExecutionFailedEventAttributes,
      StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (failWorkflowExecutionFailedEventAttributes.getCause() != null) {
        jsonGenerator
            .writeFieldName("cause")
            .writeValue(failWorkflowExecutionFailedEventAttributes.getCause());
      }
      if (failWorkflowExecutionFailedEventAttributes.getDecisionTaskCompletedEventId() != null) {
        jsonGenerator
            .writeFieldName("decisionTaskCompletedEventId")
            .writeValue(
                failWorkflowExecutionFailedEventAttributes.getDecisionTaskCompletedEventId());
      }

      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 SdkJsonGenerator */
  public void marshall(PolicyVersion policyVersion, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (policyVersion.getVersionId() != null) {
        jsonGenerator.writeFieldName("versionId").writeValue(policyVersion.getVersionId());
      }
      if (policyVersion.getIsDefaultVersion() != null) {
        jsonGenerator
            .writeFieldName("isDefaultVersion")
            .writeValue(policyVersion.getIsDefaultVersion());
      }
      if (policyVersion.getCreateDate() != null) {
        jsonGenerator.writeFieldName("createDate").writeValue(policyVersion.getCreateDate());
      }

      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 SdkJsonGenerator */
  public void marshall(
      RejectedLogEventsInfo rejectedLogEventsInfo, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (rejectedLogEventsInfo.getTooNewLogEventStartIndex() != null) {
        jsonGenerator
            .writeFieldName("tooNewLogEventStartIndex")
            .writeValue(rejectedLogEventsInfo.getTooNewLogEventStartIndex());
      }
      if (rejectedLogEventsInfo.getTooOldLogEventEndIndex() != null) {
        jsonGenerator
            .writeFieldName("tooOldLogEventEndIndex")
            .writeValue(rejectedLogEventsInfo.getTooOldLogEventEndIndex());
      }
      if (rejectedLogEventsInfo.getExpiredLogEventEndIndex() != null) {
        jsonGenerator
            .writeFieldName("expiredLogEventEndIndex")
            .writeValue(rejectedLogEventsInfo.getExpiredLogEventEndIndex());
      }

      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(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);
    }
  }
Ejemplo n.º 24
0
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(S3Location s3Location, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (s3Location.getBucket() != null) {
        jsonGenerator.writeFieldName("bucket").writeValue(s3Location.getBucket());
      }
      if (s3Location.getKey() != null) {
        jsonGenerator.writeFieldName("key").writeValue(s3Location.getKey());
      }
      if (s3Location.getBundleType() != null) {
        jsonGenerator.writeFieldName("bundleType").writeValue(s3Location.getBundleType());
      }
      if (s3Location.getVersion() != null) {
        jsonGenerator.writeFieldName("version").writeValue(s3Location.getVersion());
      }
      if (s3Location.getETag() != null) {
        jsonGenerator.writeFieldName("eTag").writeValue(s3Location.getETag());
      }

      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(UniqueProblem uniqueProblem, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (uniqueProblem.getMessage() != null) {
        jsonGenerator.writeFieldName("message").writeValue(uniqueProblem.getMessage());
      }

      java.util.List<Problem> problemsList = uniqueProblem.getProblems();
      if (problemsList != null) {
        jsonGenerator.writeFieldName("problems");
        jsonGenerator.writeStartArray();
        for (Problem problemsListValue : problemsList) {
          if (problemsListValue != null) {

            ProblemJsonMarshaller.getInstance().marshall(problemsListValue, 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(CACertificate cACertificate, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (cACertificate.getCertificateArn() != null) {
        jsonGenerator
            .writeFieldName("certificateArn")
            .writeValue(cACertificate.getCertificateArn());
      }
      if (cACertificate.getCertificateId() != null) {
        jsonGenerator.writeFieldName("certificateId").writeValue(cACertificate.getCertificateId());
      }
      if (cACertificate.getStatus() != null) {
        jsonGenerator.writeFieldName("status").writeValue(cACertificate.getStatus());
      }
      if (cACertificate.getCreationDate() != null) {
        jsonGenerator.writeFieldName("creationDate").writeValue(cACertificate.getCreationDate());
      }

      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(
      VaultNotificationConfig vaultNotificationConfig, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (vaultNotificationConfig.getSNSTopic() != null) {
        jsonGenerator.writeFieldName("SNSTopic").writeValue(vaultNotificationConfig.getSNSTopic());
      }

      java.util.List<String> eventsList = vaultNotificationConfig.getEvents();
      if (eventsList != null) {
        jsonGenerator.writeFieldName("Events");
        jsonGenerator.writeStartArray();
        for (String eventsListValue : eventsList) {
          if (eventsListValue != null) {
            jsonGenerator.writeValue(eventsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

      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 SdkJsonGenerator */
  public void marshall(PipelineContext pipelineContext, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (pipelineContext.getPipelineName() != null) {
        jsonGenerator.writeFieldName("pipelineName").writeValue(pipelineContext.getPipelineName());
      }
      if (pipelineContext.getStage() != null) {
        jsonGenerator.writeFieldName("stage");
        StageContextJsonMarshaller.getInstance()
            .marshall(pipelineContext.getStage(), jsonGenerator);
      }
      if (pipelineContext.getAction() != null) {
        jsonGenerator.writeFieldName("action");
        ActionContextJsonMarshaller.getInstance()
            .marshall(pipelineContext.getAction(), jsonGenerator);
      }

      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<ListOnPremisesInstancesRequest> marshall(
      ListOnPremisesInstancesRequest listOnPremisesInstancesRequest) {

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

    Request<ListOnPremisesInstancesRequest> request =
        new DefaultRequest<ListOnPremisesInstancesRequest>(
            listOnPremisesInstancesRequest, "AmazonCodeDeploy");
    request.addHeader("X-Amz-Target", "CodeDeploy_20141006.ListOnPremisesInstances");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (listOnPremisesInstancesRequest.getRegistrationStatus() != null) {
        jsonGenerator
            .writeFieldName("registrationStatus")
            .writeValue(listOnPremisesInstancesRequest.getRegistrationStatus());
      }

      com.amazonaws.internal.SdkInternalList<TagFilter> tagFiltersList =
          (com.amazonaws.internal.SdkInternalList<TagFilter>)
              listOnPremisesInstancesRequest.getTagFilters();
      if (!tagFiltersList.isEmpty() || !tagFiltersList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("tagFilters");
        jsonGenerator.writeStartArray();
        for (TagFilter tagFiltersListValue : tagFiltersList) {
          if (tagFiltersListValue != null) {

            TagFilterJsonMarshaller.getInstance().marshall(tagFiltersListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (listOnPremisesInstancesRequest.getNextToken() != null) {
        jsonGenerator
            .writeFieldName("nextToken")
            .writeValue(listOnPremisesInstancesRequest.getNextToken());
      }

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