public Request<DescribeEcsClustersRequest> marshall(
      DescribeEcsClustersRequest describeEcsClustersRequest) {

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

    Request<DescribeEcsClustersRequest> request =
        new DefaultRequest<DescribeEcsClustersRequest>(describeEcsClustersRequest, "AWSOpsWorks");
    request.addHeader("X-Amz-Target", "OpsWorks_20130218.DescribeEcsClusters");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      final StructuredJsonGenerator jsonGenerator =
          SdkJsonProtocolFactory.createWriter(false, "1.1");

      jsonGenerator.writeStartObject();

      com.amazonaws.internal.SdkInternalList<String> ecsClusterArnsList =
          (com.amazonaws.internal.SdkInternalList<String>)
              describeEcsClustersRequest.getEcsClusterArns();
      if (!ecsClusterArnsList.isEmpty() || !ecsClusterArnsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("EcsClusterArns");
        jsonGenerator.writeStartArray();
        for (String ecsClusterArnsListValue : ecsClusterArnsList) {
          if (ecsClusterArnsListValue != null) {
            jsonGenerator.writeValue(ecsClusterArnsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (describeEcsClustersRequest.getStackId() != null) {
        jsonGenerator.writeFieldName("StackId").writeValue(describeEcsClustersRequest.getStackId());
      }
      if (describeEcsClustersRequest.getNextToken() != null) {
        jsonGenerator
            .writeFieldName("NextToken")
            .writeValue(describeEcsClustersRequest.getNextToken());
      }
      if (describeEcsClustersRequest.getMaxResults() != null) {
        jsonGenerator
            .writeFieldName("MaxResults")
            .writeValue(describeEcsClustersRequest.getMaxResults());
      }

      jsonGenerator.writeEndObject();

      byte[] content = jsonGenerator.getBytes();
      request.setContent(new ByteArrayInputStream(content));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", jsonGenerator.getContentType());
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  public Request<DescribeRaidArraysRequest> marshall(
      DescribeRaidArraysRequest describeRaidArraysRequest) {

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

    Request<DescribeRaidArraysRequest> request =
        new DefaultRequest<DescribeRaidArraysRequest>(describeRaidArraysRequest, "AWSOpsWorks");
    request.addHeader("X-Amz-Target", "OpsWorks_20130218.DescribeRaidArrays");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (describeRaidArraysRequest.getInstanceId() != null) {
        jsonGenerator
            .writeFieldName("InstanceId")
            .writeValue(describeRaidArraysRequest.getInstanceId());
      }
      if (describeRaidArraysRequest.getStackId() != null) {
        jsonGenerator.writeFieldName("StackId").writeValue(describeRaidArraysRequest.getStackId());
      }

      com.amazonaws.internal.SdkInternalList<String> raidArrayIdsList =
          (com.amazonaws.internal.SdkInternalList<String>)
              describeRaidArraysRequest.getRaidArrayIds();
      if (!raidArrayIdsList.isEmpty() || !raidArrayIdsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("RaidArrayIds");
        jsonGenerator.writeStartArray();
        for (String raidArrayIdsListValue : raidArrayIdsList) {
          if (raidArrayIdsListValue != null) {
            jsonGenerator.writeValue(raidArrayIdsListValue);
          }
        }
        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 SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
  public Request<SetLoadBasedAutoScalingRequest> marshall(
      SetLoadBasedAutoScalingRequest setLoadBasedAutoScalingRequest) {

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

    Request<SetLoadBasedAutoScalingRequest> request =
        new DefaultRequest<SetLoadBasedAutoScalingRequest>(
            setLoadBasedAutoScalingRequest, "AWSOpsWorks");
    request.addHeader("X-Amz-Target", "OpsWorks_20130218.SetLoadBasedAutoScaling");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (setLoadBasedAutoScalingRequest.getLayerId() != null) {
        jsonGenerator
            .writeFieldName("LayerId")
            .writeValue(setLoadBasedAutoScalingRequest.getLayerId());
      }
      if (setLoadBasedAutoScalingRequest.getEnable() != null) {
        jsonGenerator
            .writeFieldName("Enable")
            .writeValue(setLoadBasedAutoScalingRequest.getEnable());
      }
      if (setLoadBasedAutoScalingRequest.getUpScaling() != null) {
        jsonGenerator.writeFieldName("UpScaling");
        AutoScalingThresholdsJsonMarshaller.getInstance()
            .marshall(setLoadBasedAutoScalingRequest.getUpScaling(), jsonGenerator);
      }
      if (setLoadBasedAutoScalingRequest.getDownScaling() != null) {
        jsonGenerator.writeFieldName("DownScaling");
        AutoScalingThresholdsJsonMarshaller.getInstance()
            .marshall(setLoadBasedAutoScalingRequest.getDownScaling(), jsonGenerator);
      }

      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;
  }
コード例 #4
0
  public Request<DeleteInstanceRequest> marshall(DeleteInstanceRequest deleteInstanceRequest) {

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

    Request<DeleteInstanceRequest> request =
        new DefaultRequest<DeleteInstanceRequest>(deleteInstanceRequest, "AWSOpsWorks");
    request.addHeader("X-Amz-Target", "OpsWorks_20130218.DeleteInstance");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

    try {
      final StructuredJsonGenerator jsonGenerator =
          SdkJsonProtocolFactory.createWriter(false, "1.1");

      jsonGenerator.writeStartObject();

      if (deleteInstanceRequest.getInstanceId() != null) {
        jsonGenerator
            .writeFieldName("InstanceId")
            .writeValue(deleteInstanceRequest.getInstanceId());
      }
      if (deleteInstanceRequest.getDeleteElasticIp() != null) {
        jsonGenerator
            .writeFieldName("DeleteElasticIp")
            .writeValue(deleteInstanceRequest.getDeleteElasticIp());
      }
      if (deleteInstanceRequest.getDeleteVolumes() != null) {
        jsonGenerator
            .writeFieldName("DeleteVolumes")
            .writeValue(deleteInstanceRequest.getDeleteVolumes());
      }

      jsonGenerator.writeEndObject();

      byte[] content = jsonGenerator.getBytes();
      request.setContent(new ByteArrayInputStream(content));
      request.addHeader("Content-Length", Integer.toString(content.length));
      request.addHeader("Content-Type", jsonGenerator.getContentType());
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }

    return request;
  }
コード例 #5
0
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(
      AutoScalingThresholds autoScalingThresholds, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (autoScalingThresholds.getInstanceCount() != null) {
        jsonGenerator
            .writeFieldName("InstanceCount")
            .writeValue(autoScalingThresholds.getInstanceCount());
      }
      if (autoScalingThresholds.getThresholdsWaitTime() != null) {
        jsonGenerator
            .writeFieldName("ThresholdsWaitTime")
            .writeValue(autoScalingThresholds.getThresholdsWaitTime());
      }
      if (autoScalingThresholds.getIgnoreMetricsTime() != null) {
        jsonGenerator
            .writeFieldName("IgnoreMetricsTime")
            .writeValue(autoScalingThresholds.getIgnoreMetricsTime());
      }
      if (autoScalingThresholds.getCpuThreshold() != null) {
        jsonGenerator
            .writeFieldName("CpuThreshold")
            .writeValue(autoScalingThresholds.getCpuThreshold());
      }
      if (autoScalingThresholds.getMemoryThreshold() != null) {
        jsonGenerator
            .writeFieldName("MemoryThreshold")
            .writeValue(autoScalingThresholds.getMemoryThreshold());
      }
      if (autoScalingThresholds.getLoadThreshold() != null) {
        jsonGenerator
            .writeFieldName("LoadThreshold")
            .writeValue(autoScalingThresholds.getLoadThreshold());
      }

      com.amazonaws.internal.SdkInternalList<String> alarmsList =
          (com.amazonaws.internal.SdkInternalList<String>) autoScalingThresholds.getAlarms();
      if (!alarmsList.isEmpty() || !alarmsList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("Alarms");
        jsonGenerator.writeStartArray();
        for (String alarmsListValue : alarmsList) {
          if (alarmsListValue != null) {
            jsonGenerator.writeValue(alarmsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
コード例 #6
0
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(
      VolumeConfiguration volumeConfiguration, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (volumeConfiguration.getMountPoint() != null) {
        jsonGenerator.writeFieldName("MountPoint").writeValue(volumeConfiguration.getMountPoint());
      }
      if (volumeConfiguration.getRaidLevel() != null) {
        jsonGenerator.writeFieldName("RaidLevel").writeValue(volumeConfiguration.getRaidLevel());
      }
      if (volumeConfiguration.getNumberOfDisks() != null) {
        jsonGenerator
            .writeFieldName("NumberOfDisks")
            .writeValue(volumeConfiguration.getNumberOfDisks());
      }
      if (volumeConfiguration.getSize() != null) {
        jsonGenerator.writeFieldName("Size").writeValue(volumeConfiguration.getSize());
      }
      if (volumeConfiguration.getVolumeType() != null) {
        jsonGenerator.writeFieldName("VolumeType").writeValue(volumeConfiguration.getVolumeType());
      }
      if (volumeConfiguration.getIops() != null) {
        jsonGenerator.writeFieldName("Iops").writeValue(volumeConfiguration.getIops());
      }

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