@Override
 public void toXContent(
     CancelAllocationCommand command,
     XContentBuilder builder,
     ToXContent.Params params,
     String objectName)
     throws IOException {
   if (objectName == null) {
     builder.startObject();
   } else {
     builder.startObject(objectName);
   }
   builder.field("index", command.shardId().index().name());
   builder.field("shard", command.shardId().id());
   builder.field("node", command.node());
   builder.field("allow_primary", command.allowPrimary());
   builder.endObject();
 }
 @Override
 public void writeTo(CancelAllocationCommand command, StreamOutput out) throws IOException {
   command.shardId().writeTo(out);
   out.writeString(command.node());
   out.writeBoolean(command.allowPrimary());
 }