Compare commits

...

11 commits

Author SHA1 Message Date
Matt Ellis 9de9ad2f97 Pass dependency information to the engine
Dependency information can come from one of two places, an explicit
set of resources that you depend on (via the ResourceOptions struct)
and dependencies we infer from output tracking.
2018-06-22 16:53:21 -07:00
Matt Ellis 66ef108516 Add Output<T>
Since resource registration is an async operation, we had been using
Task<T> to represent output properties.  Awaiting the output property
would give you the ground value of the output once the registration
completed.

However, there are cases where we may not have a known value. When
previewing, the resource provider may not be able to give back known
values for all output properties (for example, consider the case where
you are creating a new resource. In this case, the Id property is
unknown, because the resource was not created at all). To handle this
case, we introduce Output<T>. Unlike Task<T>, Output<T> tracks if the
value it represents is "known". In addition, it does not allow you to
observe the underlying value directly. Instead, there is a function
Apply which allows accessing and transforming the value. However, if
the underlying value is unknown (e.g. during preview), Apply will not
allow you to observe this state.

Note that during previews, some output properties may be present, if
the resource provider knows the update would not change them. For
example, if you run and update and then preview without changing your
code, the cloud provider will known many properties are actually
stable. This means applies may run during previews.
2018-06-22 14:23:58 -07:00
Matt Ellis 3a820ddead Rework registration.
Instead of using .ContinueWith all over the place, register a single
ContinueWith call when we begin resource registration. When it
completes, we then call a callback on each resource that uses a
TaskCompletionSource to complete a task that represent the output
property.

This reduces the number of continuations we'll have floating around
and makes the code a little easier to grok.
2018-06-22 11:26:18 -07:00
Matt Ellis 791ff7e941 Use Serilog
I don't know how reason about this library taking dependencies on
something like Serilog long term, but during development we'll use
it.
2018-06-21 11:08:27 -07:00
Matt Ellis 9cdcd77015 Remove Pulumi.Host and CSI, in favor of dotnet run
This feels more natrual, even if the code you end up writing to
describe your application has a little more ceremony. We also don't
have to worry about all the crazy things we likely would have had to
worry about if we continued down the CSI path, or some path where we
had a middle stage that reflection loaded an actual binary and invoked
into it (I had a fear in the back of my mind that at some point we'd
actually have to start using AssemblyLoadContext).

This model is pretty easy to internalize, as well.

The major change from the language plugin point of view is that
instead of passing command line arguments to the executor, we just set
a bunch of `PULUMI_XXX` env-vars, which parts of our system know how
to use.

Next up, Output tracking.
2018-06-21 10:50:08 -07:00
Matt Ellis ea7ce22746 More progress
Introduce Pulum.Input<T> which is either a T or a Task<T> (in the
future, it could also be an Output<T>).

Code (by hand) something that looks like what we might end up using
for `tfgen'`d projections of Bucket and Bucket content. A bunch of
stuff is missing there, but it is sufficent to change the example code
to look a little more in line with what you'd actually end up writing.

The next thing I plan on doing is moving away from CSI, in favor of an
actual .NET binary, so I have nice IntelliSense in the example.
2018-06-19 16:08:35 -07:00
Matt Ellis 73a2d5db27 Flesh out the example a little more
Teach seralize properties about how to handle Task<T>, in a very
limited way.
2018-06-18 16:06:36 -07:00
Matt Ellis deacf9f55e Support string properties in CustomResource creation 2018-06-18 15:31:34 -07:00
Matt Ellis a9e00887a5 Start using Task<T> to model outputs
We'll want something like Output<T> at some point soon, but this is
closer in direction to what we want.
2018-06-18 13:40:48 -07:00
Matt Ellis cdda867a4a Get this building again
Small changes to deal with some changes in Pulumi itself, as well as
writing down all the stuff I had forgotten between now and March, and
add a small example.
2018-06-18 10:30:30 -07:00
Matt Ellis 7deaf24987 The very first cut of .NET Support
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:🪣:pulumi:pulumi:Stack::bucket-dotnet-testing]
    + aws:s3/bucket:Bucket: (create)
        [urn=urn:pulumi:dotnet-testing:🪣: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]$
