/**
  * Utility method to more succinctly construct an {@link Protos.Event Event} of type {@link
  * Protos.Event.Type#MESSAGE MESSAGE}.
  *
  * @param agentId The {@link org.apache.mesos.v1.Protos.AgentID#getValue() value} of the {@link
  *     Protos.Event.Message#getAgentId() agentId} to be set on the {@link Protos.Event.Message
  *     Message}.
  * @param executorId The {@link org.apache.mesos.v1.Protos.ExecutorID#getValue() value} of the
  *     {@link Protos.Event.Message#getExecutorId() executorId} to be set on the {@link
  *     Protos.Event.Message Message}.
  * @param data The {@link Protos.Event.Message#getData() data} to be set on the {@link
  *     Protos.Event.Message Message}.
  * @return A {@link Protos.Call Call} with a configured {@link Protos.Call.Acknowledge
  *     Acknowledge}.
  */
 @NotNull
 public static Protos.Event message(
     @NotNull final String agentId,
     @NotNull final String executorId,
     @NotNull final ByteString data) {
   return message(
       org.apache.mesos.v1.Protos.AgentID.newBuilder().setValue(agentId).build(),
       org.apache.mesos.v1.Protos.ExecutorID.newBuilder().setValue(executorId).build(),
       data);
 }
 /**
  * Utility method to more succinctly construct an {@link Protos.Event Event} of type {@link
  * Protos.Event.Type#OFFERS OFFERS}.
  *
  * @param hostname The hostname to set on the offer.
  * @param offerId The offerId to set on the offer.
  * @param agentId The agentId to set on the offer.
  * @param frameworkId The frameworkId to set on the offer.
  * @param cpus The number of cpus the offer will have.
  * @param mem The number of megabytes of memory the offer will have.
  * @param disk The number of megabytes of disk the offer will have.
  * @return An {@link Protos.Event Event} of type {@link Protos.Event.Type#OFFERS OFFERS}
  *     containing a single {@link org.apache.mesos.v1.Protos.Offer Offer} using the specified
  *     parameters as the values of the offer.
  */
 @NotNull
 public static Protos.Event resourceOffer(
     @NotNull final String hostname,
     @NotNull final String offerId,
     @NotNull final String agentId,
     @NotNull final String frameworkId,
     final double cpus,
     final long mem,
     final long disk) {
   return Protos.Event.newBuilder()
       .setType(Protos.Event.Type.OFFERS)
       .setOffers(
           Protos.Event.Offers.newBuilder()
               .addAllOffers(
                   Collections.singletonList(
                       org.apache.mesos.v1.Protos.Offer.newBuilder()
                           .setHostname(hostname)
                           .setId(
                               org.apache.mesos.v1.Protos.OfferID.newBuilder().setValue(offerId))
                           .setAgentId(
                               org.apache.mesos.v1.Protos.AgentID.newBuilder().setValue(agentId))
                           .setFrameworkId(
                               org.apache.mesos.v1.Protos.FrameworkID.newBuilder()
                                   .setValue(frameworkId))
                           .addResources(
                               org.apache.mesos.v1.Protos.Resource.newBuilder()
                                   .setName("cpus")
                                   .setRole("*")
                                   .setType(org.apache.mesos.v1.Protos.Value.Type.SCALAR)
                                   .setScalar(
                                       org.apache.mesos.v1.Protos.Value.Scalar.newBuilder()
                                           .setValue(cpus)))
                           .addResources(
                               org.apache.mesos.v1.Protos.Resource.newBuilder()
                                   .setName("mem")
                                   .setRole("*")
                                   .setType(org.apache.mesos.v1.Protos.Value.Type.SCALAR)
                                   .setScalar(
                                       org.apache.mesos.v1.Protos.Value.Scalar.newBuilder()
                                           .setValue(mem)))
                           .addResources(
                               org.apache.mesos.v1.Protos.Resource.newBuilder()
                                   .setName("disk")
                                   .setRole("*")
                                   .setType(org.apache.mesos.v1.Protos.Value.Type.SCALAR)
                                   .setScalar(
                                       org.apache.mesos.v1.Protos.Value.Scalar.newBuilder()
                                           .setValue(disk)))
                           .build())))
       .build();
 }
 /**
  * Utility method to more succinctly construct an {@link Protos.Event Event} of type {@link
  * Protos.Event.Type#UPDATE UPDATE}.
  *
  * @param agentId The {@link org.apache.mesos.v1.Protos.TaskStatus#getAgentId() agentId} to be set
  *     on the {@link org.apache.mesos.v1.Protos.TaskStatus TaskStatus}.
  * @param executorId The {@link org.apache.mesos.v1.Protos.TaskStatus#getExecutorId() executorId}
  *     to be set on the {@link org.apache.mesos.v1.Protos.TaskStatus TaskStatus}.
  * @param taskId The {@link org.apache.mesos.v1.Protos.TaskStatus#getTaskId() taskId} to be set on
  *     the {@link org.apache.mesos.v1.Protos.TaskStatus TaskStatus}.
  * @param state The {@link org.apache.mesos.v1.Protos.TaskState TaskState} to be set on the {@link
  *     org.apache.mesos.v1.Protos.TaskStatus TaskStatus}.
  * @param uuid The {@link org.apache.mesos.v1.Protos.TaskStatus#getUuid() uuid} to be set on the
  *     {@link org.apache.mesos.v1.Protos.TaskStatus TaskStatus}.
  * @return A {@link Protos.Call Call} with a configured {@link Protos.Call.Acknowledge
  *     Acknowledge}.
  */
 @NotNull
 public static Protos.Event update(
     @NotNull final String agentId,
     @NotNull final String executorId,
     @NotNull final String taskId,
     @NotNull final org.apache.mesos.v1.Protos.TaskState state,
     @Nullable final ByteString uuid) {
   return update(
       org.apache.mesos.v1.Protos.AgentID.newBuilder().setValue(agentId).build(),
       org.apache.mesos.v1.Protos.ExecutorID.newBuilder().setValue(executorId).build(),
       org.apache.mesos.v1.Protos.TaskID.newBuilder().setValue(taskId).build(),
       state,
       uuid);
 }