예제 #1
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;

    if (obj instanceof ContextEntry == false) return false;
    ContextEntry other = (ContextEntry) obj;
    if (other.getContextKeyName() == null ^ this.getContextKeyName() == null) return false;
    if (other.getContextKeyName() != null
        && other.getContextKeyName().equals(this.getContextKeyName()) == false) return false;
    if (other.getContextKeyValues() == null ^ this.getContextKeyValues() == null) return false;
    if (other.getContextKeyValues() != null
        && other.getContextKeyValues().equals(this.getContextKeyValues()) == false) return false;
    if (other.getContextKeyType() == null ^ this.getContextKeyType() == null) return false;
    if (other.getContextKeyType() != null
        && other.getContextKeyType().equals(this.getContextKeyType()) == false) return false;
    return true;
  }
  public Request<SimulateCustomPolicyRequest> marshall(
      SimulateCustomPolicyRequest simulateCustomPolicyRequest) {

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

    Request<SimulateCustomPolicyRequest> request =
        new DefaultRequest<SimulateCustomPolicyRequest>(
            simulateCustomPolicyRequest, "AmazonIdentityManagement");
    request.addParameter("Action", "SimulateCustomPolicy");
    request.addParameter("Version", "2010-05-08");
    request.setHttpMethod(HttpMethodName.POST);

    com.amazonaws.internal.SdkInternalList<String> policyInputListList =
        (com.amazonaws.internal.SdkInternalList<String>)
            simulateCustomPolicyRequest.getPolicyInputList();
    if (!policyInputListList.isEmpty() || !policyInputListList.isAutoConstruct()) {
      int policyInputListListIndex = 1;

      for (String policyInputListListValue : policyInputListList) {
        if (policyInputListListValue != null) {
          request.addParameter(
              "PolicyInputList.member." + policyInputListListIndex,
              StringUtils.fromString(policyInputListListValue));
        }
        policyInputListListIndex++;
      }
    }

    com.amazonaws.internal.SdkInternalList<String> actionNamesList =
        (com.amazonaws.internal.SdkInternalList<String>)
            simulateCustomPolicyRequest.getActionNames();
    if (!actionNamesList.isEmpty() || !actionNamesList.isAutoConstruct()) {
      int actionNamesListIndex = 1;

      for (String actionNamesListValue : actionNamesList) {
        if (actionNamesListValue != null) {
          request.addParameter(
              "ActionNames.member." + actionNamesListIndex,
              StringUtils.fromString(actionNamesListValue));
        }
        actionNamesListIndex++;
      }
    }

    com.amazonaws.internal.SdkInternalList<String> resourceArnsList =
        (com.amazonaws.internal.SdkInternalList<String>)
            simulateCustomPolicyRequest.getResourceArns();
    if (!resourceArnsList.isEmpty() || !resourceArnsList.isAutoConstruct()) {
      int resourceArnsListIndex = 1;

      for (String resourceArnsListValue : resourceArnsList) {
        if (resourceArnsListValue != null) {
          request.addParameter(
              "ResourceArns.member." + resourceArnsListIndex,
              StringUtils.fromString(resourceArnsListValue));
        }
        resourceArnsListIndex++;
      }
    }

    if (simulateCustomPolicyRequest.getResourcePolicy() != null) {
      request.addParameter(
          "ResourcePolicy",
          StringUtils.fromString(simulateCustomPolicyRequest.getResourcePolicy()));
    }

    if (simulateCustomPolicyRequest.getResourceOwner() != null) {
      request.addParameter(
          "ResourceOwner", StringUtils.fromString(simulateCustomPolicyRequest.getResourceOwner()));
    }

    if (simulateCustomPolicyRequest.getCallerArn() != null) {
      request.addParameter(
          "CallerArn", StringUtils.fromString(simulateCustomPolicyRequest.getCallerArn()));
    }

    com.amazonaws.internal.SdkInternalList<ContextEntry> contextEntriesList =
        (com.amazonaws.internal.SdkInternalList<ContextEntry>)
            simulateCustomPolicyRequest.getContextEntries();
    if (!contextEntriesList.isEmpty() || !contextEntriesList.isAutoConstruct()) {
      int contextEntriesListIndex = 1;

      for (ContextEntry contextEntriesListValue : contextEntriesList) {

        if (contextEntriesListValue.getContextKeyName() != null) {
          request.addParameter(
              "ContextEntries.member." + contextEntriesListIndex + ".ContextKeyName",
              StringUtils.fromString(contextEntriesListValue.getContextKeyName()));
        }

        com.amazonaws.internal.SdkInternalList<String> contextKeyValuesList =
            (com.amazonaws.internal.SdkInternalList<String>)
                contextEntriesListValue.getContextKeyValues();
        if (!contextKeyValuesList.isEmpty() || !contextKeyValuesList.isAutoConstruct()) {
          int contextKeyValuesListIndex = 1;

          for (String contextKeyValuesListValue : contextKeyValuesList) {
            if (contextKeyValuesListValue != null) {
              request.addParameter(
                  "ContextEntries.member."
                      + contextEntriesListIndex
                      + ".ContextKeyValues.member."
                      + contextKeyValuesListIndex,
                  StringUtils.fromString(contextKeyValuesListValue));
            }
            contextKeyValuesListIndex++;
          }
        }

        if (contextEntriesListValue.getContextKeyType() != null) {
          request.addParameter(
              "ContextEntries.member." + contextEntriesListIndex + ".ContextKeyType",
              StringUtils.fromString(contextEntriesListValue.getContextKeyType()));
        }
        contextEntriesListIndex++;
      }
    }

    if (simulateCustomPolicyRequest.getResourceHandlingOption() != null) {
      request.addParameter(
          "ResourceHandlingOption",
          StringUtils.fromString(simulateCustomPolicyRequest.getResourceHandlingOption()));
    }

    if (simulateCustomPolicyRequest.getMaxItems() != null) {
      request.addParameter(
          "MaxItems", StringUtils.fromInteger(simulateCustomPolicyRequest.getMaxItems()));
    }

    if (simulateCustomPolicyRequest.getMarker() != null) {
      request.addParameter(
          "Marker", StringUtils.fromString(simulateCustomPolicyRequest.getMarker()));
    }

    return request;
  }