```
2018-06-18 08:46:47 -07:00
34 changed files with 7238 additions and 0 deletions

3
sdk/dotnet/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
[Bb]in/
[Oo]bj/

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
namespace Pulumi
{
public class ComponentResource : Resource
{
public ComponentResource(string type, string name, Dictionary<string, object> properties = null, ResourceOptions options = default(ResourceOptions))
{
RegisterAsync(type, name, false, properties, options);
}
}
}

View file

@ -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<string, string> s_config = loadConfig();
static Dictionary<string, string> loadConfig() {
string envValue = Environment.GetEnvironmentVariable("PULUMI_CONFIG");
if (envValue != null) {
return JsonConvert.DeserializeObject<Dictionary<string, string>>(envValue);
}
return new Dictionary<string, string>();
}
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)];
}
}
}
}

View file

@ -0,0 +1,31 @@
using Google.Protobuf.WellKnownTypes;
using Pulumirpc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Pulumi {
public abstract class CustomResource : Resource {
protected Task<Pulumirpc.RegisterResourceResponse> m_registrationResponse;
public Output<string> Id { get; private set;}
TaskCompletionSource<OutputState<string>> m_IdCompletionSoruce;
public CustomResource() {
m_IdCompletionSoruce = new TaskCompletionSource<OutputState<string>>();
Id = new Output<string>(m_IdCompletionSoruce.Task);
}
protected override void OnResourceRegistrationComplete(Task<RegisterResourceResponse> resp) {
base.OnResourceRegistrationComplete(resp);
if (resp.IsCanceled) {
m_IdCompletionSoruce.SetCanceled();
} else if (resp.IsFaulted) {
m_IdCompletionSoruce.SetException(resp.Exception);
} else {
Serilog.Log.Debug("Setting id to {id} for {urn} with dependency {this}", resp.Result.Id, resp.Result.Urn, this);
m_IdCompletionSoruce.SetResult(new OutputState<string>(resp.Result.Id, !string.IsNullOrEmpty(resp.Result.Id), this));
}
}
}
}

View file

@ -0,0 +1,44 @@
using Grpc.Core;
using Pulumi;
using Pulumirpc;
using Serilog;
using System;
using System.IO;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace Pulumi {
public static class Deployment {
// TODO(ellismg): Perhaps we should have another overload Run<T>(Func<T> f) and we use reflection over the T
// to get all public fields and properties of type Input<T> and set them as outputs?
public static void Run(Action a) {
if (Environment.GetEnvironmentVariable("PULUMI_DOTNET_LOGGING") != null) {
Serilog.Log.Logger = new LoggerConfiguration().MinimumLevel.Debug().WriteTo.Console().CreateLogger();
}
// TODO(ellismg): any one of these could be null, and we need to guard against that for ones that must
// be set (I don't know the set off the top of my head. I think that everything except tracing is
// required. Also, they could be bad values (e.g. parallel may not be something that can be `bool.Parsed`
// and we'd like to fail in a nicer manner.
string monitor = Environment.GetEnvironmentVariable("PULUMI_MONITOR");
string engine = Environment.GetEnvironmentVariable("PULUMI_ENGINE");
string project = Environment.GetEnvironmentVariable("PULUMI_PROJECT");
string stack = Environment.GetEnvironmentVariable("PULUMI_STACK");
string pwd = Environment.GetEnvironmentVariable("PULUMI_PWD");
string dryRun = Environment.GetEnvironmentVariable("PULUMI_DRY_RUN");
string parallel = Environment.GetEnvironmentVariable("PULUMI_PARALLEL");
string tracing = Environment.GetEnvironmentVariable("PULUMI_TRACING");
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, int.Parse(parallel), bool.Parse(dryRun)));
Console.WriteLine($"Running with \U0001F379 on {RuntimeInformation.FrameworkDescription} on {RuntimeInformation.OSDescription}");
Runtime.RunInStack(a);
}
}
}

View file

@ -0,0 +1,49 @@
using Google.Protobuf.WellKnownTypes;
using System;
using System.Threading.Tasks;
namespace Pulumi {
interface IInput {
Task<OutputState<object>> GetValueAsOutputStateAsync();
}
public sealed class Input<T> : IInput{
T m_rawValue;
Task<T> m_task;
Output<T> m_output;
private Input() {}
public static implicit operator Input<T>(T rawValue) {
return new Input<T> {
m_rawValue = rawValue,
};
}
public static implicit operator Input<T>(Task<T> task) {
return new Input<T> {
m_task = task,
};
}
public static implicit operator Input<T>(Output<T> output) {
return new Input<T> {
m_output = output,
};
}
public async Task<OutputState<object>> GetValueAsOutputStateAsync() {
if (m_task != null) {
return new OutputState<object>(await m_task, true, Array.Empty<Resource>());
} else if (m_output != null) {
return await ((IOutput)m_output).GetOutputStateAsync();
} else {
// If the underlying value is a resource, ensure we flow the resource as a dependency in the synthetic output state.
// TODO(ellismg): Doing this here feels wrong for some reason.
Resource r = m_rawValue as Resource;
return new OutputState<object>(m_rawValue, true, r != null ? new Resource[] { r } : Array.Empty<Resource>());
}
}
}
}

19
sdk/dotnet/Pulumi/Log.cs Normal file
View file

@ -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)
});
}
}
}

View file

@ -0,0 +1,49 @@
using System;
using System.Threading.Tasks;
namespace Pulumi {
public class OutputState<T> {
public T Value { get; private set; }
public bool IsKnown { get; private set; }
public Resource[] DependsOn { get; private set; }
public OutputState(T value, bool isKnown, params Resource[] dependsOn) {
Serilog.Log.Debug("Creating new OutputState {value} {isKnown} {dependsOn}", value, isKnown, dependsOn);
Value = value;
IsKnown = isKnown;
DependsOn = dependsOn;
}
}
interface IOutput {
Task<OutputState<object>> GetOutputStateAsync();
}
public sealed class Output<T> : IOutput{
Task<OutputState<T>> m_stateTask;
public Output(Task<OutputState<T>> stateTask) {
m_stateTask = stateTask;
}
async Task<OutputState<object>> IOutput.GetOutputStateAsync() {
var resolvedState = await m_stateTask;
return new OutputState<object>(resolvedState.Value, resolvedState.IsKnown, resolvedState.DependsOn);
}
public void Apply(Action<T> fn) {
if (this.m_stateTask.Result.IsKnown) {
fn(this.m_stateTask.Result.Value);
}
}
public Output<U> Apply<U>(Func<T, U> fn) {
return new Output<U>(this.m_stateTask.ContinueWith(x => new OutputState<U>(
x.Result.IsKnown ? fn(x.Result.Value) : default(U),
x.Result.IsKnown,
x.Result.DependsOn)));
}
}
}

View file

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\Pulumirpc\Pulumirpc.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
<PackageReference Include="Serilog" Version="2.7.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,146 @@
using Google.Protobuf.Collections;
using Google.Protobuf.WellKnownTypes;
using Pulumirpc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Pulumi
{
public abstract class Resource
{
public Output<string> Urn { get; private set; }
private TaskCompletionSource<OutputState<string>> m_UrnCompletionSource;
public const string UnkownResourceId = "04da6b54-80e4-46f7-96ec-b56ff0331ba9";
protected Resource()
{
m_UrnCompletionSource = new TaskCompletionSource<OutputState<string>>();
Urn = new Output<string>(m_UrnCompletionSource.Task);
}
protected virtual void OnResourceRegistrationComplete(Task<RegisterResourceResponse> resp) {
if (resp.IsCanceled) {
m_UrnCompletionSource.SetCanceled();
} else if (resp.IsFaulted) {
m_UrnCompletionSource.SetException(resp.Exception);
} else {
m_UrnCompletionSource.SetResult(new OutputState<string>(resp.Result.Urn, resp.Result.Urn != null, this));
}
}
public async void RegisterAsync(string type, string name, bool custom, Dictionary<string, object> properties, ResourceOptions options) {
Serilog.Log.Debug("RegisterAsync({type}, {name})", type, name);
if (string.IsNullOrEmpty(type))
{
throw new ArgumentException(nameof(type));
}
if (string.IsNullOrEmpty(name))
{
throw new ArgumentException(nameof(name));
}
// Figure out the parent URN. If an explicit parent was passed in, use that. Otherwise use the global root URN. In the case where that hasn't been set yet, we must be creating
// the ComponentResource that represents the global stack object, so pass along no parent.
Task<string> parentUrn;
if (options.Parent == null && Runtime.Root == null) {
parentUrn = Task.FromResult("");
} else {
IOutput urnOutput = options.Parent?.Urn ?? Runtime.Root.Urn;
parentUrn = urnOutput.GetOutputStateAsync().ContinueWith(x => (string)x.Result.Value);
}
// Compute the set of dependencies this resource has. This is the union of resources the object explicitly depends on
// with the set of dependencies that any Output that is used as in Input has.
HashSet<string> dependsOnUrns = new HashSet<string>(StringComparer.Ordinal);
// Explicit dependencies.
if (options.DependsOn != null) {
foreach (Resource r in options.DependsOn) {
dependsOnUrns.Add((string)(await ((IOutput)r.Urn).GetOutputStateAsync()).Value);
}
}
// Add any dependeices from any outputs that happend to be used as inputs.
if (properties != null) {
foreach (object o in properties.Values) {
IInput input = o as IInput;
if (input != null) {
foreach (Resource r in (await input.GetValueAsOutputStateAsync()).DependsOn) {
dependsOnUrns.Add((string)(await ((IOutput)r.Urn).GetOutputStateAsync()).Value);
}
}
}
}
foreach(string urn in dependsOnUrns) {
Serilog.Log.Debug("Dependency: {urn}", urn);
}
// Kick off the registration, and when it completes, call the OnResourceRegistrationCompete method which will resolve all the tasks to their values. The fact that we don't
// await here is by design. This method is called by child classes in their constructors, where were do not want to block.
#pragma warning disable 4014
RegisterResourceRequest request = new RegisterResourceRequest();
request.Type = type;
request.Name = name;
request.Custom = custom;
request.Protect = options.Protect;
request.Object = await SerializeProperties(properties);
request.Parent = await parentUrn;
request.Dependencies.AddRange(dependsOnUrns);
Runtime.Monitor.RegisterResourceAsync(request).ResponseAsync.ContinueWith((x) => OnResourceRegistrationComplete(x));
#pragma warning restore 4014
}
private async Task<Struct> SerializeProperties(Dictionary<string, object> properties) {
if (properties == null) {
return new Struct();
}
var s = new Struct();
foreach (var kvp in properties) {
s.Fields.Add(kvp.Key, await SerializeProperty(kvp.Value));
}
return s;
}
private async Task<Value> SerializeProperty(object o) {
Serilog.Log.Debug("SerializeProperty({o})", o);
var input = o as IInput;
if (input != null) {
OutputState<object> state = await input.GetValueAsOutputStateAsync();
if (!state.IsKnown) {
return Value.ForString(UnkownResourceId);
}
object v = state.Value;
if (v == null) {
return Value.ForNull();
}
if (v is string) {
return Value.ForString((string)v);
}
// We marshal custom resources as strings of their provider generated IDs.
var cr = v as CustomResource;
if (cr != null) {
OutputState<object> s = await ((IOutput)cr.Id).GetOutputStateAsync();
return Value.ForString(s.IsKnown ? (string) s.Value : UnkownResourceId);
}
throw new NotImplementedException($"cannot marshal Input with underlying type ${input.GetType()}");
}
throw new NotImplementedException($"cannot marshal object of type ${o.GetType()}");
}
}
}

View file

@ -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;
}
}
}

View file

@ -0,0 +1,56 @@
using System;
using System.Threading.Tasks;
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);
Task.Run(run).Wait();
}
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;
}
}
}
}

View file

@ -0,0 +1,70 @@
// These are some hand authored resources in the style of what we think we'd generate via `tfgen`. So we'll get
// the shape right "by hand" and then work on the code-gen to stub everything else out:
using Pulumi;
using Pulumirpc;
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace AWS.S3 {
public class Bucket : CustomResource {
public Output<string> BucketDomainName { get; private set; }
private TaskCompletionSource<OutputState<string>> m_BucketDomainNameCompletionSource;
public Bucket(string name, BucketArgs args = default(BucketArgs), ResourceOptions opts = default(ResourceOptions))
{
m_BucketDomainNameCompletionSource = new TaskCompletionSource<OutputState<string>>();
BucketDomainName = new Output<string>(m_BucketDomainNameCompletionSource.Task);
RegisterAsync("aws:s3/bucket:Bucket", name, true, new Dictionary<string, object> {
{"acl", args.Acl},
}, opts);
}
protected override void OnResourceRegistrationComplete(Task<RegisterResourceResponse> resp)
{
base.OnResourceRegistrationComplete(resp);
if (resp.IsCanceled) {
m_BucketDomainNameCompletionSource.SetCanceled();
} else if (resp.IsFaulted) {
m_BucketDomainNameCompletionSource.SetException(resp.Exception);
}
var fields = resp.Result.Object.Fields;
bool isKnown = fields.ContainsKey("bucketDomainName");
m_BucketDomainNameCompletionSource.SetResult(new OutputState<string>(isKnown ? fields["bucketDomainName"].StringValue : default(string), isKnown, this));
}
}
public struct BucketArgs {
public Input<string> Acl;
}
public class BucketObject : CustomResource{
public BucketObject(string name, BucketObjectArgs args = default(BucketObjectArgs), ResourceOptions opts = default(ResourceOptions)) {
RegisterAsync("aws:s3/bucketObject:BucketObject", name, true, new Dictionary<string, object> {
{"acl", args.Acl},
{"bucket", args.Bucket},
{"contentBase64", args.ContentBase64},
{"contentType", args.ContentType},
{"key", args.Key},
}, opts);
}
}
public struct BucketObjectArgs {
public Input<string> Acl;
// TODO(ellismg): In the typescript projection, we model this as Input<Bucket | string> since we would marshal the CustomResource
// using just its ID. Not sure how we want to model there here. For now, just use a Bucket.
public Input<Bucket> Bucket;
public Input<string> ContentBase64;
public Input<string> ContentEncoding;
public Input<string> ContentType;
public Input<string> Key;
}
}

View file

@ -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 {
/// <summary>Holder for reflection information generated from analyzer.proto</summary>
public static partial class AnalyzerReflection {
#region Descriptor
/// <summary>File descriptor for analyzer.proto</summary>
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<AnalyzeRequest> {
private static readonly pb::MessageParser<AnalyzeRequest> _parser = new pb::MessageParser<AnalyzeRequest>(() => new AnalyzeRequest());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<AnalyzeRequest> 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);
}
/// <summary>Field number for the "type" field.</summary>
public const int TypeFieldNumber = 1;
private string type_ = "";
/// <summary>
/// the type token of the resource.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Type {
get { return type_; }
set {
type_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "properties" field.</summary>
public const int PropertiesFieldNumber = 2;
private global::Google.Protobuf.WellKnownTypes.Struct properties_;
/// <summary>
/// the full properties to use for validation.
/// </summary>
[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<AnalyzeResponse> {
private static readonly pb::MessageParser<AnalyzeResponse> _parser = new pb::MessageParser<AnalyzeResponse>(() => new AnalyzeResponse());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<AnalyzeResponse> 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);
}
/// <summary>Field number for the "failures" field.</summary>
public const int FailuresFieldNumber = 1;
private static readonly pb::FieldCodec<global::Pulumirpc.AnalyzeFailure> _repeated_failures_codec
= pb::FieldCodec.ForMessage(10, global::Pulumirpc.AnalyzeFailure.Parser);
private readonly pbc::RepeatedField<global::Pulumirpc.AnalyzeFailure> failures_ = new pbc::RepeatedField<global::Pulumirpc.AnalyzeFailure>();
/// <summary>
/// the failures (or empty if none).
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<global::Pulumirpc.AnalyzeFailure> 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<AnalyzeFailure> {
private static readonly pb::MessageParser<AnalyzeFailure> _parser = new pb::MessageParser<AnalyzeFailure>(() => new AnalyzeFailure());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<AnalyzeFailure> 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);
}
/// <summary>Field number for the "property" field.</summary>
public const int PropertyFieldNumber = 1;
private string property_ = "";
/// <summary>
/// the property that the analyzer rejected (or "" if general).
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Property {
get { return property_; }
set {
property_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "reason" field.</summary>
public const int ReasonFieldNumber = 2;
private string reason_ = "";
/// <summary>
/// the reason that the analyzer rejected the request.
/// </summary>
[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

View file

@ -0,0 +1,206 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: analyzer.proto
// </auto-generated>
// 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 {
/// <summary>
/// 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.
/// </summary>
public static partial class Analyzer
{
static readonly string __ServiceName = "pulumirpc.Analyzer";
static readonly grpc::Marshaller<global::Pulumirpc.AnalyzeRequest> __Marshaller_AnalyzeRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.AnalyzeRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.AnalyzeResponse> __Marshaller_AnalyzeResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.AnalyzeResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Protobuf.WellKnownTypes.Empty> __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.PluginInfo> __Marshaller_PluginInfo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.PluginInfo.Parser.ParseFrom);
static readonly grpc::Method<global::Pulumirpc.AnalyzeRequest, global::Pulumirpc.AnalyzeResponse> __Method_Analyze = new grpc::Method<global::Pulumirpc.AnalyzeRequest, global::Pulumirpc.AnalyzeResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Analyze",
__Marshaller_AnalyzeRequest,
__Marshaller_AnalyzeResponse);
static readonly grpc::Method<global::Google.Protobuf.WellKnownTypes.Empty, global::Pulumirpc.PluginInfo> __Method_GetPluginInfo = new grpc::Method<global::Google.Protobuf.WellKnownTypes.Empty, global::Pulumirpc.PluginInfo>(
grpc::MethodType.Unary,
__ServiceName,
"GetPluginInfo",
__Marshaller_Empty,
__Marshaller_PluginInfo);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Pulumirpc.AnalyzerReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of Analyzer</summary>
public abstract partial class AnalyzerBase
{
/// <summary>
/// Analyze analyzes a single resource object, and returns any errors that it finds.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Pulumirpc.AnalyzeResponse> Analyze(global::Pulumirpc.AnalyzeRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Pulumirpc.PluginInfo> GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for Analyzer</summary>
public partial class AnalyzerClient : grpc::ClientBase<AnalyzerClient>
{
/// <summary>Creates a new client for Analyzer</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public AnalyzerClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for Analyzer that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public AnalyzerClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected AnalyzerClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected AnalyzerClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
/// <summary>
/// Analyze analyzes a single resource object, and returns any errors that it finds.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// Analyze analyzes a single resource object, and returns any errors that it finds.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Pulumirpc.AnalyzeResponse Analyze(global::Pulumirpc.AnalyzeRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Analyze, null, options, request);
}
/// <summary>
/// Analyze analyzes a single resource object, and returns any errors that it finds.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.AnalyzeResponse> 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));
}
/// <summary>
/// Analyze analyzes a single resource object, and returns any errors that it finds.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.AnalyzeResponse> AnalyzeAsync(global::Pulumirpc.AnalyzeRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Analyze, null, options, request);
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Pulumirpc.PluginInfo GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetPluginInfo, null, options, request);
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.PluginInfo> 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));
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.PluginInfo> GetPluginInfoAsync(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetPluginInfo, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override AnalyzerClient NewInstance(ClientBaseConfiguration configuration)
{
return new AnalyzerClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(AnalyzerBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_Analyze, serviceImpl.Analyze)
.AddMethod(__Method_GetPluginInfo, serviceImpl.GetPluginInfo).Build();
}
}
}
#endregion

View file

@ -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 {
/// <summary>Holder for reflection information generated from engine.proto</summary>
public static partial class EngineReflection {
#region Descriptor
/// <summary>File descriptor for engine.proto</summary>
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
/// <summary>
/// LogSeverity is the severity level of a log message. Errors are fatal; all others are informational.
/// </summary>
public enum LogSeverity {
/// <summary>
/// a debug-level message not displayed to end-users (the default).
/// </summary>
[pbr::OriginalName("DEBUG")] Debug = 0,
/// <summary>
/// an informational message printed to output during resource operations.
/// </summary>
[pbr::OriginalName("INFO")] Info = 1,
/// <summary>
/// a warning to indicate that something went wrong.
/// </summary>
[pbr::OriginalName("WARNING")] Warning = 2,
/// <summary>
/// a fatal error indicating that the tool should stop processing subsequent resource operations.
/// </summary>
[pbr::OriginalName("ERROR")] Error = 3,
}
#endregion
#region Messages
public sealed partial class LogRequest : pb::IMessage<LogRequest> {
private static readonly pb::MessageParser<LogRequest> _parser = new pb::MessageParser<LogRequest>(() => new LogRequest());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<LogRequest> 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);
}
/// <summary>Field number for the "severity" field.</summary>
public const int SeverityFieldNumber = 1;
private global::Pulumirpc.LogSeverity severity_ = 0;
/// <summary>
/// the logging level of this message.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public global::Pulumirpc.LogSeverity Severity {
get { return severity_; }
set {
severity_ = value;
}
}
/// <summary>Field number for the "message" field.</summary>
public const int MessageFieldNumber = 2;
private string message_ = "";
/// <summary>
/// the contents of the logged message.
/// </summary>
[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

View file

@ -0,0 +1,140 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: engine.proto
// </auto-generated>
// 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 {
/// <summary>
/// Engine is an interface into the core engine responsible for orchestrating resource operations.
/// </summary>
public static partial class Engine
{
static readonly string __ServiceName = "pulumirpc.Engine";
static readonly grpc::Marshaller<global::Pulumirpc.LogRequest> __Marshaller_LogRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.LogRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Protobuf.WellKnownTypes.Empty> __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom);
static readonly grpc::Method<global::Pulumirpc.LogRequest, global::Google.Protobuf.WellKnownTypes.Empty> __Method_Log = new grpc::Method<global::Pulumirpc.LogRequest, global::Google.Protobuf.WellKnownTypes.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"Log",
__Marshaller_LogRequest,
__Marshaller_Empty);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Pulumirpc.EngineReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of Engine</summary>
public abstract partial class EngineBase
{
/// <summary>
/// Log logs a global message in the engine, including errors and warnings.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Protobuf.WellKnownTypes.Empty> Log(global::Pulumirpc.LogRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for Engine</summary>
public partial class EngineClient : grpc::ClientBase<EngineClient>
{
/// <summary>Creates a new client for Engine</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public EngineClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for Engine that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public EngineClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected EngineClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected EngineClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
/// <summary>
/// Log logs a global message in the engine, including errors and warnings.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// Log logs a global message in the engine, including errors and warnings.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Protobuf.WellKnownTypes.Empty Log(global::Pulumirpc.LogRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Log, null, options, request);
}
/// <summary>
/// Log logs a global message in the engine, including errors and warnings.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> 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));
}
/// <summary>
/// Log logs a global message in the engine, including errors and warnings.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> LogAsync(global::Pulumirpc.LogRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Log, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override EngineClient NewInstance(ClientBaseConfiguration configuration)
{
return new EngineClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(EngineBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_Log, serviceImpl.Log).Build();
}
}
}
#endregion

View file

@ -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 {
/// <summary>Holder for reflection information generated from language.proto</summary>
public static partial class LanguageReflection {
#region Descriptor
/// <summary>File descriptor for language.proto</summary>
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<GetRequiredPluginsRequest> {
private static readonly pb::MessageParser<GetRequiredPluginsRequest> _parser = new pb::MessageParser<GetRequiredPluginsRequest>(() => new GetRequiredPluginsRequest());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<GetRequiredPluginsRequest> 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);
}
/// <summary>Field number for the "project" field.</summary>
public const int ProjectFieldNumber = 1;
private string project_ = "";
/// <summary>
/// the project name.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Project {
get { return project_; }
set {
project_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "pwd" field.</summary>
public const int PwdFieldNumber = 2;
private string pwd_ = "";
/// <summary>
/// the program's working directory.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Pwd {
get { return pwd_; }
set {
pwd_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "program" field.</summary>
public const int ProgramFieldNumber = 3;
private string program_ = "";
/// <summary>
/// the path to the program.
/// </summary>
[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<GetRequiredPluginsResponse> {
private static readonly pb::MessageParser<GetRequiredPluginsResponse> _parser = new pb::MessageParser<GetRequiredPluginsResponse>(() => new GetRequiredPluginsResponse());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<GetRequiredPluginsResponse> 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);
}
/// <summary>Field number for the "plugins" field.</summary>
public const int PluginsFieldNumber = 1;
private static readonly pb::FieldCodec<global::Pulumirpc.PluginDependency> _repeated_plugins_codec
= pb::FieldCodec.ForMessage(10, global::Pulumirpc.PluginDependency.Parser);
private readonly pbc::RepeatedField<global::Pulumirpc.PluginDependency> plugins_ = new pbc::RepeatedField<global::Pulumirpc.PluginDependency>();
/// <summary>
/// a list of plugins required by this program.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<global::Pulumirpc.PluginDependency> 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;
}
}
}
}
}
/// <summary>
/// RunRequest asks the interpreter to execute a program.
/// </summary>
public sealed partial class RunRequest : pb::IMessage<RunRequest> {
private static readonly pb::MessageParser<RunRequest> _parser = new pb::MessageParser<RunRequest>(() => new RunRequest());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<RunRequest> 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);
}
/// <summary>Field number for the "project" field.</summary>
public const int ProjectFieldNumber = 1;
private string project_ = "";
/// <summary>
/// the project name.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Project {
get { return project_; }
set {
project_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "stack" field.</summary>
public const int StackFieldNumber = 2;
private string stack_ = "";
/// <summary>
/// the name of the stack being deployed into.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Stack {
get { return stack_; }
set {
stack_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "pwd" field.</summary>
public const int PwdFieldNumber = 3;
private string pwd_ = "";
/// <summary>
/// the program's working directory.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Pwd {
get { return pwd_; }
set {
pwd_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "program" field.</summary>
public const int ProgramFieldNumber = 4;
private string program_ = "";
/// <summary>
/// the path to the program to execute.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Program {
get { return program_; }
set {
program_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "args" field.</summary>
public const int ArgsFieldNumber = 5;
private static readonly pb::FieldCodec<string> _repeated_args_codec
= pb::FieldCodec.ForString(42);
private readonly pbc::RepeatedField<string> args_ = new pbc::RepeatedField<string>();
/// <summary>
/// any arguments to pass to the program.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<string> Args {
get { return args_; }
}
/// <summary>Field number for the "config" field.</summary>
public const int ConfigFieldNumber = 6;
private static readonly pbc::MapField<string, string>.Codec _map_config_codec
= new pbc::MapField<string, string>.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 50);
private readonly pbc::MapField<string, string> config_ = new pbc::MapField<string, string>();
/// <summary>
/// the configuration variables to apply before running.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::MapField<string, string> Config {
get { return config_; }
}
/// <summary>Field number for the "dryRun" field.</summary>
public const int DryRunFieldNumber = 7;
private bool dryRun_;
/// <summary>
/// true if we're only doing a dryrun (preview).
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool DryRun {
get { return dryRun_; }
set {
dryRun_ = value;
}
}
/// <summary>Field number for the "parallel" field.</summary>
public const int ParallelFieldNumber = 8;
private int parallel_;
/// <summary>
/// the degree of parallelism for resource operations (&lt;=1 for serial).
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int Parallel {
get { return parallel_; }
set {
parallel_ = value;
}
}
/// <summary>Field number for the "monitor_address" field.</summary>
public const int MonitorAddressFieldNumber = 9;
private string monitorAddress_ = "";
/// <summary>
/// the address for communicating back to the resource monitor.
/// </summary>
[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;
}
}
}
}
}
/// <summary>
/// RunResponse is the response back from the interpreter/source back to the monitor.
/// </summary>
public sealed partial class RunResponse : pb::IMessage<RunResponse> {
private static readonly pb::MessageParser<RunResponse> _parser = new pb::MessageParser<RunResponse>(() => new RunResponse());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<RunResponse> 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);
}
/// <summary>Field number for the "error" field.</summary>
public const int ErrorFieldNumber = 1;
private string error_ = "";
/// <summary>
/// an unhandled error if any occurred.
/// </summary>
[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

View file

@ -0,0 +1,271 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: language.proto
// </auto-generated>
// 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 {
/// <summary>
/// LanguageRuntime is the interface that the planning monitor uses to drive execution of an interpreter responsible
/// for confguring and creating resource objects.
/// </summary>
public static partial class LanguageRuntime
{
static readonly string __ServiceName = "pulumirpc.LanguageRuntime";
static readonly grpc::Marshaller<global::Pulumirpc.GetRequiredPluginsRequest> __Marshaller_GetRequiredPluginsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.GetRequiredPluginsRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.GetRequiredPluginsResponse> __Marshaller_GetRequiredPluginsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.GetRequiredPluginsResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.RunRequest> __Marshaller_RunRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.RunRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.RunResponse> __Marshaller_RunResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.RunResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Protobuf.WellKnownTypes.Empty> __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.PluginInfo> __Marshaller_PluginInfo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.PluginInfo.Parser.ParseFrom);
static readonly grpc::Method<global::Pulumirpc.GetRequiredPluginsRequest, global::Pulumirpc.GetRequiredPluginsResponse> __Method_GetRequiredPlugins = new grpc::Method<global::Pulumirpc.GetRequiredPluginsRequest, global::Pulumirpc.GetRequiredPluginsResponse>(
grpc::MethodType.Unary,
__ServiceName,
"GetRequiredPlugins",
__Marshaller_GetRequiredPluginsRequest,
__Marshaller_GetRequiredPluginsResponse);
static readonly grpc::Method<global::Pulumirpc.RunRequest, global::Pulumirpc.RunResponse> __Method_Run = new grpc::Method<global::Pulumirpc.RunRequest, global::Pulumirpc.RunResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Run",
__Marshaller_RunRequest,
__Marshaller_RunResponse);
static readonly grpc::Method<global::Google.Protobuf.WellKnownTypes.Empty, global::Pulumirpc.PluginInfo> __Method_GetPluginInfo = new grpc::Method<global::Google.Protobuf.WellKnownTypes.Empty, global::Pulumirpc.PluginInfo>(
grpc::MethodType.Unary,
__ServiceName,
"GetPluginInfo",
__Marshaller_Empty,
__Marshaller_PluginInfo);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Pulumirpc.LanguageReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of LanguageRuntime</summary>
public abstract partial class LanguageRuntimeBase
{
/// <summary>
/// GetRequiredPlugins computes the complete set of anticipated plugins required by a program.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Pulumirpc.GetRequiredPluginsResponse> GetRequiredPlugins(global::Pulumirpc.GetRequiredPluginsRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Run executes a program and returns its result.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Pulumirpc.RunResponse> Run(global::Pulumirpc.RunRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Pulumirpc.PluginInfo> GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for LanguageRuntime</summary>
public partial class LanguageRuntimeClient : grpc::ClientBase<LanguageRuntimeClient>
{
/// <summary>Creates a new client for LanguageRuntime</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public LanguageRuntimeClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for LanguageRuntime that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public LanguageRuntimeClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected LanguageRuntimeClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected LanguageRuntimeClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
/// <summary>
/// GetRequiredPlugins computes the complete set of anticipated plugins required by a program.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// GetRequiredPlugins computes the complete set of anticipated plugins required by a program.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Pulumirpc.GetRequiredPluginsResponse GetRequiredPlugins(global::Pulumirpc.GetRequiredPluginsRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetRequiredPlugins, null, options, request);
}
/// <summary>
/// GetRequiredPlugins computes the complete set of anticipated plugins required by a program.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.GetRequiredPluginsResponse> 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));
}
/// <summary>
/// GetRequiredPlugins computes the complete set of anticipated plugins required by a program.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.GetRequiredPluginsResponse> GetRequiredPluginsAsync(global::Pulumirpc.GetRequiredPluginsRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetRequiredPlugins, null, options, request);
}
/// <summary>
/// Run executes a program and returns its result.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// Run executes a program and returns its result.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Pulumirpc.RunResponse Run(global::Pulumirpc.RunRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Run, null, options, request);
}
/// <summary>
/// Run executes a program and returns its result.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.RunResponse> 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));
}
/// <summary>
/// Run executes a program and returns its result.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.RunResponse> RunAsync(global::Pulumirpc.RunRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Run, null, options, request);
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Pulumirpc.PluginInfo GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetPluginInfo, null, options, request);
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.PluginInfo> 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));
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.PluginInfo> GetPluginInfoAsync(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetPluginInfo, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override LanguageRuntimeClient NewInstance(ClientBaseConfiguration configuration)
{
return new LanguageRuntimeClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
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

View file

@ -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 {
/// <summary>Holder for reflection information generated from plugin.proto</summary>
public static partial class PluginReflection {
#region Descriptor
/// <summary>File descriptor for plugin.proto</summary>
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
/// <summary>
/// PluginInfo is meta-information about a plugin that is used by the system.
/// </summary>
public sealed partial class PluginInfo : pb::IMessage<PluginInfo> {
private static readonly pb::MessageParser<PluginInfo> _parser = new pb::MessageParser<PluginInfo>(() => new PluginInfo());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<PluginInfo> 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);
}
/// <summary>Field number for the "version" field.</summary>
public const int VersionFieldNumber = 1;
private string version_ = "";
/// <summary>
/// the semver for this plugin.
/// </summary>
[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;
}
}
}
}
}
/// <summary>
/// PluginDependency is information about a plugin that a program may depend upon.
/// </summary>
public sealed partial class PluginDependency : pb::IMessage<PluginDependency> {
private static readonly pb::MessageParser<PluginDependency> _parser = new pb::MessageParser<PluginDependency>(() => new PluginDependency());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<PluginDependency> 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);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// the name of the plugin.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "kind" field.</summary>
public const int KindFieldNumber = 2;
private string kind_ = "";
/// <summary>
/// the kind of plugin (e.g., language, etc).
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Kind {
get { return kind_; }
set {
kind_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "version" field.</summary>
public const int VersionFieldNumber = 3;
private string version_ = "";
/// <summary>
/// the semver for this plugin.
/// </summary>
[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

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,619 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: provider.proto
// </auto-generated>
// 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 {
/// <summary>
/// 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.
/// </summary>
public static partial class ResourceProvider
{
static readonly string __ServiceName = "pulumirpc.ResourceProvider";
static readonly grpc::Marshaller<global::Pulumirpc.ConfigureRequest> __Marshaller_ConfigureRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.ConfigureRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Protobuf.WellKnownTypes.Empty> __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.InvokeRequest> __Marshaller_InvokeRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.InvokeRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.InvokeResponse> __Marshaller_InvokeResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.InvokeResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.CheckRequest> __Marshaller_CheckRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.CheckRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.CheckResponse> __Marshaller_CheckResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.CheckResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.DiffRequest> __Marshaller_DiffRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.DiffRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.DiffResponse> __Marshaller_DiffResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.DiffResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.CreateRequest> __Marshaller_CreateRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.CreateRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.CreateResponse> __Marshaller_CreateResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.CreateResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.UpdateRequest> __Marshaller_UpdateRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.UpdateRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.UpdateResponse> __Marshaller_UpdateResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.UpdateResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.DeleteRequest> __Marshaller_DeleteRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.DeleteRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.PluginInfo> __Marshaller_PluginInfo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.PluginInfo.Parser.ParseFrom);
static readonly grpc::Method<global::Pulumirpc.ConfigureRequest, global::Google.Protobuf.WellKnownTypes.Empty> __Method_Configure = new grpc::Method<global::Pulumirpc.ConfigureRequest, global::Google.Protobuf.WellKnownTypes.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"Configure",
__Marshaller_ConfigureRequest,
__Marshaller_Empty);
static readonly grpc::Method<global::Pulumirpc.InvokeRequest, global::Pulumirpc.InvokeResponse> __Method_Invoke = new grpc::Method<global::Pulumirpc.InvokeRequest, global::Pulumirpc.InvokeResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Invoke",
__Marshaller_InvokeRequest,
__Marshaller_InvokeResponse);
static readonly grpc::Method<global::Pulumirpc.CheckRequest, global::Pulumirpc.CheckResponse> __Method_Check = new grpc::Method<global::Pulumirpc.CheckRequest, global::Pulumirpc.CheckResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Check",
__Marshaller_CheckRequest,
__Marshaller_CheckResponse);
static readonly grpc::Method<global::Pulumirpc.DiffRequest, global::Pulumirpc.DiffResponse> __Method_Diff = new grpc::Method<global::Pulumirpc.DiffRequest, global::Pulumirpc.DiffResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Diff",
__Marshaller_DiffRequest,
__Marshaller_DiffResponse);
static readonly grpc::Method<global::Pulumirpc.CreateRequest, global::Pulumirpc.CreateResponse> __Method_Create = new grpc::Method<global::Pulumirpc.CreateRequest, global::Pulumirpc.CreateResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Create",
__Marshaller_CreateRequest,
__Marshaller_CreateResponse);
static readonly grpc::Method<global::Pulumirpc.UpdateRequest, global::Pulumirpc.UpdateResponse> __Method_Update = new grpc::Method<global::Pulumirpc.UpdateRequest, global::Pulumirpc.UpdateResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Update",
__Marshaller_UpdateRequest,
__Marshaller_UpdateResponse);
static readonly grpc::Method<global::Pulumirpc.DeleteRequest, global::Google.Protobuf.WellKnownTypes.Empty> __Method_Delete = new grpc::Method<global::Pulumirpc.DeleteRequest, global::Google.Protobuf.WellKnownTypes.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"Delete",
__Marshaller_DeleteRequest,
__Marshaller_Empty);
static readonly grpc::Method<global::Google.Protobuf.WellKnownTypes.Empty, global::Pulumirpc.PluginInfo> __Method_GetPluginInfo = new grpc::Method<global::Google.Protobuf.WellKnownTypes.Empty, global::Pulumirpc.PluginInfo>(
grpc::MethodType.Unary,
__ServiceName,
"GetPluginInfo",
__Marshaller_Empty,
__Marshaller_PluginInfo);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Pulumirpc.ProviderReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of ResourceProvider</summary>
public abstract partial class ResourceProviderBase
{
/// <summary>
/// Configure configures the resource provider with "globals" that control its behavior.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Protobuf.WellKnownTypes.Empty> Configure(global::Pulumirpc.ConfigureRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Invoke dynamically executes a built-in function in the provider.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Pulumirpc.InvokeResponse> Invoke(global::Pulumirpc.InvokeRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// 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.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Pulumirpc.CheckResponse> Check(global::Pulumirpc.CheckRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Diff checks what impacts a hypothetical update will have on the resource's properties.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Pulumirpc.DiffResponse> Diff(global::Pulumirpc.DiffRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// 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").
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Pulumirpc.CreateResponse> Create(global::Pulumirpc.CreateRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Update updates an existing resource with new values.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Pulumirpc.UpdateResponse> Update(global::Pulumirpc.UpdateRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Google.Protobuf.WellKnownTypes.Empty> Delete(global::Pulumirpc.DeleteRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Pulumirpc.PluginInfo> GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for ResourceProvider</summary>
public partial class ResourceProviderClient : grpc::ClientBase<ResourceProviderClient>
{
/// <summary>Creates a new client for ResourceProvider</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public ResourceProviderClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for ResourceProvider that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public ResourceProviderClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected ResourceProviderClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected ResourceProviderClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
/// <summary>
/// Configure configures the resource provider with "globals" that control its behavior.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// Configure configures the resource provider with "globals" that control its behavior.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Protobuf.WellKnownTypes.Empty Configure(global::Pulumirpc.ConfigureRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Configure, null, options, request);
}
/// <summary>
/// Configure configures the resource provider with "globals" that control its behavior.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> 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));
}
/// <summary>
/// Configure configures the resource provider with "globals" that control its behavior.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> ConfigureAsync(global::Pulumirpc.ConfigureRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Configure, null, options, request);
}
/// <summary>
/// Invoke dynamically executes a built-in function in the provider.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// Invoke dynamically executes a built-in function in the provider.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Pulumirpc.InvokeResponse Invoke(global::Pulumirpc.InvokeRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Invoke, null, options, request);
}
/// <summary>
/// Invoke dynamically executes a built-in function in the provider.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.InvokeResponse> 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));
}
/// <summary>
/// Invoke dynamically executes a built-in function in the provider.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.InvokeResponse> InvokeAsync(global::Pulumirpc.InvokeRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Invoke, null, options, request);
}
/// <summary>
/// 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.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// 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.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Pulumirpc.CheckResponse Check(global::Pulumirpc.CheckRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Check, null, options, request);
}
/// <summary>
/// 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.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.CheckResponse> 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));
}
/// <summary>
/// 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.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.CheckResponse> CheckAsync(global::Pulumirpc.CheckRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Check, null, options, request);
}
/// <summary>
/// Diff checks what impacts a hypothetical update will have on the resource's properties.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// Diff checks what impacts a hypothetical update will have on the resource's properties.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Pulumirpc.DiffResponse Diff(global::Pulumirpc.DiffRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Diff, null, options, request);
}
/// <summary>
/// Diff checks what impacts a hypothetical update will have on the resource's properties.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.DiffResponse> 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));
}
/// <summary>
/// Diff checks what impacts a hypothetical update will have on the resource's properties.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.DiffResponse> DiffAsync(global::Pulumirpc.DiffRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Diff, null, options, request);
}
/// <summary>
/// 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").
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// 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").
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Pulumirpc.CreateResponse Create(global::Pulumirpc.CreateRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Create, null, options, request);
}
/// <summary>
/// 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").
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.CreateResponse> 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));
}
/// <summary>
/// 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").
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.CreateResponse> CreateAsync(global::Pulumirpc.CreateRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Create, null, options, request);
}
/// <summary>
/// Update updates an existing resource with new values.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// Update updates an existing resource with new values.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Pulumirpc.UpdateResponse Update(global::Pulumirpc.UpdateRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Update, null, options, request);
}
/// <summary>
/// Update updates an existing resource with new values.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.UpdateResponse> 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));
}
/// <summary>
/// Update updates an existing resource with new values.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.UpdateResponse> UpdateAsync(global::Pulumirpc.UpdateRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Update, null, options, request);
}
/// <summary>
/// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Google.Protobuf.WellKnownTypes.Empty Delete(global::Pulumirpc.DeleteRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Delete, null, options, request);
}
/// <summary>
/// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> 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));
}
/// <summary>
/// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> DeleteAsync(global::Pulumirpc.DeleteRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Delete, null, options, request);
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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));
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Pulumirpc.PluginInfo GetPluginInfo(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetPluginInfo, null, options, request);
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.PluginInfo> 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));
}
/// <summary>
/// GetPluginInfo returns generic information about this plugin, like its version.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual grpc::AsyncUnaryCall<global::Pulumirpc.PluginInfo> GetPluginInfoAsync(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetPluginInfo, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override ResourceProviderClient NewInstance(ClientBaseConfiguration configuration)
{
return new ResourceProviderClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
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

View file

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.5.1" />
<PackageReference Include="Grpc.Core" Version="1.10.0" />
<PackageReference Include="Grpc.Tools" Version="1.10.0" />
</ItemGroup>
</Project>

View file

@ -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 {
/// <summary>Holder for reflection information generated from resource.proto</summary>
public static partial class ResourceReflection {
#region Descriptor
/// <summary>File descriptor for resource.proto</summary>
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
/// <summary>
/// RegisterResourceRequest contains information about a resource object that was newly allocated.
/// </summary>
public sealed partial class RegisterResourceRequest : pb::IMessage<RegisterResourceRequest> {
private static readonly pb::MessageParser<RegisterResourceRequest> _parser = new pb::MessageParser<RegisterResourceRequest>(() => new RegisterResourceRequest());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<RegisterResourceRequest> 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);
}
/// <summary>Field number for the "type" field.</summary>
public const int TypeFieldNumber = 1;
private string type_ = "";
/// <summary>
/// the type of the object allocated.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Type {
get { return type_; }
set {
type_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 2;
private string name_ = "";
/// <summary>
/// the name, for URN purposes, of the object.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "parent" field.</summary>
public const int ParentFieldNumber = 3;
private string parent_ = "";
/// <summary>
/// an optional parent URN that this child resource belongs to.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Parent {
get { return parent_; }
set {
parent_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "custom" field.</summary>
public const int CustomFieldNumber = 4;
private bool custom_;
/// <summary>
/// true if the resource is a custom, managed by a plugin's CRUD operations.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Custom {
get { return custom_; }
set {
custom_ = value;
}
}
/// <summary>Field number for the "object" field.</summary>
public const int ObjectFieldNumber = 5;
private global::Google.Protobuf.WellKnownTypes.Struct object_;
/// <summary>
/// an object produced by the interpreter/source.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public global::Google.Protobuf.WellKnownTypes.Struct Object {
get { return object_; }
set {
object_ = value;
}
}
/// <summary>Field number for the "protect" field.</summary>
public const int ProtectFieldNumber = 6;
private bool protect_;
/// <summary>
/// true if the resource should be marked protected.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Protect {
get { return protect_; }
set {
protect_ = value;
}
}
/// <summary>Field number for the "dependencies" field.</summary>
public const int DependenciesFieldNumber = 7;
private static readonly pb::FieldCodec<string> _repeated_dependencies_codec
= pb::FieldCodec.ForString(58);
private readonly pbc::RepeatedField<string> dependencies_ = new pbc::RepeatedField<string>();
/// <summary>
/// a list of URNs that this resource depends on, as observed by the language host.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<string> 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;
}
}
}
}
}
/// <summary>
/// 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.
/// </summary>
public sealed partial class RegisterResourceResponse : pb::IMessage<RegisterResourceResponse> {
private static readonly pb::MessageParser<RegisterResourceResponse> _parser = new pb::MessageParser<RegisterResourceResponse>(() => new RegisterResourceResponse());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<RegisterResourceResponse> 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);
}
/// <summary>Field number for the "urn" field.</summary>
public const int UrnFieldNumber = 1;
private string urn_ = "";
/// <summary>
/// the URN assigned by the fabric.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Urn {
get { return urn_; }
set {
urn_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "id" field.</summary>
public const int IdFieldNumber = 2;
private string id_ = "";
/// <summary>
/// the unique ID assigned by the provider.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Id {
get { return id_; }
set {
id_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "object" field.</summary>
public const int ObjectFieldNumber = 3;
private global::Google.Protobuf.WellKnownTypes.Struct object_;
/// <summary>
/// the resulting object properties, including provider defaults.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public global::Google.Protobuf.WellKnownTypes.Struct Object {
get { return object_; }
set {
object_ = value;
}
}
/// <summary>Field number for the "stable" field.</summary>
public const int StableFieldNumber = 4;
private bool stable_;
/// <summary>
/// if true, the object's state is stable and may be trusted not to change.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Stable {
get { return stable_; }
set {
stable_ = value;
}
}
/// <summary>Field number for the "stables" field.</summary>
public const int StablesFieldNumber = 5;
private static readonly pb::FieldCodec<string> _repeated_stables_codec
= pb::FieldCodec.ForString(42);
private readonly pbc::RepeatedField<string> stables_ = new pbc::RepeatedField<string>();
/// <summary>
/// an optional list of guaranteed-stable properties.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<string> 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;
}
}
}
}
}
/// <summary>
/// RegisterResourceOutputsRequest adds extra resource outputs created by the program after registration has occurred.
/// </summary>
public sealed partial class RegisterResourceOutputsRequest : pb::IMessage<RegisterResourceOutputsRequest> {
private static readonly pb::MessageParser<RegisterResourceOutputsRequest> _parser = new pb::MessageParser<RegisterResourceOutputsRequest>(() => new RegisterResourceOutputsRequest());
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<RegisterResourceOutputsRequest> 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);
}
/// <summary>Field number for the "urn" field.</summary>
public const int UrnFieldNumber = 1;
private string urn_ = "";
/// <summary>
/// the URN for the resource to attach output properties to.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Urn {
get { return urn_; }
set {
urn_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "outputs" field.</summary>
public const int OutputsFieldNumber = 2;
private global::Google.Protobuf.WellKnownTypes.Struct outputs_;
/// <summary>
/// additional output properties to add to the existing resource.
/// </summary>
[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

View file

@ -0,0 +1,168 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: resource.proto
// </auto-generated>
// 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 {
/// <summary>
/// ResourceMonitor is the interface a source uses to talk back to the planning monitor orchestrating the execution.
/// </summary>
public static partial class ResourceMonitor
{
static readonly string __ServiceName = "pulumirpc.ResourceMonitor";
static readonly grpc::Marshaller<global::Pulumirpc.InvokeRequest> __Marshaller_InvokeRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.InvokeRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.InvokeResponse> __Marshaller_InvokeResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.InvokeResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.RegisterResourceRequest> __Marshaller_RegisterResourceRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.RegisterResourceRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.RegisterResourceResponse> __Marshaller_RegisterResourceResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.RegisterResourceResponse.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Pulumirpc.RegisterResourceOutputsRequest> __Marshaller_RegisterResourceOutputsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Pulumirpc.RegisterResourceOutputsRequest.Parser.ParseFrom);
static readonly grpc::Marshaller<global::Google.Protobuf.WellKnownTypes.Empty> __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom);
static readonly grpc::Method<global::Pulumirpc.InvokeRequest, global::Pulumirpc.InvokeResponse> __Method_Invoke = new grpc::Method<global::Pulumirpc.InvokeRequest, global::Pulumirpc.InvokeResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Invoke",
__Marshaller_InvokeRequest,
__Marshaller_InvokeResponse);
static readonly grpc::Method<global::Pulumirpc.RegisterResourceRequest, global::Pulumirpc.RegisterResourceResponse> __Method_RegisterResource = new grpc::Method<global::Pulumirpc.RegisterResourceRequest, global::Pulumirpc.RegisterResourceResponse>(
grpc::MethodType.Unary,
__ServiceName,
"RegisterResource",
__Marshaller_RegisterResourceRequest,
__Marshaller_RegisterResourceResponse);
static readonly grpc::Method<global::Pulumirpc.RegisterResourceOutputsRequest, global::Google.Protobuf.WellKnownTypes.Empty> __Method_RegisterResourceOutputs = new grpc::Method<global::Pulumirpc.RegisterResourceOutputsRequest, global::Google.Protobuf.WellKnownTypes.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"RegisterResourceOutputs",
__Marshaller_RegisterResourceOutputsRequest,
__Marshaller_Empty);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Pulumirpc.ResourceReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of ResourceMonitor</summary>
public abstract partial class ResourceMonitorBase
{
public virtual global::System.Threading.Tasks.Task<global::Pulumirpc.InvokeResponse> 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<global::Pulumirpc.RegisterResourceResponse> 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<global::Google.Protobuf.WellKnownTypes.Empty> RegisterResourceOutputs(global::Pulumirpc.RegisterResourceOutputsRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for ResourceMonitor</summary>
public partial class ResourceMonitorClient : grpc::ClientBase<ResourceMonitorClient>
{
/// <summary>Creates a new client for ResourceMonitor</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public ResourceMonitorClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for ResourceMonitor that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public ResourceMonitorClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected ResourceMonitorClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
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<global::Pulumirpc.InvokeResponse> 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<global::Pulumirpc.InvokeResponse> 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<global::Pulumirpc.RegisterResourceResponse> 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<global::Pulumirpc.RegisterResourceResponse> 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<global::Google.Protobuf.WellKnownTypes.Empty> 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<global::Google.Protobuf.WellKnownTypes.Empty> RegisterResourceOutputsAsync(global::Pulumirpc.RegisterResourceOutputsRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_RegisterResourceOutputs, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override ResourceMonitorClient NewInstance(ClientBaseConfiguration configuration)
{
return new ResourceMonitorClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
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

View file

@ -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

56
sdk/dotnet/README.md Normal file
View file

@ -0,0 +1,56 @@
# Experimental .NET Language Provider
An early prototype of a .NET language provider for Pulumi.
## Building and Running
To build, you'll want to install the .NET Core SDK, and ensure `dotnet` is on
your path. I'm using the 2.1 SDK, but I believe any 2.0+ SDK will work.
`$ dotnet build` should build the relevent libraries.
You'll also need to build the language host, which is written in Golang and
handles launching `pulumi-language-dotnet-exec`.
`$ GOBIN=/opt/pulumi/bin go install ./cmd/pulumi-language-dotnet`
Add the Publish Pulumi.Host and add the folder to you $PATH:
```
$ dotnet publish Pulumi.Host/pulumi-language-dotnet-exec.csproj
$ export PATH=$(go env GOPATH)/src/github.com/pulumi/pulumi/sdk/dotnet/Pulumi.Host/bin/Debug/netcoreapp2.0/publish:$PATH
```
Write a little sample app as a csharp script. You have to include the full Path to Pulumi.dll in
your reference.
```
$ cat main.csx
#r "/home/matell/go/src/github.com/pulumi/pulumi/sdk/dotnet/Pulumi/bin/Debug/netstandard2.0/Pulumi.dll"
using Pulumi;
using System;
Config config = new Config("hello-dotnet");
CustomResource r = new CustomResource("aws:s3/bucket:Bucket", config["name"]);
```
Make a Pulumi.yaml file:
```
$ cat Pulumi.yaml
name: hello-dotnet
runtime: dotnet
```
Then, configure it:
```
$ pulumi stack init hello-dotnet
$ pulumi config set name hello-dotnet
$ pulumi config set aws:region us-west-2
```
And finally, preview and update as you would any other Pulumi project.

12
sdk/dotnet/build-and-run.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/bash
set -eou pipefail
IFS="\n\t"
GOBIN=/opt/pulumi/bin go install ./cmd/pulumi-language-dotnet
export PATH=/opt/pulumi/bin:$PATH
cd examples/bucket
pulumi preview --diff
pulumi update --skip-preview --yes --diff
pulumi preview --diff
pulumi destroy --yes

View file

@ -0,0 +1,203 @@
// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
// pulumi-language-dotnet serves as the "language host" for Pulumi programs written in .NET. It is ultimately
// responsible for spawning the language runtime that executes the program.
//
// The program being executed is executed by a shim exe called `pulumi-language-dotnet-exec`. This script is
// written in the hosted language (in this case, C#) 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-dotnet-exec` and forwarding the RPC request arguments to the command-line.
package main
import (
"context"
"encoding/json"
"flag"
"fmt"
"os"
"os/exec"
"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/logging"
"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"
)
// 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()
logging.InitLogging(false, 0, false)
cmdutil.InitTracing("pulumi-language-dotnet", "pulumi-language-dotnet", tracing)
var dotnetExec string
if givenExecutor == "" {
pathExec, err := exec.LookPath("dotnet")
if err != nil {
err = errors.Wrap(err, "could not find `dotnet` on the $PATH")
cmdutil.Exit(err)
}
glog.V(3).Infof("language host identified executor from path: `%s`", pathExec)
dotnetExec = pathExec
} else {
glog.V(3).Infof("language host asked to use specific executor: `%s`", givenExecutor)
dotnetExec = 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(dotnetExec, 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"))
}
}
// dotnetLanguageHost 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) {
config, err := host.constructConfig(req)
if err != nil {
err = errors.Wrap(err, "failed to serialize configuration")
return nil, err
}
args := []string{"run"}
if req.GetProgram() != "" {
args = append(args, req.GetProgram())
}
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
cmd.Env = host.constructEnv(req, 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
}
func (host *dotnetLanguageHost) constructEnv(req *pulumirpc.RunRequest, config string) []string {
env := os.Environ()
maybeAppendEnv := func(k, v string) {
if v != "" {
env = append(env, strings.ToUpper("PULUMI_"+k)+"="+v)
}
}
maybeAppendEnv("monitor", req.GetMonitorAddress())
maybeAppendEnv("engine", host.engineAddress)
maybeAppendEnv("project", req.GetProject())
maybeAppendEnv("stack", req.GetStack())
maybeAppendEnv("pwd", req.GetPwd())
maybeAppendEnv("dry_run", fmt.Sprintf("%v", req.GetDryRun()))
maybeAppendEnv("parallel", fmt.Sprint(req.GetParallel()))
maybeAppendEnv("tracing", host.tracing)
maybeAppendEnv("config", config)
return env
}
// 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
}

