コード例 #1
0
ファイル: TagComparator.java プロジェクト: Xeralux/servo
  /** {@inheritDoc} */
  @Override
  public int compare(Tag tag, Tag tag1) {
    if (tag.getKey().equals(tag1.getKey())) {
      return tag.getValue().compareTo(tag1.getValue());
    }

    return tag.getKey().compareTo(tag1.getKey());
  }
  public Request<CopyDBClusterParameterGroupRequest> marshall(
      CopyDBClusterParameterGroupRequest copyDBClusterParameterGroupRequest) {

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

    Request<CopyDBClusterParameterGroupRequest> request =
        new DefaultRequest<CopyDBClusterParameterGroupRequest>(
            copyDBClusterParameterGroupRequest, "AmazonRDS");
    request.addParameter("Action", "CopyDBClusterParameterGroup");
    request.addParameter("Version", "2014-10-31");
    request.setHttpMethod(HttpMethodName.POST);

    if (copyDBClusterParameterGroupRequest.getSourceDBClusterParameterGroupIdentifier() != null) {
      request.addParameter(
          "SourceDBClusterParameterGroupIdentifier",
          StringUtils.fromString(
              copyDBClusterParameterGroupRequest.getSourceDBClusterParameterGroupIdentifier()));
    }

    if (copyDBClusterParameterGroupRequest.getTargetDBClusterParameterGroupIdentifier() != null) {
      request.addParameter(
          "TargetDBClusterParameterGroupIdentifier",
          StringUtils.fromString(
              copyDBClusterParameterGroupRequest.getTargetDBClusterParameterGroupIdentifier()));
    }

    if (copyDBClusterParameterGroupRequest.getTargetDBClusterParameterGroupDescription() != null) {
      request.addParameter(
          "TargetDBClusterParameterGroupDescription",
          StringUtils.fromString(
              copyDBClusterParameterGroupRequest.getTargetDBClusterParameterGroupDescription()));
    }

    com.amazonaws.internal.SdkInternalList<Tag> tagsList =
        (com.amazonaws.internal.SdkInternalList<Tag>) copyDBClusterParameterGroupRequest.getTags();
    if (!tagsList.isEmpty() || !tagsList.isAutoConstruct()) {
      int tagsListIndex = 1;

      for (Tag tagsListValue : tagsList) {

        if (tagsListValue.getKey() != null) {
          request.addParameter(
              "Tags.Tag." + tagsListIndex + ".Key", StringUtils.fromString(tagsListValue.getKey()));
        }

        if (tagsListValue.getValue() != null) {
          request.addParameter(
              "Tags.Tag." + tagsListIndex + ".Value",
              StringUtils.fromString(tagsListValue.getValue()));
        }
        tagsListIndex++;
      }
    }

    return request;
  }
  public Request<CreateOrUpdateTagsRequest> marshall(
      CreateOrUpdateTagsRequest createOrUpdateTagsRequest) {

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

    Request<CreateOrUpdateTagsRequest> request =
        new DefaultRequest<CreateOrUpdateTagsRequest>(
            createOrUpdateTagsRequest, "AmazonAutoScaling");
    request.addParameter("Action", "CreateOrUpdateTags");
    request.addParameter("Version", "2011-01-01");

    java.util.List<Tag> tagsList = createOrUpdateTagsRequest.getTags();
    int tagsListIndex = 1;

    for (Tag tagsListValue : tagsList) {
      Tag tagMember = tagsListValue;
      if (tagMember != null) {
        if (tagMember.getResourceId() != null) {
          request.addParameter(
              "Tags.member." + tagsListIndex + ".ResourceId",
              StringUtils.fromString(tagMember.getResourceId()));
        }
        if (tagMember.getResourceType() != null) {
          request.addParameter(
              "Tags.member." + tagsListIndex + ".ResourceType",
              StringUtils.fromString(tagMember.getResourceType()));
        }
        if (tagMember.getKey() != null) {
          request.addParameter(
              "Tags.member." + tagsListIndex + ".Key", StringUtils.fromString(tagMember.getKey()));
        }
        if (tagMember.getValue() != null) {
          request.addParameter(
              "Tags.member." + tagsListIndex + ".Value",
              StringUtils.fromString(tagMember.getValue()));
        }
        if (tagMember.isPropagateAtLaunch() != null) {
          request.addParameter(
              "Tags.member." + tagsListIndex + ".PropagateAtLaunch",
              StringUtils.fromBoolean(tagMember.isPropagateAtLaunch()));
        }
      }

      tagsListIndex++;
    }

    return request;
  }
