public Request<CreateInstanceExportTaskRequest> marshall(
      CreateInstanceExportTaskRequest createInstanceExportTaskRequest) {

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

    Request<CreateInstanceExportTaskRequest> request =
        new DefaultRequest<CreateInstanceExportTaskRequest>(
            createInstanceExportTaskRequest, "AmazonEC2");
    request.addParameter("Action", "CreateInstanceExportTask");
    request.addParameter("Version", "2013-02-01");

    if (createInstanceExportTaskRequest.getDescription() != null) {
      request.addParameter(
          "Description", StringUtils.fromString(createInstanceExportTaskRequest.getDescription()));
    }
    if (createInstanceExportTaskRequest.getInstanceId() != null) {
      request.addParameter(
          "InstanceId", StringUtils.fromString(createInstanceExportTaskRequest.getInstanceId()));
    }
    if (createInstanceExportTaskRequest.getTargetEnvironment() != null) {
      request.addParameter(
          "TargetEnvironment",
          StringUtils.fromString(createInstanceExportTaskRequest.getTargetEnvironment()));
    }
    ExportToS3TaskSpecification exportToS3TaskSpecificationExportToS3Task =
        createInstanceExportTaskRequest.getExportToS3Task();
    if (exportToS3TaskSpecificationExportToS3Task != null) {
      if (exportToS3TaskSpecificationExportToS3Task.getDiskImageFormat() != null) {
        request.addParameter(
            "ExportToS3.DiskImageFormat",
            StringUtils.fromString(exportToS3TaskSpecificationExportToS3Task.getDiskImageFormat()));
      }
      if (exportToS3TaskSpecificationExportToS3Task.getContainerFormat() != null) {
        request.addParameter(
            "ExportToS3.ContainerFormat",
            StringUtils.fromString(exportToS3TaskSpecificationExportToS3Task.getContainerFormat()));
      }
      if (exportToS3TaskSpecificationExportToS3Task.getS3Bucket() != null) {
        request.addParameter(
            "ExportToS3.S3Bucket",
            StringUtils.fromString(exportToS3TaskSpecificationExportToS3Task.getS3Bucket()));
      }
      if (exportToS3TaskSpecificationExportToS3Task.getS3Prefix() != null) {
        request.addParameter(
            "ExportToS3.S3Prefix",
            StringUtils.fromString(exportToS3TaskSpecificationExportToS3Task.getS3Prefix()));
      }
    }

    return request;
  }
コード例 #2
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof ExportToS3TaskSpecification == false) return false;
    ExportToS3TaskSpecification other = (ExportToS3TaskSpecification) obj;

    if (other.getDiskImageFormat() == null ^ this.getDiskImageFormat() == null) return false;
    if (other.getDiskImageFormat() != null
        && other.getDiskImageFormat().equals(this.getDiskImageFormat()) == false) return false;
    if (other.getContainerFormat() == null ^ this.getContainerFormat() == null) return false;
    if (other.getContainerFormat() != null
        && other.getContainerFormat().equals(this.getContainerFormat()) == false) return false;
    if (other.getS3Bucket() == null ^ this.getS3Bucket() == null) return false;
    if (other.getS3Bucket() != null && other.getS3Bucket().equals(this.getS3Bucket()) == false)
      return false;
    if (other.getS3Prefix() == null ^ this.getS3Prefix() == null) return false;
    if (other.getS3Prefix() != null && other.getS3Prefix().equals(this.getS3Prefix()) == false)
      return false;
    return true;
  }