Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdk/go/StackReference: Add GetOutputDetails #12034

Merged
merged 1 commit into from
Feb 9, 2023
Merged

Conversation

abhinav
Copy link
Contributor

@abhinav abhinav commented Feb 1, 2023

Outputs received from StackReferences are currently
unnecessarily wrapped in Output<T>.
If the name is known (string, not Input<string>),
these values are largely fixed and "known" at runtime.

This change introduces a
StackReference.GetOutputDetails method to Go
and a StackReference.get_output_details method to Python.
This method returns a plain OutputDetails object.
This object has two fields: value and secretValue.
At most one of these fields is set,
depending on whether the stack reference output is a secret.

Refs #10839, #5035


Related

Copy link
Contributor Author

abhinav commented Feb 1, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@abhinav abhinav changed the title sdk/{go,py}/StackReference: Add GetOutputDetails sdk/StackReference: Add GetOutputDetails Feb 1, 2023
@pulumi-bot
Copy link
Contributor

pulumi-bot commented Feb 1, 2023

Changelog

[uncommitted] (2023-02-04)

Features

  • [sdk/go] Adds StackReference.GetOutputDetails to retrieve outputs from StackReferences as plain objects.
    #12034

@abhinav abhinav force-pushed the abhinav/stack-ref-output/go branch 2 times, most recently from 036fd3e to 454411a Compare February 1, 2023 01:45
@abhinav abhinav changed the title sdk/StackReference: Add GetOutputDetails sdk/go/StackReference: Add GetOutputDetails Feb 3, 2023
@abhinav abhinav force-pushed the abhinav/stack-ref-output/go branch 2 times, most recently from 403bbfa to 8eb403b Compare February 3, 2023 22:24
Outputs received from StackReferences are currently
unnecessarily wrapped in `Output<T>`.
If the name is known (`string`, not `Input<string>`),
these values are largely fixed and "known" at runtime.

This change introduces a StackReference.GetOutputDetails method
which returns a plain StackReferenceOutputDetails object.
This object has two fields: Value and SecretValue.
At most one of these fields is set,
depending on whether the stack reference output is a secret.

Refs #10839, #5035
abhinav added a commit that referenced this pull request Feb 4, 2023
This is the Python equivalent to the StackReference.GetOutputDetails
method and accompanying type added to the Go SDK in #12034.

This will allow users of the Python SDK to fetch outputs from stack
references directly--without going through an Output type.

Refs #10839, #5035
abhinav added a commit that referenced this pull request Feb 4, 2023
NodeJS equivalent of the StackReference.GetOutputDetails
method and accompanying type added to the Go SDK in #12034.

This will allow users of the TypeScript and JavaScript SDKs
to fetch outputs from stack references directly--without going through
an Output type.

Couple notes about testing:

- `MockMonitor.readResource` kept exploding because the getCustom method
  was missing on the provided object.
  I didn't find any examples in the Node SDK
  of using mocks to test StackReferences,
  so I'm guessing this was an unexercised code path.
  I've fixed that.
- It seems that the JavaScript SDK promotes an entire map to secret
  if an item inside it is a secret.
  So I had to isolate the two test cases into separate outputs
  to get the plain text case to be written as a "value".
  If there's a more correct way of setting up that mock,
  I'm happy to merge the outputs back into a single map
  for a more representative test case.

Refs #10839, #5035
abhinav added a commit that referenced this pull request Feb 4, 2023
This is the Python equivalent to the StackReference.GetOutputDetails
method and accompanying type added to the Go SDK in #12034.

This will allow users of the Python SDK to fetch outputs from stack
references directly--without going through an Output type.

