コード例 #1
0
  public Request<CreateDhcpOptionsRequest> marshall(
      CreateDhcpOptionsRequest createDhcpOptionsRequest) {

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

    Request<CreateDhcpOptionsRequest> request =
        new DefaultRequest<CreateDhcpOptionsRequest>(createDhcpOptionsRequest, "AmazonEC2");
    request.addParameter("Action", "CreateDhcpOptions");
    request.addParameter("Version", "2016-04-01");
    request.setHttpMethod(HttpMethodName.POST);

    com.amazonaws.internal.SdkInternalList<DhcpConfiguration> dhcpConfigurationsList =
        (com.amazonaws.internal.SdkInternalList<DhcpConfiguration>)
            createDhcpOptionsRequest.getDhcpConfigurations();
    if (!dhcpConfigurationsList.isEmpty() || !dhcpConfigurationsList.isAutoConstruct()) {
      int dhcpConfigurationsListIndex = 1;

      for (DhcpConfiguration dhcpConfigurationsListValue : dhcpConfigurationsList) {

        if (dhcpConfigurationsListValue.getKey() != null) {
          request.addParameter(
              "DhcpConfiguration." + dhcpConfigurationsListIndex + ".Key",
              StringUtils.fromString(dhcpConfigurationsListValue.getKey()));
        }

        com.amazonaws.internal.SdkInternalList<String> valuesList =
            (com.amazonaws.internal.SdkInternalList<String>)
                dhcpConfigurationsListValue.getValues();
        if (!valuesList.isEmpty() || !valuesList.isAutoConstruct()) {
          int valuesListIndex = 1;

          for (String valuesListValue : valuesList) {
            if (valuesListValue != null) {
              request.addParameter(
                  "DhcpConfiguration." + dhcpConfigurationsListIndex + ".Value." + valuesListIndex,
                  StringUtils.fromString(valuesListValue));
            }
            valuesListIndex++;
          }
        }
        dhcpConfigurationsListIndex++;
      }
    }

    return request;
  }
  public Request<CreateDhcpOptionsRequest> marshall(
      CreateDhcpOptionsRequest createDhcpOptionsRequest) {

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

    Request<CreateDhcpOptionsRequest> request =
        new DefaultRequest<CreateDhcpOptionsRequest>(createDhcpOptionsRequest, "AmazonEC2");
    request.addParameter("Action", "CreateDhcpOptions");
    request.addParameter("Version", "2012-03-01");

    java.util.List<DhcpConfiguration> dhcpConfigurationsList =
        createDhcpOptionsRequest.getDhcpConfigurations();
    int dhcpConfigurationsListIndex = 1;

    for (DhcpConfiguration dhcpConfigurationsListValue : dhcpConfigurationsList) {
      DhcpConfiguration dhcpConfigurationMember = dhcpConfigurationsListValue;
      if (dhcpConfigurationMember != null) {
        if (dhcpConfigurationMember.getKey() != null) {
          request.addParameter(
              "DhcpConfiguration." + dhcpConfigurationsListIndex + ".Key",
              StringUtils.fromString(dhcpConfigurationMember.getKey()));
        }

        java.util.List<String> valuesList = dhcpConfigurationMember.getValues();
        int valuesListIndex = 1;

        for (String valuesListValue : valuesList) {
          if (valuesListValue != null) {
            request.addParameter(
                "DhcpConfiguration." + dhcpConfigurationsListIndex + ".Value." + valuesListIndex,
                StringUtils.fromString(valuesListValue));
          }

          valuesListIndex++;
        }
      }

      dhcpConfigurationsListIndex++;
    }

    return request;
  }