Skip to content

Commit

Permalink
Add language.proto for Auto API
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelprazak committed Dec 19, 2023
1 parent 025c45d commit 5e8ae3f
Show file tree
Hide file tree
Showing 32 changed files with 6,661 additions and 12 deletions.
2 changes: 1 addition & 1 deletion core/project.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//> using scala "3.3.1"
//> using options "-java-output-version:11", "-Ysafe-init", "-Xmax-inlines:64"
//> using options "-Werror", "-Wunused:all", "-deprecation", "-feature"
//> using options "-Wunused:all", "-feature"

//> using dep "org.virtuslab::besom-json:0.1.1-SNAPSHOT"

Expand Down
261 changes: 261 additions & 0 deletions core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/Diagnostic.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package pulumirpc.codegen.hcl

/** Diagnostic represents information to be presented to a user about an error or anomaly in parsing or evaluating configuration.
*
* @param summary
* Summary and Detail contain the English-language description of the
* problem. Summary is a terse description of the general problem and
* detail is a more elaborate, often-multi-sentence description of
* the problem and what might be done to solve it.
* @param subject
* Subject and Context are both source ranges relating to the diagnostic.
*
* Subject is a tight range referring to exactly the construct that
* is problematic, while Context is an optional broader range (which should
* fully contain Subject) that ought to be shown around Subject when
* generating isolated source-code snippets in diagnostic messages.
* If Context is nil, the Subject is also the Context.
*
* Some diagnostics have no source ranges at all. If Context is set then
* Subject should always also be set.
*/
@SerialVersionUID(0L)
final case class Diagnostic(
severity: pulumirpc.codegen.hcl.DiagnosticSeverity = pulumirpc.codegen.hcl.DiagnosticSeverity.DIAG_INVALID,
summary: _root_.scala.Predef.String = "",
detail: _root_.scala.Predef.String = "",
subject: _root_.scala.Option[pulumirpc.codegen.hcl.Range] = _root_.scala.None,
context: _root_.scala.Option[pulumirpc.codegen.hcl.Range] = _root_.scala.None,
unknownFields: _root_.scalapb.UnknownFieldSet = _root_.scalapb.UnknownFieldSet.empty
) extends scalapb.GeneratedMessage with scalapb.lenses.Updatable[Diagnostic] {
@transient
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0

{
val __value = severity.value
if (__value != 0) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeEnumSize(1, __value)
}
};

{
val __value = summary
if (!__value.isEmpty) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(2, __value)
}
};

{
val __value = detail
if (!__value.isEmpty) {
__size += _root_.com.google.protobuf.CodedOutputStream.computeStringSize(3, __value)
}
};
if (subject.isDefined) {
val __value = subject.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
if (context.isDefined) {
val __value = context.get
__size += 1 + _root_.com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
__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 = severity.value
if (__v != 0) {
_output__.writeEnum(1, __v)
}
};
{
val __v = summary
if (!__v.isEmpty) {
_output__.writeString(2, __v)
}
};
{
val __v = detail
if (!__v.isEmpty) {
_output__.writeString(3, __v)
}
};
subject.foreach { __v =>
val __m = __v
_output__.writeTag(4, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
context.foreach { __v =>
val __m = __v
_output__.writeTag(5, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
unknownFields.writeTo(_output__)
}
def withSeverity(__v: pulumirpc.codegen.hcl.DiagnosticSeverity): Diagnostic = copy(severity = __v)
def withSummary(__v: _root_.scala.Predef.String): Diagnostic = copy(summary = __v)
def withDetail(__v: _root_.scala.Predef.String): Diagnostic = copy(detail = __v)
def getSubject: pulumirpc.codegen.hcl.Range = subject.getOrElse(pulumirpc.codegen.hcl.Range.defaultInstance)
def clearSubject: Diagnostic = copy(subject = _root_.scala.None)
def withSubject(__v: pulumirpc.codegen.hcl.Range): Diagnostic = copy(subject = Option(__v))
def getContext: pulumirpc.codegen.hcl.Range = context.getOrElse(pulumirpc.codegen.hcl.Range.defaultInstance)
def clearContext: Diagnostic = copy(context = _root_.scala.None)
def withContext(__v: pulumirpc.codegen.hcl.Range): Diagnostic = copy(context = Option(__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 = severity.javaValueDescriptor
if (__t.getNumber() != 0) __t else null
}
case 2 => {
val __t = summary
if (__t != "") __t else null
}
case 3 => {
val __t = detail
if (__t != "") __t else null
}
case 4 => subject.orNull
case 5 => context.orNull
}
}
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.PEnum(severity.scalaValueDescriptor)
case 2 => _root_.scalapb.descriptors.PString(summary)
case 3 => _root_.scalapb.descriptors.PString(detail)
case 4 => subject.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
case 5 => context.map(_.toPMessage).getOrElse(_root_.scalapb.descriptors.PEmpty)
}
}
def toProtoString: _root_.scala.Predef.String = _root_.scalapb.TextFormat.printToUnicodeString(this)
def companion: pulumirpc.codegen.hcl.Diagnostic.type = pulumirpc.codegen.hcl.Diagnostic
// @@protoc_insertion_point(GeneratedMessage[pulumirpc.codegen.Diagnostic])
}

