public Request<CreatePlayerSessionsRequest> marshall(
      CreatePlayerSessionsRequest createPlayerSessionsRequest) {

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

    Request<CreatePlayerSessionsRequest> request =
        new DefaultRequest<CreatePlayerSessionsRequest>(
            createPlayerSessionsRequest, "AmazonGameLift");
    request.addHeader("X-Amz-Target", "GameLift.CreatePlayerSessions");

    request.setHttpMethod(HttpMethodName.POST);

    request.setResourcePath("");

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

      jsonGenerator.writeStartObject();

      if (createPlayerSessionsRequest.getGameSessionId() != null) {
        jsonGenerator
            .writeFieldName("GameSessionId")
            .writeValue(createPlayerSessionsRequest.getGameSessionId());
      }

      java.util.List<String> playerIdsList = createPlayerSessionsRequest.getPlayerIds();
      if (playerIdsList != null) {
        jsonGenerator.writeFieldName("PlayerIds");
        jsonGenerator.writeStartArray();
        for (String playerIdsListValue : playerIdsList) {
          if (playerIdsListValue != null) {
            jsonGenerator.writeValue(playerIdsListValue);
          }
        }
        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(FleetAttributes fleetAttributes, StructuredJsonGenerator jsonGenerator) {

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

    try {
      jsonGenerator.writeStartObject();

      if (fleetAttributes.getFleetId() != null) {
        jsonGenerator.writeFieldName("FleetId").writeValue(fleetAttributes.getFleetId());
      }
      if (fleetAttributes.getDescription() != null) {
        jsonGenerator.writeFieldName("Description").writeValue(fleetAttributes.getDescription());
      }
      if (fleetAttributes.getName() != null) {
        jsonGenerator.writeFieldName("Name").writeValue(fleetAttributes.getName());
      }
      if (fleetAttributes.getCreationTime() != null) {
        jsonGenerator.writeFieldName("CreationTime").writeValue(fleetAttributes.getCreationTime());
      }
      if (fleetAttributes.getTerminationTime() != null) {
        jsonGenerator
            .writeFieldName("TerminationTime")
            .writeValue(fleetAttributes.getTerminationTime());
      }
      if (fleetAttributes.getStatus() != null) {
        jsonGenerator.writeFieldName("Status").writeValue(fleetAttributes.getStatus());
      }
      if (fleetAttributes.getBuildId() != null) {
        jsonGenerator.writeFieldName("BuildId").writeValue(fleetAttributes.getBuildId());
      }
      if (fleetAttributes.getServerLaunchPath() != null) {
        jsonGenerator
            .writeFieldName("ServerLaunchPath")
            .writeValue(fleetAttributes.getServerLaunchPath());
      }
      if (fleetAttributes.getServerLaunchParameters() != null) {
        jsonGenerator
            .writeFieldName("ServerLaunchParameters")
            .writeValue(fleetAttributes.getServerLaunchParameters());
      }

      java.util.List<String> logPathsList = fleetAttributes.getLogPaths();
      if (logPathsList != null) {
        jsonGenerator.writeFieldName("LogPaths");
        jsonGenerator.writeStartArray();
        for (String logPathsListValue : logPathsList) {
          if (logPathsListValue != null) {
            jsonGenerator.writeValue(logPathsListValue);
          }
        }
        jsonGenerator.writeEndArray();
      }
      if (fleetAttributes.getNewGameSessionProtectionPolicy() != null) {
        jsonGenerator
            .writeFieldName("NewGameSessionProtectionPolicy")
            .writeValue(fleetAttributes.getNewGameSessionProtectionPolicy());
      }
      if (fleetAttributes.getOperatingSystem() != null) {
        jsonGenerator
            .writeFieldName("OperatingSystem")
            .writeValue(fleetAttributes.getOperatingSystem());
      }
      if (fleetAttributes.getResourceCreationLimitPolicy() != null) {
        jsonGenerator.writeFieldName("ResourceCreationLimitPolicy");
        ResourceCreationLimitPolicyJsonMarshaller.getInstance()
            .marshall(fleetAttributes.getResourceCreationLimitPolicy(), jsonGenerator);
      }

      jsonGenerator.writeEndObject();
    } catch (Throwable t) {
      throw new SdkClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
    }
  }