コード例 #1
0
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(TaskOverride taskOverride, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      com.amazonaws.internal.SdkInternalList<ContainerOverride> containerOverridesList =
          (com.amazonaws.internal.SdkInternalList<ContainerOverride>)
              taskOverride.getContainerOverrides();
      if (!containerOverridesList.isEmpty() || !containerOverridesList.isAutoConstruct()) {
        jsonGenerator.writeFieldName("containerOverrides");
        jsonGenerator.writeStartArray();
        for (ContainerOverride containerOverridesListValue : containerOverridesList) {
          if (containerOverridesListValue != null) {

            ContainerOverrideJsonMarshaller.getInstance()
                .marshall(containerOverridesListValue, jsonGenerator);
          }
        }
        jsonGenerator.writeEndArray();
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
コード例 #2
0
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(ContainerOverride containerOverride, JSONWriter jsonWriter) {
    if (containerOverride == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (containerOverride.getName() != null) {
        jsonWriter.key("name").value(containerOverride.getName());
      }

      com.amazonaws.internal.SdkInternalList<String> commandList =
          (com.amazonaws.internal.SdkInternalList<String>) containerOverride.getCommand();
      if (!commandList.isEmpty() || !commandList.isAutoConstruct()) {
        jsonWriter.key("command");
        jsonWriter.array();
        for (String commandListValue : commandList) {
          if (commandListValue != null) {
            jsonWriter.value(commandListValue);
          }
        }
        jsonWriter.endArray();
      }

      com.amazonaws.internal.SdkInternalList<KeyValuePair> environmentList =
          (com.amazonaws.internal.SdkInternalList<KeyValuePair>) containerOverride.getEnvironment();
      if (!environmentList.isEmpty() || !environmentList.isAutoConstruct()) {
        jsonWriter.key("environment");
        jsonWriter.array();
        for (KeyValuePair environmentListValue : environmentList) {
          if (environmentListValue != null) {

            KeyValuePairJsonMarshaller.getInstance().marshall(environmentListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
コード例 #3
0
  /** Marshall the given parameter object, and output to a JSONWriter */
  public void marshall(TaskDefinition taskDefinition, JSONWriter jsonWriter) {
    if (taskDefinition == null) {
      throw new AmazonClientException("Invalid argument passed to marshall(...)");
    }

    try {
      jsonWriter.object();

      if (taskDefinition.getTaskDefinitionArn() != null) {
        jsonWriter.key("taskDefinitionArn").value(taskDefinition.getTaskDefinitionArn());
      }

      com.amazonaws.internal.SdkInternalList<ContainerDefinition> containerDefinitionsList =
          (com.amazonaws.internal.SdkInternalList<ContainerDefinition>)
              taskDefinition.getContainerDefinitions();
      if (!containerDefinitionsList.isEmpty() || !containerDefinitionsList.isAutoConstruct()) {
        jsonWriter.key("containerDefinitions");
        jsonWriter.array();
        for (ContainerDefinition containerDefinitionsListValue : containerDefinitionsList) {
          if (containerDefinitionsListValue != null) {

            ContainerDefinitionJsonMarshaller.getInstance()
                .marshall(containerDefinitionsListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      if (taskDefinition.getFamily() != null) {
        jsonWriter.key("family").value(taskDefinition.getFamily());
      }

      if (taskDefinition.getRevision() != null) {
        jsonWriter.key("revision").value(taskDefinition.getRevision());
      }

      com.amazonaws.internal.SdkInternalList<Volume> volumesList =
          (com.amazonaws.internal.SdkInternalList<Volume>) taskDefinition.getVolumes();
      if (!volumesList.isEmpty() || !volumesList.isAutoConstruct()) {
        jsonWriter.key("volumes");
        jsonWriter.array();
        for (Volume volumesListValue : volumesList) {
          if (volumesListValue != null) {

            VolumeJsonMarshaller.getInstance().marshall(volumesListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

      if (taskDefinition.getStatus() != null) {
        jsonWriter.key("status").value(taskDefinition.getStatus());
      }

      com.amazonaws.internal.SdkInternalList<Attribute> requiresAttributesList =
          (com.amazonaws.internal.SdkInternalList<Attribute>)
              taskDefinition.getRequiresAttributes();
      if (!requiresAttributesList.isEmpty() || !requiresAttributesList.isAutoConstruct()) {
        jsonWriter.key("requiresAttributes");
        jsonWriter.array();
        for (Attribute requiresAttributesListValue : requiresAttributesList) {
          if (requiresAttributesListValue != null) {

            AttributeJsonMarshaller.getInstance().marshall(requiresAttributesListValue, jsonWriter);
          }
        }
        jsonWriter.endArray();
      }

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