object Diagnostic extends scalapb.GeneratedMessageCompanion[pulumirpc.codegen.hcl.Diagnostic] {
implicit def messageCompanion: scalapb.GeneratedMessageCompanion[pulumirpc.codegen.hcl.Diagnostic] = this
def parseFrom(`_input__`: _root_.com.google.protobuf.CodedInputStream): pulumirpc.codegen.hcl.Diagnostic = {
var __severity: pulumirpc.codegen.hcl.DiagnosticSeverity = pulumirpc.codegen.hcl.DiagnosticSeverity.DIAG_INVALID
var __summary: _root_.scala.Predef.String = ""
var __detail: _root_.scala.Predef.String = ""
var __subject: _root_.scala.Option[pulumirpc.codegen.hcl.Range] = _root_.scala.None
var __context: _root_.scala.Option[pulumirpc.codegen.hcl.Range] = _root_.scala.None
var `_unknownFields__`: _root_.scalapb.UnknownFieldSet.Builder = null
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 8 =>
__severity = pulumirpc.codegen.hcl.DiagnosticSeverity.fromValue(_input__.readEnum())
case 18 =>
__summary = _input__.readStringRequireUtf8()
case 26 =>
__detail = _input__.readStringRequireUtf8()
case 34 =>
__subject = Option(__subject.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.codegen.hcl.Range](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case 42 =>
__context = Option(__context.fold(_root_.scalapb.LiteParser.readMessage[pulumirpc.codegen.hcl.Range](_input__))(_root_.scalapb.LiteParser.readMessage(_input__, _)))
case tag =>
if (_unknownFields__ == null) {
_unknownFields__ = new _root_.scalapb.UnknownFieldSet.Builder()
}
_unknownFields__.parseField(tag, _input__)
}
}
pulumirpc.codegen.hcl.Diagnostic(
severity = __severity,
summary = __summary,
detail = __detail,
subject = __subject,
context = __context,
unknownFields = if (_unknownFields__ == null) _root_.scalapb.UnknownFieldSet.empty else _unknownFields__.result()
)
}
implicit def messageReads: _root_.scalapb.descriptors.Reads[pulumirpc.codegen.hcl.Diagnostic] = _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.")
pulumirpc.codegen.hcl.Diagnostic(
severity = pulumirpc.codegen.hcl.DiagnosticSeverity.fromValue(__fieldsMap.get(scalaDescriptor.findFieldByNumber(1).get).map(_.as[_root_.scalapb.descriptors.EnumValueDescriptor]).getOrElse(pulumirpc.codegen.hcl.DiagnosticSeverity.DIAG_INVALID.scalaValueDescriptor).number),
summary = __fieldsMap.get(scalaDescriptor.findFieldByNumber(2).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
detail = __fieldsMap.get(scalaDescriptor.findFieldByNumber(3).get).map(_.as[_root_.scala.Predef.String]).getOrElse(""),
subject = __fieldsMap.get(scalaDescriptor.findFieldByNumber(4).get).flatMap(_.as[_root_.scala.Option[pulumirpc.codegen.hcl.Range]]),
context = __fieldsMap.get(scalaDescriptor.findFieldByNumber(5).get).flatMap(_.as[_root_.scala.Option[pulumirpc.codegen.hcl.Range]])
)
case _ => throw new RuntimeException("Expected PMessage")
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.Descriptor = HclProto.javaDescriptor.getMessageTypes().get(2)
def scalaDescriptor: _root_.scalapb.descriptors.Descriptor = HclProto.scalaDescriptor.messages(2)
def messageCompanionForFieldNumber(__number: _root_.scala.Int): _root_.scalapb.GeneratedMessageCompanion[_] = {
var __out: _root_.scalapb.GeneratedMessageCompanion[_] = null
(__number: @_root_.scala.unchecked) match {
case 4 => __out = pulumirpc.codegen.hcl.Range
case 5 => __out = pulumirpc.codegen.hcl.Range
}
__out
}
lazy val nestedMessagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] = Seq.empty
def enumCompanionForFieldNumber(__fieldNumber: _root_.scala.Int): _root_.scalapb.GeneratedEnumCompanion[_] = {
(__fieldNumber: @_root_.scala.unchecked) match {
case 1 => pulumirpc.codegen.hcl.DiagnosticSeverity
}
}
lazy val defaultInstance = pulumirpc.codegen.hcl.Diagnostic(
severity = pulumirpc.codegen.hcl.DiagnosticSeverity.DIAG_INVALID,
summary = "",
detail = "",
subject = _root_.scala.None,
context = _root_.scala.None
)
implicit class DiagnosticLens[UpperPB](_l: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.codegen.hcl.Diagnostic]) extends _root_.scalapb.lenses.ObjectLens[UpperPB, pulumirpc.codegen.hcl.Diagnostic](_l) {
def severity: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.codegen.hcl.DiagnosticSeverity] = field(_.severity)((c_, f_) => c_.copy(severity = f_))
def summary: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.summary)((c_, f_) => c_.copy(summary = f_))
def detail: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Predef.String] = field(_.detail)((c_, f_) => c_.copy(detail = f_))
def subject: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.codegen.hcl.Range] = field(_.getSubject)((c_, f_) => c_.copy(subject = Option(f_)))
def optionalSubject: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.codegen.hcl.Range]] = field(_.subject)((c_, f_) => c_.copy(subject = f_))
def context: _root_.scalapb.lenses.Lens[UpperPB, pulumirpc.codegen.hcl.Range] = field(_.getContext)((c_, f_) => c_.copy(context = Option(f_)))
def optionalContext: _root_.scalapb.lenses.Lens[UpperPB, _root_.scala.Option[pulumirpc.codegen.hcl.Range]] = field(_.context)((c_, f_) => c_.copy(context = f_))
}
final val SEVERITY_FIELD_NUMBER = 1
final val SUMMARY_FIELD_NUMBER = 2
final val DETAIL_FIELD_NUMBER = 3
final val SUBJECT_FIELD_NUMBER = 4
final val CONTEXT_FIELD_NUMBER = 5
def of(
severity: pulumirpc.codegen.hcl.DiagnosticSeverity,
summary: _root_.scala.Predef.String,
detail: _root_.scala.Predef.String,
subject: _root_.scala.Option[pulumirpc.codegen.hcl.Range],
context: _root_.scala.Option[pulumirpc.codegen.hcl.Range]
): _root_.pulumirpc.codegen.hcl.Diagnostic = _root_.pulumirpc.codegen.hcl.Diagnostic(
severity,
summary,
detail,
subject,
context
)
// @@protoc_insertion_point(GeneratedMessageCompanion[pulumirpc.codegen.Diagnostic])
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package pulumirpc.codegen.hcl

/** DiagnosticSeverity is the severity level of a diagnostic message.
*/
sealed abstract class DiagnosticSeverity(val value: _root_.scala.Int) extends _root_.scalapb.GeneratedEnum {
type EnumType = pulumirpc.codegen.hcl.DiagnosticSeverity
type RecognizedType = pulumirpc.codegen.hcl.DiagnosticSeverity.Recognized
def isDiagInvalid: _root_.scala.Boolean = false
def isDiagError: _root_.scala.Boolean = false
def isDiagWarning: _root_.scala.Boolean = false
def companion: _root_.scalapb.GeneratedEnumCompanion[DiagnosticSeverity] = pulumirpc.codegen.hcl.DiagnosticSeverity
final def asRecognized: _root_.scala.Option[pulumirpc.codegen.hcl.DiagnosticSeverity.Recognized] = if (isUnrecognized) _root_.scala.None else _root_.scala.Some(this.asInstanceOf[pulumirpc.codegen.hcl.DiagnosticSeverity.Recognized])
}

object DiagnosticSeverity extends _root_.scalapb.GeneratedEnumCompanion[DiagnosticSeverity] {
sealed trait Recognized extends DiagnosticSeverity
implicit def enumCompanion: _root_.scalapb.GeneratedEnumCompanion[DiagnosticSeverity] = this

/** DIAG_INVALID is the invalid zero value of DiagnosticSeverity
*/
@SerialVersionUID(0L)
case object DIAG_INVALID extends DiagnosticSeverity(0) with DiagnosticSeverity.Recognized {
val index = 0
val name = "DIAG_INVALID"
override def isDiagInvalid: _root_.scala.Boolean = true
}

/** DIAG_ERROR indicates that the problem reported by a diagnostic prevents
* further progress in parsing and/or evaluating the subject.
*/
@SerialVersionUID(0L)
case object DIAG_ERROR extends DiagnosticSeverity(1) with DiagnosticSeverity.Recognized {
val index = 1
val name = "DIAG_ERROR"
override def isDiagError: _root_.scala.Boolean = true
}

/** DIAG_WARNING indicates that the problem reported by a diagnostic warrants
* user attention but does not prevent further progress. It is most
* commonly used for showing deprecation notices.
*/
@SerialVersionUID(0L)
case object DIAG_WARNING extends DiagnosticSeverity(2) with DiagnosticSeverity.Recognized {
val index = 2
val name = "DIAG_WARNING"
override def isDiagWarning: _root_.scala.Boolean = true
}

@SerialVersionUID(0L)
final case class Unrecognized(unrecognizedValue: _root_.scala.Int) extends DiagnosticSeverity(unrecognizedValue) with _root_.scalapb.UnrecognizedEnum
lazy val values: scala.collection.immutable.Seq[ValueType] = scala.collection.immutable.Seq(DIAG_INVALID, DIAG_ERROR, DIAG_WARNING)
def fromValue(__value: _root_.scala.Int): DiagnosticSeverity = __value match {
case 0 => DIAG_INVALID
case 1 => DIAG_ERROR
case 2 => DIAG_WARNING
case __other => Unrecognized(__other)
}
def javaDescriptor: _root_.com.google.protobuf.Descriptors.EnumDescriptor = HclProto.javaDescriptor.getEnumTypes().get(0)
def scalaDescriptor: _root_.scalapb.descriptors.EnumDescriptor = HclProto.scalaDescriptor.enums(0)
}
41 changes: 41 additions & 0 deletions core/src/main/scala/besom/rpc/pulumirpc/codegen/hcl/HclProto.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package pulumirpc.codegen.hcl

object HclProto extends _root_.scalapb.GeneratedFileObject {
lazy val dependencies: Seq[_root_.scalapb.GeneratedFileObject] = Seq.empty
lazy val messagesCompanions: Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]] =
Seq[_root_.scalapb.GeneratedMessageCompanion[_ <: _root_.scalapb.GeneratedMessage]](
pulumirpc.codegen.hcl.Pos,
pulumirpc.codegen.hcl.Range,
pulumirpc.codegen.hcl.Diagnostic
)
private lazy val ProtoBytes: _root_.scala.Array[Byte] =
scalapb.Encoding.fromBase64(scala.collection.immutable.Se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My9wcm90by9nby9jb2RlZ2VuYgZwcm90bzM="""
).mkString)
lazy val scalaDescriptor: _root_.scalapb.descriptors.FileDescriptor = {
val scalaProto = com.google.protobuf.descriptor.FileDescriptorProto.parseFrom(ProtoBytes)
_root_.scalapb.descriptors.FileDescriptor.buildFrom(scalaProto, dependencies.map(_.scalaDescriptor))
}
lazy val javaDescriptor: com.google.protobuf.Descriptors.FileDescriptor = {
val javaProto = com.google.protobuf.DescriptorProtos.FileDescriptorProto.parseFrom(ProtoBytes)
com.google.protobuf.Descriptors.FileDescriptor.buildFrom(javaProto, _root_.scala.Array(
))
}
@deprecated("Use javaDescriptor instead. In a future version this will refer to scalaDescriptor.", "ScalaPB 0.5.47")
def descriptor: com.google.protobuf.Descriptors.FileDescriptor = javaDescriptor
}
Loading

0 comments on commit 5e8ae3f

Please sign in to comment.