All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lnrpc.MiddlewareRegistration.scala Maven / Gradle / Ivy

The newest version!
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package lnrpc
import org.bitcoins.lnd.rpc.LndUtils._

/** @param middlewareName
  *  
  *  The name of the middleware to register. The name should be as informative
  *  as possible and is logged on registration.
  * @param customMacaroonCaveatName
  *  
  *  The name of the custom macaroon caveat that this middleware is responsible
  *  for. Only requests/responses that contain a macaroon with the registered
  *  custom caveat are forwarded for interception to the middleware. The
  *  exception being the read-only mode: All requests/responses are forwarded to
  *  a middleware that requests read-only access but such a middleware won't be
  *  allowed to _alter_ responses. As a security measure, _no_ middleware can
  *  change responses to requests made with _unencumbered_ macaroons!
  *  NOTE: Cannot be used at the same time as read_only_mode.
  * @param readOnlyMode
  *  
  *  Instead of defining a custom macaroon caveat name a middleware can register
  *  itself for read-only access only. In that mode all requests/responses are
  *  forwarded to the middleware but the middleware isn't allowed to alter any of
  *  the responses.
  *  NOTE: Cannot be used at the same time as custom_macaroon_caveat_name.
  */
@SerialVersionUID(0L)
final case class MiddlewareRegistration(
    middlewareName: _root_.scala.Predef.String = "",
    customMacaroonCaveatName: _root_.scala.Predef.String = "",
    readOnlyMode: _root_.scala.Boolean = false,
    unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
    ) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[MiddlewareRegistration] {
    @transient
    private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
    private[this] def __computeSerializedSize(): _root_.scala.Int = {
      var __size = 0
      
      {
        val __value = middlewareName
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(1, __value)
        }
      };
      
      {
        val __value = customMacaroonCaveatName
        if (!__value.isEmpty) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value)
        }
      };
      
      {
        val __value = readOnlyMode
        if (__value != false) {
          __size += _root_.com.google.protobuf.CodedOutputStream.computeBoolSize(3, __value)
        }
      };
      __size += unknownFields.serializedSize
      __size
    }
    override def serializedSize: _root_.scala.Int = {
      var __size = __serializedSizeMemoized
      if (__size == 0) {
        __size = __computeSerializedSize() + 1
        __serializedSizeMemoized = __size
      }
      __size - 1
      
    }
    def writeTo(`_output__`: _root_.com.google.protobuf.CodedOutputStream): _root_.scala.Unit = {
      {
        val __v = middlewareName
        if (!__v.isEmpty) {
          _output__.writeString(1, __v)
        }
      };
      {
        val __v = customMacaroonCaveatName
        if (!__v.isEmpty) {
          _output__.writeString(2, __v)
        }
      };
      {
        val __v = readOnlyMode
        if (__v != false) {
          _output__.writeBool(3, __v)
        }
      };
      unknownFields.writeTo(_output__)
    }
    def withMiddlewareName(__v: _root_.scala.Predef.String): MiddlewareRegistration = copy(middlewareName = __v)
    def withCustomMacaroonCaveatName(__v: _root_.scala.Predef.String): MiddlewareRegistration = copy(customMacaroonCaveatName = __v)
    def withReadOnlyMode(__v: _root_.scala.Boolean): MiddlewareRegistration = copy(readOnlyMode = __v)
    def withUnknownFields(__v: _root_.scalapb.UnknownFieldSet) = copy(unknownFields = __v)
    def discardUnknownFields = copy(unknownFields = _root_.scalapb.UnknownFieldSet.empty)
    def getFieldByNumber(__fieldNumber: _root_.scala.Int): _root_.scala.Any = {
      (__fieldNumber: @_root_.scala.unchecked) match {
        case 1 => {
          val __t = middlewareName
          if (__t != "") __t else null
        }
        case 2 => {
          val __t = customMacaroonCaveatName
          if (__t != "") __t else null
        }
        case 3 => {
          val __t = readOnlyMode
          if (__t != false) __t else null
        }
      }
    }
    def getField(__field: _root_.scalapb.descriptors.FieldDescriptor): _root_.scalapb.descriptors.PValue = {
      _root_.scala.Predef.require(__field.containingMessage eq companion.scalaDescriptor)
      (__field.number: @_root_.scala.unchecked) match {
        case 1 => _root_.scalapb.descriptors.PString(middlewareName)
        case 2 => _root_.scalapb.descriptors.PString(customMacaroonCaveatName)
        case 3 => _root_.scalapb.descriptors.PBoolean(readOnlyMode)
      }
    }
    def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
    def companion: lnrpc.MiddlewareRegistration.type = lnrpc.MiddlewareRegistration
    // @@protoc_insertion_point(GeneratedMessage[lnrpc.MiddlewareRegistration])
}

