/**
  * Utility method to more succinctly construct an {@link Protos.Event Event} of type {@link
  * Protos.Event.Type#SUBSCRIBED SUBSCRIBED}.
  *
  * @param frameworkId The frameworkId to be set on the {@link Protos.Event.Subscribed} message.
  * @param heartbeatIntervalSeconds The heartbeatIntervalSeconds to be set on the {@link
  *     Protos.Event.Subscribed} message.
  * @return An instance of {@link Protos.Event Event} of type {@link Protos.Event.Type#SUBSCRIBED
  *     SUBSCRIBED} and {@link Protos.Event#getSubscribed() subscribed} set based on the provide
  *     parameters.
  */
 @NotNull
 public static Protos.Event subscribed(
     @NotNull final String frameworkId, final int heartbeatIntervalSeconds) {
   return Protos.Event.newBuilder()
       .setType(Protos.Event.Type.SUBSCRIBED)
       .setSubscribed(
           Protos.Event.Subscribed.newBuilder()
               .setFrameworkId(
                   org.apache.mesos.v1.Protos.FrameworkID.newBuilder().setValue(frameworkId))
               .setHeartbeatIntervalSeconds(heartbeatIntervalSeconds))
       .build();
 }
 /**
  * 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();
 }