Refs #10839, #5035
@abhinav abhinav marked this pull request as ready for review February 6, 2023 22:09
// Output value returned by the StackReference.
// This field is nil if the value is a secret
// or it does not exist.
Value interface{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Horrible corner case that I don't think we need to worry about, but I think an output can be "null" itself. But I imagine hardly anything in Go handles that correctly anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Yeah, if we get to a point where we want to support null in the model, it might be possible to introduce a sentinel value pulumi.Null. Although I don't think this is likely for the top-level object.

@abhinav
Copy link
Contributor Author

abhinav commented Feb 9, 2023

bors r+

@bors
Copy link
Contributor

bors bot commented Feb 9, 2023

Build succeeded:

@bors bors bot merged commit 4f19856 into master Feb 9, 2023
@bors bors bot deleted the abhinav/stack-ref-output/go branch February 9, 2023 16:59
bors bot added a commit that referenced this pull request Feb 9, 2023
12071: sdk/py/StackReference: Add get_output_details r=abhinav a=abhinav

This is the Python equivalent to the StackReference.GetOutputDetails
method and accompanying type added to the Go SDK in #12034.

This will allow users of the Python SDK to fetch outputs from stack
references directly--without going through an Output type.

Refs #10839, #5035


12072: sdk/node/StackReference: Add getOutputDetails r=abhinav a=abhinav

NodeJS equivalent of the StackReference.GetOutputDetails
method and accompanying type added to the Go SDK in #12034.

This will allow users of the TypeScript and JavaScript SDKs
to fetch outputs from stack references directly--without going through
an Output type.

Couple notes about testing:

- `MockMonitor.readResource` kept exploding because the getCustom method
  was missing on the provided object.
  I didn't find any examples in the Node SDK
  of using mocks to test StackReferences,
  so I'm guessing this was an unexercised code path.
  I've fixed that.
- It seems that the JavaScript SDK promotes an entire map to secret
  if an item inside it is a secret.
  So I had to isolate the two test cases into separate outputs
  to get the plain text case to be written as a "value".
  If there's a more correct way of setting up that mock,
  I'm happy to merge the outputs back into a single map
  for a more representative test case.

Refs #10839, #5035


Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
bors bot added a commit that referenced this pull request Feb 9, 2023
12071: sdk/py/StackReference: Add get_output_details r=abhinav a=abhinav

This is the Python equivalent to the StackReference.GetOutputDetails
method and accompanying type added to the Go SDK in #12034.

This will allow users of the Python SDK to fetch outputs from stack
references directly--without going through an Output type.

Refs #10839, #5035


Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
bors bot added a commit that referenced this pull request Feb 9, 2023
12072: sdk/node/StackReference: Add getOutputDetails r=abhinav a=abhinav

NodeJS equivalent of the StackReference.GetOutputDetails
method and accompanying type added to the Go SDK in #12034.

This will allow users of the TypeScript and JavaScript SDKs
to fetch outputs from stack references directly--without going through
an Output type.

Couple notes about testing:

- `MockMonitor.readResource` kept exploding because the getCustom method
  was missing on the provided object.
  I didn't find any examples in the Node SDK
  of using mocks to test StackReferences,
  so I'm guessing this was an unexercised code path.
  I've fixed that.
- It seems that the JavaScript SDK promotes an entire map to secret
  if an item inside it is a secret.
  So I had to isolate the two test cases into separate outputs
  to get the plain text case to be written as a "value".
  If there's a more correct way of setting up that mock,
  I'm happy to merge the outputs back into a single map
  for a more representative test case.

Refs #10839, #5035


Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
abhinav added a commit to pulumi/pulumi-dotnet that referenced this pull request Feb 10, 2023
This is the C# equivalent of StackReference.GetOutputDetails
that was added to:

- Go SDK in pulumi/pulumi#12034
- Python SDK in pulumi/pulumi#12071
- Node SDK in pulumi/pulumi#12072

It introduces a GetOutputDetailsAsync method
that returns a StackReferenceOutputDetails promise,
allowing looking at the results without going through an Output type.

**Testing**: As with Node (pulumi/pulumi#12072), C# appears to promote
the entire dictionary to secret if one of the values is secret.
Therefore, this needed separate tests for each case.

Refs pulumi/pulumi#10839, pulumi/pulumi#5035
abhinav added a commit to pulumi/pulumi-dotnet that referenced this pull request Feb 13, 2023
This is the C# equivalent of StackReference.GetOutputDetails
that was added to:

- Go SDK in pulumi/pulumi#12034
- Python SDK in pulumi/pulumi#12071
- Node SDK in pulumi/pulumi#12072

It introduces a GetOutputDetailsAsync method
that returns a StackReferenceOutputDetails promise,
allowing looking at the results without going through an Output type.

**Testing**: As with Node (pulumi/pulumi#12072), C# appears to promote
the entire dictionary to secret if one of the values is secret.
Therefore, this needed separate tests for each case.

Refs pulumi/pulumi#10839, pulumi/pulumi#5035
abhinav added a commit to pulumi/pulumi-java that referenced this pull request Feb 13, 2023
Adds the Java equivalent of StackReference.GetOutputDetails
that was added to:

- Go SDK in pulumi/pulumi#12034
- Python SDK in pulumi/pulumi#12071
- Node SDK in pulumi/pulumi#12072
- .NET SDK in pulumi/pulumi-dotnet#103

In Java, this adds a new `StackReference.outputDetailsAsync` method
which returns a CompletableFuture of a StackReferenceOutputDetails.
The object has optional value and secretValue fields,
at most one of which is set depending on whether the value is a secret.
Neither field is set if the value is absent.

Refs pulumi/pulumi#10839, pulumi/pulumi#5035
abhinav added a commit to pulumi/pulumi-java that referenced this pull request Feb 13, 2023
Adds the Java equivalent of StackReference.GetOutputDetails
that was added to:

- Go SDK in pulumi/pulumi#12034
- Python SDK in pulumi/pulumi#12071
- Node SDK in pulumi/pulumi#12072
- .NET SDK in pulumi/pulumi-dotnet#103

In Java, this adds a new `StackReference.outputDetailsAsync` method
which returns a CompletableFuture of a StackReferenceOutputDetails.
The object has optional value and secretValue fields,
at most one of which is set depending on whether the value is a secret.
Neither field is set if the value is absent.

Refs pulumi/pulumi#10839, pulumi/pulumi#5035
abhinav added a commit to pulumi/pulumi-java that referenced this pull request Mar 9, 2023
Adds the Java equivalent of StackReference.GetOutputDetails
that was added to:

- Go SDK in pulumi/pulumi#12034
- Python SDK in pulumi/pulumi#12071
- Node SDK in pulumi/pulumi#12072
- .NET SDK in pulumi/pulumi-dotnet#103

In Java, this adds a new `StackReference.outputDetailsAsync` method
which returns a CompletableFuture of a StackReferenceOutputDetails.
The object has optional value and secretValue fields,
at most one of which is set depending on whether the value is a secret.
Neither field is set if the value is absent.

Refs pulumi/pulumi#10839, pulumi/pulumi#5035
abhinav added a commit to pulumi/pulumi-java that referenced this pull request Mar 10, 2023
Adds the Java equivalent of StackReference.GetOutputDetails
that was added to:

- Go SDK in pulumi/pulumi#12034
- Python SDK in pulumi/pulumi#12071
- Node SDK in pulumi/pulumi#12072
- .NET SDK in pulumi/pulumi-dotnet#103

In Java, this adds a new `StackReference.outputDetailsAsync` method
which returns a CompletableFuture of a StackReferenceOutputDetails.
The object has optional value and secretValue fields,
at most one of which is set depending on whether the value is a secret.
Neither field is set if the value is absent.

Refs pulumi/pulumi#10839, pulumi/pulumi#5035
abhinav added a commit to pulumi/pulumi-java that referenced this pull request Mar 10, 2023
Adds the Java equivalent of StackReference.GetOutputDetails
that was added to:

- Go SDK in pulumi/pulumi#12034
- Python SDK in pulumi/pulumi#12071
- Node SDK in pulumi/pulumi#12072
- .NET SDK in pulumi/pulumi-dotnet#103

In Java, this adds a new `StackReference.outputDetailsAsync` method
which returns a CompletableFuture of a StackReferenceOutputDetails.
The object has optional value and secretValue fields,
at most one of which is set depending on whether the value is a secret.
Neither field is set if the value is absent.

Refs pulumi/pulumi#10839, pulumi/pulumi#5035
abhinav added a commit to pulumi/pulumi-java that referenced this pull request Mar 10, 2023
Adds the Java equivalent of StackReference.GetOutputDetails
that was added to:

- Go SDK in pulumi/pulumi#12034
- Python SDK in pulumi/pulumi#12071
- Node SDK in pulumi/pulumi#12072
- .NET SDK in pulumi/pulumi-dotnet#103

In Java, this adds a new `StackReference.outputDetailsAsync` method
which returns a CompletableFuture of a StackReferenceOutputDetails.
The object has optional value and secretValue fields,
at most one of which is set depending on whether the value is a secret.
Neither field is set if the value is absent.

Refs pulumi/pulumi#10839, pulumi/pulumi#5035
abhinav added a commit to pulumi/pulumi-hugo that referenced this pull request Mar 22, 2023
Adds a blog post introducing
the new StackReference OutputDetails feature.

The feature was added to all supported SDKs in the following PRs:

- pulumi/pulumi#12034
- pulumi/pulumi#12071
- pulumi/pulumi-dotnet#103
- pulumi/pulumi#12072
- pulumi/pulumi-java#986
abhinav added a commit to pulumi/pulumi-hugo that referenced this pull request Mar 23, 2023
Adds a blog post introducing
the new StackReference OutputDetails feature.

The feature was added to all supported SDKs in the following PRs:

- pulumi/pulumi#12034
- pulumi/pulumi#12071
- pulumi/pulumi-dotnet#103
- pulumi/pulumi#12072
- pulumi/pulumi-java#986
abhinav added a commit to pulumi/pulumi-hugo that referenced this pull request Mar 23, 2023
Adds a blog post introducing
the new StackReference OutputDetails feature.

The feature was added to all supported SDKs in the following PRs:

- pulumi/pulumi#12034
- pulumi/pulumi#12071
- pulumi/pulumi-dotnet#103
- pulumi/pulumi#12072
- pulumi/pulumi-java#986
scottslowe pushed a commit to pulumi/pulumi-hugo that referenced this pull request Mar 24, 2023
Adds a blog post introducing
the new StackReference OutputDetails feature.

The feature was added to all supported SDKs in the following PRs:

- pulumi/pulumi#12034
- pulumi/pulumi#12071
- pulumi/pulumi-dotnet#103
- pulumi/pulumi#12072
- pulumi/pulumi-java#986
jkerken pushed a commit to algompluecker/pulumi-dotnet that referenced this pull request Jul 24, 2024
This is the C# equivalent of StackReference.GetOutputDetails
that was added to:

- Go SDK in pulumi/pulumi#12034
- Python SDK in pulumi/pulumi#12071
- Node SDK in pulumi/pulumi#12072

It introduces a GetOutputDetailsAsync method
that returns a StackReferenceOutputDetails promise,
allowing looking at the results without going through an Output type.

**Testing**: As with Node (pulumi/pulumi#12072), C# appears to promote
the entire dictionary to secret if one of the values is secret.
Therefore, this needed separate tests for each case.

Refs pulumi/pulumi#10839, pulumi/pulumi#5035
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants