diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 0766a7057e1..c0756a3faf6 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -2,7 +2,6 @@ - Default to using Gradle with the Nexus publishing plugin when using `gen-sdk` - Support RunPlugin for Maven and Gradle plugins +- Remove `@Deprecated` members from the Java SDK -### Bug Fixes - -- Use filepath.Join instead of file.Join \ No newline at end of file +### Bug Fixes \ No newline at end of file diff --git a/pkg/cmd/pulumi-language-java/testdata/projects/l1-stack-reference/src/main/java/generated_program/App.java b/pkg/cmd/pulumi-language-java/testdata/projects/l1-stack-reference/src/main/java/generated_program/App.java index eb54d584606..571b9a00773 100644 --- a/pkg/cmd/pulumi-language-java/testdata/projects/l1-stack-reference/src/main/java/generated_program/App.java +++ b/pkg/cmd/pulumi-language-java/testdata/projects/l1-stack-reference/src/main/java/generated_program/App.java @@ -22,7 +22,7 @@ public static void stack(Context ctx) { .name("organization/other/dev") .build()); - ctx.export("plain", ref.getOutput("plain")); - ctx.export("secret", ref.getOutput("secret")); + ctx.export("plain", ref.output("plain")); + ctx.export("secret", ref.output("secret")); } } diff --git a/pkg/codegen/java/gen_program_expressions.go b/pkg/codegen/java/gen_program_expressions.go index b872e473199..36b5623950d 100644 --- a/pkg/codegen/java/gen_program_expressions.go +++ b/pkg/codegen/java/gen_program_expressions.go @@ -442,7 +442,7 @@ func (g *generator) GenFunctionCallExpression(w io.Writer, expr *model.FunctionC case "project": g.Fgen(w, "Deployment.getInstance().getProjectName()") case "getOutput": - g.Fgenf(w, "%v.getOutput(%v)", expr.Args[0], expr.Args[1]) + g.Fgenf(w, "%v.output(%v)", expr.Args[0], expr.Args[1]) case "organization": g.Fgen(w, "Deployment.getInstance().getOrganizationName()") default: diff --git a/pkg/codegen/testing/test/testdata/jumbo-resources/java-extras/src/test/java/com/pulumi/jumbo/JumboTest.java b/pkg/codegen/testing/test/testdata/jumbo-resources/java-extras/src/test/java/com/pulumi/jumbo/JumboTest.java index 1eea9b66a31..0021efe6d24 100644 --- a/pkg/codegen/testing/test/testdata/jumbo-resources/java-extras/src/test/java/com/pulumi/jumbo/JumboTest.java +++ b/pkg/codegen/testing/test/testdata/jumbo-resources/java-extras/src/test/java/com/pulumi/jumbo/JumboTest.java @@ -558,7 +558,7 @@ void testJumboCustomType() { }).throwOnError(); var resource = result.resources().stream() - .filter(r -> r.getResourceName().equals("testResource")) + .filter(r -> r.pulumiResourceName().equals("testResource")) .filter(r -> r instanceof ACustomResource) .map(r -> (ACustomResource) r) .findFirst() @@ -581,4 +581,4 @@ public CompletableFuture newResourceAsync(ResourceArgs args) { throw new IllegalArgumentException(String.format("Unknown resource '%s'", args.type)); } } -} +} \ No newline at end of file diff --git a/sdk/java/pulumi/src/main/java/com/pulumi/core/annotations/CustomType.java b/sdk/java/pulumi/src/main/java/com/pulumi/core/annotations/CustomType.java index e9d2160e597..9a7368e5c79 100644 --- a/sdk/java/pulumi/src/main/java/com/pulumi/core/annotations/CustomType.java +++ b/sdk/java/pulumi/src/main/java/com/pulumi/core/annotations/CustomType.java @@ -9,43 +9,14 @@ * Annotation used by a Pulumi Cloud Provider Package to mark complex types used for a Resource * output property. *