object MiddlewareRegistration extends scalapb.GeneratedMessageCompanion[lnrpc.MiddlewareRegistration] {
  implicit def messageCompanion: scalapb.GeneratedMessageCompanion[lnrpc.MiddlewareRegistration] = this
  def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): lnrpc.MiddlewareRegistration = {
    var __middlewareName: _root_.scala.Predef.String = ""
    var __customMacaroonCaveatName: _root_.scala.Predef.String = ""
    var __readOnlyMode: _root_.scala.Boolean = false
    var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
    var _done__ = false
    while (!_done__) {
      val _tag__ = _input__.readTag()
      _tag__ match {
        case 0 => _done__ = true
        case 10 =>
          __middlewareName = _input__.readStringRequireUtf8()
        case 18 =>
          __customMacaroonCaveatName = _input__.readStringRequireUtf8()
        case 24 =>
          __readOnlyMode = _input__.readBool()
        case tag =>
          if (_unknownFields__ == null) {
            _unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
          }
          _unknownFields__.parseField(tag, _input__)
      }
    }
    lnrpc.MiddlewareRegistration(
        middlewareName = __middlewareName,
        customMacaroonCaveatName = __customMacaroonCaveatName,
        readOnlyMode = __readOnlyMode,
        unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
    )
  }
  implicit def messageReads: _root_.scalapb.descriptors.Reads[lnrpc.MiddlewareRegistration] = _root_.scalapb.descriptors.Reads{
    case _root_.scalapb.descriptors.PMessage(__fieldsMap) =>
      _root_.scala.Predef.require(__fieldsMap.keys.forall(_.containingMessage eq scalaDescriptor), "FieldDescriptor does not match message type.")
      lnrpc.MiddlewareRegistration(
        middlewareName = __fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        customMacaroonCaveatName = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
        readOnlyMode = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Boolean]).getOrElse(false)
      )
    case _ => throw new RuntimeException("Expected PMessage")
  }
  def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = LightningProto.javaDescriptor.getMessageTypes().get(190)
  def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = LightningProto.scalaDescriptor.messages(190)
  def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = throw new MatchError(__number)
  lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
  def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = throw new MatchError(__fieldNumber)
  lazy val defaultInstance = lnrpc.MiddlewareRegistration(
    middlewareName = "",
    customMacaroonCaveatName = "",
    readOnlyMode = false
  )
  implicit class MiddlewareRegistrationLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, lnrpc.MiddlewareRegistration]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, lnrpc.MiddlewareRegistration](_l) {
    def middlewareName: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.middlewareName)((c_, f_) => c_.copy(middlewareName = f_))
    def customMacaroonCaveatName: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.customMacaroonCaveatName)((c_, f_) => c_.copy(customMacaroonCaveatName = f_))
    def readOnlyMode: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Boolean] = field(_.readOnlyMode)((c_, f_) => c_.copy(readOnlyMode = f_))
  }
  final val MIDDLEWARE_NAME_FIELD_NUMBER = 1
  final val CUSTOM_MACAROON_CAVEAT_NAME_FIELD_NUMBER = 2
  final val READ_ONLY_MODE_FIELD_NUMBER = 3
  def of(
    middlewareName: _root_.scala.Predef.String,
    customMacaroonCaveatName: _root_.scala.Predef.String,
    readOnlyMode: _root_.scala.Boolean
  ): _root_.lnrpc.MiddlewareRegistration = _root_.lnrpc.MiddlewareRegistration(
    middlewareName,
    customMacaroonCaveatName,
    readOnlyMode
  )
  // @@protoc_insertion_point(GeneratedMessageCompanion[lnrpc.MiddlewareRegistration])
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy