From 7deaf249870c30cfa6a877f5958f36f2a1eef4e8 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Sun, 4 Mar 2018 21:38:52 -0800 Subject: [PATCH] The very first cut of .NET Support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just enough to manually invoke the resource providers, but code like the following worked: ``` [matell@matell bucket]$ cat Pulumi.yaml name: bucket runtime: dotnet [matell@matell bucket]$ cat main.csx using Pulumi; using System; using System.Runtime.InteropServices; Config config = new Config("bucket"); CustomResource r = new CustomResource("aws:s3/bucket:Bucket", config["name"]); [matell@matell bucket]$ pulumi update Performing changes: info: Running with 🍹 on .NET Core 4.6.00001.0 on Linux 4.14.11-300.fc27.x86_64 #1 SMP Wed Jan 3 13:52:28 UTC 2018 + pulumi:pulumi:Stack: (create) [urn=urn:pulumi:dotnet-testing::bucket::pulumi:pulumi:Stack::bucket-dotnet-testing] + aws:s3/bucket:Bucket: (create) [urn=urn:pulumi:dotnet-testing::bucket::aws:s3/bucket:Bucket::hello-aws-from-dotnet] acl : "private" bucket : "hello-aws-from-dotnet-a37c2a3" forceDestroy: false ---outputs:--- arn : "arn:aws:s3:::hello-aws-from-dotnet-a37c2a3" bucketDomainName : "hello-aws-from-dotnet-a37c2a3.s3.amazonaws.com" hostedZoneId : "Z3BJ6K6RIION7M" id : "hello-aws-from-dotnet-a37c2a3" region : "us-west-2" requestPayer : "BucketOwner" versioning : [ [0]: { enabled : false mfaDelete: false } ] info: 2 changes performed: + 2 resources created Update duration: 11.799058053s [matell@matell bucket]$ ``` --- sdk/dotnet/.gitignore | 3 + sdk/dotnet/Pulumi.Host/.vscode/launch.json | 28 + sdk/dotnet/Pulumi.Host/.vscode/tasks.json | 27 + sdk/dotnet/Pulumi.Host/Program.cs | 63 + .../pulumi-language-dotnet-exec.csproj | 21 + sdk/dotnet/Pulumi/ComponentResource.cs | 14 + sdk/dotnet/Pulumi/Config.cs | 34 + sdk/dotnet/Pulumi/CustomResource.cs | 15 + sdk/dotnet/Pulumi/Log.cs | 19 + sdk/dotnet/Pulumi/Pulumi.csproj | 15 + sdk/dotnet/Pulumi/Resource.cs | 44 + sdk/dotnet/Pulumi/ResourceOptions.cs | 17 + sdk/dotnet/Pulumi/Runtime.cs | 55 + sdk/dotnet/Pulumirpc/Analyzer.cs | 471 ++++ sdk/dotnet/Pulumirpc/AnalyzerGrpc.cs | 206 ++ sdk/dotnet/Pulumirpc/Engine.cs | 221 ++ sdk/dotnet/Pulumirpc/EngineGrpc.cs | 140 + sdk/dotnet/Pulumirpc/Language.cs | 831 ++++++ sdk/dotnet/Pulumirpc/LanguageGrpc.cs | 271 ++ sdk/dotnet/Pulumirpc/Plugin.cs | 351 +++ sdk/dotnet/Pulumirpc/Provider.cs | 2248 +++++++++++++++++ sdk/dotnet/Pulumirpc/ProviderGrpc.cs | 619 +++++ sdk/dotnet/Pulumirpc/Pulumirpc.csproj | 13 + sdk/dotnet/Pulumirpc/Resource.cs | 772 ++++++ sdk/dotnet/Pulumirpc/ResourceGrpc.cs | 168 ++ sdk/dotnet/Pulumirpc/generate.sh | 2 + sdk/dotnet/README.md | 4 + sdk/dotnet/cmd/pulumi-language-dotnet/main.go | 225 ++ 28 files changed, 6897 insertions(+) create mode 100644 sdk/dotnet/.gitignore create mode 100644 sdk/dotnet/Pulumi.Host/.vscode/launch.json create mode 100644 sdk/dotnet/Pulumi.Host/.vscode/tasks.json create mode 100644 sdk/dotnet/Pulumi.Host/Program.cs create mode 100644 sdk/dotnet/Pulumi.Host/pulumi-language-dotnet-exec.csproj create mode 100644 sdk/dotnet/Pulumi/ComponentResource.cs create mode 100644 sdk/dotnet/Pulumi/Config.cs create mode 100644 sdk/dotnet/Pulumi/CustomResource.cs create mode 100644 sdk/dotnet/Pulumi/Log.cs create mode 100644 sdk/dotnet/Pulumi/Pulumi.csproj create mode 100644 sdk/dotnet/Pulumi/Resource.cs create mode 100644 sdk/dotnet/Pulumi/ResourceOptions.cs create mode 100644 sdk/dotnet/Pulumi/Runtime.cs create mode 100644 sdk/dotnet/Pulumirpc/Analyzer.cs create mode 100644 sdk/dotnet/Pulumirpc/AnalyzerGrpc.cs create mode 100644 sdk/dotnet/Pulumirpc/Engine.cs create mode 100644 sdk/dotnet/Pulumirpc/EngineGrpc.cs create mode 100644 sdk/dotnet/Pulumirpc/Language.cs create mode 100644 sdk/dotnet/Pulumirpc/LanguageGrpc.cs create mode 100644 sdk/dotnet/Pulumirpc/Plugin.cs create mode 100644 sdk/dotnet/Pulumirpc/Provider.cs create mode 100644 sdk/dotnet/Pulumirpc/ProviderGrpc.cs create mode 100644 sdk/dotnet/Pulumirpc/Pulumirpc.csproj create mode 100644 sdk/dotnet/Pulumirpc/Resource.cs create mode 100644 sdk/dotnet/Pulumirpc/ResourceGrpc.cs create mode 100755 sdk/dotnet/Pulumirpc/generate.sh create mode 100644 sdk/dotnet/README.md create mode 100644 sdk/dotnet/cmd/pulumi-language-dotnet/main.go diff --git a/sdk/dotnet/.gitignore b/sdk/dotnet/.gitignore new file mode 100644 index 000000000..18ec11aa4 --- /dev/null +++ b/sdk/dotnet/.gitignore @@ -0,0 +1,3 @@ +[Bb]in/ +[Oo]bj/ + diff --git a/sdk/dotnet/Pulumi.Host/.vscode/launch.json b/sdk/dotnet/Pulumi.Host/.vscode/launch.json new file mode 100644 index 000000000..ae2693219 --- /dev/null +++ b/sdk/dotnet/Pulumi.Host/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/DummyHost.dll", + "args": [], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window + "console": "internalConsole", + "stopAtEntry": false, + "internalConsoleOptions": "openOnSessionStart" + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ] +} \ No newline at end of file diff --git a/sdk/dotnet/Pulumi.Host/.vscode/tasks.json b/sdk/dotnet/Pulumi.Host/.vscode/tasks.json new file mode 100644 index 000000000..cae878570 --- /dev/null +++ b/sdk/dotnet/Pulumi.Host/.vscode/tasks.json @@ -0,0 +1,27 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/pulumi-language-dotnet-exec.csproj" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "-r", + "linux-x64", + "${workspaceFolder}/pulumi-language-dotnet-exec.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/sdk/dotnet/Pulumi.Host/Program.cs b/sdk/dotnet/Pulumi.Host/Program.cs new file mode 100644 index 000000000..c24175cc3 --- /dev/null +++ b/sdk/dotnet/Pulumi.Host/Program.cs @@ -0,0 +1,63 @@ +using Grpc.Core; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Scripting; +using Microsoft.CodeAnalysis.Scripting; +using Microsoft.CodeAnalysis.Scripting.Hosting; +using Mono.Options; +using Pulumi; +using Pulumirpc; +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.IO; +using System.Runtime.InteropServices; + +namespace Pulumi.Host +{ + class Program + { + static void Main(string[] args) + { + string monitor = ""; + string engine = ""; + string project = ""; + string stack = ""; + string pwd = ""; + string dryRun = ""; + int parallel = 1; + string tracing = ""; + + OptionSet o = new OptionSet { + {"monitor=", "", m => monitor = m }, + {"engine=", "", e => engine = e}, + {"project=", "", p => project = p}, + {"stack=", "", s => stack = s }, + {"pwd=", "", wd => pwd = wd}, + {"dry_run=", dry => dryRun = dry}, + {"parallel=", (int n) => parallel = n}, + {"tracing=", t => tracing = t}, + }; + + List extra = o.Parse(args); + + Channel engineChannel = new Channel(engine, ChannelCredentials.Insecure); + Channel monitorChannel = new Channel(monitor, ChannelCredentials.Insecure); + + Runtime.Initialize(new Runtime.Settings(new Engine.EngineClient(engineChannel), + new ResourceMonitor.ResourceMonitorClient(monitorChannel), + stack, project, parallel, true)); + + Console.WriteLine($"Running with \U0001F379 on {RuntimeInformation.FrameworkDescription} on {RuntimeInformation.OSDescription}"); + + Script script = CSharpScript.Create(File.OpenRead("main.csx")); + script.Compile(); + Runtime.RunInStack(() => { + script.RunAsync().Wait(); + }); + + engineChannel.ShutdownAsync().Wait(); + monitorChannel.ShutdownAsync().Wait(); + } + } +} + diff --git a/sdk/dotnet/Pulumi.Host/pulumi-language-dotnet-exec.csproj b/sdk/dotnet/Pulumi.Host/pulumi-language-dotnet-exec.csproj new file mode 100644 index 000000000..1cbe71539 --- /dev/null +++ b/sdk/dotnet/Pulumi.Host/pulumi-language-dotnet-exec.csproj @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + Exe + netcoreapp2.0 + + + diff --git a/sdk/dotnet/Pulumi/ComponentResource.cs b/sdk/dotnet/Pulumi/ComponentResource.cs new file mode 100644 index 000000000..88846226e --- /dev/null +++ b/sdk/dotnet/Pulumi/ComponentResource.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; + +namespace Pulumi +{ + + public class ComponentResource : Resource + { + public ComponentResource(string type, string name, Dictionary properties = null, ResourceOptions options = default(ResourceOptions)) + { + Register(type, name, false, properties, options); + } + } +} \ No newline at end of file diff --git a/sdk/dotnet/Pulumi/Config.cs b/sdk/dotnet/Pulumi/Config.cs new file mode 100644 index 000000000..15de8c3d8 --- /dev/null +++ b/sdk/dotnet/Pulumi/Config.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Pulumi { + public class Config { + private string m_prefix; + + private static Dictionary s_config = loadConfig(); + + static Dictionary loadConfig() { + string envValue = Environment.GetEnvironmentVariable("PULUMI_CONFIG"); + if (envValue != null) { + return JsonConvert.DeserializeObject>(envValue); + } + + return new Dictionary(); + } + + public Config(string name) { + m_prefix = name; + } + + private string FullKey(string name) { + return m_prefix + ":" + name; + } + + public string this[string name] { + get { + return s_config[FullKey(name)]; + } + } + } +} \ No newline at end of file diff --git a/sdk/dotnet/Pulumi/CustomResource.cs b/sdk/dotnet/Pulumi/CustomResource.cs new file mode 100644 index 000000000..fbb9ac49b --- /dev/null +++ b/sdk/dotnet/Pulumi/CustomResource.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Pulumi { + + public class CustomResource : Resource { + public string Id {get; internal set;} + + public CustomResource(string type, string name, Dictionary properties = null, ResourceOptions options = default(ResourceOptions)) { + var res = Register(type, name, true, properties, options); + + Id = res.Id; + } + } +} \ No newline at end of file diff --git a/sdk/dotnet/Pulumi/Log.cs b/sdk/dotnet/Pulumi/Log.cs new file mode 100644 index 000000000..ae1e7724c --- /dev/null +++ b/sdk/dotnet/Pulumi/Log.cs @@ -0,0 +1,19 @@ +using Pulumirpc; + +namespace Pulumi { + public static class Log { + public static void Info(string format, params object[] args) { + Runtime.Engine.Log(new Pulumirpc.LogRequest { + Severity = LogSeverity.Info, + Message = string.Format(format, args) + }); + } + + public static void Warning(string format, params object[] args) { + Runtime.Engine.Log(new Pulumirpc.LogRequest { + Severity = LogSeverity.Warning, + Message = string.Format(format, args) + }); + } + } +} diff --git a/sdk/dotnet/Pulumi/Pulumi.csproj b/sdk/dotnet/Pulumi/Pulumi.csproj new file mode 100644 index 000000000..e52383b70 --- /dev/null +++ b/sdk/dotnet/Pulumi/Pulumi.csproj @@ -0,0 +1,15 @@ + + + + + + + + + + + + netstandard2.0 + + + diff --git a/sdk/dotnet/Pulumi/Resource.cs b/sdk/dotnet/Pulumi/Resource.cs new file mode 100644 index 000000000..ee0a3bf4a --- /dev/null +++ b/sdk/dotnet/Pulumi/Resource.cs @@ -0,0 +1,44 @@ +using Pulumirpc; +using System; +using System.Collections.Generic; + +namespace Pulumi +{ + public abstract class Resource + { + public string Urn { get; private set; } + + public const string UnkownResourceId = "04da6b54-80e4-46f7-96ec-b56ff0331ba9"; + + public Resource() + { + } + + protected RegisterResourceResponse Register(string type, string name, bool custom, Dictionary properties, ResourceOptions options) { + if (string.IsNullOrEmpty(type)) + { + throw new ArgumentException(nameof(type)); + } + + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentException(nameof(name)); + } + + RegisterResourceResponse res = Runtime.Monitor.RegisterResource( + new RegisterResourceRequest() + { + Type = type, + Name = name, + Custom = custom, + Protect = false, + Object = new Google.Protobuf.WellKnownTypes.Struct(), + Parent = options.Parent?.Urn ?? Runtime.Root?.Urn ?? "", + }); + + Urn = res.Urn; + + return res; + } + } +} \ No newline at end of file diff --git a/sdk/dotnet/Pulumi/ResourceOptions.cs b/sdk/dotnet/Pulumi/ResourceOptions.cs new file mode 100644 index 000000000..70f3ca7d5 --- /dev/null +++ b/sdk/dotnet/Pulumi/ResourceOptions.cs @@ -0,0 +1,17 @@ +using System; + +namespace Pulumi { + public struct ResourceOptions { + public static ResourceOptions None = default(ResourceOptions); + + public Resource Parent {get; set;} + public Resource[] DependsOn {get; set;} + public bool Protect {get; set;} + + public ResourceOptions WithParent(Resource parent) { + var n = this; + n.Parent = parent; + return n; + } + } +} \ No newline at end of file diff --git a/sdk/dotnet/Pulumi/Runtime.cs b/sdk/dotnet/Pulumi/Runtime.cs new file mode 100644 index 000000000..a04816d93 --- /dev/null +++ b/sdk/dotnet/Pulumi/Runtime.cs @@ -0,0 +1,55 @@ +using System; +using Pulumirpc; + +namespace Pulumi +{ + public static class Runtime + { + public static string Stack { get; private set; } + + public static Engine.EngineClient Engine { get; private set; } + + public static ResourceMonitor.ResourceMonitorClient Monitor { get; private set; } + + public static string Project { get; private set; } + + public static bool DryRun { get; private set; } + + internal static ComponentResource Root {get; private set;} + + public static void Initialize(Settings settings) + { + Engine = settings.Engine; + Monitor = settings.Monitor; + Project = settings.Project; + Stack = settings.Stack; + DryRun = DryRun; + } + + public static void RunInStack(Action run) + { + Root = new ComponentResource("pulumi:pulumi:Stack", $"{Runtime.Project}-{Runtime.Stack}", null, ResourceOptions.None); + run(); + } + + public class Settings + { + public string Project { get; set; } + public Engine.EngineClient Engine { get; set; } + public ResourceMonitor.ResourceMonitorClient Monitor { get; set; } + public string Stack { get; set; } + public int Parallel { get; set; } + public bool DryRun { get; set; } + + public Settings(Engine.EngineClient engineClient, ResourceMonitor.ResourceMonitorClient monitorClient, string stack, string project, int parallel, bool dryRun) + { + Engine = engineClient; + Monitor = monitorClient; + Stack = stack; + Project = project; + Parallel = parallel; + DryRun = dryRun; + } + } + } +} \ No newline at end of file diff --git a/sdk/dotnet/Pulumirpc/Analyzer.cs b/sdk/dotnet/Pulumirpc/Analyzer.cs new file mode 100644 index 000000000..ac50eec72 --- /dev/null +++ b/sdk/dotnet/Pulumirpc/Analyzer.cs @@ -0,0 +1,471 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: analyzer.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Pulumirpc { + + /// Holder for reflection information generated from analyzer.proto + public static partial class AnalyzerReflection { + + #region Descriptor + /// File descriptor for analyzer.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static AnalyzerReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cg5hbmFseXplci5wcm90bxIJcHVsdW1pcnBjGgxwbHVnaW4ucHJvdG8aG2dv", + "b2dsZS9wcm90b2J1Zi9lbXB0eS5wcm90bxocZ29vZ2xlL3Byb3RvYnVmL3N0", + "cnVjdC5wcm90byJLCg5BbmFseXplUmVxdWVzdBIMCgR0eXBlGAEgASgJEisK", + "CnByb3BlcnRpZXMYAiABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0Ij4K", + "D0FuYWx5emVSZXNwb25zZRIrCghmYWlsdXJlcxgBIAMoCzIZLnB1bHVtaXJw", + "Yy5BbmFseXplRmFpbHVyZSIyCg5BbmFseXplRmFpbHVyZRIQCghwcm9wZXJ0", + "eRgBIAEoCRIOCgZyZWFzb24YAiABKAkykAEKCEFuYWx5emVyEkIKB0FuYWx5", + "emUSGS5wdWx1bWlycGMuQW5hbHl6ZVJlcXVlc3QaGi5wdWx1bWlycGMuQW5h", + "bHl6ZVJlc3BvbnNlIgASQAoNR2V0UGx1Z2luSW5mbxIWLmdvb2dsZS5wcm90", + "b2J1Zi5FbXB0eRoVLnB1bHVtaXJwYy5QbHVnaW5JbmZvIgBiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Pulumirpc.PluginReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.AnalyzeRequest), global::Pulumirpc.AnalyzeRequest.Parser, new[]{ "Type", "Properties" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.AnalyzeResponse), global::Pulumirpc.AnalyzeResponse.Parser, new[]{ "Failures" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.AnalyzeFailure), global::Pulumirpc.AnalyzeFailure.Parser, new[]{ "Property", "Reason" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class AnalyzeRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AnalyzeRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.AnalyzerReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnalyzeRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnalyzeRequest(AnalyzeRequest other) : this() { + type_ = other.type_; + Properties = other.properties_ != null ? other.Properties.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnalyzeRequest Clone() { + return new AnalyzeRequest(this); + } + + /// Field number for the "type" field. + public const int TypeFieldNumber = 1; + private string type_ = ""; + /// + /// the type token of the resource. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Type { + get { return type_; } + set { + type_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "properties" field. + public const int PropertiesFieldNumber = 2; + private global::Google.Protobuf.WellKnownTypes.Struct properties_; + /// + /// the full properties to use for validation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Properties { + get { return properties_; } + set { + properties_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AnalyzeRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AnalyzeRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Type != other.Type) return false; + if (!object.Equals(Properties, other.Properties)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Type.Length != 0) hash ^= Type.GetHashCode(); + if (properties_ != null) hash ^= Properties.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Type.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Type); + } + if (properties_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Properties); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Type.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Type); + } + if (properties_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Properties); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AnalyzeRequest other) { + if (other == null) { + return; + } + if (other.Type.Length != 0) { + Type = other.Type; + } + if (other.properties_ != null) { + if (properties_ == null) { + properties_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Properties.MergeFrom(other.Properties); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Type = input.ReadString(); + break; + } + case 18: { + if (properties_ == null) { + properties_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(properties_); + break; + } + } + } + } + + } + + public sealed partial class AnalyzeResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AnalyzeResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.AnalyzerReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnalyzeResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnalyzeResponse(AnalyzeResponse other) : this() { + failures_ = other.failures_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnalyzeResponse Clone() { + return new AnalyzeResponse(this); + } + + /// Field number for the "failures" field. + public const int FailuresFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_failures_codec + = pb::FieldCodec.ForMessage(10, global::Pulumirpc.AnalyzeFailure.Parser); + private readonly pbc::RepeatedField failures_ = new pbc::RepeatedField(); + /// + /// the failures (or empty if none). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Failures { + get { return failures_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AnalyzeResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AnalyzeResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!failures_.Equals(other.failures_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= failures_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + failures_.WriteTo(output, _repeated_failures_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += failures_.CalculateSize(_repeated_failures_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AnalyzeResponse other) { + if (other == null) { + return; + } + failures_.Add(other.failures_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + failures_.AddEntriesFrom(input, _repeated_failures_codec); + break; + } + } + } + } + + } + + public sealed partial class AnalyzeFailure : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AnalyzeFailure()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.AnalyzerReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnalyzeFailure() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnalyzeFailure(AnalyzeFailure other) : this() { + property_ = other.property_; + reason_ = other.reason_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnalyzeFailure Clone() { + return new AnalyzeFailure(this); + } + + /// Field number for the "property" field. + public const int PropertyFieldNumber = 1; + private string property_ = ""; + /// + /// the property that the analyzer rejected (or "" if general). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Property { + get { return property_; } + set { + property_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "reason" field. + public const int ReasonFieldNumber = 2; + private string reason_ = ""; + /// + /// the reason that the analyzer rejected the request. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Reason { + get { return reason_; } + set { + reason_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AnalyzeFailure); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AnalyzeFailure other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Property != other.Property) return false; + if (Reason != other.Reason) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Property.Length != 0) hash ^= Property.GetHashCode(); + if (Reason.Length != 0) hash ^= Reason.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Property.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Property); + } + if (Reason.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Reason); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Property.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Property); + } + if (Reason.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Reason); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AnalyzeFailure other) { + if (other == null) { + return; + } + if (other.Property.Length != 0) { + Property = other.Property; + } + if (other.Reason.Length != 0) { + Reason = other.Reason; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Property = input.ReadString(); + break; + } + case 18: { + Reason = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/sdk/dotnet/Pulumirpc/AnalyzerGrpc.cs b/sdk/dotnet/Pulumirpc/AnalyzerGrpc.cs new file mode 100644 index 000000000..ec507ef94 --- /dev/null +++ b/sdk/dotnet/Pulumirpc/AnalyzerGrpc.cs @@ -0,0 +1,206 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: analyzer.proto +// +// Original file comments: +// Copyright 2016-2017, Pulumi Corporation. All rights reserved. +// +#pragma warning disable 1591 +#region Designer generated code + +using System; +using System.Threading; +using System.Threading.Tasks; +using grpc = global::Grpc.Core; + +namespace Pulumirpc { + /// + /// Analyzer is a pluggable service that checks entire projects/stacks/snapshots, and/or individual resources, + /// for arbitrary issues. These might be style, policy, correctness, security, or performance related. + /// + public static partial class Analyzer + { + static readonly string __ServiceName = "pulumirpc.Analyzer"; + + static readonly grpc::Marshaller __Marshaller_AnalyzeRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.AnalyzeRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_AnalyzeResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.AnalyzeResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_PluginInfo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.PluginInfo.Parser.ParseFrom); + + static readonly grpc::Method __Method_Analyze = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Analyze", + __Marshaller_AnalyzeRequest, + __Marshaller_AnalyzeResponse); + + static readonly grpc::Method __Method_GetPluginInfo = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetPluginInfo", + __Marshaller_Empty, + __Marshaller_PluginInfo); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Pulumirpc.AnalyzerReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of Analyzer + public abstract partial class AnalyzerBase + { + /// + /// Analyze analyzes a single resource object, and returns any errors that it finds. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Analyze(global::Pulumirpc.AnalyzeRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for Analyzer + public partial class AnalyzerClient : grpc::ClientBase + { + /// Creates a new client for Analyzer + /// The channel to use to make remote calls. + public AnalyzerClient(grpc::Channel channel) : base(channel) + { + } + /// Creates a new client for Analyzer that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public AnalyzerClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected AnalyzerClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected AnalyzerClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Analyze analyzes a single resource object, and returns any errors that it finds. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Pulumirpc.AnalyzeResponse Analyze(global::Pulumirpc.AnalyzeRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return Analyze(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Analyze analyzes a single resource object, and returns any errors that it finds. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Pulumirpc.AnalyzeResponse Analyze(global::Pulumirpc.AnalyzeRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Analyze, null, options, request); + } + /// + /// Analyze analyzes a single resource object, and returns any errors that it finds. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall AnalyzeAsync(global::Pulumirpc.AnalyzeRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return AnalyzeAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Analyze analyzes a single resource object, and returns any errors that it finds. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall AnalyzeAsync(global::Pulumirpc.AnalyzeRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Analyze, null, options, request); + } + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Pulumirpc.PluginInfo GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return GetPluginInfo(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Pulumirpc.PluginInfo GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetPluginInfo, null, options, request); + } + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall GetPluginInfoAsync(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return GetPluginInfoAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall GetPluginInfoAsync(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetPluginInfo, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override AnalyzerClient NewInstance(ClientBaseConfiguration configuration) + { + return new AnalyzerClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(AnalyzerBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_Analyze, serviceImpl.Analyze) + .AddMethod(__Method_GetPluginInfo, serviceImpl.GetPluginInfo).Build(); + } + + } +} +#endregion diff --git a/sdk/dotnet/Pulumirpc/Engine.cs b/sdk/dotnet/Pulumirpc/Engine.cs new file mode 100644 index 000000000..42f3ef3d5 --- /dev/null +++ b/sdk/dotnet/Pulumirpc/Engine.cs @@ -0,0 +1,221 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: engine.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Pulumirpc { + + /// Holder for reflection information generated from engine.proto + public static partial class EngineReflection { + + #region Descriptor + /// File descriptor for engine.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static EngineReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CgxlbmdpbmUucHJvdG8SCXB1bHVtaXJwYxobZ29vZ2xlL3Byb3RvYnVmL2Vt", + "cHR5LnByb3RvIkcKCkxvZ1JlcXVlc3QSKAoIc2V2ZXJpdHkYASABKA4yFi5w", + "dWx1bWlycGMuTG9nU2V2ZXJpdHkSDwoHbWVzc2FnZRgCIAEoCSo6CgtMb2dT", + "ZXZlcml0eRIJCgVERUJVRxAAEggKBElORk8QARILCgdXQVJOSU5HEAISCQoF", + "RVJST1IQAzJACgZFbmdpbmUSNgoDTG9nEhUucHVsdW1pcnBjLkxvZ1JlcXVl", + "c3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiAGIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Pulumirpc.LogSeverity), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.LogRequest), global::Pulumirpc.LogRequest.Parser, new[]{ "Severity", "Message" }, null, null, null) + })); + } + #endregion + + } + #region Enums + /// + /// LogSeverity is the severity level of a log message. Errors are fatal; all others are informational. + /// + public enum LogSeverity { + /// + /// a debug-level message not displayed to end-users (the default). + /// + [pbr::OriginalName("DEBUG")] Debug = 0, + /// + /// an informational message printed to output during resource operations. + /// + [pbr::OriginalName("INFO")] Info = 1, + /// + /// a warning to indicate that something went wrong. + /// + [pbr::OriginalName("WARNING")] Warning = 2, + /// + /// a fatal error indicating that the tool should stop processing subsequent resource operations. + /// + [pbr::OriginalName("ERROR")] Error = 3, + } + + #endregion + + #region Messages + public sealed partial class LogRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LogRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.EngineReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public LogRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public LogRequest(LogRequest other) : this() { + severity_ = other.severity_; + message_ = other.message_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public LogRequest Clone() { + return new LogRequest(this); + } + + /// Field number for the "severity" field. + public const int SeverityFieldNumber = 1; + private global::Pulumirpc.LogSeverity severity_ = 0; + /// + /// the logging level of this message. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Pulumirpc.LogSeverity Severity { + get { return severity_; } + set { + severity_ = value; + } + } + + /// Field number for the "message" field. + public const int MessageFieldNumber = 2; + private string message_ = ""; + /// + /// the contents of the logged message. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Message { + get { return message_; } + set { + message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as LogRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(LogRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Severity != other.Severity) return false; + if (Message != other.Message) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Severity != 0) hash ^= Severity.GetHashCode(); + if (Message.Length != 0) hash ^= Message.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Severity != 0) { + output.WriteRawTag(8); + output.WriteEnum((int) Severity); + } + if (Message.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Message); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Severity != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Severity); + } + if (Message.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(LogRequest other) { + if (other == null) { + return; + } + if (other.Severity != 0) { + Severity = other.Severity; + } + if (other.Message.Length != 0) { + Message = other.Message; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + severity_ = (global::Pulumirpc.LogSeverity) input.ReadEnum(); + break; + } + case 18: { + Message = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/sdk/dotnet/Pulumirpc/EngineGrpc.cs b/sdk/dotnet/Pulumirpc/EngineGrpc.cs new file mode 100644 index 000000000..ad7b2621e --- /dev/null +++ b/sdk/dotnet/Pulumirpc/EngineGrpc.cs @@ -0,0 +1,140 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: engine.proto +// +// Original file comments: +// Copyright 2016-2017, Pulumi Corporation. All rights reserved. +// +#pragma warning disable 1591 +#region Designer generated code + +using System; +using System.Threading; +using System.Threading.Tasks; +using grpc = global::Grpc.Core; + +namespace Pulumirpc { + /// + /// Engine is an interface into the core engine responsible for orchestrating resource operations. + /// + public static partial class Engine + { + static readonly string __ServiceName = "pulumirpc.Engine"; + + static readonly grpc::Marshaller __Marshaller_LogRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.LogRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); + + static readonly grpc::Method __Method_Log = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Log", + __Marshaller_LogRequest, + __Marshaller_Empty); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Pulumirpc.EngineReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of Engine + public abstract partial class EngineBase + { + /// + /// Log logs a global message in the engine, including errors and warnings. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Log(global::Pulumirpc.LogRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for Engine + public partial class EngineClient : grpc::ClientBase + { + /// Creates a new client for Engine + /// The channel to use to make remote calls. + public EngineClient(grpc::Channel channel) : base(channel) + { + } + /// Creates a new client for Engine that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public EngineClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected EngineClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected EngineClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Log logs a global message in the engine, including errors and warnings. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Google.Protobuf.WellKnownTypes.Empty Log(global::Pulumirpc.LogRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return Log(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Log logs a global message in the engine, including errors and warnings. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Google.Protobuf.WellKnownTypes.Empty Log(global::Pulumirpc.LogRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Log, null, options, request); + } + /// + /// Log logs a global message in the engine, including errors and warnings. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall LogAsync(global::Pulumirpc.LogRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return LogAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Log logs a global message in the engine, including errors and warnings. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall LogAsync(global::Pulumirpc.LogRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Log, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override EngineClient NewInstance(ClientBaseConfiguration configuration) + { + return new EngineClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(EngineBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_Log, serviceImpl.Log).Build(); + } + + } +} +#endregion diff --git a/sdk/dotnet/Pulumirpc/Language.cs b/sdk/dotnet/Pulumirpc/Language.cs new file mode 100644 index 000000000..2e1d1cbef --- /dev/null +++ b/sdk/dotnet/Pulumirpc/Language.cs @@ -0,0 +1,831 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: language.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Pulumirpc { + + /// Holder for reflection information generated from language.proto + public static partial class LanguageReflection { + + #region Descriptor + /// File descriptor for language.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static LanguageReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cg5sYW5ndWFnZS5wcm90bxIJcHVsdW1pcnBjGgxwbHVnaW4ucHJvdG8aG2dv", + "b2dsZS9wcm90b2J1Zi9lbXB0eS5wcm90byJKChlHZXRSZXF1aXJlZFBsdWdp", + "bnNSZXF1ZXN0Eg8KB3Byb2plY3QYASABKAkSCwoDcHdkGAIgASgJEg8KB3By", + "b2dyYW0YAyABKAkiSgoaR2V0UmVxdWlyZWRQbHVnaW5zUmVzcG9uc2USLAoH", + "cGx1Z2lucxgBIAMoCzIbLnB1bHVtaXJwYy5QbHVnaW5EZXBlbmRlbmN5IvUB", + "CgpSdW5SZXF1ZXN0Eg8KB3Byb2plY3QYASABKAkSDQoFc3RhY2sYAiABKAkS", + "CwoDcHdkGAMgASgJEg8KB3Byb2dyYW0YBCABKAkSDAoEYXJncxgFIAMoCRIx", + "CgZjb25maWcYBiADKAsyIS5wdWx1bWlycGMuUnVuUmVxdWVzdC5Db25maWdF", + "bnRyeRIOCgZkcnlSdW4YByABKAgSEAoIcGFyYWxsZWwYCCABKAUSFwoPbW9u", + "aXRvcl9hZGRyZXNzGAkgASgJGi0KC0NvbmZpZ0VudHJ5EgsKA2tleRgBIAEo", + "CRINCgV2YWx1ZRgCIAEoCToCOAEiHAoLUnVuUmVzcG9uc2USDQoFZXJyb3IY", + "ASABKAky8AEKD0xhbmd1YWdlUnVudGltZRJjChJHZXRSZXF1aXJlZFBsdWdp", + "bnMSJC5wdWx1bWlycGMuR2V0UmVxdWlyZWRQbHVnaW5zUmVxdWVzdBolLnB1", + "bHVtaXJwYy5HZXRSZXF1aXJlZFBsdWdpbnNSZXNwb25zZSIAEjYKA1J1bhIV", + "LnB1bHVtaXJwYy5SdW5SZXF1ZXN0GhYucHVsdW1pcnBjLlJ1blJlc3BvbnNl", + "IgASQAoNR2V0UGx1Z2luSW5mbxIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRoV", + "LnB1bHVtaXJwYy5QbHVnaW5JbmZvIgBiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Pulumirpc.PluginReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.GetRequiredPluginsRequest), global::Pulumirpc.GetRequiredPluginsRequest.Parser, new[]{ "Project", "Pwd", "Program" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.GetRequiredPluginsResponse), global::Pulumirpc.GetRequiredPluginsResponse.Parser, new[]{ "Plugins" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.RunRequest), global::Pulumirpc.RunRequest.Parser, new[]{ "Project", "Stack", "Pwd", "Program", "Args", "Config", "DryRun", "Parallel", "MonitorAddress" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.RunResponse), global::Pulumirpc.RunResponse.Parser, new[]{ "Error" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class GetRequiredPluginsRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetRequiredPluginsRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.LanguageReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetRequiredPluginsRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetRequiredPluginsRequest(GetRequiredPluginsRequest other) : this() { + project_ = other.project_; + pwd_ = other.pwd_; + program_ = other.program_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetRequiredPluginsRequest Clone() { + return new GetRequiredPluginsRequest(this); + } + + /// Field number for the "project" field. + public const int ProjectFieldNumber = 1; + private string project_ = ""; + /// + /// the project name. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Project { + get { return project_; } + set { + project_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "pwd" field. + public const int PwdFieldNumber = 2; + private string pwd_ = ""; + /// + /// the program's working directory. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Pwd { + get { return pwd_; } + set { + pwd_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "program" field. + public const int ProgramFieldNumber = 3; + private string program_ = ""; + /// + /// the path to the program. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Program { + get { return program_; } + set { + program_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetRequiredPluginsRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetRequiredPluginsRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Project != other.Project) return false; + if (Pwd != other.Pwd) return false; + if (Program != other.Program) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Project.Length != 0) hash ^= Project.GetHashCode(); + if (Pwd.Length != 0) hash ^= Pwd.GetHashCode(); + if (Program.Length != 0) hash ^= Program.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Project.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Project); + } + if (Pwd.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Pwd); + } + if (Program.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Program); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Project.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Project); + } + if (Pwd.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Pwd); + } + if (Program.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Program); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetRequiredPluginsRequest other) { + if (other == null) { + return; + } + if (other.Project.Length != 0) { + Project = other.Project; + } + if (other.Pwd.Length != 0) { + Pwd = other.Pwd; + } + if (other.Program.Length != 0) { + Program = other.Program; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Project = input.ReadString(); + break; + } + case 18: { + Pwd = input.ReadString(); + break; + } + case 26: { + Program = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class GetRequiredPluginsResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetRequiredPluginsResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.LanguageReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetRequiredPluginsResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetRequiredPluginsResponse(GetRequiredPluginsResponse other) : this() { + plugins_ = other.plugins_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GetRequiredPluginsResponse Clone() { + return new GetRequiredPluginsResponse(this); + } + + /// Field number for the "plugins" field. + public const int PluginsFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_plugins_codec + = pb::FieldCodec.ForMessage(10, global::Pulumirpc.PluginDependency.Parser); + private readonly pbc::RepeatedField plugins_ = new pbc::RepeatedField(); + /// + /// a list of plugins required by this program. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Plugins { + get { return plugins_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GetRequiredPluginsResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GetRequiredPluginsResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!plugins_.Equals(other.plugins_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= plugins_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + plugins_.WriteTo(output, _repeated_plugins_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += plugins_.CalculateSize(_repeated_plugins_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GetRequiredPluginsResponse other) { + if (other == null) { + return; + } + plugins_.Add(other.plugins_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + plugins_.AddEntriesFrom(input, _repeated_plugins_codec); + break; + } + } + } + } + + } + + /// + /// RunRequest asks the interpreter to execute a program. + /// + public sealed partial class RunRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RunRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.LanguageReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RunRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RunRequest(RunRequest other) : this() { + project_ = other.project_; + stack_ = other.stack_; + pwd_ = other.pwd_; + program_ = other.program_; + args_ = other.args_.Clone(); + config_ = other.config_.Clone(); + dryRun_ = other.dryRun_; + parallel_ = other.parallel_; + monitorAddress_ = other.monitorAddress_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RunRequest Clone() { + return new RunRequest(this); + } + + /// Field number for the "project" field. + public const int ProjectFieldNumber = 1; + private string project_ = ""; + /// + /// the project name. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Project { + get { return project_; } + set { + project_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "stack" field. + public const int StackFieldNumber = 2; + private string stack_ = ""; + /// + /// the name of the stack being deployed into. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Stack { + get { return stack_; } + set { + stack_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "pwd" field. + public const int PwdFieldNumber = 3; + private string pwd_ = ""; + /// + /// the program's working directory. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Pwd { + get { return pwd_; } + set { + pwd_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "program" field. + public const int ProgramFieldNumber = 4; + private string program_ = ""; + /// + /// the path to the program to execute. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Program { + get { return program_; } + set { + program_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "args" field. + public const int ArgsFieldNumber = 5; + private static readonly pb::FieldCodec _repeated_args_codec + = pb::FieldCodec.ForString(42); + private readonly pbc::RepeatedField args_ = new pbc::RepeatedField(); + /// + /// any arguments to pass to the program. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Args { + get { return args_; } + } + + /// Field number for the "config" field. + public const int ConfigFieldNumber = 6; + private static readonly pbc::MapField.Codec _map_config_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 50); + private readonly pbc::MapField config_ = new pbc::MapField(); + /// + /// the configuration variables to apply before running. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Config { + get { return config_; } + } + + /// Field number for the "dryRun" field. + public const int DryRunFieldNumber = 7; + private bool dryRun_; + /// + /// true if we're only doing a dryrun (preview). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool DryRun { + get { return dryRun_; } + set { + dryRun_ = value; + } + } + + /// Field number for the "parallel" field. + public const int ParallelFieldNumber = 8; + private int parallel_; + /// + /// the degree of parallelism for resource operations (<=1 for serial). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Parallel { + get { return parallel_; } + set { + parallel_ = value; + } + } + + /// Field number for the "monitor_address" field. + public const int MonitorAddressFieldNumber = 9; + private string monitorAddress_ = ""; + /// + /// the address for communicating back to the resource monitor. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string MonitorAddress { + get { return monitorAddress_; } + set { + monitorAddress_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RunRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RunRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Project != other.Project) return false; + if (Stack != other.Stack) return false; + if (Pwd != other.Pwd) return false; + if (Program != other.Program) return false; + if(!args_.Equals(other.args_)) return false; + if (!Config.Equals(other.Config)) return false; + if (DryRun != other.DryRun) return false; + if (Parallel != other.Parallel) return false; + if (MonitorAddress != other.MonitorAddress) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Project.Length != 0) hash ^= Project.GetHashCode(); + if (Stack.Length != 0) hash ^= Stack.GetHashCode(); + if (Pwd.Length != 0) hash ^= Pwd.GetHashCode(); + if (Program.Length != 0) hash ^= Program.GetHashCode(); + hash ^= args_.GetHashCode(); + hash ^= Config.GetHashCode(); + if (DryRun != false) hash ^= DryRun.GetHashCode(); + if (Parallel != 0) hash ^= Parallel.GetHashCode(); + if (MonitorAddress.Length != 0) hash ^= MonitorAddress.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Project.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Project); + } + if (Stack.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Stack); + } + if (Pwd.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Pwd); + } + if (Program.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Program); + } + args_.WriteTo(output, _repeated_args_codec); + config_.WriteTo(output, _map_config_codec); + if (DryRun != false) { + output.WriteRawTag(56); + output.WriteBool(DryRun); + } + if (Parallel != 0) { + output.WriteRawTag(64); + output.WriteInt32(Parallel); + } + if (MonitorAddress.Length != 0) { + output.WriteRawTag(74); + output.WriteString(MonitorAddress); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Project.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Project); + } + if (Stack.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Stack); + } + if (Pwd.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Pwd); + } + if (Program.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Program); + } + size += args_.CalculateSize(_repeated_args_codec); + size += config_.CalculateSize(_map_config_codec); + if (DryRun != false) { + size += 1 + 1; + } + if (Parallel != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Parallel); + } + if (MonitorAddress.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(MonitorAddress); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RunRequest other) { + if (other == null) { + return; + } + if (other.Project.Length != 0) { + Project = other.Project; + } + if (other.Stack.Length != 0) { + Stack = other.Stack; + } + if (other.Pwd.Length != 0) { + Pwd = other.Pwd; + } + if (other.Program.Length != 0) { + Program = other.Program; + } + args_.Add(other.args_); + config_.Add(other.config_); + if (other.DryRun != false) { + DryRun = other.DryRun; + } + if (other.Parallel != 0) { + Parallel = other.Parallel; + } + if (other.MonitorAddress.Length != 0) { + MonitorAddress = other.MonitorAddress; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Project = input.ReadString(); + break; + } + case 18: { + Stack = input.ReadString(); + break; + } + case 26: { + Pwd = input.ReadString(); + break; + } + case 34: { + Program = input.ReadString(); + break; + } + case 42: { + args_.AddEntriesFrom(input, _repeated_args_codec); + break; + } + case 50: { + config_.AddEntriesFrom(input, _map_config_codec); + break; + } + case 56: { + DryRun = input.ReadBool(); + break; + } + case 64: { + Parallel = input.ReadInt32(); + break; + } + case 74: { + MonitorAddress = input.ReadString(); + break; + } + } + } + } + + } + + /// + /// RunResponse is the response back from the interpreter/source back to the monitor. + /// + public sealed partial class RunResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RunResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.LanguageReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RunResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RunResponse(RunResponse other) : this() { + error_ = other.error_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RunResponse Clone() { + return new RunResponse(this); + } + + /// Field number for the "error" field. + public const int ErrorFieldNumber = 1; + private string error_ = ""; + /// + /// an unhandled error if any occurred. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Error { + get { return error_; } + set { + error_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RunResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RunResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Error != other.Error) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Error.Length != 0) hash ^= Error.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Error.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Error); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Error.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Error); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RunResponse other) { + if (other == null) { + return; + } + if (other.Error.Length != 0) { + Error = other.Error; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Error = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/sdk/dotnet/Pulumirpc/LanguageGrpc.cs b/sdk/dotnet/Pulumirpc/LanguageGrpc.cs new file mode 100644 index 000000000..9621bc1ec --- /dev/null +++ b/sdk/dotnet/Pulumirpc/LanguageGrpc.cs @@ -0,0 +1,271 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: language.proto +// +// Original file comments: +// Copyright 2016-2017, Pulumi Corporation. All rights reserved. +// +#pragma warning disable 1591 +#region Designer generated code + +using System; +using System.Threading; +using System.Threading.Tasks; +using grpc = global::Grpc.Core; + +namespace Pulumirpc { + /// + /// LanguageRuntime is the interface that the planning monitor uses to drive execution of an interpreter responsible + /// for confguring and creating resource objects. + /// + public static partial class LanguageRuntime + { + static readonly string __ServiceName = "pulumirpc.LanguageRuntime"; + + static readonly grpc::Marshaller __Marshaller_GetRequiredPluginsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.GetRequiredPluginsRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_GetRequiredPluginsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.GetRequiredPluginsResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RunRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.RunRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RunResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.RunResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_PluginInfo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.PluginInfo.Parser.ParseFrom); + + static readonly grpc::Method __Method_GetRequiredPlugins = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetRequiredPlugins", + __Marshaller_GetRequiredPluginsRequest, + __Marshaller_GetRequiredPluginsResponse); + + static readonly grpc::Method __Method_Run = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Run", + __Marshaller_RunRequest, + __Marshaller_RunResponse); + + static readonly grpc::Method __Method_GetPluginInfo = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetPluginInfo", + __Marshaller_Empty, + __Marshaller_PluginInfo); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Pulumirpc.LanguageReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of LanguageRuntime + public abstract partial class LanguageRuntimeBase + { + /// + /// GetRequiredPlugins computes the complete set of anticipated plugins required by a program. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task GetRequiredPlugins(global::Pulumirpc.GetRequiredPluginsRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Run executes a program and returns its result. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Run(global::Pulumirpc.RunRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for LanguageRuntime + public partial class LanguageRuntimeClient : grpc::ClientBase + { + /// Creates a new client for LanguageRuntime + /// The channel to use to make remote calls. + public LanguageRuntimeClient(grpc::Channel channel) : base(channel) + { + } + /// Creates a new client for LanguageRuntime that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public LanguageRuntimeClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected LanguageRuntimeClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected LanguageRuntimeClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// GetRequiredPlugins computes the complete set of anticipated plugins required by a program. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Pulumirpc.GetRequiredPluginsResponse GetRequiredPlugins(global::Pulumirpc.GetRequiredPluginsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return GetRequiredPlugins(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// GetRequiredPlugins computes the complete set of anticipated plugins required by a program. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Pulumirpc.GetRequiredPluginsResponse GetRequiredPlugins(global::Pulumirpc.GetRequiredPluginsRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetRequiredPlugins, null, options, request); + } + /// + /// GetRequiredPlugins computes the complete set of anticipated plugins required by a program. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall GetRequiredPluginsAsync(global::Pulumirpc.GetRequiredPluginsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return GetRequiredPluginsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// GetRequiredPlugins computes the complete set of anticipated plugins required by a program. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall GetRequiredPluginsAsync(global::Pulumirpc.GetRequiredPluginsRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetRequiredPlugins, null, options, request); + } + /// + /// Run executes a program and returns its result. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Pulumirpc.RunResponse Run(global::Pulumirpc.RunRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return Run(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Run executes a program and returns its result. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Pulumirpc.RunResponse Run(global::Pulumirpc.RunRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Run, null, options, request); + } + /// + /// Run executes a program and returns its result. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall RunAsync(global::Pulumirpc.RunRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return RunAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Run executes a program and returns its result. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall RunAsync(global::Pulumirpc.RunRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Run, null, options, request); + } + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Pulumirpc.PluginInfo GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return GetPluginInfo(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Pulumirpc.PluginInfo GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetPluginInfo, null, options, request); + } + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall GetPluginInfoAsync(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return GetPluginInfoAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall GetPluginInfoAsync(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetPluginInfo, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override LanguageRuntimeClient NewInstance(ClientBaseConfiguration configuration) + { + return new LanguageRuntimeClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(LanguageRuntimeBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_GetRequiredPlugins, serviceImpl.GetRequiredPlugins) + .AddMethod(__Method_Run, serviceImpl.Run) + .AddMethod(__Method_GetPluginInfo, serviceImpl.GetPluginInfo).Build(); + } + + } +} +#endregion diff --git a/sdk/dotnet/Pulumirpc/Plugin.cs b/sdk/dotnet/Pulumirpc/Plugin.cs new file mode 100644 index 000000000..185325d3a --- /dev/null +++ b/sdk/dotnet/Pulumirpc/Plugin.cs @@ -0,0 +1,351 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: plugin.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Pulumirpc { + + /// Holder for reflection information generated from plugin.proto + public static partial class PluginReflection { + + #region Descriptor + /// File descriptor for plugin.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static PluginReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CgxwbHVnaW4ucHJvdG8SCXB1bHVtaXJwYyIdCgpQbHVnaW5JbmZvEg8KB3Zl", + "cnNpb24YASABKAkiPwoQUGx1Z2luRGVwZW5kZW5jeRIMCgRuYW1lGAEgASgJ", + "EgwKBGtpbmQYAiABKAkSDwoHdmVyc2lvbhgDIAEoCWIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.PluginInfo), global::Pulumirpc.PluginInfo.Parser, new[]{ "Version" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.PluginDependency), global::Pulumirpc.PluginDependency.Parser, new[]{ "Name", "Kind", "Version" }, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// PluginInfo is meta-information about a plugin that is used by the system. + /// + public sealed partial class PluginInfo : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PluginInfo()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.PluginReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PluginInfo() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PluginInfo(PluginInfo other) : this() { + version_ = other.version_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PluginInfo Clone() { + return new PluginInfo(this); + } + + /// Field number for the "version" field. + public const int VersionFieldNumber = 1; + private string version_ = ""; + /// + /// the semver for this plugin. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Version { + get { return version_; } + set { + version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as PluginInfo); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(PluginInfo other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Version != other.Version) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Version.Length != 0) hash ^= Version.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Version.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Version); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Version.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(PluginInfo other) { + if (other == null) { + return; + } + if (other.Version.Length != 0) { + Version = other.Version; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Version = input.ReadString(); + break; + } + } + } + } + + } + + /// + /// PluginDependency is information about a plugin that a program may depend upon. + /// + public sealed partial class PluginDependency : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PluginDependency()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.PluginReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PluginDependency() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PluginDependency(PluginDependency other) : this() { + name_ = other.name_; + kind_ = other.kind_; + version_ = other.version_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public PluginDependency Clone() { + return new PluginDependency(this); + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 1; + private string name_ = ""; + /// + /// the name of the plugin. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "kind" field. + public const int KindFieldNumber = 2; + private string kind_ = ""; + /// + /// the kind of plugin (e.g., language, etc). + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Kind { + get { return kind_; } + set { + kind_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "version" field. + public const int VersionFieldNumber = 3; + private string version_ = ""; + /// + /// the semver for this plugin. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Version { + get { return version_; } + set { + version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as PluginDependency); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(PluginDependency other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (Kind != other.Kind) return false; + if (Version != other.Version) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Kind.Length != 0) hash ^= Kind.GetHashCode(); + if (Version.Length != 0) hash ^= Version.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (Kind.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Kind); + } + if (Version.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Version); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Kind.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Kind); + } + if (Version.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(PluginDependency other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Kind.Length != 0) { + Kind = other.Kind; + } + if (other.Version.Length != 0) { + Version = other.Version; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + Kind = input.ReadString(); + break; + } + case 26: { + Version = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/sdk/dotnet/Pulumirpc/Provider.cs b/sdk/dotnet/Pulumirpc/Provider.cs new file mode 100644 index 000000000..8cc218840 --- /dev/null +++ b/sdk/dotnet/Pulumirpc/Provider.cs @@ -0,0 +1,2248 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: provider.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Pulumirpc { + + /// Holder for reflection information generated from provider.proto + public static partial class ProviderReflection { + + #region Descriptor + /// File descriptor for provider.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ProviderReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cg5wcm92aWRlci5wcm90bxIJcHVsdW1pcnBjGgxwbHVnaW4ucHJvdG8aG2dv", + "b2dsZS9wcm90b2J1Zi9lbXB0eS5wcm90bxocZ29vZ2xlL3Byb3RvYnVmL3N0", + "cnVjdC5wcm90byKDAQoQQ29uZmlndXJlUmVxdWVzdBI9Cgl2YXJpYWJsZXMY", + "ASADKAsyKi5wdWx1bWlycGMuQ29uZmlndXJlUmVxdWVzdC5WYXJpYWJsZXNF", + "bnRyeRowCg5WYXJpYWJsZXNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUY", + "AiABKAk6AjgBIkMKDUludm9rZVJlcXVlc3QSCwoDdG9rGAEgASgJEiUKBGFy", + "Z3MYAiABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0ImQKDkludm9rZVJl", + "c3BvbnNlEicKBnJldHVybhgBIAEoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1", + "Y3QSKQoIZmFpbHVyZXMYAiADKAsyFy5wdWx1bWlycGMuQ2hlY2tGYWlsdXJl", + "ImkKDENoZWNrUmVxdWVzdBILCgN1cm4YASABKAkSJQoEb2xkcxgCIAEoCzIX", + "Lmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QSJQoEbmV3cxgDIAEoCzIXLmdvb2ds", + "ZS5wcm90b2J1Zi5TdHJ1Y3QiYwoNQ2hlY2tSZXNwb25zZRInCgZpbnB1dHMY", + "ASABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0EikKCGZhaWx1cmVzGAIg", + "AygLMhcucHVsdW1pcnBjLkNoZWNrRmFpbHVyZSIwCgxDaGVja0ZhaWx1cmUS", + "EAoIcHJvcGVydHkYASABKAkSDgoGcmVhc29uGAIgASgJInQKC0RpZmZSZXF1", + "ZXN0EgoKAmlkGAEgASgJEgsKA3VybhgCIAEoCRIlCgRvbGRzGAMgASgLMhcu", + "Z29vZ2xlLnByb3RvYnVmLlN0cnVjdBIlCgRuZXdzGAQgASgLMhcuZ29vZ2xl", + "LnByb3RvYnVmLlN0cnVjdCJOCgxEaWZmUmVzcG9uc2USEAoIcmVwbGFjZXMY", + "ASADKAkSDwoHc3RhYmxlcxgCIAMoCRIbChNkZWxldGVCZWZvcmVSZXBsYWNl", + "GAMgASgIIkkKDUNyZWF0ZVJlcXVlc3QSCwoDdXJuGAEgASgJEisKCnByb3Bl", + "cnRpZXMYAiABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0IkkKDkNyZWF0", + "ZVJlc3BvbnNlEgoKAmlkGAEgASgJEisKCnByb3BlcnRpZXMYAiABKAsyFy5n", + "b29nbGUucHJvdG9idWYuU3RydWN0InYKDVVwZGF0ZVJlcXVlc3QSCgoCaWQY", + "ASABKAkSCwoDdXJuGAIgASgJEiUKBG9sZHMYAyABKAsyFy5nb29nbGUucHJv", + "dG9idWYuU3RydWN0EiUKBG5ld3MYBCABKAsyFy5nb29nbGUucHJvdG9idWYu", + "U3RydWN0Ij0KDlVwZGF0ZVJlc3BvbnNlEisKCnByb3BlcnRpZXMYASABKAsy", + "Fy5nb29nbGUucHJvdG9idWYuU3RydWN0IlUKDURlbGV0ZVJlcXVlc3QSCgoC", + "aWQYASABKAkSCwoDdXJuGAIgASgJEisKCnByb3BlcnRpZXMYAyABKAsyFy5n", + "b29nbGUucHJvdG9idWYuU3RydWN0MpIEChBSZXNvdXJjZVByb3ZpZGVyEkIK", + "CUNvbmZpZ3VyZRIbLnB1bHVtaXJwYy5Db25maWd1cmVSZXF1ZXN0GhYuZ29v", + "Z2xlLnByb3RvYnVmLkVtcHR5IgASPwoGSW52b2tlEhgucHVsdW1pcnBjLklu", + "dm9rZVJlcXVlc3QaGS5wdWx1bWlycGMuSW52b2tlUmVzcG9uc2UiABI8CgVD", + "aGVjaxIXLnB1bHVtaXJwYy5DaGVja1JlcXVlc3QaGC5wdWx1bWlycGMuQ2hl", + "Y2tSZXNwb25zZSIAEjkKBERpZmYSFi5wdWx1bWlycGMuRGlmZlJlcXVlc3Qa", + "Fy5wdWx1bWlycGMuRGlmZlJlc3BvbnNlIgASPwoGQ3JlYXRlEhgucHVsdW1p", + "cnBjLkNyZWF0ZVJlcXVlc3QaGS5wdWx1bWlycGMuQ3JlYXRlUmVzcG9uc2Ui", + "ABI/CgZVcGRhdGUSGC5wdWx1bWlycGMuVXBkYXRlUmVxdWVzdBoZLnB1bHVt", + "aXJwYy5VcGRhdGVSZXNwb25zZSIAEjwKBkRlbGV0ZRIYLnB1bHVtaXJwYy5E", + "ZWxldGVSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASQAoNR2V0", + "UGx1Z2luSW5mbxIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRoVLnB1bHVtaXJw", + "Yy5QbHVnaW5JbmZvIgBiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Pulumirpc.PluginReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.ConfigureRequest), global::Pulumirpc.ConfigureRequest.Parser, new[]{ "Variables" }, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.InvokeRequest), global::Pulumirpc.InvokeRequest.Parser, new[]{ "Tok", "Args" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.InvokeResponse), global::Pulumirpc.InvokeResponse.Parser, new[]{ "Return", "Failures" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.CheckRequest), global::Pulumirpc.CheckRequest.Parser, new[]{ "Urn", "Olds", "News" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.CheckResponse), global::Pulumirpc.CheckResponse.Parser, new[]{ "Inputs", "Failures" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.CheckFailure), global::Pulumirpc.CheckFailure.Parser, new[]{ "Property", "Reason" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.DiffRequest), global::Pulumirpc.DiffRequest.Parser, new[]{ "Id", "Urn", "Olds", "News" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.DiffResponse), global::Pulumirpc.DiffResponse.Parser, new[]{ "Replaces", "Stables", "DeleteBeforeReplace" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.CreateRequest), global::Pulumirpc.CreateRequest.Parser, new[]{ "Urn", "Properties" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.CreateResponse), global::Pulumirpc.CreateResponse.Parser, new[]{ "Id", "Properties" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.UpdateRequest), global::Pulumirpc.UpdateRequest.Parser, new[]{ "Id", "Urn", "Olds", "News" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.UpdateResponse), global::Pulumirpc.UpdateResponse.Parser, new[]{ "Properties" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.DeleteRequest), global::Pulumirpc.DeleteRequest.Parser, new[]{ "Id", "Urn", "Properties" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ConfigureRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConfigureRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConfigureRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConfigureRequest(ConfigureRequest other) : this() { + variables_ = other.variables_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ConfigureRequest Clone() { + return new ConfigureRequest(this); + } + + /// Field number for the "variables" field. + public const int VariablesFieldNumber = 1; + private static readonly pbc::MapField.Codec _map_variables_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 10); + private readonly pbc::MapField variables_ = new pbc::MapField(); + /// + /// a map of configuration keys to values. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField Variables { + get { return variables_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ConfigureRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ConfigureRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!Variables.Equals(other.Variables)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= Variables.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + variables_.WriteTo(output, _map_variables_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += variables_.CalculateSize(_map_variables_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ConfigureRequest other) { + if (other == null) { + return; + } + variables_.Add(other.variables_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + variables_.AddEntriesFrom(input, _map_variables_codec); + break; + } + } + } + } + + } + + public sealed partial class InvokeRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InvokeRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public InvokeRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public InvokeRequest(InvokeRequest other) : this() { + tok_ = other.tok_; + Args = other.args_ != null ? other.Args.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public InvokeRequest Clone() { + return new InvokeRequest(this); + } + + /// Field number for the "tok" field. + public const int TokFieldNumber = 1; + private string tok_ = ""; + /// + /// the function token to invoke. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Tok { + get { return tok_; } + set { + tok_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "args" field. + public const int ArgsFieldNumber = 2; + private global::Google.Protobuf.WellKnownTypes.Struct args_; + /// + /// the arguments for the function invocation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Args { + get { return args_; } + set { + args_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as InvokeRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(InvokeRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Tok != other.Tok) return false; + if (!object.Equals(Args, other.Args)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Tok.Length != 0) hash ^= Tok.GetHashCode(); + if (args_ != null) hash ^= Args.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Tok.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Tok); + } + if (args_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Args); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Tok.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Tok); + } + if (args_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Args); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(InvokeRequest other) { + if (other == null) { + return; + } + if (other.Tok.Length != 0) { + Tok = other.Tok; + } + if (other.args_ != null) { + if (args_ == null) { + args_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Args.MergeFrom(other.Args); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Tok = input.ReadString(); + break; + } + case 18: { + if (args_ == null) { + args_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(args_); + break; + } + } + } + } + + } + + public sealed partial class InvokeResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InvokeResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public InvokeResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public InvokeResponse(InvokeResponse other) : this() { + Return = other.return_ != null ? other.Return.Clone() : null; + failures_ = other.failures_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public InvokeResponse Clone() { + return new InvokeResponse(this); + } + + /// Field number for the "return" field. + public const int ReturnFieldNumber = 1; + private global::Google.Protobuf.WellKnownTypes.Struct return_; + /// + /// the returned values, if invoke was successful. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Return { + get { return return_; } + set { + return_ = value; + } + } + + /// Field number for the "failures" field. + public const int FailuresFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_failures_codec + = pb::FieldCodec.ForMessage(18, global::Pulumirpc.CheckFailure.Parser); + private readonly pbc::RepeatedField failures_ = new pbc::RepeatedField(); + /// + /// the failures if any arguments didn't pass verification. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Failures { + get { return failures_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as InvokeResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(InvokeResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Return, other.Return)) return false; + if(!failures_.Equals(other.failures_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (return_ != null) hash ^= Return.GetHashCode(); + hash ^= failures_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (return_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Return); + } + failures_.WriteTo(output, _repeated_failures_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (return_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Return); + } + size += failures_.CalculateSize(_repeated_failures_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(InvokeResponse other) { + if (other == null) { + return; + } + if (other.return_ != null) { + if (return_ == null) { + return_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Return.MergeFrom(other.Return); + } + failures_.Add(other.failures_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + if (return_ == null) { + return_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(return_); + break; + } + case 18: { + failures_.AddEntriesFrom(input, _repeated_failures_codec); + break; + } + } + } + } + + } + + public sealed partial class CheckRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CheckRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CheckRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CheckRequest(CheckRequest other) : this() { + urn_ = other.urn_; + Olds = other.olds_ != null ? other.Olds.Clone() : null; + News = other.news_ != null ? other.News.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CheckRequest Clone() { + return new CheckRequest(this); + } + + /// Field number for the "urn" field. + public const int UrnFieldNumber = 1; + private string urn_ = ""; + /// + /// the Pulumi URN for this resource. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Urn { + get { return urn_; } + set { + urn_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "olds" field. + public const int OldsFieldNumber = 2; + private global::Google.Protobuf.WellKnownTypes.Struct olds_; + /// + /// the old Pulumi inputs for this resource, if any. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Olds { + get { return olds_; } + set { + olds_ = value; + } + } + + /// Field number for the "news" field. + public const int NewsFieldNumber = 3; + private global::Google.Protobuf.WellKnownTypes.Struct news_; + /// + /// the new Pulumi inputs for this resource. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct News { + get { return news_; } + set { + news_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CheckRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CheckRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Urn != other.Urn) return false; + if (!object.Equals(Olds, other.Olds)) return false; + if (!object.Equals(News, other.News)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Urn.Length != 0) hash ^= Urn.GetHashCode(); + if (olds_ != null) hash ^= Olds.GetHashCode(); + if (news_ != null) hash ^= News.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Urn.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Urn); + } + if (olds_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Olds); + } + if (news_ != null) { + output.WriteRawTag(26); + output.WriteMessage(News); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Urn.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Urn); + } + if (olds_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Olds); + } + if (news_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(News); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CheckRequest other) { + if (other == null) { + return; + } + if (other.Urn.Length != 0) { + Urn = other.Urn; + } + if (other.olds_ != null) { + if (olds_ == null) { + olds_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Olds.MergeFrom(other.Olds); + } + if (other.news_ != null) { + if (news_ == null) { + news_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + News.MergeFrom(other.News); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Urn = input.ReadString(); + break; + } + case 18: { + if (olds_ == null) { + olds_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(olds_); + break; + } + case 26: { + if (news_ == null) { + news_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(news_); + break; + } + } + } + } + + } + + public sealed partial class CheckResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CheckResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CheckResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CheckResponse(CheckResponse other) : this() { + Inputs = other.inputs_ != null ? other.Inputs.Clone() : null; + failures_ = other.failures_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CheckResponse Clone() { + return new CheckResponse(this); + } + + /// Field number for the "inputs" field. + public const int InputsFieldNumber = 1; + private global::Google.Protobuf.WellKnownTypes.Struct inputs_; + /// + /// the provider inputs for this resource. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Inputs { + get { return inputs_; } + set { + inputs_ = value; + } + } + + /// Field number for the "failures" field. + public const int FailuresFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_failures_codec + = pb::FieldCodec.ForMessage(18, global::Pulumirpc.CheckFailure.Parser); + private readonly pbc::RepeatedField failures_ = new pbc::RepeatedField(); + /// + /// any validation failures that occurred. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Failures { + get { return failures_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CheckResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CheckResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Inputs, other.Inputs)) return false; + if(!failures_.Equals(other.failures_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (inputs_ != null) hash ^= Inputs.GetHashCode(); + hash ^= failures_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (inputs_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Inputs); + } + failures_.WriteTo(output, _repeated_failures_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (inputs_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Inputs); + } + size += failures_.CalculateSize(_repeated_failures_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CheckResponse other) { + if (other == null) { + return; + } + if (other.inputs_ != null) { + if (inputs_ == null) { + inputs_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Inputs.MergeFrom(other.Inputs); + } + failures_.Add(other.failures_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + if (inputs_ == null) { + inputs_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(inputs_); + break; + } + case 18: { + failures_.AddEntriesFrom(input, _repeated_failures_codec); + break; + } + } + } + } + + } + + public sealed partial class CheckFailure : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CheckFailure()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CheckFailure() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CheckFailure(CheckFailure other) : this() { + property_ = other.property_; + reason_ = other.reason_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CheckFailure Clone() { + return new CheckFailure(this); + } + + /// Field number for the "property" field. + public const int PropertyFieldNumber = 1; + private string property_ = ""; + /// + /// the property that failed validation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Property { + get { return property_; } + set { + property_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "reason" field. + public const int ReasonFieldNumber = 2; + private string reason_ = ""; + /// + /// the reason that the property failed validation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Reason { + get { return reason_; } + set { + reason_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CheckFailure); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CheckFailure other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Property != other.Property) return false; + if (Reason != other.Reason) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Property.Length != 0) hash ^= Property.GetHashCode(); + if (Reason.Length != 0) hash ^= Reason.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Property.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Property); + } + if (Reason.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Reason); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Property.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Property); + } + if (Reason.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Reason); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CheckFailure other) { + if (other == null) { + return; + } + if (other.Property.Length != 0) { + Property = other.Property; + } + if (other.Reason.Length != 0) { + Reason = other.Reason; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Property = input.ReadString(); + break; + } + case 18: { + Reason = input.ReadString(); + break; + } + } + } + } + + } + + public sealed partial class DiffRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DiffRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DiffRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DiffRequest(DiffRequest other) : this() { + id_ = other.id_; + urn_ = other.urn_; + Olds = other.olds_ != null ? other.Olds.Clone() : null; + News = other.news_ != null ? other.News.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DiffRequest Clone() { + return new DiffRequest(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// the ID of the resource to diff. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "urn" field. + public const int UrnFieldNumber = 2; + private string urn_ = ""; + /// + /// the Pulumi URN for this resource. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Urn { + get { return urn_; } + set { + urn_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "olds" field. + public const int OldsFieldNumber = 3; + private global::Google.Protobuf.WellKnownTypes.Struct olds_; + /// + /// the old values of provider inputs to diff. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Olds { + get { return olds_; } + set { + olds_ = value; + } + } + + /// Field number for the "news" field. + public const int NewsFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Struct news_; + /// + /// the new values of provider inputs to diff. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct News { + get { return news_; } + set { + news_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DiffRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DiffRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (Urn != other.Urn) return false; + if (!object.Equals(Olds, other.Olds)) return false; + if (!object.Equals(News, other.News)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (Urn.Length != 0) hash ^= Urn.GetHashCode(); + if (olds_ != null) hash ^= Olds.GetHashCode(); + if (news_ != null) hash ^= News.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (Urn.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Urn); + } + if (olds_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Olds); + } + if (news_ != null) { + output.WriteRawTag(34); + output.WriteMessage(News); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (Urn.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Urn); + } + if (olds_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Olds); + } + if (news_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(News); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DiffRequest other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + if (other.Urn.Length != 0) { + Urn = other.Urn; + } + if (other.olds_ != null) { + if (olds_ == null) { + olds_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Olds.MergeFrom(other.Olds); + } + if (other.news_ != null) { + if (news_ == null) { + news_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + News.MergeFrom(other.News); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + Urn = input.ReadString(); + break; + } + case 26: { + if (olds_ == null) { + olds_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(olds_); + break; + } + case 34: { + if (news_ == null) { + news_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(news_); + break; + } + } + } + } + + } + + public sealed partial class DiffResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DiffResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DiffResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DiffResponse(DiffResponse other) : this() { + replaces_ = other.replaces_.Clone(); + stables_ = other.stables_.Clone(); + deleteBeforeReplace_ = other.deleteBeforeReplace_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DiffResponse Clone() { + return new DiffResponse(this); + } + + /// Field number for the "replaces" field. + public const int ReplacesFieldNumber = 1; + private static readonly pb::FieldCodec _repeated_replaces_codec + = pb::FieldCodec.ForString(10); + private readonly pbc::RepeatedField replaces_ = new pbc::RepeatedField(); + /// + /// if this update requires a replacement, the set of properties triggering it. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Replaces { + get { return replaces_; } + } + + /// Field number for the "stables" field. + public const int StablesFieldNumber = 2; + private static readonly pb::FieldCodec _repeated_stables_codec + = pb::FieldCodec.ForString(18); + private readonly pbc::RepeatedField stables_ = new pbc::RepeatedField(); + /// + /// an optional list of properties that will not ever change. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Stables { + get { return stables_; } + } + + /// Field number for the "deleteBeforeReplace" field. + public const int DeleteBeforeReplaceFieldNumber = 3; + private bool deleteBeforeReplace_; + /// + /// if true, this resource must be deleted before replacing it. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool DeleteBeforeReplace { + get { return deleteBeforeReplace_; } + set { + deleteBeforeReplace_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DiffResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DiffResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!replaces_.Equals(other.replaces_)) return false; + if(!stables_.Equals(other.stables_)) return false; + if (DeleteBeforeReplace != other.DeleteBeforeReplace) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= replaces_.GetHashCode(); + hash ^= stables_.GetHashCode(); + if (DeleteBeforeReplace != false) hash ^= DeleteBeforeReplace.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + replaces_.WriteTo(output, _repeated_replaces_codec); + stables_.WriteTo(output, _repeated_stables_codec); + if (DeleteBeforeReplace != false) { + output.WriteRawTag(24); + output.WriteBool(DeleteBeforeReplace); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += replaces_.CalculateSize(_repeated_replaces_codec); + size += stables_.CalculateSize(_repeated_stables_codec); + if (DeleteBeforeReplace != false) { + size += 1 + 1; + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DiffResponse other) { + if (other == null) { + return; + } + replaces_.Add(other.replaces_); + stables_.Add(other.stables_); + if (other.DeleteBeforeReplace != false) { + DeleteBeforeReplace = other.DeleteBeforeReplace; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + replaces_.AddEntriesFrom(input, _repeated_replaces_codec); + break; + } + case 18: { + stables_.AddEntriesFrom(input, _repeated_stables_codec); + break; + } + case 24: { + DeleteBeforeReplace = input.ReadBool(); + break; + } + } + } + } + + } + + public sealed partial class CreateRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRequest(CreateRequest other) : this() { + urn_ = other.urn_; + Properties = other.properties_ != null ? other.Properties.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateRequest Clone() { + return new CreateRequest(this); + } + + /// Field number for the "urn" field. + public const int UrnFieldNumber = 1; + private string urn_ = ""; + /// + /// the Pulumi URN for this resource. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Urn { + get { return urn_; } + set { + urn_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "properties" field. + public const int PropertiesFieldNumber = 2; + private global::Google.Protobuf.WellKnownTypes.Struct properties_; + /// + /// the provider inputs to set during creation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Properties { + get { return properties_; } + set { + properties_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Urn != other.Urn) return false; + if (!object.Equals(Properties, other.Properties)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Urn.Length != 0) hash ^= Urn.GetHashCode(); + if (properties_ != null) hash ^= Properties.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Urn.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Urn); + } + if (properties_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Properties); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Urn.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Urn); + } + if (properties_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Properties); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateRequest other) { + if (other == null) { + return; + } + if (other.Urn.Length != 0) { + Urn = other.Urn; + } + if (other.properties_ != null) { + if (properties_ == null) { + properties_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Properties.MergeFrom(other.Properties); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Urn = input.ReadString(); + break; + } + case 18: { + if (properties_ == null) { + properties_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(properties_); + break; + } + } + } + } + + } + + public sealed partial class CreateResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateResponse(CreateResponse other) : this() { + id_ = other.id_; + Properties = other.properties_ != null ? other.Properties.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CreateResponse Clone() { + return new CreateResponse(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// the ID of the created resource. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "properties" field. + public const int PropertiesFieldNumber = 2; + private global::Google.Protobuf.WellKnownTypes.Struct properties_; + /// + /// any properties that were computed during creation. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Properties { + get { return properties_; } + set { + properties_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CreateResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CreateResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (!object.Equals(Properties, other.Properties)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (properties_ != null) hash ^= Properties.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (properties_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Properties); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (properties_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Properties); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CreateResponse other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + if (other.properties_ != null) { + if (properties_ == null) { + properties_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Properties.MergeFrom(other.Properties); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + if (properties_ == null) { + properties_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(properties_); + break; + } + } + } + } + + } + + public sealed partial class UpdateRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRequest(UpdateRequest other) : this() { + id_ = other.id_; + urn_ = other.urn_; + Olds = other.olds_ != null ? other.Olds.Clone() : null; + News = other.news_ != null ? other.News.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateRequest Clone() { + return new UpdateRequest(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// the ID of the resource to update. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "urn" field. + public const int UrnFieldNumber = 2; + private string urn_ = ""; + /// + /// the Pulumi URN for this resource. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Urn { + get { return urn_; } + set { + urn_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "olds" field. + public const int OldsFieldNumber = 3; + private global::Google.Protobuf.WellKnownTypes.Struct olds_; + /// + /// the old values of provider inputs for the resource to update. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Olds { + get { return olds_; } + set { + olds_ = value; + } + } + + /// Field number for the "news" field. + public const int NewsFieldNumber = 4; + private global::Google.Protobuf.WellKnownTypes.Struct news_; + /// + /// the new values of provider inputs for the resource to update. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct News { + get { return news_; } + set { + news_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (Urn != other.Urn) return false; + if (!object.Equals(Olds, other.Olds)) return false; + if (!object.Equals(News, other.News)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (Urn.Length != 0) hash ^= Urn.GetHashCode(); + if (olds_ != null) hash ^= Olds.GetHashCode(); + if (news_ != null) hash ^= News.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (Urn.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Urn); + } + if (olds_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Olds); + } + if (news_ != null) { + output.WriteRawTag(34); + output.WriteMessage(News); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (Urn.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Urn); + } + if (olds_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Olds); + } + if (news_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(News); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateRequest other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + if (other.Urn.Length != 0) { + Urn = other.Urn; + } + if (other.olds_ != null) { + if (olds_ == null) { + olds_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Olds.MergeFrom(other.Olds); + } + if (other.news_ != null) { + if (news_ == null) { + news_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + News.MergeFrom(other.News); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + Urn = input.ReadString(); + break; + } + case 26: { + if (olds_ == null) { + olds_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(olds_); + break; + } + case 34: { + if (news_ == null) { + news_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(news_); + break; + } + } + } + } + + } + + public sealed partial class UpdateResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[11]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateResponse(UpdateResponse other) : this() { + Properties = other.properties_ != null ? other.Properties.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public UpdateResponse Clone() { + return new UpdateResponse(this); + } + + /// Field number for the "properties" field. + public const int PropertiesFieldNumber = 1; + private global::Google.Protobuf.WellKnownTypes.Struct properties_; + /// + /// any properties that were computed during updating. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Properties { + get { return properties_; } + set { + properties_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as UpdateResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(UpdateResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Properties, other.Properties)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (properties_ != null) hash ^= Properties.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (properties_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Properties); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (properties_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Properties); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(UpdateResponse other) { + if (other == null) { + return; + } + if (other.properties_ != null) { + if (properties_ == null) { + properties_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Properties.MergeFrom(other.Properties); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + if (properties_ == null) { + properties_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(properties_); + break; + } + } + } + } + + } + + public sealed partial class DeleteRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ProviderReflection.Descriptor.MessageTypes[12]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRequest(DeleteRequest other) : this() { + id_ = other.id_; + urn_ = other.urn_; + Properties = other.properties_ != null ? other.Properties.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DeleteRequest Clone() { + return new DeleteRequest(this); + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 1; + private string id_ = ""; + /// + /// the ID of the resource to delete. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "urn" field. + public const int UrnFieldNumber = 2; + private string urn_ = ""; + /// + /// the Pulumi URN for this resource. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Urn { + get { return urn_; } + set { + urn_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "properties" field. + public const int PropertiesFieldNumber = 3; + private global::Google.Protobuf.WellKnownTypes.Struct properties_; + /// + /// the current properties on the resource. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Properties { + get { return properties_; } + set { + properties_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DeleteRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DeleteRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Id != other.Id) return false; + if (Urn != other.Urn) return false; + if (!object.Equals(Properties, other.Properties)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (Urn.Length != 0) hash ^= Urn.GetHashCode(); + if (properties_ != null) hash ^= Properties.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Id.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Id); + } + if (Urn.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Urn); + } + if (properties_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Properties); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (Urn.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Urn); + } + if (properties_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Properties); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DeleteRequest other) { + if (other == null) { + return; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + if (other.Urn.Length != 0) { + Urn = other.Urn; + } + if (other.properties_ != null) { + if (properties_ == null) { + properties_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Properties.MergeFrom(other.Properties); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Id = input.ReadString(); + break; + } + case 18: { + Urn = input.ReadString(); + break; + } + case 26: { + if (properties_ == null) { + properties_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(properties_); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/sdk/dotnet/Pulumirpc/ProviderGrpc.cs b/sdk/dotnet/Pulumirpc/ProviderGrpc.cs new file mode 100644 index 000000000..99ff6061f --- /dev/null +++ b/sdk/dotnet/Pulumirpc/ProviderGrpc.cs @@ -0,0 +1,619 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: provider.proto +// +// Original file comments: +// Copyright 2016-2017, Pulumi Corporation. All rights reserved. +// +#pragma warning disable 1591 +#region Designer generated code + +using System; +using System.Threading; +using System.Threading.Tasks; +using grpc = global::Grpc.Core; + +namespace Pulumirpc { + /// + /// ResourceProvider is a service that understands how to create, read, update, or delete resources for types defined + /// within a single package. It is driven by the overall planning engine in response to resource diffs. + /// + public static partial class ResourceProvider + { + static readonly string __ServiceName = "pulumirpc.ResourceProvider"; + + static readonly grpc::Marshaller __Marshaller_ConfigureRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.ConfigureRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_InvokeRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.InvokeRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_InvokeResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.InvokeResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CheckRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.CheckRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CheckResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.CheckResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_DiffRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.DiffRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_DiffResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.DiffResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.CreateRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_CreateResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.CreateResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UpdateRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.UpdateRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_UpdateResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.UpdateResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_DeleteRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.DeleteRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_PluginInfo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.PluginInfo.Parser.ParseFrom); + + static readonly grpc::Method __Method_Configure = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Configure", + __Marshaller_ConfigureRequest, + __Marshaller_Empty); + + static readonly grpc::Method __Method_Invoke = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Invoke", + __Marshaller_InvokeRequest, + __Marshaller_InvokeResponse); + + static readonly grpc::Method __Method_Check = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Check", + __Marshaller_CheckRequest, + __Marshaller_CheckResponse); + + static readonly grpc::Method __Method_Diff = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Diff", + __Marshaller_DiffRequest, + __Marshaller_DiffResponse); + + static readonly grpc::Method __Method_Create = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Create", + __Marshaller_CreateRequest, + __Marshaller_CreateResponse); + + static readonly grpc::Method __Method_Update = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Update", + __Marshaller_UpdateRequest, + __Marshaller_UpdateResponse); + + static readonly grpc::Method __Method_Delete = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Delete", + __Marshaller_DeleteRequest, + __Marshaller_Empty); + + static readonly grpc::Method __Method_GetPluginInfo = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "GetPluginInfo", + __Marshaller_Empty, + __Marshaller_PluginInfo); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Pulumirpc.ProviderReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of ResourceProvider + public abstract partial class ResourceProviderBase + { + /// + /// Configure configures the resource provider with "globals" that control its behavior. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Configure(global::Pulumirpc.ConfigureRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Invoke dynamically executes a built-in function in the provider. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Invoke(global::Pulumirpc.InvokeRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Check validates that the given property bag is valid for a resource of the given type and returns the inputs + /// that should be passed to successive calls to Diff, Create, or Update for this resource. As a rule, the provider + /// inputs returned by a call to Check should preserve the original representation of the properties as present in + /// the program inputs. Though this rule is not required for correctness, violations thereof can negatively impact + /// the end-user experience, as the provider inputs are using for detecting and rendering diffs. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Check(global::Pulumirpc.CheckRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Diff checks what impacts a hypothetical update will have on the resource's properties. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Diff(global::Pulumirpc.DiffRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID + /// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Create(global::Pulumirpc.CreateRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Update updates an existing resource with new values. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Update(global::Pulumirpc.UpdateRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task Delete(global::Pulumirpc.DeleteRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request received from the client. + /// The context of the server-side call handler being invoked. + /// The response to send back to the client (wrapped by a task). + public virtual global::System.Threading.Tasks.Task GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for ResourceProvider + public partial class ResourceProviderClient : grpc::ClientBase + { + /// Creates a new client for ResourceProvider + /// The channel to use to make remote calls. + public ResourceProviderClient(grpc::Channel channel) : base(channel) + { + } + /// Creates a new client for ResourceProvider that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public ResourceProviderClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected ResourceProviderClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected ResourceProviderClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// + /// Configure configures the resource provider with "globals" that control its behavior. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Google.Protobuf.WellKnownTypes.Empty Configure(global::Pulumirpc.ConfigureRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return Configure(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Configure configures the resource provider with "globals" that control its behavior. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Google.Protobuf.WellKnownTypes.Empty Configure(global::Pulumirpc.ConfigureRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Configure, null, options, request); + } + /// + /// Configure configures the resource provider with "globals" that control its behavior. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall ConfigureAsync(global::Pulumirpc.ConfigureRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return ConfigureAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Configure configures the resource provider with "globals" that control its behavior. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall ConfigureAsync(global::Pulumirpc.ConfigureRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Configure, null, options, request); + } + /// + /// Invoke dynamically executes a built-in function in the provider. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Pulumirpc.InvokeResponse Invoke(global::Pulumirpc.InvokeRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return Invoke(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Invoke dynamically executes a built-in function in the provider. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Pulumirpc.InvokeResponse Invoke(global::Pulumirpc.InvokeRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Invoke, null, options, request); + } + /// + /// Invoke dynamically executes a built-in function in the provider. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall InvokeAsync(global::Pulumirpc.InvokeRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return InvokeAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Invoke dynamically executes a built-in function in the provider. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall InvokeAsync(global::Pulumirpc.InvokeRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Invoke, null, options, request); + } + /// + /// Check validates that the given property bag is valid for a resource of the given type and returns the inputs + /// that should be passed to successive calls to Diff, Create, or Update for this resource. As a rule, the provider + /// inputs returned by a call to Check should preserve the original representation of the properties as present in + /// the program inputs. Though this rule is not required for correctness, violations thereof can negatively impact + /// the end-user experience, as the provider inputs are using for detecting and rendering diffs. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Pulumirpc.CheckResponse Check(global::Pulumirpc.CheckRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return Check(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Check validates that the given property bag is valid for a resource of the given type and returns the inputs + /// that should be passed to successive calls to Diff, Create, or Update for this resource. As a rule, the provider + /// inputs returned by a call to Check should preserve the original representation of the properties as present in + /// the program inputs. Though this rule is not required for correctness, violations thereof can negatively impact + /// the end-user experience, as the provider inputs are using for detecting and rendering diffs. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Pulumirpc.CheckResponse Check(global::Pulumirpc.CheckRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Check, null, options, request); + } + /// + /// Check validates that the given property bag is valid for a resource of the given type and returns the inputs + /// that should be passed to successive calls to Diff, Create, or Update for this resource. As a rule, the provider + /// inputs returned by a call to Check should preserve the original representation of the properties as present in + /// the program inputs. Though this rule is not required for correctness, violations thereof can negatively impact + /// the end-user experience, as the provider inputs are using for detecting and rendering diffs. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall CheckAsync(global::Pulumirpc.CheckRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return CheckAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Check validates that the given property bag is valid for a resource of the given type and returns the inputs + /// that should be passed to successive calls to Diff, Create, or Update for this resource. As a rule, the provider + /// inputs returned by a call to Check should preserve the original representation of the properties as present in + /// the program inputs. Though this rule is not required for correctness, violations thereof can negatively impact + /// the end-user experience, as the provider inputs are using for detecting and rendering diffs. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall CheckAsync(global::Pulumirpc.CheckRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Check, null, options, request); + } + /// + /// Diff checks what impacts a hypothetical update will have on the resource's properties. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Pulumirpc.DiffResponse Diff(global::Pulumirpc.DiffRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return Diff(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Diff checks what impacts a hypothetical update will have on the resource's properties. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Pulumirpc.DiffResponse Diff(global::Pulumirpc.DiffRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Diff, null, options, request); + } + /// + /// Diff checks what impacts a hypothetical update will have on the resource's properties. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DiffAsync(global::Pulumirpc.DiffRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return DiffAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Diff checks what impacts a hypothetical update will have on the resource's properties. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DiffAsync(global::Pulumirpc.DiffRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Diff, null, options, request); + } + /// + /// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID + /// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Pulumirpc.CreateResponse Create(global::Pulumirpc.CreateRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return Create(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID + /// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Pulumirpc.CreateResponse Create(global::Pulumirpc.CreateRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Create, null, options, request); + } + /// + /// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID + /// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall CreateAsync(global::Pulumirpc.CreateRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return CreateAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID + /// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall CreateAsync(global::Pulumirpc.CreateRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Create, null, options, request); + } + /// + /// Update updates an existing resource with new values. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Pulumirpc.UpdateResponse Update(global::Pulumirpc.UpdateRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return Update(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Update updates an existing resource with new values. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Pulumirpc.UpdateResponse Update(global::Pulumirpc.UpdateRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Update, null, options, request); + } + /// + /// Update updates an existing resource with new values. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall UpdateAsync(global::Pulumirpc.UpdateRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return UpdateAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Update updates an existing resource with new values. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall UpdateAsync(global::Pulumirpc.UpdateRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Update, null, options, request); + } + /// + /// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Google.Protobuf.WellKnownTypes.Empty Delete(global::Pulumirpc.DeleteRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return Delete(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Google.Protobuf.WellKnownTypes.Empty Delete(global::Pulumirpc.DeleteRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Delete, null, options, request); + } + /// + /// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DeleteAsync(global::Pulumirpc.DeleteRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return DeleteAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall DeleteAsync(global::Pulumirpc.DeleteRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Delete, null, options, request); + } + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The response received from the server. + public virtual global::Pulumirpc.PluginInfo GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return GetPluginInfo(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request to send to the server. + /// The options for the call. + /// The response received from the server. + public virtual global::Pulumirpc.PluginInfo GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_GetPluginInfo, null, options, request); + } + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request to send to the server. + /// The initial metadata to send with the call. This parameter is optional. + /// An optional deadline for the call. The call will be cancelled if deadline is hit. + /// An optional token for canceling the call. + /// The call object. + public virtual grpc::AsyncUnaryCall GetPluginInfoAsync(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return GetPluginInfoAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + /// + /// GetPluginInfo returns generic information about this plugin, like its version. + /// + /// The request to send to the server. + /// The options for the call. + /// The call object. + public virtual grpc::AsyncUnaryCall GetPluginInfoAsync(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_GetPluginInfo, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override ResourceProviderClient NewInstance(ClientBaseConfiguration configuration) + { + return new ResourceProviderClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(ResourceProviderBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_Configure, serviceImpl.Configure) + .AddMethod(__Method_Invoke, serviceImpl.Invoke) + .AddMethod(__Method_Check, serviceImpl.Check) + .AddMethod(__Method_Diff, serviceImpl.Diff) + .AddMethod(__Method_Create, serviceImpl.Create) + .AddMethod(__Method_Update, serviceImpl.Update) + .AddMethod(__Method_Delete, serviceImpl.Delete) + .AddMethod(__Method_GetPluginInfo, serviceImpl.GetPluginInfo).Build(); + } + + } +} +#endregion diff --git a/sdk/dotnet/Pulumirpc/Pulumirpc.csproj b/sdk/dotnet/Pulumirpc/Pulumirpc.csproj new file mode 100644 index 000000000..9f81b4aab --- /dev/null +++ b/sdk/dotnet/Pulumirpc/Pulumirpc.csproj @@ -0,0 +1,13 @@ + + + + netstandard2.0 + + + + + + + + + diff --git a/sdk/dotnet/Pulumirpc/Resource.cs b/sdk/dotnet/Pulumirpc/Resource.cs new file mode 100644 index 000000000..e4ca07380 --- /dev/null +++ b/sdk/dotnet/Pulumirpc/Resource.cs @@ -0,0 +1,772 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: resource.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Pulumirpc { + + /// Holder for reflection information generated from resource.proto + public static partial class ResourceReflection { + + #region Descriptor + /// File descriptor for resource.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ResourceReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cg5yZXNvdXJjZS5wcm90bxIJcHVsdW1pcnBjGhtnb29nbGUvcHJvdG9idWYv", + "ZW1wdHkucHJvdG8aHGdvb2dsZS9wcm90b2J1Zi9zdHJ1Y3QucHJvdG8aDnBy", + "b3ZpZGVyLnByb3RvIqUBChdSZWdpc3RlclJlc291cmNlUmVxdWVzdBIMCgR0", + "eXBlGAEgASgJEgwKBG5hbWUYAiABKAkSDgoGcGFyZW50GAMgASgJEg4KBmN1", + "c3RvbRgEIAEoCBInCgZvYmplY3QYBSABKAsyFy5nb29nbGUucHJvdG9idWYu", + "U3RydWN0Eg8KB3Byb3RlY3QYBiABKAgSFAoMZGVwZW5kZW5jaWVzGAcgAygJ", + "In0KGFJlZ2lzdGVyUmVzb3VyY2VSZXNwb25zZRILCgN1cm4YASABKAkSCgoC", + "aWQYAiABKAkSJwoGb2JqZWN0GAMgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0", + "cnVjdBIOCgZzdGFibGUYBCABKAgSDwoHc3RhYmxlcxgFIAMoCSJXCh5SZWdp", + "c3RlclJlc291cmNlT3V0cHV0c1JlcXVlc3QSCwoDdXJuGAEgASgJEigKB291", + "dHB1dHMYAiABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0MpECCg9SZXNv", + "dXJjZU1vbml0b3ISPwoGSW52b2tlEhgucHVsdW1pcnBjLkludm9rZVJlcXVl", + "c3QaGS5wdWx1bWlycGMuSW52b2tlUmVzcG9uc2UiABJdChBSZWdpc3RlclJl", + "c291cmNlEiIucHVsdW1pcnBjLlJlZ2lzdGVyUmVzb3VyY2VSZXF1ZXN0GiMu", + "cHVsdW1pcnBjLlJlZ2lzdGVyUmVzb3VyY2VSZXNwb25zZSIAEl4KF1JlZ2lz", + "dGVyUmVzb3VyY2VPdXRwdXRzEikucHVsdW1pcnBjLlJlZ2lzdGVyUmVzb3Vy", + "Y2VPdXRwdXRzUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAYgZw", + "cm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Pulumirpc.ProviderReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.RegisterResourceRequest), global::Pulumirpc.RegisterResourceRequest.Parser, new[]{ "Type", "Name", "Parent", "Custom", "Object", "Protect", "Dependencies" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.RegisterResourceResponse), global::Pulumirpc.RegisterResourceResponse.Parser, new[]{ "Urn", "Id", "Object", "Stable", "Stables" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pulumirpc.RegisterResourceOutputsRequest), global::Pulumirpc.RegisterResourceOutputsRequest.Parser, new[]{ "Urn", "Outputs" }, null, null, null) + })); + } + #endregion + + } + #region Messages + /// + /// RegisterResourceRequest contains information about a resource object that was newly allocated. + /// + public sealed partial class RegisterResourceRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegisterResourceRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ResourceReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegisterResourceRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegisterResourceRequest(RegisterResourceRequest other) : this() { + type_ = other.type_; + name_ = other.name_; + parent_ = other.parent_; + custom_ = other.custom_; + Object = other.object_ != null ? other.Object.Clone() : null; + protect_ = other.protect_; + dependencies_ = other.dependencies_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegisterResourceRequest Clone() { + return new RegisterResourceRequest(this); + } + + /// Field number for the "type" field. + public const int TypeFieldNumber = 1; + private string type_ = ""; + /// + /// the type of the object allocated. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Type { + get { return type_; } + set { + type_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "name" field. + public const int NameFieldNumber = 2; + private string name_ = ""; + /// + /// the name, for URN purposes, of the object. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "parent" field. + public const int ParentFieldNumber = 3; + private string parent_ = ""; + /// + /// an optional parent URN that this child resource belongs to. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Parent { + get { return parent_; } + set { + parent_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "custom" field. + public const int CustomFieldNumber = 4; + private bool custom_; + /// + /// true if the resource is a custom, managed by a plugin's CRUD operations. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Custom { + get { return custom_; } + set { + custom_ = value; + } + } + + /// Field number for the "object" field. + public const int ObjectFieldNumber = 5; + private global::Google.Protobuf.WellKnownTypes.Struct object_; + /// + /// an object produced by the interpreter/source. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Object { + get { return object_; } + set { + object_ = value; + } + } + + /// Field number for the "protect" field. + public const int ProtectFieldNumber = 6; + private bool protect_; + /// + /// true if the resource should be marked protected. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Protect { + get { return protect_; } + set { + protect_ = value; + } + } + + /// Field number for the "dependencies" field. + public const int DependenciesFieldNumber = 7; + private static readonly pb::FieldCodec _repeated_dependencies_codec + = pb::FieldCodec.ForString(58); + private readonly pbc::RepeatedField dependencies_ = new pbc::RepeatedField(); + /// + /// a list of URNs that this resource depends on, as observed by the language host. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Dependencies { + get { return dependencies_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegisterResourceRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegisterResourceRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Type != other.Type) return false; + if (Name != other.Name) return false; + if (Parent != other.Parent) return false; + if (Custom != other.Custom) return false; + if (!object.Equals(Object, other.Object)) return false; + if (Protect != other.Protect) return false; + if(!dependencies_.Equals(other.dependencies_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Type.Length != 0) hash ^= Type.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Parent.Length != 0) hash ^= Parent.GetHashCode(); + if (Custom != false) hash ^= Custom.GetHashCode(); + if (object_ != null) hash ^= Object.GetHashCode(); + if (Protect != false) hash ^= Protect.GetHashCode(); + hash ^= dependencies_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Type.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Type); + } + if (Name.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Name); + } + if (Parent.Length != 0) { + output.WriteRawTag(26); + output.WriteString(Parent); + } + if (Custom != false) { + output.WriteRawTag(32); + output.WriteBool(Custom); + } + if (object_ != null) { + output.WriteRawTag(42); + output.WriteMessage(Object); + } + if (Protect != false) { + output.WriteRawTag(48); + output.WriteBool(Protect); + } + dependencies_.WriteTo(output, _repeated_dependencies_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Type.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Type); + } + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (Parent.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Parent); + } + if (Custom != false) { + size += 1 + 1; + } + if (object_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Object); + } + if (Protect != false) { + size += 1 + 1; + } + size += dependencies_.CalculateSize(_repeated_dependencies_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegisterResourceRequest other) { + if (other == null) { + return; + } + if (other.Type.Length != 0) { + Type = other.Type; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + if (other.Parent.Length != 0) { + Parent = other.Parent; + } + if (other.Custom != false) { + Custom = other.Custom; + } + if (other.object_ != null) { + if (object_ == null) { + object_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Object.MergeFrom(other.Object); + } + if (other.Protect != false) { + Protect = other.Protect; + } + dependencies_.Add(other.dependencies_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Type = input.ReadString(); + break; + } + case 18: { + Name = input.ReadString(); + break; + } + case 26: { + Parent = input.ReadString(); + break; + } + case 32: { + Custom = input.ReadBool(); + break; + } + case 42: { + if (object_ == null) { + object_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(object_); + break; + } + case 48: { + Protect = input.ReadBool(); + break; + } + case 58: { + dependencies_.AddEntriesFrom(input, _repeated_dependencies_codec); + break; + } + } + } + } + + } + + /// + /// RegisterResourceResponse is returned by the engine after a resource has finished being initialized. It includes the + /// auto-assigned URN, the provider-assigned ID, and any other properties initialized by the engine. + /// + public sealed partial class RegisterResourceResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegisterResourceResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ResourceReflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegisterResourceResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegisterResourceResponse(RegisterResourceResponse other) : this() { + urn_ = other.urn_; + id_ = other.id_; + Object = other.object_ != null ? other.Object.Clone() : null; + stable_ = other.stable_; + stables_ = other.stables_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegisterResourceResponse Clone() { + return new RegisterResourceResponse(this); + } + + /// Field number for the "urn" field. + public const int UrnFieldNumber = 1; + private string urn_ = ""; + /// + /// the URN assigned by the fabric. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Urn { + get { return urn_; } + set { + urn_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "id" field. + public const int IdFieldNumber = 2; + private string id_ = ""; + /// + /// the unique ID assigned by the provider. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Id { + get { return id_; } + set { + id_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "object" field. + public const int ObjectFieldNumber = 3; + private global::Google.Protobuf.WellKnownTypes.Struct object_; + /// + /// the resulting object properties, including provider defaults. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Object { + get { return object_; } + set { + object_ = value; + } + } + + /// Field number for the "stable" field. + public const int StableFieldNumber = 4; + private bool stable_; + /// + /// if true, the object's state is stable and may be trusted not to change. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Stable { + get { return stable_; } + set { + stable_ = value; + } + } + + /// Field number for the "stables" field. + public const int StablesFieldNumber = 5; + private static readonly pb::FieldCodec _repeated_stables_codec + = pb::FieldCodec.ForString(42); + private readonly pbc::RepeatedField stables_ = new pbc::RepeatedField(); + /// + /// an optional list of guaranteed-stable properties. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Stables { + get { return stables_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegisterResourceResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegisterResourceResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Urn != other.Urn) return false; + if (Id != other.Id) return false; + if (!object.Equals(Object, other.Object)) return false; + if (Stable != other.Stable) return false; + if(!stables_.Equals(other.stables_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Urn.Length != 0) hash ^= Urn.GetHashCode(); + if (Id.Length != 0) hash ^= Id.GetHashCode(); + if (object_ != null) hash ^= Object.GetHashCode(); + if (Stable != false) hash ^= Stable.GetHashCode(); + hash ^= stables_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Urn.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Urn); + } + if (Id.Length != 0) { + output.WriteRawTag(18); + output.WriteString(Id); + } + if (object_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Object); + } + if (Stable != false) { + output.WriteRawTag(32); + output.WriteBool(Stable); + } + stables_.WriteTo(output, _repeated_stables_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Urn.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Urn); + } + if (Id.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Id); + } + if (object_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Object); + } + if (Stable != false) { + size += 1 + 1; + } + size += stables_.CalculateSize(_repeated_stables_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegisterResourceResponse other) { + if (other == null) { + return; + } + if (other.Urn.Length != 0) { + Urn = other.Urn; + } + if (other.Id.Length != 0) { + Id = other.Id; + } + if (other.object_ != null) { + if (object_ == null) { + object_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Object.MergeFrom(other.Object); + } + if (other.Stable != false) { + Stable = other.Stable; + } + stables_.Add(other.stables_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Urn = input.ReadString(); + break; + } + case 18: { + Id = input.ReadString(); + break; + } + case 26: { + if (object_ == null) { + object_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(object_); + break; + } + case 32: { + Stable = input.ReadBool(); + break; + } + case 42: { + stables_.AddEntriesFrom(input, _repeated_stables_codec); + break; + } + } + } + } + + } + + /// + /// RegisterResourceOutputsRequest adds extra resource outputs created by the program after registration has occurred. + /// + public sealed partial class RegisterResourceOutputsRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegisterResourceOutputsRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pulumirpc.ResourceReflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegisterResourceOutputsRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegisterResourceOutputsRequest(RegisterResourceOutputsRequest other) : this() { + urn_ = other.urn_; + Outputs = other.outputs_ != null ? other.Outputs.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public RegisterResourceOutputsRequest Clone() { + return new RegisterResourceOutputsRequest(this); + } + + /// Field number for the "urn" field. + public const int UrnFieldNumber = 1; + private string urn_ = ""; + /// + /// the URN for the resource to attach output properties to. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Urn { + get { return urn_; } + set { + urn_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "outputs" field. + public const int OutputsFieldNumber = 2; + private global::Google.Protobuf.WellKnownTypes.Struct outputs_; + /// + /// additional output properties to add to the existing resource. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct Outputs { + get { return outputs_; } + set { + outputs_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as RegisterResourceOutputsRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(RegisterResourceOutputsRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Urn != other.Urn) return false; + if (!object.Equals(Outputs, other.Outputs)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Urn.Length != 0) hash ^= Urn.GetHashCode(); + if (outputs_ != null) hash ^= Outputs.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Urn.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Urn); + } + if (outputs_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Outputs); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Urn.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Urn); + } + if (outputs_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Outputs); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(RegisterResourceOutputsRequest other) { + if (other == null) { + return; + } + if (other.Urn.Length != 0) { + Urn = other.Urn; + } + if (other.outputs_ != null) { + if (outputs_ == null) { + outputs_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + Outputs.MergeFrom(other.Outputs); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Urn = input.ReadString(); + break; + } + case 18: { + if (outputs_ == null) { + outputs_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(outputs_); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/sdk/dotnet/Pulumirpc/ResourceGrpc.cs b/sdk/dotnet/Pulumirpc/ResourceGrpc.cs new file mode 100644 index 000000000..40255a67a --- /dev/null +++ b/sdk/dotnet/Pulumirpc/ResourceGrpc.cs @@ -0,0 +1,168 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: resource.proto +// +// Original file comments: +// Copyright 2016-2017, Pulumi Corporation. All rights reserved. +// +#pragma warning disable 1591 +#region Designer generated code + +using System; +using System.Threading; +using System.Threading.Tasks; +using grpc = global::Grpc.Core; + +namespace Pulumirpc { + /// + /// ResourceMonitor is the interface a source uses to talk back to the planning monitor orchestrating the execution. + /// + public static partial class ResourceMonitor + { + static readonly string __ServiceName = "pulumirpc.ResourceMonitor"; + + static readonly grpc::Marshaller __Marshaller_InvokeRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.InvokeRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_InvokeResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.InvokeResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RegisterResourceRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.RegisterResourceRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RegisterResourceResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.RegisterResourceResponse.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_RegisterResourceOutputsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.RegisterResourceOutputsRequest.Parser.ParseFrom); + static readonly grpc::Marshaller __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); + + static readonly grpc::Method __Method_Invoke = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "Invoke", + __Marshaller_InvokeRequest, + __Marshaller_InvokeResponse); + + static readonly grpc::Method __Method_RegisterResource = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "RegisterResource", + __Marshaller_RegisterResourceRequest, + __Marshaller_RegisterResourceResponse); + + static readonly grpc::Method __Method_RegisterResourceOutputs = new grpc::Method( + grpc::MethodType.Unary, + __ServiceName, + "RegisterResourceOutputs", + __Marshaller_RegisterResourceOutputsRequest, + __Marshaller_Empty); + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Pulumirpc.ResourceReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of ResourceMonitor + public abstract partial class ResourceMonitorBase + { + public virtual global::System.Threading.Tasks.Task Invoke(global::Pulumirpc.InvokeRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task RegisterResource(global::Pulumirpc.RegisterResourceRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + public virtual global::System.Threading.Tasks.Task RegisterResourceOutputs(global::Pulumirpc.RegisterResourceOutputsRequest request, grpc::ServerCallContext context) + { + throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); + } + + } + + /// Client for ResourceMonitor + public partial class ResourceMonitorClient : grpc::ClientBase + { + /// Creates a new client for ResourceMonitor + /// The channel to use to make remote calls. + public ResourceMonitorClient(grpc::Channel channel) : base(channel) + { + } + /// Creates a new client for ResourceMonitor that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public ResourceMonitorClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected ResourceMonitorClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected ResourceMonitorClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + public virtual global::Pulumirpc.InvokeResponse Invoke(global::Pulumirpc.InvokeRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return Invoke(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::Pulumirpc.InvokeResponse Invoke(global::Pulumirpc.InvokeRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_Invoke, null, options, request); + } + public virtual grpc::AsyncUnaryCall InvokeAsync(global::Pulumirpc.InvokeRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return InvokeAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall InvokeAsync(global::Pulumirpc.InvokeRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_Invoke, null, options, request); + } + public virtual global::Pulumirpc.RegisterResourceResponse RegisterResource(global::Pulumirpc.RegisterResourceRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return RegisterResource(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::Pulumirpc.RegisterResourceResponse RegisterResource(global::Pulumirpc.RegisterResourceRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_RegisterResource, null, options, request); + } + public virtual grpc::AsyncUnaryCall RegisterResourceAsync(global::Pulumirpc.RegisterResourceRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return RegisterResourceAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall RegisterResourceAsync(global::Pulumirpc.RegisterResourceRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_RegisterResource, null, options, request); + } + public virtual global::Google.Protobuf.WellKnownTypes.Empty RegisterResourceOutputs(global::Pulumirpc.RegisterResourceOutputsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return RegisterResourceOutputs(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual global::Google.Protobuf.WellKnownTypes.Empty RegisterResourceOutputs(global::Pulumirpc.RegisterResourceOutputsRequest request, grpc::CallOptions options) + { + return CallInvoker.BlockingUnaryCall(__Method_RegisterResourceOutputs, null, options, request); + } + public virtual grpc::AsyncUnaryCall RegisterResourceOutputsAsync(global::Pulumirpc.RegisterResourceOutputsRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return RegisterResourceOutputsAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); + } + public virtual grpc::AsyncUnaryCall RegisterResourceOutputsAsync(global::Pulumirpc.RegisterResourceOutputsRequest request, grpc::CallOptions options) + { + return CallInvoker.AsyncUnaryCall(__Method_RegisterResourceOutputs, null, options, request); + } + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override ResourceMonitorClient NewInstance(ClientBaseConfiguration configuration) + { + return new ResourceMonitorClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(ResourceMonitorBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder() + .AddMethod(__Method_Invoke, serviceImpl.Invoke) + .AddMethod(__Method_RegisterResource, serviceImpl.RegisterResource) + .AddMethod(__Method_RegisterResourceOutputs, serviceImpl.RegisterResourceOutputs).Build(); + } + + } +} +#endregion diff --git a/sdk/dotnet/Pulumirpc/generate.sh b/sdk/dotnet/Pulumirpc/generate.sh new file mode 100755 index 000000000..208caa70a --- /dev/null +++ b/sdk/dotnet/Pulumirpc/generate.sh @@ -0,0 +1,2 @@ +#!/bin/bash +protoc -I=. --csharp_out ../dotnet/ --grpc_out ../dotnet/ --plugin=protoc-gen-grpc=/home/matell/.nuget/packages/grpc.tools/1.10.0/tools/linux_x64/grpc_csharp_plugin *.proto diff --git a/sdk/dotnet/README.md b/sdk/dotnet/README.md new file mode 100644 index 000000000..2ce7d2884 --- /dev/null +++ b/sdk/dotnet/README.md @@ -0,0 +1,4 @@ +# Experimental .NET Language Provider + +An early prototype of a .NET language provider for Pulumi. + diff --git a/sdk/dotnet/cmd/pulumi-language-dotnet/main.go b/sdk/dotnet/cmd/pulumi-language-dotnet/main.go new file mode 100644 index 000000000..378665ee1 --- /dev/null +++ b/sdk/dotnet/cmd/pulumi-language-dotnet/main.go @@ -0,0 +1,225 @@ +// Copyright 2016-2018, Pulumi Corporation. All rights reserved. + +// pulumi-language-python serves as the "language host" for Pulumi programs written in Python. It is ultimately +// responsible for spawning the language runtime that executes the program. +// +// The program being executed is executed by a shim script called `pulumi-language-python-exec`. This script is +// written in the hosted language (in this case, Python) and is responsible for initiating RPC links to the resource +// monitor and engine. +// +// It's therefore the responsibility of this program to implement the LanguageHostServer endpoint by spawning +// instances of `pulumi-language-python-exec` and forwarding the RPC request arguments to the command-line. +package main + +import ( + "context" + "encoding/json" + "flag" + "fmt" + "os" + "os/exec" + "path/filepath" + "strings" + "syscall" + + "github.com/golang/glog" + pbempty "github.com/golang/protobuf/ptypes/empty" + "github.com/pkg/errors" + "github.com/pulumi/pulumi/pkg/util/cmdutil" + "github.com/pulumi/pulumi/pkg/util/rpcutil" + "github.com/pulumi/pulumi/pkg/version" + pulumirpc "github.com/pulumi/pulumi/sdk/proto/go" + "google.golang.org/grpc" +) + +const ( + // By convention, the executor is the name of the current program (pulumi-language-python) plus this suffix. + pythonExecSuffix = "-exec" // the exec shim for Pulumi to run Python programs. + + // The runtime expects the config object to be saved to this environment variable. + pulumiConfigVar = "PULUMI_CONFIG" +) + +// Launches the language host RPC endpoint, which in turn fires up an RPC server implementing the +// LanguageRuntimeServer RPC endpoint. +func main() { + var tracing string + flag.StringVar(&tracing, "tracing", "", "Emit tracing to a Zipkin-compatible tracing endpoint") + + // You can use the below flag to request that the language host load a specific executor instead of probing the + // PATH. This can be used during testing to override the default location. + var givenExecutor string + flag.StringVar(&givenExecutor, "use-executor", "", + "Use the given program as the executor instead of looking for one on PATH") + + flag.Parse() + args := flag.Args() + cmdutil.InitLogging(false, 0, false) + cmdutil.InitTracing(os.Args[0], tracing) + var pythonExec string + if givenExecutor == "" { + // The -exec binary is the same name as the current language host, except that we must trim off + // the file extension (if any) and then append -exec to it. + bin := os.Args[0] + if ext := filepath.Ext(bin); ext != "" { + bin = bin[:len(bin)-len(ext)] + } + bin += pythonExecSuffix + pathExec, err := exec.LookPath(bin) + if err != nil { + err = errors.Wrapf(err, "could not find `%s` on the $PATH", bin) + cmdutil.Exit(err) + } + + glog.V(3).Infof("language host identified executor from path: `%s`", pathExec) + pythonExec = pathExec + } else { + glog.V(3).Infof("language host asked to use specific executor: `%s`", givenExecutor) + pythonExec = givenExecutor + } + + // Optionally pluck out the engine so we can do logging, etc. + var engineAddress string + if len(args) > 0 { + engineAddress = args[0] + } + + // Fire up a gRPC server, letting the kernel choose a free port. + port, done, err := rpcutil.Serve(0, nil, []func(*grpc.Server) error{ + func(srv *grpc.Server) error { + host := newLanguageHost(pythonExec, engineAddress, tracing) + pulumirpc.RegisterLanguageRuntimeServer(srv, host) + return nil + }, + }) + if err != nil { + cmdutil.Exit(errors.Wrapf(err, "could not start language host RPC server")) + } + + // Otherwise, print out the port so that the spawner knows how to reach us. + fmt.Printf("%d\n", port) + + // And finally wait for the server to stop serving. + if err := <-done; err != nil { + cmdutil.Exit(errors.Wrapf(err, "language host RPC stopped serving")) + } +} + +// pythonLanguageHost implements the LanguageRuntimeServer interface +// for use as an API endpoint. +type dotnetLanguageHost struct { + exec string + engineAddress string + tracing string +} + +func newLanguageHost(exec, engineAddress, tracing string) pulumirpc.LanguageRuntimeServer { + return &dotnetLanguageHost{ + exec: exec, + engineAddress: engineAddress, + tracing: tracing, + } +} + +// GetRequiredPlugins computes the complete set of anticipated plugins required by a program. +func (host *dotnetLanguageHost) GetRequiredPlugins(ctx context.Context, + req *pulumirpc.GetRequiredPluginsRequest) (*pulumirpc.GetRequiredPluginsResponse, error) { + // TODO: implement this. + return &pulumirpc.GetRequiredPluginsResponse{}, nil +} + +// RPC endpoint for LanguageRuntimeServer::Run +func (host *dotnetLanguageHost) Run(ctx context.Context, req *pulumirpc.RunRequest) (*pulumirpc.RunResponse, error) { + args := host.constructArguments(req) + config, err := host.constructConfig(req) + if err != nil { + err = errors.Wrap(err, "failed to serialize configuration") + return nil, err + } + + if glog.V(5) { + commandStr := strings.Join(args, " ") + glog.V(5).Infoln("Language host launching process: ", host.exec, commandStr) + } + + // Now simply spawn a process to execute the requested program, wiring up stdout/stderr directly. + var errResult string + cmd := exec.Command(host.exec, args...) // nolint: gas, intentionally running dynamic program name. + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if config != "" { + cmd.Env = append(os.Environ(), pulumiConfigVar+"="+config) + } + if err := cmd.Run(); err != nil { + if exiterr, ok := err.(*exec.ExitError); ok { + // If the program ran, but exited with a non-zero error code. This will happen often, since user + // errors will trigger this. So, the error message should look as nice as possible. + if status, stok := exiterr.Sys().(syscall.WaitStatus); stok { + err = errors.Errorf("Program exited with non-zero exit code: %d", status.ExitStatus()) + } else { + err = errors.Wrapf(exiterr, "Program exited unexpectedly") + } + } else { + // Otherwise, we didn't even get to run the program. This ought to never happen unless there's + // a bug or system condition that prevented us from running the language exec. Issue a scarier error. + err = errors.Wrapf(err, "Problem executing program (could not run language executor)") + } + + errResult = err.Error() + } + + return &pulumirpc.RunResponse{Error: errResult}, nil +} + +// constructArguments constructs a command-line for `pulumi-language-python` +// by enumerating all of the optional and non-optional arguments present +// in a RunRequest. +func (host *dotnetLanguageHost) constructArguments(req *pulumirpc.RunRequest) []string { + var args []string + maybeAppendArg := func(k, v string) { + if v != "" { + args = append(args, "--"+k, v) + } + } + + maybeAppendArg("monitor", req.GetMonitorAddress()) + maybeAppendArg("engine", host.engineAddress) + maybeAppendArg("project", req.GetProject()) + maybeAppendArg("stack", req.GetStack()) + maybeAppendArg("pwd", req.GetPwd()) + maybeAppendArg("dry_run", fmt.Sprintf("%v", req.GetDryRun())) + maybeAppendArg("parallel", fmt.Sprint(req.GetParallel())) + maybeAppendArg("tracing", host.tracing) + + // If no program is specified, just default to the current directory (which will invoke "__main__.py"). + if req.GetProgram() == "" { + args = append(args, ".") + } else { + args = append(args, req.GetProgram()) + } + + args = append(args, req.GetArgs()...) + return args + +} + +// constructConfig json-serializes the configuration data given as part of a RunRequest. +func (host *dotnetLanguageHost) constructConfig(req *pulumirpc.RunRequest) (string, error) { + configMap := req.GetConfig() + if configMap == nil { + return "", nil + } + + configJSON, err := json.Marshal(configMap) + if err != nil { + return "", err + } + + return string(configJSON), nil +} + +func (host *dotnetLanguageHost) GetPluginInfo(ctx context.Context, req *pbempty.Empty) (*pulumirpc.PluginInfo, error) { + return &pulumirpc.PluginInfo{ + Version: version.Version, + }, nil +}