- * A complex type must have a single constructor - * marked with the @see {@link CustomType.Constructor} annotation, - * or a single builder marked with the @see {@link CustomType.Builder} annotation. + * A complex type must have a single builder marked with the {@link CustomType.Builder} annotation. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface CustomType { - - /** - * Annotation used by a Pulumi provider to mark the constructor for a complex - * property type so that it can be instantiated by the Pulumi runtime. - *

- * WARNING: nested classes will have a reference to the parent class - * as the first parameter of the constructor ({@code arg0}) - * and this type also needs to be deserializable - * or the class needs to be made static. - * This is unlikely scenario, but theoretically possible. - * The invisible fist argument needs also to be named in the annotation value. - *

- * The constructor must take parameters annotated with {@link Parameter} that map to - * the resultant @see {@link com.google.protobuf.Struct} returned by the engine. - * - * @deprecated use {@link CustomType.Builder} and {@link CustomType.Setter} - */ - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.CONSTRUCTOR) - @Deprecated - @interface Constructor { - /* Empty */ - } - /** * Annotation used by a Pulumi provider to mark a builder for a complex * property type so that it can be instantiated by the Pulumi runtime. - *

- * The setter must take a parameter annotated with {@link Parameter} that map to - * the resultant @see {@link com.google.protobuf.Struct} returned by the engine. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @@ -56,9 +27,6 @@ /** * Annotation used by a Pulumi provider to mark a setter for a complex * property type so that it can be instantiated by the Pulumi runtime. - *

- * The setter must take a parameter annotated with {@link Parameter} that map to - * the resultant @see {@link com.google.protobuf.Struct} returned by the engine. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @@ -71,23 +39,4 @@ */ String value() default ""; } - - /** - * Annotation used by a Pulumi Cloud Provider Package to marks a constructor parameter for a complex - * property type so that it can be instantiated by the Pulumi runtime. - * - * @deprecated use {@link CustomType.Builder} and {@link CustomType.Setter} - */ - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.PARAMETER) - @Deprecated - @interface Parameter { - /** - * We need to know the name of a constructor parameter, - * and unfortunately Java compiler does not give this information through reflection (by default) - * - * @return name of a constructor parameter - */ - String value(); - } -} +} \ No newline at end of file diff --git a/sdk/java/pulumi/src/main/java/com/pulumi/core/annotations/Export.java b/sdk/java/pulumi/src/main/java/com/pulumi/core/annotations/Export.java index 3c4fdadedd4..6f3b5730c89 100644 --- a/sdk/java/pulumi/src/main/java/com/pulumi/core/annotations/Export.java +++ b/sdk/java/pulumi/src/main/java/com/pulumi/core/annotations/Export.java @@ -27,21 +27,6 @@ */ String name() default ""; - /** - * @return the generic type parameter of the annotated @see {@link com.pulumi.core.Output} - * @deprecated use {@link #tree()} and {@link #refs()} - */ - @Deprecated - Class type() default Object.class; - - /** - * @return the generic type parameters of the @see {@link #type()} - * If not set, the assumption is that the @see {@link #type()} is not a generic type. - * @deprecated use {@link #tree()} and {@link #refs()} - */ - @Deprecated - Class[] parameters() default {}; - /** * @return the generic type parameter tree shape of the annotated @see {@link com.pulumi.core.Output} */ diff --git a/sdk/java/pulumi/src/main/java/com/pulumi/core/internal/annotations/ExportMetadata.java b/sdk/java/pulumi/src/main/java/com/pulumi/core/internal/annotations/ExportMetadata.java index 86c47a13913..a6335617360 100644 --- a/sdk/java/pulumi/src/main/java/com/pulumi/core/internal/annotations/ExportMetadata.java +++ b/sdk/java/pulumi/src/main/java/com/pulumi/core/internal/annotations/ExportMetadata.java @@ -94,14 +94,8 @@ public static ImmutableMap> of(Class extractionType ))); var fieldType = field.getType(); - if (export.refs().length == 0) { - var exportType = export.type(); - var parameters = export.parameters(); - return of(field, export, fieldType, exportType, parameters); - } else { - var exportTypeNew = TypeShape.fromTree(export.refs(), export.tree()); - return of(field, export, fieldType, exportTypeNew); - } + var exportTypeNew = TypeShape.fromTree(export.refs(), export.tree()); + return of(field, export, fieldType, exportTypeNew); }) .collect(toImmutableMap( ImportExportMetadata::getName, diff --git a/sdk/java/pulumi/src/main/java/com/pulumi/resources/CustomResource.java b/sdk/java/pulumi/src/main/java/com/pulumi/resources/CustomResource.java index 8e597d127df..a0e60248d4d 100644 --- a/sdk/java/pulumi/src/main/java/com/pulumi/resources/CustomResource.java +++ b/sdk/java/pulumi/src/main/java/com/pulumi/resources/CustomResource.java @@ -108,18 +108,6 @@ protected Optional>> idFuture() { return Optional.of(this.idFuture); } - /** - * ID is the provider-assigned unique ID for this managed resource. It is set during - * deployments and may be missing (unknown) during planning phases. - * - * @return the provider-assigned unique ID - * @deprecated use {@link #id()} - */ - @Deprecated - public Output getId() { - return id(); - } - /** * Pulumi ID is the provider-assigned unique ID for this managed resource. * It is set during deployments and may be missing (unknown) during planning phases. diff --git a/sdk/java/pulumi/src/main/java/com/pulumi/resources/Resource.java b/sdk/java/pulumi/src/main/java/com/pulumi/resources/Resource.java index 769e02cbf6a..7585ac1ca18 100644 --- a/sdk/java/pulumi/src/main/java/com/pulumi/resources/Resource.java +++ b/sdk/java/pulumi/src/main/java/com/pulumi/resources/Resource.java @@ -253,17 +253,6 @@ protected Optional>> idFuture() { return Optional.empty(); } - /** - * The type assigned to the resource at construction. - * - * @return the type of the resource - * @deprecated use {@link #pulumiResourceType()} - */ - @Deprecated - public String getResourceType() { - return type; - } - /** * The Pulumi type assigned to the resource at construction. * @@ -273,17 +262,6 @@ public String pulumiResourceType() { return type; } - /** - * The name assigned to the resource at construction. - * - * @return the name of the resource - * @deprecated use {@link #pulumiResourceName()} - */ - @Deprecated - public String getResourceName() { - return name; - } - /** * The Pulumi name assigned to the resource at construction. * @@ -293,29 +271,6 @@ public String pulumiResourceName() { return name; } - /** - * The child resources of this resource. We use these (only from a @see {@link ComponentResource}) to - * allow code to "dependOn" a @see {@link ComponentResource} and have that effectively mean that it is - * depending on all the @see {@link ComponentResource} children of that component. - *

- * Important! We only walk through @see {@link ComponentResource}s. They're the only resources that - * serve as an aggregation of other primitive (i.e.custom) resources. - * While a custom resource can be a parent of other resources, we don't want to ever depend - * on those child resource. - * If we do, it's simple to end up in a situation where we end up depending on a - * child resource that has a data cycle dependency due to the data passed into it. - * This would be pretty nonsensical as there is zero need for a custom resource to - * ever need to reference the urn of a component resource. - * So it's acceptable if that sort of pattern failed in practice. - * - * @return the child resources of this resource - * @deprecated use {@link #pulumiChildResources()} - */ - @Deprecated - public Set getChildResources() { - return childResources; - } - /** * The child resources of this Pulumi resource. We use these (only from a @see {@link ComponentResource}) to * allow code to "dependOn" a @see {@link ComponentResource} and have that effectively mean that it is @@ -337,17 +292,6 @@ public Set pulumiChildResources() { return childResources; } - /** - * Urn is the stable logical URN used to distinctly address a resource, both before and after deployments. - * - * @return the stable logical URN - * @deprecated use {@link #urn()} - */ - @Deprecated - public Output getUrn() { - return this.urn; - } - /** * Pulumi URN is the stable logical identifier used to distinctly address a resource, * both before and after deployments. diff --git a/sdk/java/pulumi/src/main/java/com/pulumi/resources/ResourceTransformation.java b/sdk/java/pulumi/src/main/java/com/pulumi/resources/ResourceTransformation.java index 1b386171cdc..bb4c7f93487 100644 --- a/sdk/java/pulumi/src/main/java/com/pulumi/resources/ResourceTransformation.java +++ b/sdk/java/pulumi/src/main/java/com/pulumi/resources/ResourceTransformation.java @@ -47,15 +47,6 @@ public Resource resource() { return this.resource; } - /** - * @return the {@link Resource} instance that is being transformed. - * @deprecated use {@link #resource()} - */ - @Deprecated - public Resource getResource() { - return this.resource; - } - /** * @return the original properties passed to the {@link Resource} constructor. */ @@ -63,30 +54,12 @@ public ResourceArgs args() { return this.args; } - /** - * @return the original properties passed to the {@link Resource} constructor. - * @deprecated use {@link #args()} - */ - @Deprecated - public ResourceArgs getArgs() { - return this.args; - } - /** * @return the original resource options passed to the {@link Resource} constructor. */ public ResourceOptions options() { return this.options; } - - /** - * @return the original resource options passed to the {@link Resource} constructor. - * @deprecated use {@link #options()} - */ - @Deprecated - public ResourceOptions getOptions() { - return this.options; - } } /** @@ -112,29 +85,11 @@ public ResourceArgs args() { return args; } - /** - * @return the original properties passed to the Resource constructor. - * @deprecated use {@link #args()} - */ - @Deprecated - public ResourceArgs getArgs() { - return args; - } - /** * @return the original resource options passed to the Resource constructor. */ public ResourceOptions options() { return options; } - - /** - * @return the original resource options passed to the Resource constructor. - * @deprecated use {@link #options()} - */ - @Deprecated - public ResourceOptions getOptions() { - return options; - } } -} +} \ No newline at end of file diff --git a/sdk/java/pulumi/src/main/java/com/pulumi/resources/StackReference.java b/sdk/java/pulumi/src/main/java/com/pulumi/resources/StackReference.java index 13d886e7f58..9039b499c15 100644 --- a/sdk/java/pulumi/src/main/java/com/pulumi/resources/StackReference.java +++ b/sdk/java/pulumi/src/main/java/com/pulumi/resources/StackReference.java @@ -81,17 +81,6 @@ private static Output ensureName(@Nullable StackReferenceArgs args, Stri return args == null ? Output.of(name) : args.name().orElse(Output.of(name)); } - /** - * The name of the referenced stack. - * - * @return the stack name - * @deprecated use {@link #name()} - */ - @Deprecated - public Output getName() { - return name(); - } - /** * The name of the referenced stack. * @@ -101,17 +90,6 @@ public Output name() { return name; } - /** - * The outputs of the referenced stack. - * - * @return the stack outputs - * @deprecated use {@link #outputs()} - */ - @Deprecated - public Output> getOutputs() { - return outputs(); - } - /** * The outputs of the referenced stack. * @@ -121,17 +99,6 @@ public Output> outputs() { return outputs.applyValue(ImmutableMap::copyOf); } - /** - * The secret output names of the referenced stack. - * - * @return the names of the secret outputs - * @deprecated use {@link #secretOutputNames()} - */ - @Deprecated - public Output> getSecretOutputNames() { - return secretOutputNames(); - } - /** * The secret output names of the referenced stack. * @@ -141,19 +108,6 @@ public Output> secretOutputNames() { return secretOutputNames.applyValue(ImmutableList::copyOf); } - /** - * Fetches the value of the named stack output, or {@code null} if the stack output was not found. - *

- * - * @param name The name of the stack output to fetch. - * @return An {@link Output} containing the requested value. - * @deprecated use {@link #output(String)} - */ - @Deprecated - public Output getOutput(String name) { - return output(name); - } - /** * Fetches the value of the named stack output, or {@code null} if the stack output was not found. *

@@ -165,19 +119,6 @@ public Output output(String name) { return output(Output.of(name)); } - /** - * Fetches the value of the named stack output, or {@code null} if the stack output was not found. - *

- * - * @param name The name of the stack output to fetch. - * @return An {@link Output} containing the requested value. - * @deprecated use {@link #output(Output)} - */ - @Deprecated - public Output getOutput(Output name) { - return output(name); - } - /** * Fetches the value of the named stack output, or {@code null} if the stack output was not found. *

@@ -334,4 +275,4 @@ public KeyMissingException(String key, String stack) { super(String.format("Required output '%s' does not exist on stack '%s'.", key, stack)); } } -} +} \ No newline at end of file diff --git a/sdk/java/pulumi/src/main/java/com/pulumi/resources/StackReferenceArgs.java b/sdk/java/pulumi/src/main/java/com/pulumi/resources/StackReferenceArgs.java index ef3b03d3657..98c7b2dfa94 100644 --- a/sdk/java/pulumi/src/main/java/com/pulumi/resources/StackReferenceArgs.java +++ b/sdk/java/pulumi/src/main/java/com/pulumi/resources/StackReferenceArgs.java @@ -24,16 +24,6 @@ public StackReferenceArgs(@Nullable Output name) { this.name = name; } - /** - * The name of the stack to reference. - * - * @deprecated use {@link #name()} - */ - @Deprecated - public Optional> getName() { - return name(); - } - /** * The name of the stack to reference. */ @@ -82,4 +72,4 @@ public StackReferenceArgs build() { return new StackReferenceArgs(this.name); } } -} +} \ No newline at end of file diff --git a/sdk/java/pulumi/src/main/java/com/pulumi/serialization/internal/Converter.java b/sdk/java/pulumi/src/main/java/com/pulumi/serialization/internal/Converter.java index aa8f33e470a..f8bb92e5b2a 100644 --- a/sdk/java/pulumi/src/main/java/com/pulumi/serialization/internal/Converter.java +++ b/sdk/java/pulumi/src/main/java/com/pulumi/serialization/internal/Converter.java @@ -281,92 +281,6 @@ private Object tryConvertObjectInner( return tryConvertMap(context, value, targetType); } - var hasAnnotatedConstructor = targetType.hasAnnotatedConstructor(CustomType.Constructor.class); - if (hasAnnotatedConstructor) { - var constructor = targetType.getAnnotatedConstructor(CustomType.Constructor.class); - - //noinspection unchecked - var argumentsMap = (Map) tryEnsureType(context, value, TypeShape.of(Map.class), Map.of()); - var constructorParameters = constructor.getParameters(); - var arguments = new Object[constructorParameters.length]; - - // Validate that we can decode the argument we've received - var expectedParameterNames = Arrays.stream(constructorParameters) - .map(p -> Optional.ofNullable(p.getAnnotation(CustomType.Parameter.class))) - .filter(Optional::isPresent) - .map(p -> p.get().value()) - .collect(toSet()); - for (var argumentName : argumentsMap.keySet()) { - if (!expectedParameterNames.contains(argumentName)) { - throw new IllegalArgumentException(String.format( - "Expected type '%s' (annotated with '%s') to provide a constructor annotated with '%s', " + - "and the parameter names in the annotation matching the parameters being deserialized. " + - "Constructor '%s' expects parameter names of: '%s', " + - "but does not expect: '%s'. Unable to deserialize.", - targetType.getTypeName(), - CustomType.class.getTypeName(), - CustomType.Constructor.class.getTypeName(), - constructor, - String.join(",", expectedParameterNames), - argumentName - )); - } - } - for (int i = 0, n = constructorParameters.length; i < n; i++) { - var parameter = constructorParameters[i]; - var parameterName = extractParameterName(parameter); - if (parameterName.isEmpty()) { - throw new IllegalArgumentException(String.format( - "Expected type '%s' (annotated with '%s') to provide a constructor annotated with '%s', " + - "and the parameter names in the parameter annotation matching the parameters being deserialized. " + - "Constructor '%s' parameter nr %d (starting from 0) lacks @%s annotation, " + - "but it is required to deserialize.", - targetType.getTypeName(), - CustomType.class.getTypeName(), - CustomType.Constructor.class.getTypeName(), - constructor, - i, - CustomType.Parameter.class.getSimpleName() - )); - } - - // Note: tryGetValue may not find a value here. - // That can happen for things like unknown values. - // That's ok. We'll set the argument as null. - var argValue = Maps.tryGetValue(argumentsMap, parameterName.get()); - if (argValue.isPresent()) { - arguments[i] = tryConvertObjectInner( - String.format("%s(%s)", targetType.getTypeName(), parameterName.get()), - argValue, - TypeShape.extract(parameter) - ); - } else { - arguments[i] = null; - if (!parameter.isAnnotationPresent(Nullable.class)) { - log.debug(String.format( - "Expected type '%s' (annotated with '%s') to provide a constructor annotated with '%s', " + - "and the parameter names in the parameter annotation matching the parameters being deserialized. " + - "Constructor '%s' parameter named '%s' (nr %d starting from 0) lacks @%s annotation, " + - "so the value is required, but there is no value to deserialize.", - targetType.getTypeName(), - CustomType.class.getTypeName(), - CustomType.Constructor.class.getTypeName(), - constructor, - parameterName.get(), - i, - Nullable.class.getTypeName() - )); - } - } - } - - try { - return constructor.newInstance(arguments); - } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new IllegalStateException(String.format("Unexpected exception: %s", e.getMessage()), e); - } - } - var hasAnnotatedBuilder = targetType.hasAnnotatedClass(CustomType.Builder.class); if (hasAnnotatedBuilder) { var builderType = targetType.getAnnotatedClass(CustomType.Builder.class); @@ -793,37 +707,7 @@ public void checkTargetType(String context, TypeShape targetType, HashSet checkTargetType( - String.format("%s(%s)", targetType.getTypeName(), parameter.getName()), - TypeShape.extract(parameter), // check nested target type - seenTypes - )); - return; - } if (hasAnnotatedBuilder) { var builder = targetType.getAnnotatedClass(CustomType.Builder.class); collectSetters(builder).forEach((name, parameter) -> checkTargetType( @@ -833,6 +717,13 @@ public void checkTargetType(String context, TypeShape targetType, HashSet extractParameterName(Parameter parameter) { - // we cannot just use parameter.getName(), - // because it will be different at runtime e.g. 'arg0', 'arg1', etc. - return Optional.ofNullable( - parameter.getAnnotation(CustomType.Parameter.class) - ).map(CustomType.Parameter::value); - } - private static String extractSetterName(Method method) { // we cannot just use parameter.getName(), // because it will be different at runtime e.g. 'arg0', 'arg1', etc. diff --git a/tests/examples/aws-native-java-s3-folder/src/main/java/s3site/App.java b/tests/examples/aws-native-java-s3-folder/src/main/java/s3site/App.java index ee3625f257f..1973e11b2f7 100644 --- a/tests/examples/aws-native-java-s3-folder/src/main/java/s3site/App.java +++ b/tests/examples/aws-native-java-s3-folder/src/main/java/s3site/App.java @@ -32,14 +32,14 @@ private static void stack(Context ctx) { final String siteDir = "www/"; forEachFileInTree(siteDir, (path, contentType) -> { new BucketObject(path.toString().replace(siteDir, ""), - BucketObjectArgs.builder().bucket(siteBucket.getId()) + BucketObjectArgs.builder().bucket(siteBucket.id()) .source(new FileAsset(path.toAbsolutePath().toString())) .contentType(contentType).build() ); }); final var bucketPolicy = new BucketPolicy("bucketPolicy", - BucketPolicyArgs.builder().bucket(siteBucket.getId()) + BucketPolicyArgs.builder().bucket(siteBucket.id()) .policy(siteBucket.arn() .applyValue(bucketArn -> """ { @@ -73,4 +73,4 @@ private static void forEachFileInTree(String siteDir, BiConsumer c throw new RuntimeException(String.format("Failed to walk a path: '%s'", siteDir), e); } } -} +} \ No newline at end of file diff --git a/tests/examples/random/pom.xml b/tests/examples/random/pom.xml index 83d100c8528..5549d1a75a1 100644 --- a/tests/examples/random/pom.xml +++ b/tests/examples/random/pom.xml @@ -44,7 +44,7 @@ com.pulumi random - 4.6.0 + 4.14.0 @@ -107,4 +107,4 @@ - + \ No newline at end of file diff --git a/tests/integration/stack-transformation/pom.xml b/tests/integration/stack-transformation/pom.xml index 6ecbca7cf76..a03d2e34338 100644 --- a/tests/integration/stack-transformation/pom.xml +++ b/tests/integration/stack-transformation/pom.xml @@ -46,7 +46,7 @@ com.pulumi random - 4.8.1 + 4.14.0 @@ -109,4 +109,4 @@ - + \ No newline at end of file diff --git a/tests/integration/stack-transformation/src/main/java/com/pulumi/example/stacktransformation/App.java b/tests/integration/stack-transformation/src/main/java/com/pulumi/example/stacktransformation/App.java index 3c1d94b2506..503c5c19c2b 100644 --- a/tests/integration/stack-transformation/src/main/java/com/pulumi/example/stacktransformation/App.java +++ b/tests/integration/stack-transformation/src/main/java/com/pulumi/example/stacktransformation/App.java @@ -48,7 +48,7 @@ private static void stack(Context ctx) { var res2 = new MyComponent("res2", ComponentResourceOptions.builder() .resourceTransformations(args -> { - if (Objects.equals(args.resource().getResourceType(), RandomStringType) + if (Objects.equals(args.resource().pulumiResourceType(), RandomStringType) && args.args() instanceof RandomStringArgs) { var oldArgs = (RandomStringArgs) args.args(); var resultArgs = RandomStringArgs.builder() @@ -95,7 +95,7 @@ private static void stack(Context ctx) { // Scenario #3 - apply a transformation to the Stack to transform all (future) resources in the stack private static Optional scenario3(ResourceTransformation.Args args) { - if (Objects.equals(args.resource().getResourceType(), RandomStringType) + if (Objects.equals(args.resource().pulumiResourceType(), RandomStringType) && args.args() instanceof RandomStringArgs) { var oldArgs = (RandomStringArgs) args.args(); var resultArgs = RandomStringArgs.builder() @@ -109,7 +109,7 @@ private static Optional scenario3(ResourceTransfo } private static Optional scenario4(ResourceTransformation.Args args, String v) { - if (Objects.equals(args.resource().getResourceType(), RandomStringType) + if (Objects.equals(args.resource().pulumiResourceType(), RandomStringType) && args.args() instanceof RandomStringArgs) { var oldArgs = (RandomStringArgs) args.args(); var resultArgs = RandomStringArgs.builder() @@ -133,7 +133,7 @@ private static ResourceTransformation transformChild1DependsOnChild2() { // will resolve that promise when it finds child2. if (args.args() instanceof RandomStringArgs) { var resourceArgs = (RandomStringArgs) args.args(); - var resourceName = args.resource().getResourceName(); + var resourceName = args.resource().pulumiResourceName(); if (resourceName.endsWith("-child2")) { // Resolve the child2 promise with the child2 resource. child2ArgsSource.complete(resourceArgs); @@ -205,4 +205,4 @@ public RandomString child2() { return child2; } } -} +} \ No newline at end of file