コード例 #4
0
ファイル: Node.java プロジェクト: junwuwei/osmosis
 /** ${@inheritDoc}. */
 @Override
 public String toString() {
   String name = null;
   Collection<Tag> tags = getTags();
   for (Tag tag : tags) {
     if (tag.getKey() != null && tag.getKey().equalsIgnoreCase("name")) {
       name = tag.getValue();
       break;
     }
   }
   if (name != null) {
     return "Node(id=" + getId() + ", #tags=" + getTags().size() + ", name='" + name + "')";
   }
   return "Node(id=" + getId() + ", #tags=" + getTags().size() + ")";
 }
コード例 #5
0
ファイル: EC2Cloud.java プロジェクト: ryanaslett/ec2-plugin
 protected boolean isEc2ProvisionedAmiSlave(Instance i, String ami, String templateDesc) {
   // Check if the ami matches
   if (ami == null || StringUtils.equals(ami, i.getImageId())) {
     // Check if there is a ec2slave tag...
     for (Tag tag : i.getTags()) {
       if (StringUtils.equals(tag.getKey(), EC2Tag.TAG_NAME_JENKINS_SLAVE_TYPE)) {
         if (ami == null || templateDesc == null) {
           return true;
         } else if (StringUtils.equals(tag.getValue(), EC2Cloud.EC2_SLAVE_TYPE_DEMAND)
             || StringUtils.equals(tag.getValue(), EC2Cloud.EC2_SLAVE_TYPE_SPOT)) {
           // To handle cases where description is null and also upgrade cases for existing slave
           // nodes.
           return true;
         } else if (StringUtils.equals(
                 tag.getValue(),
                 getSlaveTypeTagValue(EC2Cloud.EC2_SLAVE_TYPE_DEMAND, templateDesc))
             || StringUtils.equals(
                 tag.getValue(),
                 getSlaveTypeTagValue(EC2Cloud.EC2_SLAVE_TYPE_SPOT, templateDesc))) {
           return true;
         } else {
           return false;
         }
       }
     }
     return false;
   }
   return false;
 }
コード例 #6
0
ファイル: SortedTagList.java プロジェクト: Xeralux/servo
 /** Returns a map containing a copy of the tags in this list. */
 @Override
 public Map<String, String> asMap() {
   Map<String, String> stringMap = new HashMap<String, String>(size());
   for (Tag t : tagSortedMap.values()) {
     stringMap.put(t.getKey(), t.getValue());
   }
   return stringMap;
 }
  public Request<CreateHsmClientCertificateRequest> marshall(
      CreateHsmClientCertificateRequest createHsmClientCertificateRequest) {

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

    Request<CreateHsmClientCertificateRequest> request =
        new DefaultRequest<CreateHsmClientCertificateRequest>(
            createHsmClientCertificateRequest, "AmazonRedshift");
    request.addParameter("Action", "CreateHsmClientCertificate");
    request.addParameter("Version", "2012-12-01");
    request.setHttpMethod(HttpMethodName.POST);

    if (createHsmClientCertificateRequest.getHsmClientCertificateIdentifier() != null) {
      request.addParameter(
          "HsmClientCertificateIdentifier",
          StringUtils.fromString(
              createHsmClientCertificateRequest.getHsmClientCertificateIdentifier()));
    }

    com.amazonaws.internal.SdkInternalList<Tag> tagsList =
        (com.amazonaws.internal.SdkInternalList<Tag>) createHsmClientCertificateRequest.getTags();
    if (!tagsList.isEmpty() || !tagsList.isAutoConstruct()) {
      int tagsListIndex = 1;

      for (Tag tagsListValue : tagsList) {

        if (tagsListValue.getKey() != null) {
          request.addParameter(
              "Tags.Tag." + tagsListIndex + ".Key", StringUtils.fromString(tagsListValue.getKey()));
        }

        if (tagsListValue.getValue() != null) {
          request.addParameter(
              "Tags.Tag." + tagsListIndex + ".Value",
              StringUtils.fromString(tagsListValue.getValue()));
        }
        tagsListIndex++;
      }
    }

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

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

    try {
      jsonGenerator.writeStartObject();

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

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

    try {
      jsonWriter.object();

      if (tag.getKey() != null) {
        jsonWriter.key("Key").value(tag.getKey());
      }

      if (tag.getValue() != null) {
        jsonWriter.key("Value").value(tag.getValue());
      }

      jsonWriter.endObject();
    } catch (Throwable t) {
      throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }
コード例 #10
0
ファイル: SortedTagList.java プロジェクト: Xeralux/servo
 public Builder withTag(Tag t) {
   data.put(t.getKey(), t);
   return this;
 }
コード例 #11
0
ファイル: SortedTagList.java プロジェクト: Xeralux/servo
 public Builder withTags(TagList tags) {
   for (Tag t : tags) {
     data.put(t.getKey(), t);
   }
   return this;
 }
コード例 #12
0
ファイル: SortedTagList.java プロジェクト: Xeralux/servo
 public Builder withTags(Collection<Tag> tagsCollection) {
   for (Tag t : tagsCollection) {
     data.put(t.getKey(), t);
   }
   return this;
 }
コード例 #13
0
 public boolean isThisKind(Tag tag) {
   if (tag.getValue() != null && !tag.getValue().isEmpty())
     return this.isThisKind(tag.getKey(), tag.getValue());
   else return this.isThisKind(tag.getKey());
 }
コード例 #14
0
  public Request<CreateDBInstanceRequest> marshall(
      CreateDBInstanceRequest createDBInstanceRequest) {

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

    Request<CreateDBInstanceRequest> request =
        new DefaultRequest<CreateDBInstanceRequest>(createDBInstanceRequest, "AmazonRDS");
    request.addParameter("Action", "CreateDBInstance");
    request.addParameter("Version", "2014-10-31");
    request.setHttpMethod(HttpMethodName.POST);

    if (createDBInstanceRequest.getDBName() != null) {
      request.addParameter("DBName", StringUtils.fromString(createDBInstanceRequest.getDBName()));
    }

    if (createDBInstanceRequest.getDBInstanceIdentifier() != null) {
      request.addParameter(
          "DBInstanceIdentifier",
          StringUtils.fromString(createDBInstanceRequest.getDBInstanceIdentifier()));
    }

    if (createDBInstanceRequest.getAllocatedStorage() != null) {
      request.addParameter(
          "AllocatedStorage",
          StringUtils.fromInteger(createDBInstanceRequest.getAllocatedStorage()));
    }

    if (createDBInstanceRequest.getDBInstanceClass() != null) {
      request.addParameter(
          "DBInstanceClass", StringUtils.fromString(createDBInstanceRequest.getDBInstanceClass()));
    }

    if (createDBInstanceRequest.getEngine() != null) {
      request.addParameter("Engine", StringUtils.fromString(createDBInstanceRequest.getEngine()));
    }

    if (createDBInstanceRequest.getMasterUsername() != null) {
      request.addParameter(
          "MasterUsername", StringUtils.fromString(createDBInstanceRequest.getMasterUsername()));
    }

    if (createDBInstanceRequest.getMasterUserPassword() != null) {
      request.addParameter(
          "MasterUserPassword",
          StringUtils.fromString(createDBInstanceRequest.getMasterUserPassword()));
    }

    com.amazonaws.internal.SdkInternalList<String> dBSecurityGroupsList =
        (com.amazonaws.internal.SdkInternalList<String>)
            createDBInstanceRequest.getDBSecurityGroups();
    if (!dBSecurityGroupsList.isEmpty() || !dBSecurityGroupsList.isAutoConstruct()) {
      int dBSecurityGroupsListIndex = 1;

      for (String dBSecurityGroupsListValue : dBSecurityGroupsList) {
        if (dBSecurityGroupsListValue != null) {
          request.addParameter(
              "DBSecurityGroups.DBSecurityGroupName." + dBSecurityGroupsListIndex,
              StringUtils.fromString(dBSecurityGroupsListValue));
        }
        dBSecurityGroupsListIndex++;
      }
    }

    com.amazonaws.internal.SdkInternalList<String> vpcSecurityGroupIdsList =
        (com.amazonaws.internal.SdkInternalList<String>)
            createDBInstanceRequest.getVpcSecurityGroupIds();
    if (!vpcSecurityGroupIdsList.isEmpty() || !vpcSecurityGroupIdsList.isAutoConstruct()) {
      int vpcSecurityGroupIdsListIndex = 1;

      for (String vpcSecurityGroupIdsListValue : vpcSecurityGroupIdsList) {
        if (vpcSecurityGroupIdsListValue != null) {
          request.addParameter(
              "VpcSecurityGroupIds.VpcSecurityGroupId." + vpcSecurityGroupIdsListIndex,
              StringUtils.fromString(vpcSecurityGroupIdsListValue));
        }
        vpcSecurityGroupIdsListIndex++;
      }
    }

    if (createDBInstanceRequest.getAvailabilityZone() != null) {
      request.addParameter(
          "AvailabilityZone",
          StringUtils.fromString(createDBInstanceRequest.getAvailabilityZone()));
    }

    if (createDBInstanceRequest.getDBSubnetGroupName() != null) {
      request.addParameter(
          "DBSubnetGroupName",
          StringUtils.fromString(createDBInstanceRequest.getDBSubnetGroupName()));
    }

    if (createDBInstanceRequest.getPreferredMaintenanceWindow() != null) {
      request.addParameter(
          "PreferredMaintenanceWindow",
          StringUtils.fromString(createDBInstanceRequest.getPreferredMaintenanceWindow()));
    }

    if (createDBInstanceRequest.getDBParameterGroupName() != null) {
      request.addParameter(
          "DBParameterGroupName",
          StringUtils.fromString(createDBInstanceRequest.getDBParameterGroupName()));
    }

    if (createDBInstanceRequest.getBackupRetentionPeriod() != null) {
      request.addParameter(
          "BackupRetentionPeriod",
          StringUtils.fromInteger(createDBInstanceRequest.getBackupRetentionPeriod()));
    }

    if (createDBInstanceRequest.getPreferredBackupWindow() != null) {
      request.addParameter(
          "PreferredBackupWindow",
          StringUtils.fromString(createDBInstanceRequest.getPreferredBackupWindow()));
    }

    if (createDBInstanceRequest.getPort() != null) {
      request.addParameter("Port", StringUtils.fromInteger(createDBInstanceRequest.getPort()));
    }

    if (createDBInstanceRequest.getMultiAZ() != null) {
      request.addParameter(
          "MultiAZ", StringUtils.fromBoolean(createDBInstanceRequest.getMultiAZ()));
    }

    if (createDBInstanceRequest.getEngineVersion() != null) {
      request.addParameter(
          "EngineVersion", StringUtils.fromString(createDBInstanceRequest.getEngineVersion()));
    }

    if (createDBInstanceRequest.getAutoMinorVersionUpgrade() != null) {
      request.addParameter(
          "AutoMinorVersionUpgrade",
          StringUtils.fromBoolean(createDBInstanceRequest.getAutoMinorVersionUpgrade()));
    }

    if (createDBInstanceRequest.getLicenseModel() != null) {
      request.addParameter(
          "LicenseModel", StringUtils.fromString(createDBInstanceRequest.getLicenseModel()));
    }

    if (createDBInstanceRequest.getIops() != null) {
      request.addParameter("Iops", StringUtils.fromInteger(createDBInstanceRequest.getIops()));
    }

    if (createDBInstanceRequest.getOptionGroupName() != null) {
      request.addParameter(
          "OptionGroupName", StringUtils.fromString(createDBInstanceRequest.getOptionGroupName()));
    }

    if (createDBInstanceRequest.getCharacterSetName() != null) {
      request.addParameter(
          "CharacterSetName",
          StringUtils.fromString(createDBInstanceRequest.getCharacterSetName()));
    }

    if (createDBInstanceRequest.getPubliclyAccessible() != null) {
      request.addParameter(
          "PubliclyAccessible",
          StringUtils.fromBoolean(createDBInstanceRequest.getPubliclyAccessible()));
    }

    com.amazonaws.internal.SdkInternalList<Tag> tagsList =
        (com.amazonaws.internal.SdkInternalList<Tag>) createDBInstanceRequest.getTags();
    if (!tagsList.isEmpty() || !tagsList.isAutoConstruct()) {
      int tagsListIndex = 1;

      for (Tag tagsListValue : tagsList) {

        if (tagsListValue.getKey() != null) {
          request.addParameter(
              "Tags.Tag." + tagsListIndex + ".Key", StringUtils.fromString(tagsListValue.getKey()));
        }

        if (tagsListValue.getValue() != null) {
          request.addParameter(
              "Tags.Tag." + tagsListIndex + ".Value",
              StringUtils.fromString(tagsListValue.getValue()));
        }
        tagsListIndex++;
      }
    }

    if (createDBInstanceRequest.getDBClusterIdentifier() != null) {
      request.addParameter(
          "DBClusterIdentifier",
          StringUtils.fromString(createDBInstanceRequest.getDBClusterIdentifier()));
    }

    if (createDBInstanceRequest.getStorageType() != null) {
      request.addParameter(
          "StorageType", StringUtils.fromString(createDBInstanceRequest.getStorageType()));
    }

    if (createDBInstanceRequest.getTdeCredentialArn() != null) {
      request.addParameter(
          "TdeCredentialArn",
          StringUtils.fromString(createDBInstanceRequest.getTdeCredentialArn()));
    }

    if (createDBInstanceRequest.getTdeCredentialPassword() != null) {
      request.addParameter(
          "TdeCredentialPassword",
          StringUtils.fromString(createDBInstanceRequest.getTdeCredentialPassword()));
    }

    if (createDBInstanceRequest.getStorageEncrypted() != null) {
      request.addParameter(
          "StorageEncrypted",
          StringUtils.fromBoolean(createDBInstanceRequest.getStorageEncrypted()));
    }

    if (createDBInstanceRequest.getKmsKeyId() != null) {
      request.addParameter(
          "KmsKeyId", StringUtils.fromString(createDBInstanceRequest.getKmsKeyId()));
    }

    if (createDBInstanceRequest.getDomain() != null) {
      request.addParameter("Domain", StringUtils.fromString(createDBInstanceRequest.getDomain()));
    }

    if (createDBInstanceRequest.getCopyTagsToSnapshot() != null) {
      request.addParameter(
          "CopyTagsToSnapshot",
          StringUtils.fromBoolean(createDBInstanceRequest.getCopyTagsToSnapshot()));
    }

    if (createDBInstanceRequest.getMonitoringInterval() != null) {
      request.addParameter(
          "MonitoringInterval",
          StringUtils.fromInteger(createDBInstanceRequest.getMonitoringInterval()));
    }

    if (createDBInstanceRequest.getMonitoringRoleArn() != null) {
      request.addParameter(
          "MonitoringRoleArn",
          StringUtils.fromString(createDBInstanceRequest.getMonitoringRoleArn()));
    }

    if (createDBInstanceRequest.getDomainIAMRoleName() != null) {
      request.addParameter(
          "DomainIAMRoleName",
          StringUtils.fromString(createDBInstanceRequest.getDomainIAMRoleName()));
    }

    if (createDBInstanceRequest.getPromotionTier() != null) {
      request.addParameter(
          "PromotionTier", StringUtils.fromInteger(createDBInstanceRequest.getPromotionTier()));
    }

    if (createDBInstanceRequest.getTimezone() != null) {
      request.addParameter(
          "Timezone", StringUtils.fromString(createDBInstanceRequest.getTimezone()));
    }

    return request;
  }
  public Request<CreateDBInstanceReadReplicaRequest> marshall(
      CreateDBInstanceReadReplicaRequest createDBInstanceReadReplicaRequest) {

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

    Request<CreateDBInstanceReadReplicaRequest> request =
        new DefaultRequest<CreateDBInstanceReadReplicaRequest>(
            createDBInstanceReadReplicaRequest, "AmazonRDS");
    request.addParameter("Action", "CreateDBInstanceReadReplica");
    request.addParameter("Version", "2014-10-31");
    request.setHttpMethod(HttpMethodName.POST);

    if (createDBInstanceReadReplicaRequest.getDBInstanceIdentifier() != null) {
      request.addParameter(
          "DBInstanceIdentifier",
          StringUtils.fromString(createDBInstanceReadReplicaRequest.getDBInstanceIdentifier()));
    }

    if (createDBInstanceReadReplicaRequest.getSourceDBInstanceIdentifier() != null) {
      request.addParameter(
          "SourceDBInstanceIdentifier",
          StringUtils.fromString(
              createDBInstanceReadReplicaRequest.getSourceDBInstanceIdentifier()));
    }

    if (createDBInstanceReadReplicaRequest.getDBInstanceClass() != null) {
      request.addParameter(
          "DBInstanceClass",
          StringUtils.fromString(createDBInstanceReadReplicaRequest.getDBInstanceClass()));
    }

    if (createDBInstanceReadReplicaRequest.getAvailabilityZone() != null) {
      request.addParameter(
          "AvailabilityZone",
          StringUtils.fromString(createDBInstanceReadReplicaRequest.getAvailabilityZone()));
    }

    if (createDBInstanceReadReplicaRequest.getPort() != null) {
      request.addParameter(
          "Port", StringUtils.fromInteger(createDBInstanceReadReplicaRequest.getPort()));
    }

    if (createDBInstanceReadReplicaRequest.getAutoMinorVersionUpgrade() != null) {
      request.addParameter(
          "AutoMinorVersionUpgrade",
          StringUtils.fromBoolean(createDBInstanceReadReplicaRequest.getAutoMinorVersionUpgrade()));
    }

    if (createDBInstanceReadReplicaRequest.getIops() != null) {
      request.addParameter(
          "Iops", StringUtils.fromInteger(createDBInstanceReadReplicaRequest.getIops()));
    }

    if (createDBInstanceReadReplicaRequest.getOptionGroupName() != null) {
      request.addParameter(
          "OptionGroupName",
          StringUtils.fromString(createDBInstanceReadReplicaRequest.getOptionGroupName()));
    }

    if (createDBInstanceReadReplicaRequest.getPubliclyAccessible() != null) {
      request.addParameter(
          "PubliclyAccessible",
          StringUtils.fromBoolean(createDBInstanceReadReplicaRequest.getPubliclyAccessible()));
    }

    com.amazonaws.internal.SdkInternalList<Tag> tagsList =
        (com.amazonaws.internal.SdkInternalList<Tag>) createDBInstanceReadReplicaRequest.getTags();
    if (!tagsList.isEmpty() || !tagsList.isAutoConstruct()) {
      int tagsListIndex = 1;

      for (Tag tagsListValue : tagsList) {

        if (tagsListValue.getKey() != null) {
          request.addParameter(
              "Tags.Tag." + tagsListIndex + ".Key", StringUtils.fromString(tagsListValue.getKey()));
        }

        if (tagsListValue.getValue() != null) {
          request.addParameter(
              "Tags.Tag." + tagsListIndex + ".Value",
              StringUtils.fromString(tagsListValue.getValue()));
        }
        tagsListIndex++;
      }
    }

    if (createDBInstanceReadReplicaRequest.getDBSubnetGroupName() != null) {
      request.addParameter(
          "DBSubnetGroupName",
          StringUtils.fromString(createDBInstanceReadReplicaRequest.getDBSubnetGroupName()));
    }

    if (createDBInstanceReadReplicaRequest.getStorageType() != null) {
      request.addParameter(
          "StorageType",
          StringUtils.fromString(createDBInstanceReadReplicaRequest.getStorageType()));
    }

    if (createDBInstanceReadReplicaRequest.getCopyTagsToSnapshot() != null) {
      request.addParameter(
          "CopyTagsToSnapshot",
          StringUtils.fromBoolean(createDBInstanceReadReplicaRequest.getCopyTagsToSnapshot()));
    }

    if (createDBInstanceReadReplicaRequest.getMonitoringInterval() != null) {
      request.addParameter(
          "MonitoringInterval",
          StringUtils.fromInteger(createDBInstanceReadReplicaRequest.getMonitoringInterval()));
    }

    if (createDBInstanceReadReplicaRequest.getMonitoringRoleArn() != null) {
      request.addParameter(
          "MonitoringRoleArn",
          StringUtils.fromString(createDBInstanceReadReplicaRequest.getMonitoringRoleArn()));
    }

    return request;
  }
コード例 #16
0
  public Request<CreateDBClusterRequest> marshall(CreateDBClusterRequest createDBClusterRequest) {

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

    Request<CreateDBClusterRequest> request =
        new DefaultRequest<CreateDBClusterRequest>(createDBClusterRequest, "AmazonRDS");
    request.addParameter("Action", "CreateDBCluster");
    request.addParameter("Version", "2014-10-31");
    request.setHttpMethod(HttpMethodName.POST);

    com.amazonaws.internal.SdkInternalList<String> availabilityZonesList =
        (com.amazonaws.internal.SdkInternalList<String>)
            createDBClusterRequest.getAvailabilityZones();
    if (!availabilityZonesList.isEmpty() || !availabilityZonesList.isAutoConstruct()) {
      int availabilityZonesListIndex = 1;

      for (String availabilityZonesListValue : availabilityZonesList) {
        if (availabilityZonesListValue != null) {
          request.addParameter(
              "AvailabilityZones.AvailabilityZone." + availabilityZonesListIndex,
              StringUtils.fromString(availabilityZonesListValue));
        }
        availabilityZonesListIndex++;
      }
    }

    if (createDBClusterRequest.getBackupRetentionPeriod() != null) {
      request.addParameter(
          "BackupRetentionPeriod",
          StringUtils.fromInteger(createDBClusterRequest.getBackupRetentionPeriod()));
    }

    if (createDBClusterRequest.getCharacterSetName() != null) {
      request.addParameter(
          "CharacterSetName", StringUtils.fromString(createDBClusterRequest.getCharacterSetName()));
    }

    if (createDBClusterRequest.getDatabaseName() != null) {
      request.addParameter(
          "DatabaseName", StringUtils.fromString(createDBClusterRequest.getDatabaseName()));
    }

    if (createDBClusterRequest.getDBClusterIdentifier() != null) {
      request.addParameter(
          "DBClusterIdentifier",
          StringUtils.fromString(createDBClusterRequest.getDBClusterIdentifier()));
    }

    if (createDBClusterRequest.getDBClusterParameterGroupName() != null) {
      request.addParameter(
          "DBClusterParameterGroupName",
          StringUtils.fromString(createDBClusterRequest.getDBClusterParameterGroupName()));
    }

    com.amazonaws.internal.SdkInternalList<String> vpcSecurityGroupIdsList =
        (com.amazonaws.internal.SdkInternalList<String>)
            createDBClusterRequest.getVpcSecurityGroupIds();
    if (!vpcSecurityGroupIdsList.isEmpty() || !vpcSecurityGroupIdsList.isAutoConstruct()) {
      int vpcSecurityGroupIdsListIndex = 1;

      for (String vpcSecurityGroupIdsListValue : vpcSecurityGroupIdsList) {
        if (vpcSecurityGroupIdsListValue != null) {
          request.addParameter(
              "VpcSecurityGroupIds.VpcSecurityGroupId." + vpcSecurityGroupIdsListIndex,
              StringUtils.fromString(vpcSecurityGroupIdsListValue));
        }
        vpcSecurityGroupIdsListIndex++;
      }
    }

    if (createDBClusterRequest.getDBSubnetGroupName() != null) {
      request.addParameter(
          "DBSubnetGroupName",
          StringUtils.fromString(createDBClusterRequest.getDBSubnetGroupName()));
    }

    if (createDBClusterRequest.getEngine() != null) {
      request.addParameter("Engine", StringUtils.fromString(createDBClusterRequest.getEngine()));
    }

    if (createDBClusterRequest.getEngineVersion() != null) {
      request.addParameter(
          "EngineVersion", StringUtils.fromString(createDBClusterRequest.getEngineVersion()));
    }

    if (createDBClusterRequest.getPort() != null) {
      request.addParameter("Port", StringUtils.fromInteger(createDBClusterRequest.getPort()));
    }

    if (createDBClusterRequest.getMasterUsername() != null) {
      request.addParameter(
          "MasterUsername", StringUtils.fromString(createDBClusterRequest.getMasterUsername()));
    }

    if (createDBClusterRequest.getMasterUserPassword() != null) {
      request.addParameter(
          "MasterUserPassword",
          StringUtils.fromString(createDBClusterRequest.getMasterUserPassword()));
    }

    if (createDBClusterRequest.getOptionGroupName() != null) {
      request.addParameter(
          "OptionGroupName", StringUtils.fromString(createDBClusterRequest.getOptionGroupName()));
    }

    if (createDBClusterRequest.getPreferredBackupWindow() != null) {
      request.addParameter(
          "PreferredBackupWindow",
          StringUtils.fromString(createDBClusterRequest.getPreferredBackupWindow()));
    }

    if (createDBClusterRequest.getPreferredMaintenanceWindow() != null) {
      request.addParameter(
          "PreferredMaintenanceWindow",
          StringUtils.fromString(createDBClusterRequest.getPreferredMaintenanceWindow()));
    }

    if (createDBClusterRequest.getReplicationSourceIdentifier() != null) {
      request.addParameter(
          "ReplicationSourceIdentifier",
          StringUtils.fromString(createDBClusterRequest.getReplicationSourceIdentifier()));
    }

    com.amazonaws.internal.SdkInternalList<Tag> tagsList =
        (com.amazonaws.internal.SdkInternalList<Tag>) createDBClusterRequest.getTags();
    if (!tagsList.isEmpty() || !tagsList.isAutoConstruct()) {
      int tagsListIndex = 1;

      for (Tag tagsListValue : tagsList) {

        if (tagsListValue.getKey() != null) {
          request.addParameter(
              "Tags.Tag." + tagsListIndex + ".Key", StringUtils.fromString(tagsListValue.getKey()));
        }

        if (tagsListValue.getValue() != null) {
          request.addParameter(
              "Tags.Tag." + tagsListIndex + ".Value",
              StringUtils.fromString(tagsListValue.getValue()));
        }
        tagsListIndex++;
      }
    }

    if (createDBClusterRequest.getStorageEncrypted() != null) {
      request.addParameter(
          "StorageEncrypted",
          StringUtils.fromBoolean(createDBClusterRequest.getStorageEncrypted()));
    }

    if (createDBClusterRequest.getKmsKeyId() != null) {
      request.addParameter(
          "KmsKeyId", StringUtils.fromString(createDBClusterRequest.getKmsKeyId()));
    }

    return request;
  }