pulumi / pulumi/pulumi-java

Make XResource.get() more ergonomic over missing options

Open
#479 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api/suggestion area/languages kind/enhancement
Dominant language
Java
Stars
85
Forks
26
Avg merge
11h 49m
Merged PRs (30d)
22

Description

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

For example, for a com.pulumi.aws.ec2.SecurityGroup the get method has the following signature:

    /**
     * Get an existing Host resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state
     * @param options Optional settings to control the behavior of the CustomResource.
     */
    public static SecurityGroup get(String name, Output<String> id, @Nullable SecurityGroupState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new SecurityGroup(name, id, state, options);
    }

Note how String id is not auto-promoted to Output<String> and state, options must be supplied as nulls and cannot be omitted. This is a minor ergonomics problem but perhaps we can enhance the API here to read better.

Affected area/feature

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the XResource.get API and the SecurityGroup.get signature shown in the issue. Compare how generated get methods handle String IDs, state, and options, then define a consistent ergonomic API and its compatibility requirements. Done means the design is agreed and the relevant generated APIs and tests cover omitted optional values.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.