pulumi/sdk/dotnet/Pulumi.Automation/StackDeployment.cs
Sean Fausett ae3da5e7fe
[auto/dotnet] Make StackDeployment.FromJsonString public (#7067)
* Make StackDeployment.FromJsonString public

* Update changelog

Co-authored-by: Anton Tayanovskyy <anton@pulumi.com>
2021-05-20 09:47:44 -04:00

41 lines
1.2 KiB
C#

// Copyright 2016-2021, Pulumi Corporation
using System.Text.Json;
namespace Pulumi.Automation
{
/// <summary>
/// Represents the state of a stack deployment as used by
/// ExportStackAsync and ImportStackAsync.
/// <para/>
/// There is no strongly typed model for the contents yet, but you
/// can access the raw representation via the Json property.
/// <para/>
/// NOTE: instances may contain sensitive data (secrets).
/// </summary>
public sealed class StackDeployment
{
public static StackDeployment FromJsonString(string jsonString)
{
var json = JsonSerializer.Deserialize<JsonElement>(jsonString);
var version = json.GetProperty("version").GetInt32();
return new StackDeployment(version, json);
}
/// <summary>
/// Version indicates the schema of the encoded deployment.
/// </summary>
public int Version { get; }
/// <summary>
/// JSON representation of the deployment.
/// </summary>
public JsonElement Json { get; }
private StackDeployment(int version, JsonElement json)
{
this.Version = version;
this.Json = json;
}
}
}