code: public AllocateQuotaRequest asQuotaRequest(Clock clock) {
      Preconditions.checkState(!Strings.isNullOrEmpty(getServiceName()),
          "a service name must be set");
      Preconditions.checkState(!Strings.isNullOrEmpty(getOperationId()),
          "an operation ID must be set");
      Preconditions.checkState(!Strings.isNullOrEmpty(getOperationName()),
          "an operation name must be set");
      Operation.Builder b = super.asOperation(clock).toBuilder();
      b.putAllLabels(getSystemLabels());
  
      QuotaOperation.Builder opBuilder = QuotaOperation.newBuilder()
          .setOperationId(getOperationId())
          .setMethodName(getOperationName())
          .setConsumerId(getOperationConsumerId())
          .setQuotaMode(QuotaMode.BEST_EFFORT)
          .putAllLabels(getSystemLabels());
      for (Map.Entry<String, Long> entry : metricCosts.entrySet()) {
        long cost = entry.getValue();
        opBuilder.addQuotaMetrics(MetricValueSet.newBuilder()
            .setMetricName(entry.getKey())
            .addMetricValues(MetricValue.newBuilder()
                .setInt64Value(cost <= 0 ? 1 : cost)));
      }
      AllocateQuotaRequest.Builder builder = AllocateQuotaRequest.newBuilder()
          .setServiceName(getServiceName())
          .setAllocateOperation(opBuilder);
      if (configId != null) {
        builder.setServiceConfigId(configId);
      }
      return builder.build();
    }
docs: Returns the {@link AllocateQuotaRequest} instance corresponding to this instance.
  
  <p>
  The service name, operation ID and operation Name must all be set
  <p>
  
  @param clock is used to determine the current timestamp
  
  @return an {@link AllocateQuotaRequest}
  @throws java.lang.IllegalStateException if any required values are not set when this is called.