public Request<MergeDeveloperIdentitiesRequest> marshall(
      MergeDeveloperIdentitiesRequest mergeDeveloperIdentitiesRequest) {

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

    Request<MergeDeveloperIdentitiesRequest> request =
        new DefaultRequest<MergeDeveloperIdentitiesRequest>(
            mergeDeveloperIdentitiesRequest, "AmazonCognitoIdentity");
    request.addHeader("X-Amz-Target", "AWSCognitoIdentityService.MergeDeveloperIdentities");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (mergeDeveloperIdentitiesRequest.getSourceUserIdentifier() != null) {
        jsonGenerator
            .writeFieldName("SourceUserIdentifier")
            .writeValue(mergeDeveloperIdentitiesRequest.getSourceUserIdentifier());
      }
      if (mergeDeveloperIdentitiesRequest.getDestinationUserIdentifier() != null) {
        jsonGenerator
            .writeFieldName("DestinationUserIdentifier")
            .writeValue(mergeDeveloperIdentitiesRequest.getDestinationUserIdentifier());
      }
      if (mergeDeveloperIdentitiesRequest.getDeveloperProviderName() != null) {
        jsonGenerator
            .writeFieldName("DeveloperProviderName")
            .writeValue(mergeDeveloperIdentitiesRequest.getDeveloperProviderName());
      }
      if (mergeDeveloperIdentitiesRequest.getIdentityPoolId() != null) {
        jsonGenerator
            .writeFieldName("IdentityPoolId")
            .writeValue(mergeDeveloperIdentitiesRequest.getIdentityPoolId());
      }

      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;
  }
  public Request<DeleteIdentitiesRequest> marshall(
      DeleteIdentitiesRequest deleteIdentitiesRequest) {

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

    Request<DeleteIdentitiesRequest> request =
        new DefaultRequest<DeleteIdentitiesRequest>(
            deleteIdentitiesRequest, "AmazonCognitoIdentity");
    request.addHeader("X-Amz-Target", "AWSCognitoIdentityService.DeleteIdentities");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      java.util.List<String> identityIdsToDeleteList =
          deleteIdentitiesRequest.getIdentityIdsToDelete();
      if (identityIdsToDeleteList != null) {
        jsonGenerator.writeFieldName("IdentityIdsToDelete");
        jsonGenerator.writeStartArray();
        for (String identityIdsToDeleteListValue : identityIdsToDeleteList) {
          if (identityIdsToDeleteListValue != null) {
            jsonGenerator.writeValue(identityIdsToDeleteListValue);
          }
        }
        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;
  }
  /** Marshall the given parameter object, and output to a SdkJsonGenerator */
  public void marshall(
      IdentityDescription identityDescription, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (identityDescription.getIdentityId() != null) {
        jsonGenerator.writeFieldName("IdentityId").writeValue(identityDescription.getIdentityId());
      }

      java.util.List<String> loginsList = identityDescription.getLogins();
      if (loginsList != null) {
        jsonGenerator.writeFieldName("Logins");
        jsonGenerator.writeStartArray();
        for (String loginsListValue : loginsList) {
          if (loginsListValue != null) {
            jsonGenerator.writeValue(loginsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (identityDescription.getCreationDate() != null) {
        jsonGenerator
            .writeFieldName("CreationDate")
            .writeValue(identityDescription.getCreationDate());
      }
      if (identityDescription.getLastModifiedDate() != null) {
        jsonGenerator
            .writeFieldName("LastModifiedDate")
            .writeValue(identityDescription.getLastModifiedDate());
      }

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

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

    Request<UnlinkIdentityRequest> request =
        new DefaultRequest<UnlinkIdentityRequest>(unlinkIdentityRequest, "AmazonCognitoIdentity");
    request.addHeader("X-Amz-Target", "AWSCognitoIdentityService.UnlinkIdentity");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (unlinkIdentityRequest.getIdentityId() != null) {
        jsonGenerator
            .writeFieldName("IdentityId")
            .writeValue(unlinkIdentityRequest.getIdentityId());
      }

      java.util.Map<String, String> loginsMap = unlinkIdentityRequest.getLogins();
      if (loginsMap != null) {
        jsonGenerator.writeFieldName("Logins");
        jsonGenerator.writeStartObject();

        for (Map.Entry<String, String> loginsMapValue : loginsMap.entrySet()) {
          if (loginsMapValue.getValue() != null) {
            jsonGenerator.writeFieldName(loginsMapValue.getKey());

            jsonGenerator.writeValue(loginsMapValue.getValue());
          }
        }
        jsonGenerator.writeEndObject();
      }

      java.util.List<String> loginsToRemoveList = unlinkIdentityRequest.getLoginsToRemove();
      if (loginsToRemoveList != null) {
        jsonGenerator.writeFieldName("LoginsToRemove");
        jsonGenerator.writeStartArray();
        for (String loginsToRemoveListValue : loginsToRemoveList) {
          if (loginsToRemoveListValue != null) {
            jsonGenerator.writeValue(loginsToRemoveListValue);
          }
        }
        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;
  }