48
sdk/dotnet/dotnet.sln Normal file
View file

@ -0,0 +1,48 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pulumi", "Pulumi\Pulumi.csproj", "{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pulumirpc", "Pulumirpc\Pulumirpc.csproj", "{2B15CCF1-2D54-4E35-B42D-8747193FC70F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}.Debug|x64.ActiveCfg = Debug|Any CPU
{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}.Debug|x64.Build.0 = Debug|Any CPU
{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}.Debug|x86.ActiveCfg = Debug|Any CPU
{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}.Debug|x86.Build.0 = Debug|Any CPU
{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}.Release|Any CPU.Build.0 = Release|Any CPU
{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}.Release|x64.ActiveCfg = Release|Any CPU
{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}.Release|x64.Build.0 = Release|Any CPU
{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}.Release|x86.ActiveCfg = Release|Any CPU
{0A2BFED8-13F3-43A4-A38B-B5D1651203EB}.Release|x86.Build.0 = Release|Any CPU
{2B15CCF1-2D54-4E35-B42D-8747193FC70F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B15CCF1-2D54-4E35-B42D-8747193FC70F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B15CCF1-2D54-4E35-B42D-8747193FC70F}.Debug|x64.ActiveCfg = Debug|Any CPU
{2B15CCF1-2D54-4E35-B42D-8747193FC70F}.Debug|x64.Build.0 = Debug|Any CPU
{2B15CCF1-2D54-4E35-B42D-8747193FC70F}.Debug|x86.ActiveCfg = Debug|Any CPU
{2B15CCF1-2D54-4E35-B42D-8747193FC70F}.Debug|x86.Build.0 = Debug|Any CPU
{2B15CCF1-2D54-4E35-B42D-8747193FC70F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B15CCF1-2D54-4E35-B42D-8747193FC70F}.Release|Any CPU.Build.0 = Release|Any CPU
{2B15CCF1-2D54-4E35-B42D-8747193FC70F}.Release|x64.ActiveCfg = Release|Any CPU
{2B15CCF1-2D54-4E35-B42D-8747193FC70F}.Release|x64.Build.0 = Release|Any CPU
{2B15CCF1-2D54-4E35-B42D-8747193FC70F}.Release|x86.ActiveCfg = Release|Any CPU
{2B15CCF1-2D54-4E35-B42D-8747193FC70F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,40 @@
using AWS.S3;
using Pulumi;
using System;
using System.Text;
class Program
{
static void Main(string[] args)
{
Deployment.Run(() => {
Config config = new Config("hello-dotnet");
// Create the bucket, and make it public.
var bucket = new Bucket(config["name"], new BucketArgs {
Acl = "public-read"
}
);
// Add some content. We can use contentBase64 for now, but next we'll want to build out the Assets pipeline so we
// can do a natural thing.
var content = new BucketObject($"{config["name"]}-content", new BucketObjectArgs {
Acl = "public-read",
Bucket = bucket,
ContentBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes("Made with \u2764, Pulumi, and .NET")),
ContentType = "text/plain; charset=utf8",
Key = "hello.txt"
}
);
// In addition to the logging here being nice, it actually forces us to block until the Tasks that represent the RPC
// calls to create the resources complete.
//
// TODO(ellismg): We need to come up with a solution here. We probably want to track all the pending tasks generated
// by Pulumi during execution and await them to complete in the host itself...
bucket.Id.Apply(id => Console.WriteLine($"Bucket ID id: {id}"));
content.Id.Apply(id => Console.WriteLine($"Content ID id: {id}"));
bucket.BucketDomainName.Apply(domain => Console.WriteLine($"https://{domain}/hello.txt"));
});
}
}

View file

@ -0,0 +1,3 @@
config:
aws:region: us-west-2
hello-dotnet:name: hello-dotnet

View file

@ -0,0 +1,2 @@
name: hello-dotnet
runtime: dotnet

View file

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../Pulumi/Pulumi.csproj" />
</ItemGroup>
</Project>