Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created January 15, 2020 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guitarrapc/91b4cc5b5e36dffe2988e31bb8c7760e to your computer and use it in GitHub Desktop.
Save guitarrapc/91b4cc5b5e36dffe2988e31bb8c7760e to your computer and use it in GitHub Desktop.
Deserialize Pulumi Resource JSON
void Main()
{
var json = File.ReadAllText(@"pulumi_20200115.json");
var pulumi = System.Text.Json.JsonSerializer.Deserialize<PulumiResource>(json);
var parents = pulumi.deployment.resources.Select(x => x.parent).Where(x => x != null).ToArray();
var keys = pulumi.deployment.resources.Select(x => x.urn).ToArray();
}
public class PulumiResource
{
public int version { get; set; }
public Deployment deployment { get; set; }
}
public class Deployment
{
public Manifest manifest { get; set; }
public Secrets_Providers secrets_providers { get; set; }
public Resource[] resources { get; set; }
}
public class Manifest
{
public DateTime time { get; set; }
public string magic { get; set; }
public string version { get; set; }
}
public class Secrets_Providers
{
public string type { get; set; }
public State state { get; set; }
}
public class State
{
public string url { get; set; }
public string owner { get; set; }
public string project { get; set; }
public string stack { get; set; }
}
public class Resource
{
public string urn { get; set; }
public bool custom { get; set; }
public string type { get; set; }
public Outputs outputs { get; set; }
public string parent { get; set; }
public string id { get; set; }
public Inputs inputs { get; set; }
public string provider { get; set; }
public Propertydependencies propertyDependencies { get; set; }
public string[] dependencies { get; set; }
}
public class Outputs
{
public string id { get; set; }
public string name { get; set; }
public string autoScalingGroupName { get; set; }
public string ecrRepositoryName { get; set; }
public string ecrRepositoryUri { get; set; }
public string eksClusterName { get; set; }
public string eksEndpoint { get; set; }
public string eksInitKubeConfigCommand { get; set; }
public string eksKubeConfigCertificateAuthorityData { get; set; }
public string kubernetesAnnotations { get; set; }
public string kubernetesConfigMapAwsAuth { get; set; }
public string kubernetesVersion { get; set; }
public string kubesecKmsArn { get; set; }
public string serviceDiscoveryNameSpace { get; set; }
public string profile { get; set; }
public string region { get; set; }
public string version { get; set; }
public string description { get; set; }
public string ClusterEndpoint { get; set; }
public string LbDns { get; set; }
public string LbZoneId { get; set; }
public string redisDns { get; set; }
public string zoneId { get; set; }
public string zoneName { get; set; }
public string[] zoneNameServers { get; set; }
public string Arn { get; set; }
public string Id { get; set; }
public string sgEksControlPlaneId { get; set; }
public string sgEksNodegroupStandardworkerId { get; set; }
public string sgEksNodegroupWorkernodeId { get; set; }
public string sgElastiCacheId { get; set; }
public string[] subnetEksIds { get; set; }
public string vpcId { get; set; }
public string comment { get; set; }
public string delegationSetId { get; set; }
public bool forceDestroy { get; set; }
public string[] nameServers { get; set; }
public Tags tags { get; set; }
public object[] vpcs { get; set; }
public string Name { get; set; }
public string Url { get; set; }
public string CertificateAuthorityData { get; set; }
public string Version { get; set; }
public string ami { get; set; }
public string autoScalingGroupId { get; set; }
public string launchConfigurationId { get; set; }
public string userdata { get; set; }
public string alias { get; set; }
public string arn { get; set; }
public string family { get; set; }
public Parameter[] parameters { get; set; }
public string[] CustomPolicyArns { get; set; }
public string InstanceProfileArn { get; set; }
public string CodeBuildInputS3bucket { get; set; }
public string CodeBuildName { get; set; }
public string CodePipelineName { get; set; }
public string NlbAliasZoneId { get; set; }
public string NlbDns { get; set; }
public string CodeBuildInputBucket { get; set; }
public string CodeBuildOutputBucket { get; set; }
public string CodePipelineBucket { get; set; }
public string CodeBuildLogGroup { get; set; }
public string EcsTaskLogGroup { get; set; }
public string serverDns { get; set; }
public string webdebugDns { get; set; }
public string CloudwatchEventPipelineRoleArn { get; set; }
public string CodeBuildRoleArn { get; set; }
public string CodeDeployRoleArn { get; set; }
public string CodePipelineRoleArn { get; set; }
public string EcsTaskRoleArn { get; set; }
public string AlbAliasZoneId { get; set; }
public string AlbDns { get; set; }
public string sgMagicOnionId { get; set; }
public string[] subnetIds { get; set; }
public string dhcpOptionsId { get; set; }
public string arnSuffix { get; set; }
public int deregistrationDelay { get; set; }
public Healthcheck healthCheck { get; set; }
public bool lambdaMultiValueHeadersEnabled { get; set; }
public int port { get; set; }
public string protocol { get; set; }
public bool proxyProtocolV2 { get; set; }
public int slowStart { get; set; }
public Stickiness stickiness { get; set; }
public string targetType { get; set; }
public string BucketArn { get; set; }
public string BucketName { get; set; }
public Accesslogs accessLogs { get; set; }
public string dnsName { get; set; }
public bool enableCrossZoneLoadBalancing { get; set; }
public bool enableDeletionProtection { get; set; }
public bool enableHttp2 { get; set; }
public int idleTimeout { get; set; }
public bool _internal { get; set; }
public string ipAddressType { get; set; }
public string loadBalancerType { get; set; }
public string[] securityGroups { get; set; }
public Subnetmapping[] subnetMappings { get; set; }
public string[] subnets { get; set; }
public string accelerationStatus { get; set; }
public string acl { get; set; }
public string bucket { get; set; }
public string bucketDomainName { get; set; }
public string bucketRegionalDomainName { get; set; }
public object[] corsRules { get; set; }
public string hostedZoneId { get; set; }
public object[] lifecycleRules { get; set; }
public object[] loggings { get; set; }
public object objectLockConfiguration { get; set; }
public object replicationConfiguration { get; set; }
public string requestPayer { get; set; }
public object serverSideEncryptionConfiguration { get; set; }
public Versioning versioning { get; set; }
public object website { get; set; }
public string routeTableId { get; set; }
public string subnetId { get; set; }
public Defaultaction[] defaultActions { get; set; }
public string loadBalancerArn { get; set; }
public string sslPolicy { get; set; }
public bool blockPublicAcls { get; set; }
public bool blockPublicPolicy { get; set; }
public bool ignorePublicAcls { get; set; }
public bool restrictPublicBuckets { get; set; }
public Artifacts artifacts { get; set; }
public bool badgeEnabled { get; set; }
public string badgeUrl { get; set; }
public int buildTimeout { get; set; }
public Cache cache { get; set; }
public string encryptionKey { get; set; }
public Environment environment { get; set; }
public Logsconfig logsConfig { get; set; }
public int queuedTimeout { get; set; }
public object[] secondaryArtifacts { get; set; }
public object[] secondarySources { get; set; }
public string serviceRole { get; set; }
public Source source { get; set; }
public object vpcConfig { get; set; }
public string policy { get; set; }
public string targetGroupArn { get; set; }
public string targetId { get; set; }
public string clusterArn { get; set; }
public string clusterName { get; set; }
public string serviceId { get; set; }
public string serviceName { get; set; }
public string taskDefId { get; set; }
public string __meta { get; set; }
public Alias[] aliases { get; set; }
public object[] failoverRoutingPolicies { get; set; }
public string fqdn { get; set; }
public object[] geolocationRoutingPolicies { get; set; }
public string healthCheckId { get; set; }
public object[] latencyRoutingPolicies { get; set; }
public string[] records { get; set; }
public string setIdentifier { get; set; }
public int ttl { get; set; }
public string type { get; set; }
public object[] weightedRoutingPolicies { get; set; }
public object[] capacityProviders { get; set; }
public object[] defaultCapacityProviderStrategies { get; set; }
public Setting[] settings { get; set; }
public Containerdefinitions containerDefinitions { get; set; }
public string cpu { get; set; }
public string executionRoleArn { get; set; }
public string memory { get; set; }
public string networkMode { get; set; }
public object[] placementConstraints { get; set; }
public object proxyConfiguration { get; set; }
public string[] requiresCompatibilities { get; set; }
public int revision { get; set; }
public string taskRoleArn { get; set; }
public object[] volumes { get; set; }
public object[] capacityProviderStrategies { get; set; }
public string cluster { get; set; }
public Deploymentcontroller deploymentController { get; set; }
public int deploymentMaximumPercent { get; set; }
public int deploymentMinimumHealthyPercent { get; set; }
public int desiredCount { get; set; }
public bool enableEcsManagedTags { get; set; }
public int healthCheckGracePeriodSeconds { get; set; }
public string iamRole { get; set; }
public string launchType { get; set; }
public Loadbalancer[] loadBalancers { get; set; }
public Networkconfiguration networkConfiguration { get; set; }
public object[] orderedPlacementStrategies { get; set; }
public object[] placementStrategies { get; set; }
public string platformVersion { get; set; }
public string propagateTags { get; set; }
public string schedulingStrategy { get; set; }
public object serviceRegistries { get; set; }
public string taskDefinition { get; set; }
public bool waitForSteadyState { get; set; }
}
public class Tags
{
public string ResourceGroup { get; set; }
public string environment { get; set; }
public string manage { get; set; }
public string project { get; set; }
}
public class Healthcheck
{
public bool enabled { get; set; }
public int healthyThreshold { get; set; }
public int interval { get; set; }
public string matcher { get; set; }
public string path { get; set; }
public string port { get; set; }
public string protocol { get; set; }
public int timeout { get; set; }
public int unhealthyThreshold { get; set; }
}
public class Stickiness
{
public int cookieDuration { get; set; }
public bool enabled { get; set; }
public string type { get; set; }
}
public class Accesslogs
{
public string bucket { get; set; }
public bool enabled { get; set; }
public string prefix { get; set; }
}
public class Versioning
{
public bool enabled { get; set; }
public bool mfaDelete { get; set; }
}
public class Artifacts
{
public string artifactIdentifier { get; set; }
public bool encryptionDisabled { get; set; }
public string location { get; set; }
public string name { get; set; }
public string namespaceType { get; set; }
public bool overrideArtifactName { get; set; }
public string packaging { get; set; }
public string path { get; set; }
public string type { get; set; }
}
public class Cache
{
public string location { get; set; }
public object[] modes { get; set; }
public string type { get; set; }
}
public class Environment
{
public string certificate { get; set; }
public string computeType { get; set; }
public Environmentvariable[] environmentVariables { get; set; }
public string image { get; set; }
public string imagePullCredentialsType { get; set; }
public bool privilegedMode { get; set; }
public object registryCredential { get; set; }
public string type { get; set; }
}
public class Environmentvariable
{
public string name { get; set; }
public string type { get; set; }
public string value { get; set; }
}
public class Logsconfig
{
public Cloudwatchlogs cloudwatchLogs { get; set; }
public S3logs s3Logs { get; set; }
}
public class Cloudwatchlogs
{
public string groupName { get; set; }
public string status { get; set; }
public string streamName { get; set; }
}
public class S3logs
{
public bool encryptionDisabled { get; set; }
public string location { get; set; }
public string status { get; set; }
}
public class Source
{
public object[] auths { get; set; }
public string buildspec { get; set; }
public int gitCloneDepth { get; set; }
public bool insecureSsl { get; set; }
public string location { get; set; }
public bool reportBuildStatus { get; set; }
public string type { get; set; }
}
public class Containerdefinitions
{
public string _4dabf18193072939515e22adb298388d { get; set; }
public string ciphertext { get; set; }
}
public class Deploymentcontroller
{
public string type { get; set; }
}
public class Networkconfiguration
{
public bool assignPublicIp { get; set; }
public string[] securityGroups { get; set; }
public string[] subnets { get; set; }
}
public class Parameter
{
public string name { get; set; }
public string value { get; set; }
}
public class Subnetmapping
{
public string allocationId { get; set; }
public string subnetId { get; set; }
}
public class Defaultaction
{
public object authenticateCognito { get; set; }
public object authenticateOidc { get; set; }
public object fixedResponse { get; set; }
public int order { get; set; }
public object redirect { get; set; }
public string targetGroupArn { get; set; }
public string type { get; set; }
}
public class Alias
{
public bool evaluateTargetHealth { get; set; }
public string name { get; set; }
public string zoneId { get; set; }
}
public class Setting
{
public string name { get; set; }
public string value { get; set; }
}
public class Loadbalancer
{
public string containerName { get; set; }
public int containerPort { get; set; }
public string elbName { get; set; }
public string targetGroupArn { get; set; }
}
public class Inputs
{
public string profile { get; set; }
public string region { get; set; }
public string version { get; set; }
public string[] __defaults { get; set; }
public string comment { get; set; }
public string delegationSetId { get; set; }
public bool forceDestroy { get; set; }
public string name { get; set; }
public Tags1 tags { get; set; }
public object[] vpcs { get; set; }
public string description { get; set; }
public string family { get; set; }
public Parameter1[] parameters { get; set; }
public string dhcpOptionsId { get; set; }
public string vpcId { get; set; }
public int deregistrationDelay { get; set; }
public Healthcheck1 healthCheck { get; set; }
public bool lambdaMultiValueHeadersEnabled { get; set; }
public int port { get; set; }
public string protocol { get; set; }
public bool proxyProtocolV2 { get; set; }
public int slowStart { get; set; }
public Stickiness1 stickiness { get; set; }
public string targetType { get; set; }
public Accesslogs1 accessLogs { get; set; }
public bool enableCrossZoneLoadBalancing { get; set; }
public bool enableDeletionProtection { get; set; }
public bool enableHttp2 { get; set; }
public int idleTimeout { get; set; }
public bool _internal { get; set; }
public string ipAddressType { get; set; }
public string loadBalancerType { get; set; }
public string[] securityGroups { get; set; }
public Subnetmapping1[] subnetMappings { get; set; }
public string[] subnets { get; set; }
public string accelerationStatus { get; set; }
public string acl { get; set; }
public string arn { get; set; }
public string bucket { get; set; }
public object[] corsRules { get; set; }
public string hostedZoneId { get; set; }
public object[] lifecycleRules { get; set; }
public object[] loggings { get; set; }
public object objectLockConfiguration { get; set; }
public object replicationConfiguration { get; set; }
public string requestPayer { get; set; }
public object serverSideEncryptionConfiguration { get; set; }
public Versioning1 versioning { get; set; }
public object website { get; set; }
public string routeTableId { get; set; }
public string subnetId { get; set; }
public Defaultaction1[] defaultActions { get; set; }
public string loadBalancerArn { get; set; }
public string sslPolicy { get; set; }
public bool blockPublicAcls { get; set; }
public bool blockPublicPolicy { get; set; }
public bool ignorePublicAcls { get; set; }
public bool restrictPublicBuckets { get; set; }
public Artifacts1 artifacts { get; set; }
public bool badgeEnabled { get; set; }
public int buildTimeout { get; set; }
public Cache1 cache { get; set; }
public string encryptionKey { get; set; }
public Environment1 environment { get; set; }
public Logsconfig1 logsConfig { get; set; }
public int queuedTimeout { get; set; }
public object[] secondaryArtifacts { get; set; }
public object[] secondarySources { get; set; }
public string serviceRole { get; set; }
public Source1 source { get; set; }
public object vpcConfig { get; set; }
public string policy { get; set; }
public string targetGroupArn { get; set; }
public string targetId { get; set; }
public Alias1[] aliases { get; set; }
public object[] failoverRoutingPolicies { get; set; }
public object[] geolocationRoutingPolicies { get; set; }
public string healthCheckId { get; set; }
public object[] latencyRoutingPolicies { get; set; }
public string[] records { get; set; }
public string setIdentifier { get; set; }
public int ttl { get; set; }
public string type { get; set; }
public object[] weightedRoutingPolicies { get; set; }
public string zoneId { get; set; }
public object[] capacityProviders { get; set; }
public object[] defaultCapacityProviderStrategies { get; set; }
public Setting1[] settings { get; set; }
public Containerdefinitions1 containerDefinitions { get; set; }
public string cpu { get; set; }
public string executionRoleArn { get; set; }
public string memory { get; set; }
public string networkMode { get; set; }
public object[] placementConstraints { get; set; }
public object proxyConfiguration { get; set; }
public string[] requiresCompatibilities { get; set; }
public string taskRoleArn { get; set; }
public object[] volumes { get; set; }
public object[] capacityProviderStrategies { get; set; }
public string cluster { get; set; }
public Deploymentcontroller1 deploymentController { get; set; }
public int deploymentMaximumPercent { get; set; }
public int deploymentMinimumHealthyPercent { get; set; }
public int desiredCount { get; set; }
public bool enableEcsManagedTags { get; set; }
public int healthCheckGracePeriodSeconds { get; set; }
public string iamRole { get; set; }
public string launchType { get; set; }
public Loadbalancer1[] loadBalancers { get; set; }
public Networkconfiguration1 networkConfiguration { get; set; }
public object[] orderedPlacementStrategies { get; set; }
public object[] placementStrategies { get; set; }
public string platformVersion { get; set; }
public string propagateTags { get; set; }
public string schedulingStrategy { get; set; }
public object serviceRegistries { get; set; }
public string taskDefinition { get; set; }
public bool waitForSteadyState { get; set; }
}
public class Tags1
{
public string ResourceGroup { get; set; }
public object[] __defaults { get; set; }
public string environment { get; set; }
public string manage { get; set; }
public string project { get; set; }
}
public class Healthcheck1
{
public string[] __defaults { get; set; }
public bool enabled { get; set; }
public int healthyThreshold { get; set; }
public int interval { get; set; }
public string matcher { get; set; }
public string path { get; set; }
public string port { get; set; }
public string protocol { get; set; }
public int timeout { get; set; }
public int unhealthyThreshold { get; set; }
}
public class Stickiness1
{
public int cookieDuration { get; set; }
public bool enabled { get; set; }
public string type { get; set; }
}
public class Accesslogs1
{
public string bucket { get; set; }
public bool enabled { get; set; }
public string prefix { get; set; }
}
public class Versioning1
{
public string[] __defaults { get; set; }
public bool enabled { get; set; }
public bool mfaDelete { get; set; }
}
public class Artifacts1
{
public string[] __defaults { get; set; }
public string artifactIdentifier { get; set; }
public bool encryptionDisabled { get; set; }
public string location { get; set; }
public string name { get; set; }
public string namespaceType { get; set; }
public bool overrideArtifactName { get; set; }
public string packaging { get; set; }
public string path { get; set; }
public string type { get; set; }
}
public class Cache1
{
public string location { get; set; }
public object[] modes { get; set; }
public string type { get; set; }
}
public class Environment1
{
public object[] __defaults { get; set; }
public string certificate { get; set; }
public string computeType { get; set; }
public Environmentvariable1[] environmentVariables { get; set; }
public string image { get; set; }
public string imagePullCredentialsType { get; set; }
public bool privilegedMode { get; set; }
public object registryCredential { get; set; }
public string type { get; set; }
}
public class Environmentvariable1
{
public object[] __defaults { get; set; }
public string name { get; set; }
public string type { get; set; }
public string value { get; set; }
}
public class Logsconfig1
{
public Cloudwatchlogs1 cloudwatchLogs { get; set; }
public S3logs1 s3Logs { get; set; }
}
public class Cloudwatchlogs1
{
public string groupName { get; set; }
public string status { get; set; }
public string streamName { get; set; }
}
public class S3logs1
{
public bool encryptionDisabled { get; set; }
public string location { get; set; }
public string status { get; set; }
}
public class Source1
{
public object[] __defaults { get; set; }
public object[] auths { get; set; }
public string buildspec { get; set; }
public int gitCloneDepth { get; set; }
public bool insecureSsl { get; set; }
public string location { get; set; }
public bool reportBuildStatus { get; set; }
public string type { get; set; }
}
public class Containerdefinitions1
{
public string _4dabf18193072939515e22adb298388d { get; set; }
public string ciphertext { get; set; }
}
public class Deploymentcontroller1
{
public object[] __defaults { get; set; }
public string type { get; set; }
}
public class Networkconfiguration1
{
public object[] __defaults { get; set; }
public bool assignPublicIp { get; set; }
public string[] securityGroups { get; set; }
public string[] subnets { get; set; }
}
public class Parameter1
{
public object[] __defaults { get; set; }
public string name { get; set; }
public string value { get; set; }
}
public class Subnetmapping1
{
public string allocationId { get; set; }
public string subnetId { get; set; }
}
public class Defaultaction1
{
public object[] __defaults { get; set; }
public object authenticateCognito { get; set; }
public object authenticateOidc { get; set; }
public object fixedResponse { get; set; }
public int order { get; set; }
public object redirect { get; set; }
public string targetGroupArn { get; set; }
public string type { get; set; }
}
public class Alias1
{
public object[] __defaults { get; set; }
public bool evaluateTargetHealth { get; set; }
public string name { get; set; }
public string zoneId { get; set; }
}
public class Setting1
{
public string name { get; set; }
public string value { get; set; }
}
public class Loadbalancer1
{
public object[] __defaults { get; set; }
public string containerName { get; set; }
public int containerPort { get; set; }
public string elbName { get; set; }
public string targetGroupArn { get; set; }
}
public class Propertydependencies
{
public object comment { get; set; }
public string[] name { get; set; }
public object tags { get; set; }
public object description { get; set; }
public object family { get; set; }
public object parameters { get; set; }
public string[] dhcpOptionsId { get; set; }
public string[] vpcId { get; set; }
public object deregistrationDelay { get; set; }
public object healthCheck { get; set; }
public object port { get; set; }
public object protocol { get; set; }
public object slowStart { get; set; }
public object targetType { get; set; }
public object enableDeletionProtection { get; set; }
public object _internal { get; set; }
public object loadBalancerType { get; set; }
public string[] subnets { get; set; }
public object acl { get; set; }
public object forceDestroy { get; set; }
public object region { get; set; }
public object versioning { get; set; }
public string[] routeTableId { get; set; }
public string[] subnetId { get; set; }
public string[] defaultActions { get; set; }
public string[] loadBalancerArn { get; set; }
public object blockPublicAcls { get; set; }
public object blockPublicPolicy { get; set; }
public string[] bucket { get; set; }
public object ignorePublicAcls { get; set; }
public object restrictPublicBuckets { get; set; }
public string[] artifacts { get; set; }
public object buildTimeout { get; set; }
public string[] environment { get; set; }
public string[] serviceRole { get; set; }
public string[] source { get; set; }
public string[] policy { get; set; }
public string[] securityGroups { get; set; }
public string[] targetGroupArn { get; set; }
public string[] targetId { get; set; }
public string[] aliases { get; set; }
public object type { get; set; }
public string[] zoneId { get; set; }
public string[] containerDefinitions { get; set; }
public object cpu { get; set; }
public string[] executionRoleArn { get; set; }
public object memory { get; set; }
public object networkMode { get; set; }
public object requiresCompatibilities { get; set; }
public string[] records { get; set; }
public object ttl { get; set; }
public string[] cluster { get; set; }
public object deploymentController { get; set; }
public object deploymentMaximumPercent { get; set; }
public object deploymentMinimumHealthyPercent { get; set; }
public object desiredCount { get; set; }
public object healthCheckGracePeriodSeconds { get; set; }
public object launchType { get; set; }
public string[] loadBalancers { get; set; }
public string[] networkConfiguration { get; set; }
public string[] taskDefinition { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment