From fed755de20c29d489add7c5dd4b744863cdff9a1 Mon Sep 17 00:00:00 2001 From: Aaron Friel Date: Fri, 12 Apr 2024 16:01:28 -0700 Subject: [PATCH] update pkg refs, latest tests --- .../test/testdata/kubernetes20/java/README.md | 1 + .../testdata/kubernetes20/java/build.gradle | 152 ++++ .../kubernetes20/java/codegen-manifest.json | 30 + .../kubernetes20/java/settings.gradle | 14 + .../java/com/pulumi/kubernetes/Config.java | 32 + .../java/com/pulumi/kubernetes/Provider.java | 51 ++ .../com/pulumi/kubernetes/ProviderArgs.java | 180 ++++ .../java/com/pulumi/kubernetes/Utilities.java | 89 ++ .../pulumi/kubernetes/core_v1/ConfigMap.java | 164 ++++ .../kubernetes/core_v1/ConfigMapArgs.java | 274 ++++++ .../kubernetes/core_v1/ConfigMapList.java | 136 +++ .../kubernetes/core_v1/ConfigMapListArgs.java | 214 +++++ .../core_v1/inputs/ConfigMapArgs.java | 278 ++++++ .../kubernetes/core_v1/outputs/ConfigMap.java | 165 ++++ .../pulumi/kubernetes/helm/sh_v3/Release.java | 116 +++ .../kubernetes/helm/sh_v3/ReleaseArgs.java | 175 ++++ .../inputs/KubeClientSettingsArgs.java | 89 ++ .../meta_v1/inputs/ListMetaArgs.java | 199 ++++ .../inputs/ManagedFieldsEntryArgs.java | 310 +++++++ .../meta_v1/inputs/ObjectMetaArgs.java | 733 +++++++++++++++ .../meta_v1/inputs/OwnerReferenceArgs.java | 286 ++++++ .../kubernetes/meta_v1/outputs/ListMeta.java | 121 +++ .../meta_v1/outputs/ManagedFieldsEntry.java | 184 ++++ .../meta_v1/outputs/ObjectMeta.java | 414 +++++++++ .../meta_v1/outputs/OwnerReference.java | 172 ++++ .../kubernetes/yaml_v2/ConfigGroup.java | 70 ++ .../kubernetes/yaml_v2/ConfigGroupArgs.java | 257 ++++++ .../test/testdata/kubernetes20/schema.json | 852 ++++++++++++++++++ .../test/testdata/legacy-names/java/README.md | 1 + .../testdata/legacy-names/java/build.gradle | 152 ++++ .../legacy-names/java/codegen-manifest.json | 14 + .../legacy-names/java/settings.gradle | 14 + .../pulumi/legacy_names/Example_resource.java | 87 ++ .../legacy_names/Example_resourceArgs.java | 88 ++ .../HTTP_module/inputs/RequestArgs.java | 80 ++ .../com/pulumi/legacy_names/Provider.java | 47 + .../com/pulumi/legacy_names/ProviderArgs.java | 28 + .../com/pulumi/legacy_names/Utilities.java | 89 ++ .../pulumi/legacy_names/enums/Enum_XYZ.java | 35 + .../test/testdata/legacy-names/schema.json | 81 ++ .../com/pulumi/foobar/ModuleResource.java | 14 +- .../com/pulumi/foobar/ModuleResourceArgs.java | 308 +++---- .../testdata/regress-go-15478/java/README.md | 1 + .../regress-go-15478/java/build.gradle | 152 ++++ .../java/codegen-manifest.json | 13 + .../regress-go-15478/java/settings.gradle | 14 + .../java/com/pulumi/nestedTypes/Provider.java | 47 + .../com/pulumi/nestedTypes/ProviderArgs.java | 28 + .../java/com/pulumi/nestedTypes/Resource.java | 72 ++ .../com/pulumi/nestedTypes/ResourceArgs.java | 28 + .../com/pulumi/nestedTypes/Utilities.java | 89 ++ .../nestedTypes/outputs/NestedType.java | 66 ++ .../testdata/regress-go-15478/schema.json | 52 ++ .../testdata/regress-py-12980/java/README.md | 1 + .../regress-py-12980/java/build.gradle | 152 ++++ .../java/codegen-manifest.json | 20 + .../regress-py-12980/java/settings.gradle | 14 + .../main/java/com/pulumi/myPkg/Provider.java | 47 + .../java/com/pulumi/myPkg/ProviderArgs.java | 28 + .../main/java/com/pulumi/myPkg/Utilities.java | 89 ++ .../pulumi/myPkg/myMod_childA/MemberA1.java | 47 + .../myPkg/myMod_childA/MemberA1Args.java | 28 + .../myPkg/myMod_childA/enums/EnumA.java | 33 + .../myPkg/myMod_childA/outputs/ObjectA.java | 49 + .../pulumi/myPkg/myMod_childB/MemberB1.java | 47 + .../myPkg/myMod_childB/MemberB1Args.java | 28 + .../pulumi/myPkg/myMod_childB/MemberB2.java | 92 ++ .../myPkg/myMod_childB/MemberB2Args.java | 28 + .../myPkg/myMod_childB/enums/EnumB.java | 33 + .../myPkg/myMod_childB/outputs/ObjectB.java | 49 + .../testdata/regress-py-12980/schema.json | 82 ++ .../java/com/pulumi/example/NoRecursive.java | 8 +- .../java/README.md | 1 + .../java/build.gradle | 152 ++++ .../java/codegen-manifest.json | 16 + .../java/settings.gradle | 14 + .../java/com/pulumi/credentials/Config.java | 39 + .../java/com/pulumi/credentials/Provider.java | 83 ++ .../com/pulumi/credentials/ProviderArgs.java | 188 ++++ .../java/com/pulumi/credentials/User.java | 77 ++ .../java/com/pulumi/credentials/UserArgs.java | 65 ++ .../com/pulumi/credentials/Utilities.java | 89 ++ .../pulumi/credentials/enums/HashKind.java | 41 + .../com/pulumi/credentials/inputs/Shared.java | 49 + .../pulumi/credentials/inputs/SharedArgs.java | 63 ++ .../using-shared-types-in-config/schema.json | 144 +++ pulumi | 2 +- tests/integration/java_integration_test.go | 3 + 88 files changed, 9093 insertions(+), 166 deletions(-) create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/README.md create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/build.gradle create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/codegen-manifest.json create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/settings.gradle create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Config.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Provider.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/ProviderArgs.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Utilities.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMap.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapArgs.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapList.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapListArgs.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/inputs/ConfigMapArgs.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/outputs/ConfigMap.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/helm/sh_v3/Release.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/helm/sh_v3/ReleaseArgs.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/inputs/KubeClientSettingsArgs.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ListMetaArgs.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ManagedFieldsEntryArgs.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ObjectMetaArgs.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/OwnerReferenceArgs.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ListMeta.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ManagedFieldsEntry.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ObjectMeta.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/OwnerReference.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroup.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroupArgs.java create mode 100644 pkg/codegen/testing/test/testdata/kubernetes20/schema.json create mode 100644 pkg/codegen/testing/test/testdata/legacy-names/java/README.md create mode 100644 pkg/codegen/testing/test/testdata/legacy-names/java/build.gradle create mode 100644 pkg/codegen/testing/test/testdata/legacy-names/java/codegen-manifest.json create mode 100644 pkg/codegen/testing/test/testdata/legacy-names/java/settings.gradle create mode 100644 pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Example_resource.java create mode 100644 pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Example_resourceArgs.java create mode 100644 pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/HTTP_module/inputs/RequestArgs.java create mode 100644 pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Provider.java create mode 100644 pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/ProviderArgs.java create mode 100644 pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Utilities.java create mode 100644 pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/enums/Enum_XYZ.java create mode 100644 pkg/codegen/testing/test/testdata/legacy-names/schema.json create mode 100644 pkg/codegen/testing/test/testdata/regress-go-15478/java/README.md create mode 100644 pkg/codegen/testing/test/testdata/regress-go-15478/java/build.gradle create mode 100644 pkg/codegen/testing/test/testdata/regress-go-15478/java/codegen-manifest.json create mode 100644 pkg/codegen/testing/test/testdata/regress-go-15478/java/settings.gradle create mode 100644 pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/Provider.java create mode 100644 pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/ProviderArgs.java create mode 100644 pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/Resource.java create mode 100644 pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/ResourceArgs.java create mode 100644 pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/Utilities.java create mode 100644 pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/outputs/NestedType.java create mode 100644 pkg/codegen/testing/test/testdata/regress-go-15478/schema.json create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/README.md create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/build.gradle create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/codegen-manifest.json create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/settings.gradle create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/Provider.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/ProviderArgs.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/Utilities.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/MemberA1.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/MemberA1Args.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/enums/EnumA.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/outputs/ObjectA.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB1.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB1Args.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB2.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB2Args.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/enums/EnumB.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/outputs/ObjectB.java create mode 100644 pkg/codegen/testing/test/testdata/regress-py-12980/schema.json create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/README.md create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/build.gradle create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/codegen-manifest.json create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/settings.gradle create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/Config.java create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/Provider.java create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/ProviderArgs.java create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/User.java create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/UserArgs.java create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/Utilities.java create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/enums/HashKind.java create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/inputs/Shared.java create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/inputs/SharedArgs.java create mode 100644 pkg/codegen/testing/test/testdata/using-shared-types-in-config/schema.json diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/README.md b/pkg/codegen/testing/test/testdata/kubernetes20/java/README.md new file mode 100644 index 00000000000..6b0d347bb27 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/README.md @@ -0,0 +1 @@ +test description diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/build.gradle b/pkg/codegen/testing/test/testdata/kubernetes20/java/build.gradle new file mode 100644 index 00000000000..5e0f59c13e1 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/build.gradle @@ -0,0 +1,152 @@ +// *** WARNING: this file was generated by pulumi-java-gen *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +plugins { + id("signing") + id("java-library") + id("maven-publish") +} + +group = "com.pulumi" + +def resolvedVersion = System.getenv("PACKAGE_VERSION") ?: + (project.version == "unspecified" + ? "0.0.1" + : project.version) + +def signingKey = System.getenv("SIGNING_KEY") +def signingPassword = System.getenv("SIGNING_PASSWORD") +def publishRepoURL = System.getenv("PUBLISH_REPO_URL") +def publishRepoUsername = System.getenv("PUBLISH_REPO_USERNAME") +def publishRepoPassword = System.getenv("PUBLISH_REPO_PASSWORD") + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } +} + +compileJava { + options.fork = true + options.forkOptions.jvmArgs.addAll(["-Xmx16g"]) + options.encoding = "UTF-8" +} + +repositories { + mavenLocal() + maven { // The google mirror is less flaky than mavenCentral() + url("https://maven-central.storage-download.googleapis.com/maven2/") + } + mavenCentral() +} + +dependencies { + implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("com.google.code.gson:gson:2.8.9") + implementation("com.pulumi:pulumi:0.0.1") +} + +task sourcesJar(type: Jar) { + from sourceSets.main.allJava + archiveClassifier.set('sources') +} + +task javadocJar(type: Jar) { + from javadoc + archiveClassifier.set('javadoc') + zip64 = true +} + +def genPulumiResources = tasks.register('genPulumiResources') { + doLast { + def resourcesDir = sourceSets.main.output.resourcesDir + def subDir = project.name.replace(".", "/") + def outDir = file("$resourcesDir/$subDir") + outDir.mkdirs() + new File(outDir, "version.txt").text = resolvedVersion + def info = new Object() + info.metaClass.resource = true + info.metaClass.name = "kubernetes" + info.metaClass.version = resolvedVersion + def infoJson = new groovy.json.JsonBuilder(info).toPrettyString() + new File(outDir, "plugin.json").text = infoJson + } +} + +jar.configure { + dependsOn genPulumiResources +} + +publishing { + publications { + mainPublication(MavenPublication) { + groupId = "com.pulumi" + artifactId = "kubernetes" + version = resolvedVersion + from components.java + artifact sourcesJar + artifact javadocJar + + pom { + inceptionYear = "2022" + name = "pulumi-kubernetes" + packaging = "jar" + description = "test description" + + url = "https://github.com/pulumi/pulumi-java" + + scm { + connection = "git@github.com/pulumi/pulumi-java.git" + developerConnection = "git@github.com/pulumi/pulumi-java.git" + url = "https://github.com/pulumi/pulumi-java" + } + + licenses { + license { + name = "The Apache License, Version 2.0" + url = "http://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + + developers { + developer { + id = "pulumi" + name = "Pulumi" + email = "support@pulumi.com" + } + } + } + } + } + + if (publishRepoURL) { + repositories { + maven { + name = "PublishRepo" + url = publishRepoURL + credentials { + username = publishRepoUsername + password = publishRepoPassword + } + } + } + } +} + +javadoc { + if (JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } + options.jFlags("-Xmx8g", "-Xms512m") +} + +jar { + zip64 = true +} + +if (signingKey) { + signing { + useInMemoryPgpKeys(signingKey, signingPassword) + sign publishing.publications.mainPublication + } +} \ No newline at end of file diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/codegen-manifest.json b/pkg/codegen/testing/test/testdata/kubernetes20/java/codegen-manifest.json new file mode 100644 index 00000000000..3ac085dc244 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/codegen-manifest.json @@ -0,0 +1,30 @@ +{ + "emittedFiles": [ + "README.md", + "build.gradle", + "settings.gradle", + "src/main/java/com/pulumi/kubernetes/Config.java", + "src/main/java/com/pulumi/kubernetes/Provider.java", + "src/main/java/com/pulumi/kubernetes/ProviderArgs.java", + "src/main/java/com/pulumi/kubernetes/Utilities.java", + "src/main/java/com/pulumi/kubernetes/core_v1/ConfigMap.java", + "src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapArgs.java", + "src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapList.java", + "src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapListArgs.java", + "src/main/java/com/pulumi/kubernetes/core_v1/inputs/ConfigMapArgs.java", + "src/main/java/com/pulumi/kubernetes/core_v1/outputs/ConfigMap.java", + "src/main/java/com/pulumi/kubernetes/helm/sh_v3/Release.java", + "src/main/java/com/pulumi/kubernetes/helm/sh_v3/ReleaseArgs.java", + "src/main/java/com/pulumi/kubernetes/inputs/KubeClientSettingsArgs.java", + "src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ListMetaArgs.java", + "src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ManagedFieldsEntryArgs.java", + "src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ObjectMetaArgs.java", + "src/main/java/com/pulumi/kubernetes/meta_v1/inputs/OwnerReferenceArgs.java", + "src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ListMeta.java", + "src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ManagedFieldsEntry.java", + "src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ObjectMeta.java", + "src/main/java/com/pulumi/kubernetes/meta_v1/outputs/OwnerReference.java", + "src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroup.java", + "src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroupArgs.java" + ] +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/settings.gradle b/pkg/codegen/testing/test/testdata/kubernetes20/java/settings.gradle new file mode 100644 index 00000000000..8ad8bfed289 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/settings.gradle @@ -0,0 +1,14 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +pluginManagement { + repositories { + maven { // The google mirror is less flaky than mavenCentral() + url("https://maven-central.storage-download.googleapis.com/maven2/") + } + gradlePluginPortal() + } +} + +rootProject.name = "com.pulumi.kubernetes" +include("lib") diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Config.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Config.java new file mode 100644 index 00000000000..adc31882311 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Config.java @@ -0,0 +1,32 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes; + +import com.pulumi.core.internal.Codegen; +import java.lang.String; +import java.util.Optional; + +public final class Config { + + private static final com.pulumi.Config config = com.pulumi.Config.of("kubernetes"); +/** + * The contents of a kubeconfig file or the path to a kubeconfig file. If this is set, this config will be used instead of $KUBECONFIG. + * + */ + public Optional kubeconfig() { + return Codegen.stringProp("kubeconfig").config(config).get(); + } +/** + * If present, the default namespace to use. This flag is ignored for cluster-scoped resources. + * + * A namespace can be specified in multiple places, and the precedence is as follows: + * 1. `.metadata.namespace` set on the resource. + * 2. This `namespace` parameter. + * 3. `namespace` set for the active context in the kubeconfig. + * + */ + public Optional namespace() { + return Codegen.stringProp("namespace").config(config).get(); + } +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Provider.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Provider.java new file mode 100644 index 00000000000..29e6347cc70 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Provider.java @@ -0,0 +1,51 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.kubernetes.ProviderArgs; +import com.pulumi.kubernetes.Utilities; +import javax.annotation.Nullable; + +/** + * The provider type for the kubernetes package. + * + */ +@ResourceType(type="pulumi:providers:kubernetes") +public class Provider extends com.pulumi.resources.ProviderResource { + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public Provider(String name) { + this(name, ProviderArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public Provider(String name, @Nullable ProviderArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public Provider(String name, @Nullable ProviderArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("kubernetes", name, args == null ? ProviderArgs.Empty : args, makeResourceOptions(options, Codegen.empty())); + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/ProviderArgs.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/ProviderArgs.java new file mode 100644 index 00000000000..4ad6cb2701a --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/ProviderArgs.java @@ -0,0 +1,180 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.core.internal.Codegen; +import com.pulumi.kubernetes.inputs.KubeClientSettingsArgs; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class ProviderArgs extends com.pulumi.resources.ResourceArgs { + + public static final ProviderArgs Empty = new ProviderArgs(); + + /** + * Options for tuning the Kubernetes client used by a Provider. + * + */ + @Import(name="kubeClientSettings", json=true) + private @Nullable Output kubeClientSettings; + + /** + * @return Options for tuning the Kubernetes client used by a Provider. + * + */ + public Optional> kubeClientSettings() { + return Optional.ofNullable(this.kubeClientSettings); + } + + /** + * The contents of a kubeconfig file or the path to a kubeconfig file. + * + */ + @Import(name="kubeconfig") + private @Nullable Output kubeconfig; + + /** + * @return The contents of a kubeconfig file or the path to a kubeconfig file. + * + */ + public Optional> kubeconfig() { + return Optional.ofNullable(this.kubeconfig); + } + + /** + * If present, the default namespace to use. This flag is ignored for cluster-scoped resources. + * + * A namespace can be specified in multiple places, and the precedence is as follows: + * 1. `.metadata.namespace` set on the resource. + * 2. This `namespace` parameter. + * 3. `namespace` set for the active context in the kubeconfig. + * + */ + @Import(name="namespace") + private @Nullable Output namespace; + + /** + * @return If present, the default namespace to use. This flag is ignored for cluster-scoped resources. + * + * A namespace can be specified in multiple places, and the precedence is as follows: + * 1. `.metadata.namespace` set on the resource. + * 2. This `namespace` parameter. + * 3. `namespace` set for the active context in the kubeconfig. + * + */ + public Optional> namespace() { + return Optional.ofNullable(this.namespace); + } + + private ProviderArgs() {} + + private ProviderArgs(ProviderArgs $) { + this.kubeClientSettings = $.kubeClientSettings; + this.kubeconfig = $.kubeconfig; + this.namespace = $.namespace; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(ProviderArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private ProviderArgs $; + + public Builder() { + $ = new ProviderArgs(); + } + + public Builder(ProviderArgs defaults) { + $ = new ProviderArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param kubeClientSettings Options for tuning the Kubernetes client used by a Provider. + * + * @return builder + * + */ + public Builder kubeClientSettings(@Nullable Output kubeClientSettings) { + $.kubeClientSettings = kubeClientSettings; + return this; + } + + /** + * @param kubeClientSettings Options for tuning the Kubernetes client used by a Provider. + * + * @return builder + * + */ + public Builder kubeClientSettings(KubeClientSettingsArgs kubeClientSettings) { + return kubeClientSettings(Output.of(kubeClientSettings)); + } + + /** + * @param kubeconfig The contents of a kubeconfig file or the path to a kubeconfig file. + * + * @return builder + * + */ + public Builder kubeconfig(@Nullable Output kubeconfig) { + $.kubeconfig = kubeconfig; + return this; + } + + /** + * @param kubeconfig The contents of a kubeconfig file or the path to a kubeconfig file. + * + * @return builder + * + */ + public Builder kubeconfig(String kubeconfig) { + return kubeconfig(Output.of(kubeconfig)); + } + + /** + * @param namespace If present, the default namespace to use. This flag is ignored for cluster-scoped resources. + * + * A namespace can be specified in multiple places, and the precedence is as follows: + * 1. `.metadata.namespace` set on the resource. + * 2. This `namespace` parameter. + * 3. `namespace` set for the active context in the kubeconfig. + * + * @return builder + * + */ + public Builder namespace(@Nullable Output namespace) { + $.namespace = namespace; + return this; + } + + /** + * @param namespace If present, the default namespace to use. This flag is ignored for cluster-scoped resources. + * + * A namespace can be specified in multiple places, and the precedence is as follows: + * 1. `.metadata.namespace` set on the resource. + * 2. This `namespace` parameter. + * 3. `namespace` set for the active context in the kubeconfig. + * + * @return builder + * + */ + public Builder namespace(String namespace) { + return namespace(Output.of(namespace)); + } + + public ProviderArgs build() { + $.kubeconfig = Codegen.stringProp("kubeconfig").output().arg($.kubeconfig).env("KUBECONFIG").getNullable(); + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Utilities.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Utilities.java new file mode 100644 index 00000000000..08fc211b74d --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/Utilities.java @@ -0,0 +1,89 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes; + + + + + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Optional; +import java.util.stream.Collectors; +import javax.annotation.Nullable; +import com.pulumi.core.internal.Environment; +import com.pulumi.deployment.InvokeOptions; + +public class Utilities { + + public static Optional getEnv(String... names) { + for (var n : names) { + var value = Environment.getEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvBoolean(String... names) { + for (var n : names) { + var value = Environment.getBooleanEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvInteger(String... names) { + for (var n : names) { + var value = Environment.getIntegerEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvDouble(String... names) { + for (var n : names) { + var value = Environment.getDoubleEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static InvokeOptions withVersion(@Nullable InvokeOptions options) { + if (options != null && options.getVersion().isPresent()) { + return options; + } + return new InvokeOptions( + options == null ? null : options.getParent().orElse(null), + options == null ? null : options.getProvider().orElse(null), + getVersion() + ); + } + + private static final String version; + public static String getVersion() { + return version; + } + + static { + var resourceName = "com/pulumi/kubernetes/version.txt"; + var versionFile = Utilities.class.getClassLoader().getResourceAsStream(resourceName); + if (versionFile == null) { + throw new IllegalStateException( + String.format("expected resource '%s' on Classpath, not found", resourceName) + ); + } + version = new BufferedReader(new InputStreamReader(versionFile)) + .lines() + .collect(Collectors.joining("\n")) + .trim(); + } +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMap.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMap.java new file mode 100644 index 00000000000..8082ae44f07 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMap.java @@ -0,0 +1,164 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.core_v1; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Export; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.kubernetes.Utilities; +import com.pulumi.kubernetes.core_v1.ConfigMapArgs; +import com.pulumi.kubernetes.meta_v1.outputs.ObjectMeta; +import java.lang.Boolean; +import java.lang.String; +import java.util.Map; +import javax.annotation.Nullable; + +/** + * A non-overlay, non-component, Kubernetes resource. + * + */ +@ResourceType(type="kubernetes:core/v1:ConfigMap") +public class ConfigMap extends com.pulumi.resources.CustomResource { + /** + * APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + */ + @Export(name="apiVersion", refs={String.class}, tree="[0]") + private Output apiVersion; + + /** + * @return APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + */ + public Output apiVersion() { + return this.apiVersion; + } + /** + * BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + * + */ + @Export(name="binaryData", refs={Map.class,String.class}, tree="[0,1,1]") + private Output> binaryData; + + /** + * @return BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + * + */ + public Output> binaryData() { + return this.binaryData; + } + /** + * Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + * + */ + @Export(name="data", refs={Map.class,String.class}, tree="[0,1,1]") + private Output> data; + + /** + * @return Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + * + */ + public Output> data() { + return this.data; + } + /** + * Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + * + */ + @Export(name="immutable", refs={Boolean.class}, tree="[0]") + private Output immutable; + + /** + * @return Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + * + */ + public Output immutable() { + return this.immutable; + } + /** + * Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + @Export(name="kind", refs={String.class}, tree="[0]") + private Output kind; + + /** + * @return Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + public Output kind() { + return this.kind; + } + /** + * Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + @Export(name="metadata", refs={ObjectMeta.class}, tree="[0]") + private Output metadata; + + /** + * @return Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + public Output metadata() { + return this.metadata; + } + + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public ConfigMap(String name) { + this(name, ConfigMapArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public ConfigMap(String name, @Nullable ConfigMapArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public ConfigMap(String name, @Nullable ConfigMapArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("kubernetes:core/v1:ConfigMap", name, makeArgs(args), makeResourceOptions(options, Codegen.empty())); + } + + private ConfigMap(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("kubernetes:core/v1:ConfigMap", name, null, makeResourceOptions(options, id)); + } + + private static ConfigMapArgs makeArgs(@Nullable ConfigMapArgs args) { + var builder = args == null ? ConfigMapArgs.builder() : ConfigMapArgs.builder(args); + return builder + .apiVersion("v1") + .kind("ConfigMap") + .build(); + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + + /** + * 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 options Optional settings to control the behavior of the CustomResource. + */ + public static ConfigMap get(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + return new ConfigMap(name, id, options); + } +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapArgs.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapArgs.java new file mode 100644 index 00000000000..a69323ae49e --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapArgs.java @@ -0,0 +1,274 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.core_v1; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.core.internal.Codegen; +import com.pulumi.kubernetes.meta_v1.inputs.ObjectMetaArgs; +import java.lang.Boolean; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class ConfigMapArgs extends com.pulumi.resources.ResourceArgs { + + public static final ConfigMapArgs Empty = new ConfigMapArgs(); + + /** + * APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + */ + @Import(name="apiVersion") + private @Nullable Output apiVersion; + + /** + * @return APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + */ + public Optional> apiVersion() { + return Optional.ofNullable(this.apiVersion); + } + + /** + * BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + * + */ + @Import(name="binaryData") + private @Nullable Output> binaryData; + + /** + * @return BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + * + */ + public Optional>> binaryData() { + return Optional.ofNullable(this.binaryData); + } + + /** + * Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + * + */ + @Import(name="data") + private @Nullable Output> data; + + /** + * @return Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + * + */ + public Optional>> data() { + return Optional.ofNullable(this.data); + } + + /** + * Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + * + */ + @Import(name="immutable") + private @Nullable Output immutable; + + /** + * @return Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + * + */ + public Optional> immutable() { + return Optional.ofNullable(this.immutable); + } + + /** + * Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + @Import(name="kind") + private @Nullable Output kind; + + /** + * @return Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + public Optional> kind() { + return Optional.ofNullable(this.kind); + } + + /** + * Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + @Import(name="metadata") + private @Nullable Output metadata; + + /** + * @return Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + public Optional> metadata() { + return Optional.ofNullable(this.metadata); + } + + private ConfigMapArgs() {} + + private ConfigMapArgs(ConfigMapArgs $) { + this.apiVersion = $.apiVersion; + this.binaryData = $.binaryData; + this.data = $.data; + this.immutable = $.immutable; + this.kind = $.kind; + this.metadata = $.metadata; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(ConfigMapArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private ConfigMapArgs $; + + public Builder() { + $ = new ConfigMapArgs(); + } + + public Builder(ConfigMapArgs defaults) { + $ = new ConfigMapArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param apiVersion APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + * @return builder + * + */ + public Builder apiVersion(@Nullable Output apiVersion) { + $.apiVersion = apiVersion; + return this; + } + + /** + * @param apiVersion APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + * @return builder + * + */ + public Builder apiVersion(String apiVersion) { + return apiVersion(Output.of(apiVersion)); + } + + /** + * @param binaryData BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + * + * @return builder + * + */ + public Builder binaryData(@Nullable Output> binaryData) { + $.binaryData = binaryData; + return this; + } + + /** + * @param binaryData BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + * + * @return builder + * + */ + public Builder binaryData(Map binaryData) { + return binaryData(Output.of(binaryData)); + } + + /** + * @param data Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + * + * @return builder + * + */ + public Builder data(@Nullable Output> data) { + $.data = data; + return this; + } + + /** + * @param data Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + * + * @return builder + * + */ + public Builder data(Map data) { + return data(Output.of(data)); + } + + /** + * @param immutable Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + * + * @return builder + * + */ + public Builder immutable(@Nullable Output immutable) { + $.immutable = immutable; + return this; + } + + /** + * @param immutable Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + * + * @return builder + * + */ + public Builder immutable(Boolean immutable) { + return immutable(Output.of(immutable)); + } + + /** + * @param kind Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + * @return builder + * + */ + public Builder kind(@Nullable Output kind) { + $.kind = kind; + return this; + } + + /** + * @param kind Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + * @return builder + * + */ + public Builder kind(String kind) { + return kind(Output.of(kind)); + } + + /** + * @param metadata Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + * @return builder + * + */ + public Builder metadata(@Nullable Output metadata) { + $.metadata = metadata; + return this; + } + + /** + * @param metadata Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + * @return builder + * + */ + public Builder metadata(ObjectMetaArgs metadata) { + return metadata(Output.of(metadata)); + } + + public ConfigMapArgs build() { + $.apiVersion = Codegen.stringProp("apiVersion").output().arg($.apiVersion).getNullable(); + $.kind = Codegen.stringProp("kind").output().arg($.kind).getNullable(); + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapList.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapList.java new file mode 100644 index 00000000000..4ef4aab2359 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapList.java @@ -0,0 +1,136 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.core_v1; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Export; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.kubernetes.Utilities; +import com.pulumi.kubernetes.core_v1.ConfigMapListArgs; +import com.pulumi.kubernetes.core_v1.outputs.ConfigMap; +import com.pulumi.kubernetes.meta_v1.outputs.ListMeta; +import java.lang.String; +import java.util.List; +import javax.annotation.Nullable; + +/** + * A Kubernetes list resource. + * + */ +@ResourceType(type="kubernetes:core/v1:ConfigMapList") +public class ConfigMapList extends com.pulumi.resources.CustomResource { + /** + * APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + */ + @Export(name="apiVersion", refs={String.class}, tree="[0]") + private Output apiVersion; + + /** + * @return APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + */ + public Output apiVersion() { + return this.apiVersion; + } + /** + * Items is the list of ConfigMaps. + * + */ + @Export(name="items", refs={List.class,ConfigMap.class}, tree="[0,1]") + private Output> items; + + /** + * @return Items is the list of ConfigMaps. + * + */ + public Output> items() { + return this.items; + } + /** + * Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + @Export(name="kind", refs={String.class}, tree="[0]") + private Output kind; + + /** + * @return Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + public Output kind() { + return this.kind; + } + /** + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + @Export(name="metadata", refs={ListMeta.class}, tree="[0]") + private Output metadata; + + /** + * @return More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + public Output metadata() { + return this.metadata; + } + + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public ConfigMapList(String name) { + this(name, ConfigMapListArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public ConfigMapList(String name, ConfigMapListArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public ConfigMapList(String name, ConfigMapListArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("kubernetes:core/v1:ConfigMapList", name, makeArgs(args), makeResourceOptions(options, Codegen.empty())); + } + + private ConfigMapList(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("kubernetes:core/v1:ConfigMapList", name, null, makeResourceOptions(options, id)); + } + + private static ConfigMapListArgs makeArgs(ConfigMapListArgs args) { + var builder = args == null ? ConfigMapListArgs.builder() : ConfigMapListArgs.builder(args); + return builder + .apiVersion("v1") + .kind("ConfigMapList") + .build(); + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + + /** + * 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 options Optional settings to control the behavior of the CustomResource. + */ + public static ConfigMapList get(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + return new ConfigMapList(name, id, options); + } +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapListArgs.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapListArgs.java new file mode 100644 index 00000000000..d4b162a54f1 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/ConfigMapListArgs.java @@ -0,0 +1,214 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.core_v1; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.core.internal.Codegen; +import com.pulumi.exceptions.MissingRequiredPropertyException; +import com.pulumi.kubernetes.core_v1.inputs.ConfigMapArgs; +import com.pulumi.kubernetes.meta_v1.inputs.ListMetaArgs; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class ConfigMapListArgs extends com.pulumi.resources.ResourceArgs { + + public static final ConfigMapListArgs Empty = new ConfigMapListArgs(); + + /** + * APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + */ + @Import(name="apiVersion") + private @Nullable Output apiVersion; + + /** + * @return APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + */ + public Optional> apiVersion() { + return Optional.ofNullable(this.apiVersion); + } + + /** + * Items is the list of ConfigMaps. + * + */ + @Import(name="items", required=true) + private Output> items; + + /** + * @return Items is the list of ConfigMaps. + * + */ + public Output> items() { + return this.items; + } + + /** + * Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + @Import(name="kind") + private @Nullable Output kind; + + /** + * @return Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + public Optional> kind() { + return Optional.ofNullable(this.kind); + } + + /** + * More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + @Import(name="metadata") + private @Nullable Output metadata; + + /** + * @return More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + public Optional> metadata() { + return Optional.ofNullable(this.metadata); + } + + private ConfigMapListArgs() {} + + private ConfigMapListArgs(ConfigMapListArgs $) { + this.apiVersion = $.apiVersion; + this.items = $.items; + this.kind = $.kind; + this.metadata = $.metadata; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(ConfigMapListArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private ConfigMapListArgs $; + + public Builder() { + $ = new ConfigMapListArgs(); + } + + public Builder(ConfigMapListArgs defaults) { + $ = new ConfigMapListArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param apiVersion APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + * @return builder + * + */ + public Builder apiVersion(@Nullable Output apiVersion) { + $.apiVersion = apiVersion; + return this; + } + + /** + * @param apiVersion APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + * @return builder + * + */ + public Builder apiVersion(String apiVersion) { + return apiVersion(Output.of(apiVersion)); + } + + /** + * @param items Items is the list of ConfigMaps. + * + * @return builder + * + */ + public Builder items(Output> items) { + $.items = items; + return this; + } + + /** + * @param items Items is the list of ConfigMaps. + * + * @return builder + * + */ + public Builder items(List items) { + return items(Output.of(items)); + } + + /** + * @param items Items is the list of ConfigMaps. + * + * @return builder + * + */ + public Builder items(ConfigMapArgs... items) { + return items(List.of(items)); + } + + /** + * @param kind Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + * @return builder + * + */ + public Builder kind(@Nullable Output kind) { + $.kind = kind; + return this; + } + + /** + * @param kind Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + * @return builder + * + */ + public Builder kind(String kind) { + return kind(Output.of(kind)); + } + + /** + * @param metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + * @return builder + * + */ + public Builder metadata(@Nullable Output metadata) { + $.metadata = metadata; + return this; + } + + /** + * @param metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + * @return builder + * + */ + public Builder metadata(ListMetaArgs metadata) { + return metadata(Output.of(metadata)); + } + + public ConfigMapListArgs build() { + $.apiVersion = Codegen.stringProp("apiVersion").output().arg($.apiVersion).getNullable(); + if ($.items == null) { + throw new MissingRequiredPropertyException("ConfigMapListArgs", "items"); + } + $.kind = Codegen.stringProp("kind").output().arg($.kind).getNullable(); + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/inputs/ConfigMapArgs.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/inputs/ConfigMapArgs.java new file mode 100644 index 00000000000..9eb09b36574 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/inputs/ConfigMapArgs.java @@ -0,0 +1,278 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.core_v1.inputs; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.core.internal.Codegen; +import com.pulumi.kubernetes.meta_v1.inputs.ObjectMetaArgs; +import java.lang.Boolean; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +/** + * ConfigMap holds configuration data for pods to consume. + * + */ +public final class ConfigMapArgs extends com.pulumi.resources.ResourceArgs { + + public static final ConfigMapArgs Empty = new ConfigMapArgs(); + + /** + * APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + */ + @Import(name="apiVersion") + private @Nullable Output apiVersion; + + /** + * @return APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + */ + public Optional> apiVersion() { + return Optional.ofNullable(this.apiVersion); + } + + /** + * BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + * + */ + @Import(name="binaryData") + private @Nullable Output> binaryData; + + /** + * @return BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + * + */ + public Optional>> binaryData() { + return Optional.ofNullable(this.binaryData); + } + + /** + * Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + * + */ + @Import(name="data") + private @Nullable Output> data; + + /** + * @return Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + * + */ + public Optional>> data() { + return Optional.ofNullable(this.data); + } + + /** + * Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + * + */ + @Import(name="immutable") + private @Nullable Output immutable; + + /** + * @return Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + * + */ + public Optional> immutable() { + return Optional.ofNullable(this.immutable); + } + + /** + * Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + @Import(name="kind") + private @Nullable Output kind; + + /** + * @return Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + public Optional> kind() { + return Optional.ofNullable(this.kind); + } + + /** + * Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + @Import(name="metadata") + private @Nullable Output metadata; + + /** + * @return Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + public Optional> metadata() { + return Optional.ofNullable(this.metadata); + } + + private ConfigMapArgs() {} + + private ConfigMapArgs(ConfigMapArgs $) { + this.apiVersion = $.apiVersion; + this.binaryData = $.binaryData; + this.data = $.data; + this.immutable = $.immutable; + this.kind = $.kind; + this.metadata = $.metadata; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(ConfigMapArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private ConfigMapArgs $; + + public Builder() { + $ = new ConfigMapArgs(); + } + + public Builder(ConfigMapArgs defaults) { + $ = new ConfigMapArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param apiVersion APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + * @return builder + * + */ + public Builder apiVersion(@Nullable Output apiVersion) { + $.apiVersion = apiVersion; + return this; + } + + /** + * @param apiVersion APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + * @return builder + * + */ + public Builder apiVersion(String apiVersion) { + return apiVersion(Output.of(apiVersion)); + } + + /** + * @param binaryData BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + * + * @return builder + * + */ + public Builder binaryData(@Nullable Output> binaryData) { + $.binaryData = binaryData; + return this; + } + + /** + * @param binaryData BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + * + * @return builder + * + */ + public Builder binaryData(Map binaryData) { + return binaryData(Output.of(binaryData)); + } + + /** + * @param data Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + * + * @return builder + * + */ + public Builder data(@Nullable Output> data) { + $.data = data; + return this; + } + + /** + * @param data Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + * + * @return builder + * + */ + public Builder data(Map data) { + return data(Output.of(data)); + } + + /** + * @param immutable Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + * + * @return builder + * + */ + public Builder immutable(@Nullable Output immutable) { + $.immutable = immutable; + return this; + } + + /** + * @param immutable Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + * + * @return builder + * + */ + public Builder immutable(Boolean immutable) { + return immutable(Output.of(immutable)); + } + + /** + * @param kind Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + * @return builder + * + */ + public Builder kind(@Nullable Output kind) { + $.kind = kind; + return this; + } + + /** + * @param kind Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + * @return builder + * + */ + public Builder kind(String kind) { + return kind(Output.of(kind)); + } + + /** + * @param metadata Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + * @return builder + * + */ + public Builder metadata(@Nullable Output metadata) { + $.metadata = metadata; + return this; + } + + /** + * @param metadata Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + * @return builder + * + */ + public Builder metadata(ObjectMetaArgs metadata) { + return metadata(Output.of(metadata)); + } + + public ConfigMapArgs build() { + $.apiVersion = Codegen.stringProp("apiVersion").output().arg($.apiVersion).getNullable(); + $.kind = Codegen.stringProp("kind").output().arg($.kind).getNullable(); + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/outputs/ConfigMap.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/outputs/ConfigMap.java new file mode 100644 index 00000000000..6858a59c130 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/core_v1/outputs/ConfigMap.java @@ -0,0 +1,165 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.core_v1.outputs; + +import com.pulumi.core.annotations.CustomType; +import com.pulumi.kubernetes.meta_v1.outputs.ObjectMeta; +import java.lang.Boolean; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + +@CustomType +public final class ConfigMap { + /** + * @return APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + */ + private @Nullable String apiVersion; + /** + * @return BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + * + */ + private @Nullable Map binaryData; + /** + * @return Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + * + */ + private @Nullable Map data; + /** + * @return Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + * + */ + private @Nullable Boolean immutable; + /** + * @return Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + private @Nullable String kind; + /** + * @return Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + private @Nullable ObjectMeta metadata; + + private ConfigMap() {} + /** + * @return APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + * + */ + public Optional apiVersion() { + return Optional.ofNullable(this.apiVersion); + } + /** + * @return BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. + * + */ + public Map binaryData() { + return this.binaryData == null ? Map.of() : this.binaryData; + } + /** + * @return Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process. + * + */ + public Map data() { + return this.data == null ? Map.of() : this.data; + } + /** + * @return Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil. + * + */ + public Optional immutable() { + return Optional.ofNullable(this.immutable); + } + /** + * @return Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + public Optional kind() { + return Optional.ofNullable(this.kind); + } + /** + * @return Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + public Optional metadata() { + return Optional.ofNullable(this.metadata); + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(ConfigMap defaults) { + return new Builder(defaults); + } + @CustomType.Builder + public static final class Builder { + private @Nullable String apiVersion; + private @Nullable Map binaryData; + private @Nullable Map data; + private @Nullable Boolean immutable; + private @Nullable String kind; + private @Nullable ObjectMeta metadata; + public Builder() {} + public Builder(ConfigMap defaults) { + Objects.requireNonNull(defaults); + this.apiVersion = defaults.apiVersion; + this.binaryData = defaults.binaryData; + this.data = defaults.data; + this.immutable = defaults.immutable; + this.kind = defaults.kind; + this.metadata = defaults.metadata; + } + + @CustomType.Setter + public Builder apiVersion(@Nullable String apiVersion) { + + this.apiVersion = apiVersion; + return this; + } + @CustomType.Setter + public Builder binaryData(@Nullable Map binaryData) { + + this.binaryData = binaryData; + return this; + } + @CustomType.Setter + public Builder data(@Nullable Map data) { + + this.data = data; + return this; + } + @CustomType.Setter + public Builder immutable(@Nullable Boolean immutable) { + + this.immutable = immutable; + return this; + } + @CustomType.Setter + public Builder kind(@Nullable String kind) { + + this.kind = kind; + return this; + } + @CustomType.Setter + public Builder metadata(@Nullable ObjectMeta metadata) { + + this.metadata = metadata; + return this; + } + public ConfigMap build() { + final var _resultValue = new ConfigMap(); + _resultValue.apiVersion = apiVersion; + _resultValue.binaryData = binaryData; + _resultValue.data = data; + _resultValue.immutable = immutable; + _resultValue.kind = kind; + _resultValue.metadata = metadata; + return _resultValue; + } + } +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/helm/sh_v3/Release.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/helm/sh_v3/Release.java new file mode 100644 index 00000000000..d0865bf91ce --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/helm/sh_v3/Release.java @@ -0,0 +1,116 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.helm.sh_v3; + +import com.pulumi.asset.AssetOrArchive; +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Export; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.kubernetes.Utilities; +import com.pulumi.kubernetes.helm.sh_v3.ReleaseArgs; +import java.lang.Object; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Nullable; + +/** + * A non-overlay, non-component, non-Kubernetes resource. + * + */ +@ResourceType(type="kubernetes:helm.sh/v3:Release") +public class Release extends com.pulumi.resources.CustomResource { + /** + * Chart name to be installed. A path may be used. + * + */ + @Export(name="chart", refs={String.class}, tree="[0]") + private Output chart; + + /** + * @return Chart name to be installed. A path may be used. + * + */ + public Output chart() { + return this.chart; + } + /** + * List of assets (raw yaml files). Content is read and merged with values (with values taking precedence). + * + */ + @Export(name="valueYamlFiles", refs={List.class,AssetOrArchive.class}, tree="[0,1]") + private Output> valueYamlFiles; + + /** + * @return List of assets (raw yaml files). Content is read and merged with values (with values taking precedence). + * + */ + public Output>> valueYamlFiles() { + return Codegen.optional(this.valueYamlFiles); + } + /** + * Custom values set for the release. + * + */ + @Export(name="values", refs={Map.class,String.class,Object.class}, tree="[0,1,2]") + private Output> values; + + /** + * @return Custom values set for the release. + * + */ + public Output>> values() { + return Codegen.optional(this.values); + } + + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public Release(String name) { + this(name, ReleaseArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public Release(String name, ReleaseArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public Release(String name, ReleaseArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("kubernetes:helm.sh/v3:Release", name, args == null ? ReleaseArgs.Empty : args, makeResourceOptions(options, Codegen.empty())); + } + + private Release(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("kubernetes:helm.sh/v3:Release", name, null, makeResourceOptions(options, id)); + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + + /** + * 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 options Optional settings to control the behavior of the CustomResource. + */ + public static Release get(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + return new Release(name, id, options); + } +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/helm/sh_v3/ReleaseArgs.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/helm/sh_v3/ReleaseArgs.java new file mode 100644 index 00000000000..dbf2e5d13f4 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/helm/sh_v3/ReleaseArgs.java @@ -0,0 +1,175 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.helm.sh_v3; + +import com.pulumi.asset.AssetOrArchive; +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.exceptions.MissingRequiredPropertyException; +import java.lang.Object; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class ReleaseArgs extends com.pulumi.resources.ResourceArgs { + + public static final ReleaseArgs Empty = new ReleaseArgs(); + + /** + * Chart name to be installed. A path may be used. + * + */ + @Import(name="chart", required=true) + private Output chart; + + /** + * @return Chart name to be installed. A path may be used. + * + */ + public Output chart() { + return this.chart; + } + + /** + * List of assets (raw yaml files). Content is read and merged with values. + * + */ + @Import(name="valueYamlFiles") + private @Nullable Output> valueYamlFiles; + + /** + * @return List of assets (raw yaml files). Content is read and merged with values. + * + */ + public Optional>> valueYamlFiles() { + return Optional.ofNullable(this.valueYamlFiles); + } + + /** + * Custom values set for the release. + * + */ + @Import(name="values") + private @Nullable Output> values; + + /** + * @return Custom values set for the release. + * + */ + public Optional>> values() { + return Optional.ofNullable(this.values); + } + + private ReleaseArgs() {} + + private ReleaseArgs(ReleaseArgs $) { + this.chart = $.chart; + this.valueYamlFiles = $.valueYamlFiles; + this.values = $.values; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(ReleaseArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private ReleaseArgs $; + + public Builder() { + $ = new ReleaseArgs(); + } + + public Builder(ReleaseArgs defaults) { + $ = new ReleaseArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param chart Chart name to be installed. A path may be used. + * + * @return builder + * + */ + public Builder chart(Output chart) { + $.chart = chart; + return this; + } + + /** + * @param chart Chart name to be installed. A path may be used. + * + * @return builder + * + */ + public Builder chart(String chart) { + return chart(Output.of(chart)); + } + + /** + * @param valueYamlFiles List of assets (raw yaml files). Content is read and merged with values. + * + * @return builder + * + */ + public Builder valueYamlFiles(@Nullable Output> valueYamlFiles) { + $.valueYamlFiles = valueYamlFiles; + return this; + } + + /** + * @param valueYamlFiles List of assets (raw yaml files). Content is read and merged with values. + * + * @return builder + * + */ + public Builder valueYamlFiles(List valueYamlFiles) { + return valueYamlFiles(Output.of(valueYamlFiles)); + } + + /** + * @param valueYamlFiles List of assets (raw yaml files). Content is read and merged with values. + * + * @return builder + * + */ + public Builder valueYamlFiles(AssetOrArchive... valueYamlFiles) { + return valueYamlFiles(List.of(valueYamlFiles)); + } + + /** + * @param values Custom values set for the release. + * + * @return builder + * + */ + public Builder values(@Nullable Output> values) { + $.values = values; + return this; + } + + /** + * @param values Custom values set for the release. + * + * @return builder + * + */ + public Builder values(Map values) { + return values(Output.of(values)); + } + + public ReleaseArgs build() { + if ($.chart == null) { + throw new MissingRequiredPropertyException("ReleaseArgs", "chart"); + } + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/inputs/KubeClientSettingsArgs.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/inputs/KubeClientSettingsArgs.java new file mode 100644 index 00000000000..a07643d33e7 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/inputs/KubeClientSettingsArgs.java @@ -0,0 +1,89 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.inputs; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.core.internal.Codegen; +import java.lang.Integer; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +/** + * Options for tuning the Kubernetes client used by a Provider. + * + */ +public final class KubeClientSettingsArgs extends com.pulumi.resources.ResourceArgs { + + public static final KubeClientSettingsArgs Empty = new KubeClientSettingsArgs(); + + /** + * Maximum time in seconds to wait before cancelling a HTTP request to the Kubernetes server. Default value is 32. + * + */ + @Import(name="timeout") + private @Nullable Output timeout; + + /** + * @return Maximum time in seconds to wait before cancelling a HTTP request to the Kubernetes server. Default value is 32. + * + */ + public Optional> timeout() { + return Optional.ofNullable(this.timeout); + } + + private KubeClientSettingsArgs() {} + + private KubeClientSettingsArgs(KubeClientSettingsArgs $) { + this.timeout = $.timeout; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(KubeClientSettingsArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private KubeClientSettingsArgs $; + + public Builder() { + $ = new KubeClientSettingsArgs(); + } + + public Builder(KubeClientSettingsArgs defaults) { + $ = new KubeClientSettingsArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param timeout Maximum time in seconds to wait before cancelling a HTTP request to the Kubernetes server. Default value is 32. + * + * @return builder + * + */ + public Builder timeout(@Nullable Output timeout) { + $.timeout = timeout; + return this; + } + + /** + * @param timeout Maximum time in seconds to wait before cancelling a HTTP request to the Kubernetes server. Default value is 32. + * + * @return builder + * + */ + public Builder timeout(Integer timeout) { + return timeout(Output.of(timeout)); + } + + public KubeClientSettingsArgs build() { + $.timeout = Codegen.integerProp("timeout").output().arg($.timeout).env("PULUMI_K8S_CLIENT_TIMEOUT").getNullable(); + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ListMetaArgs.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ListMetaArgs.java new file mode 100644 index 00000000000..b5de47d54fc --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ListMetaArgs.java @@ -0,0 +1,199 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.meta_v1.inputs; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.Integer; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +/** + * ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}. + * + */ +public final class ListMetaArgs extends com.pulumi.resources.ResourceArgs { + + public static final ListMetaArgs Empty = new ListMetaArgs(); + + /** + * continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message. + * + */ + @Import(name="continue") + private @Nullable Output continue_; + + /** + * @return continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message. + * + */ + public Optional> continue_() { + return Optional.ofNullable(this.continue_); + } + + /** + * remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact. + * + */ + @Import(name="remainingItemCount") + private @Nullable Output remainingItemCount; + + /** + * @return remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact. + * + */ + public Optional> remainingItemCount() { + return Optional.ofNullable(this.remainingItemCount); + } + + /** + * String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * + */ + @Import(name="resourceVersion") + private @Nullable Output resourceVersion; + + /** + * @return String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * + */ + public Optional> resourceVersion() { + return Optional.ofNullable(this.resourceVersion); + } + + /** + * Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * + */ + @Import(name="selfLink") + private @Nullable Output selfLink; + + /** + * @return Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * + */ + public Optional> selfLink() { + return Optional.ofNullable(this.selfLink); + } + + private ListMetaArgs() {} + + private ListMetaArgs(ListMetaArgs $) { + this.continue_ = $.continue_; + this.remainingItemCount = $.remainingItemCount; + this.resourceVersion = $.resourceVersion; + this.selfLink = $.selfLink; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(ListMetaArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private ListMetaArgs $; + + public Builder() { + $ = new ListMetaArgs(); + } + + public Builder(ListMetaArgs defaults) { + $ = new ListMetaArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param continue_ continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message. + * + * @return builder + * + */ + public Builder continue_(@Nullable Output continue_) { + $.continue_ = continue_; + return this; + } + + /** + * @param continue_ continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message. + * + * @return builder + * + */ + public Builder continue_(String continue_) { + return continue_(Output.of(continue_)); + } + + /** + * @param remainingItemCount remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact. + * + * @return builder + * + */ + public Builder remainingItemCount(@Nullable Output remainingItemCount) { + $.remainingItemCount = remainingItemCount; + return this; + } + + /** + * @param remainingItemCount remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact. + * + * @return builder + * + */ + public Builder remainingItemCount(Integer remainingItemCount) { + return remainingItemCount(Output.of(remainingItemCount)); + } + + /** + * @param resourceVersion String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * + * @return builder + * + */ + public Builder resourceVersion(@Nullable Output resourceVersion) { + $.resourceVersion = resourceVersion; + return this; + } + + /** + * @param resourceVersion String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * + * @return builder + * + */ + public Builder resourceVersion(String resourceVersion) { + return resourceVersion(Output.of(resourceVersion)); + } + + /** + * @param selfLink Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * + * @return builder + * + */ + public Builder selfLink(@Nullable Output selfLink) { + $.selfLink = selfLink; + return this; + } + + /** + * @param selfLink Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * + * @return builder + * + */ + public Builder selfLink(String selfLink) { + return selfLink(Output.of(selfLink)); + } + + public ListMetaArgs build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ManagedFieldsEntryArgs.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ManagedFieldsEntryArgs.java new file mode 100644 index 00000000000..af9d196d4e7 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ManagedFieldsEntryArgs.java @@ -0,0 +1,310 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.meta_v1.inputs; + +import com.google.gson.JsonElement; +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +/** + * ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource that the fieldset applies to. + * + */ +public final class ManagedFieldsEntryArgs extends com.pulumi.resources.ResourceArgs { + + public static final ManagedFieldsEntryArgs Empty = new ManagedFieldsEntryArgs(); + + /** + * APIVersion defines the version of this resource that this field set applies to. The format is "group/version" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted. + * + */ + @Import(name="apiVersion") + private @Nullable Output apiVersion; + + /** + * @return APIVersion defines the version of this resource that this field set applies to. The format is "group/version" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted. + * + */ + public Optional> apiVersion() { + return Optional.ofNullable(this.apiVersion); + } + + /** + * FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: "FieldsV1" + * + */ + @Import(name="fieldsType") + private @Nullable Output fieldsType; + + /** + * @return FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: "FieldsV1" + * + */ + public Optional> fieldsType() { + return Optional.ofNullable(this.fieldsType); + } + + /** + * FieldsV1 holds the first JSON version format as described in the "FieldsV1" type. + * + */ + @Import(name="fieldsV1") + private @Nullable Output fieldsV1; + + /** + * @return FieldsV1 holds the first JSON version format as described in the "FieldsV1" type. + * + */ + public Optional> fieldsV1() { + return Optional.ofNullable(this.fieldsV1); + } + + /** + * Manager is an identifier of the workflow managing these fields. + * + */ + @Import(name="manager") + private @Nullable Output manager; + + /** + * @return Manager is an identifier of the workflow managing these fields. + * + */ + public Optional> manager() { + return Optional.ofNullable(this.manager); + } + + /** + * Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'. + * + */ + @Import(name="operation") + private @Nullable Output operation; + + /** + * @return Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'. + * + */ + public Optional> operation() { + return Optional.ofNullable(this.operation); + } + + /** + * Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource. + * + */ + @Import(name="subresource") + private @Nullable Output subresource; + + /** + * @return Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource. + * + */ + public Optional> subresource() { + return Optional.ofNullable(this.subresource); + } + + /** + * Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over. + * + */ + @Import(name="time") + private @Nullable Output time; + + /** + * @return Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over. + * + */ + public Optional> time() { + return Optional.ofNullable(this.time); + } + + private ManagedFieldsEntryArgs() {} + + private ManagedFieldsEntryArgs(ManagedFieldsEntryArgs $) { + this.apiVersion = $.apiVersion; + this.fieldsType = $.fieldsType; + this.fieldsV1 = $.fieldsV1; + this.manager = $.manager; + this.operation = $.operation; + this.subresource = $.subresource; + this.time = $.time; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(ManagedFieldsEntryArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private ManagedFieldsEntryArgs $; + + public Builder() { + $ = new ManagedFieldsEntryArgs(); + } + + public Builder(ManagedFieldsEntryArgs defaults) { + $ = new ManagedFieldsEntryArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param apiVersion APIVersion defines the version of this resource that this field set applies to. The format is "group/version" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted. + * + * @return builder + * + */ + public Builder apiVersion(@Nullable Output apiVersion) { + $.apiVersion = apiVersion; + return this; + } + + /** + * @param apiVersion APIVersion defines the version of this resource that this field set applies to. The format is "group/version" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted. + * + * @return builder + * + */ + public Builder apiVersion(String apiVersion) { + return apiVersion(Output.of(apiVersion)); + } + + /** + * @param fieldsType FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: "FieldsV1" + * + * @return builder + * + */ + public Builder fieldsType(@Nullable Output fieldsType) { + $.fieldsType = fieldsType; + return this; + } + + /** + * @param fieldsType FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: "FieldsV1" + * + * @return builder + * + */ + public Builder fieldsType(String fieldsType) { + return fieldsType(Output.of(fieldsType)); + } + + /** + * @param fieldsV1 FieldsV1 holds the first JSON version format as described in the "FieldsV1" type. + * + * @return builder + * + */ + public Builder fieldsV1(@Nullable Output fieldsV1) { + $.fieldsV1 = fieldsV1; + return this; + } + + /** + * @param fieldsV1 FieldsV1 holds the first JSON version format as described in the "FieldsV1" type. + * + * @return builder + * + */ + public Builder fieldsV1(JsonElement fieldsV1) { + return fieldsV1(Output.of(fieldsV1)); + } + + /** + * @param manager Manager is an identifier of the workflow managing these fields. + * + * @return builder + * + */ + public Builder manager(@Nullable Output manager) { + $.manager = manager; + return this; + } + + /** + * @param manager Manager is an identifier of the workflow managing these fields. + * + * @return builder + * + */ + public Builder manager(String manager) { + return manager(Output.of(manager)); + } + + /** + * @param operation Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'. + * + * @return builder + * + */ + public Builder operation(@Nullable Output operation) { + $.operation = operation; + return this; + } + + /** + * @param operation Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'. + * + * @return builder + * + */ + public Builder operation(String operation) { + return operation(Output.of(operation)); + } + + /** + * @param subresource Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource. + * + * @return builder + * + */ + public Builder subresource(@Nullable Output subresource) { + $.subresource = subresource; + return this; + } + + /** + * @param subresource Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource. + * + * @return builder + * + */ + public Builder subresource(String subresource) { + return subresource(Output.of(subresource)); + } + + /** + * @param time Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over. + * + * @return builder + * + */ + public Builder time(@Nullable Output time) { + $.time = time; + return this; + } + + /** + * @param time Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over. + * + * @return builder + * + */ + public Builder time(String time) { + return time(Output.of(time)); + } + + public ManagedFieldsEntryArgs build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ObjectMetaArgs.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ObjectMetaArgs.java new file mode 100644 index 00000000000..88b08e9010b --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/ObjectMetaArgs.java @@ -0,0 +1,733 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.meta_v1.inputs; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.kubernetes.meta_v1.inputs.ManagedFieldsEntryArgs; +import com.pulumi.kubernetes.meta_v1.inputs.OwnerReferenceArgs; +import java.lang.Integer; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +/** + * ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create. + * + */ +public final class ObjectMetaArgs extends com.pulumi.resources.ResourceArgs { + + public static final ObjectMetaArgs Empty = new ObjectMetaArgs(); + + /** + * Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations + * + */ + @Import(name="annotations") + private @Nullable Output> annotations; + + /** + * @return Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations + * + */ + public Optional>> annotations() { + return Optional.ofNullable(this.annotations); + } + + /** + * The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request. + * + */ + @Import(name="clusterName") + private @Nullable Output clusterName; + + /** + * @return The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request. + * + */ + public Optional> clusterName() { + return Optional.ofNullable(this.clusterName); + } + + /** + * CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC. + * + * Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + @Import(name="creationTimestamp") + private @Nullable Output creationTimestamp; + + /** + * @return CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC. + * + * Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + public Optional> creationTimestamp() { + return Optional.ofNullable(this.creationTimestamp); + } + + /** + * Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only. + * + */ + @Import(name="deletionGracePeriodSeconds") + private @Nullable Output deletionGracePeriodSeconds; + + /** + * @return Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only. + * + */ + public Optional> deletionGracePeriodSeconds() { + return Optional.ofNullable(this.deletionGracePeriodSeconds); + } + + /** + * DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested. + * + * Populated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + @Import(name="deletionTimestamp") + private @Nullable Output deletionTimestamp; + + /** + * @return DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested. + * + * Populated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + public Optional> deletionTimestamp() { + return Optional.ofNullable(this.deletionTimestamp); + } + + /** + * Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list. + * + */ + @Import(name="finalizers") + private @Nullable Output> finalizers; + + /** + * @return Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list. + * + */ + public Optional>> finalizers() { + return Optional.ofNullable(this.finalizers); + } + + /** + * GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. + * + * If this field is specified and the generated name exists, the server will return a 409. + * + * Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency + * + */ + @Import(name="generateName") + private @Nullable Output generateName; + + /** + * @return GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. + * + * If this field is specified and the generated name exists, the server will return a 409. + * + * Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency + * + */ + public Optional> generateName() { + return Optional.ofNullable(this.generateName); + } + + /** + * A sequence number representing a specific generation of the desired state. Populated by the system. Read-only. + * + */ + @Import(name="generation") + private @Nullable Output generation; + + /** + * @return A sequence number representing a specific generation of the desired state. Populated by the system. Read-only. + * + */ + public Optional> generation() { + return Optional.ofNullable(this.generation); + } + + /** + * Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + * + */ + @Import(name="labels") + private @Nullable Output> labels; + + /** + * @return Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + * + */ + public Optional>> labels() { + return Optional.ofNullable(this.labels); + } + + /** + * ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like "ci-cd". The set of fields is always in the version that the workflow used when modifying the object. + * + */ + @Import(name="managedFields") + private @Nullable Output> managedFields; + + /** + * @return ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like "ci-cd". The set of fields is always in the version that the workflow used when modifying the object. + * + */ + public Optional>> managedFields() { + return Optional.ofNullable(this.managedFields); + } + + /** + * Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * + */ + @Import(name="name") + private @Nullable Output name; + + /** + * @return Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * + */ + public Optional> name() { + return Optional.ofNullable(this.name); + } + + /** + * Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. + * + * Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces + * + */ + @Import(name="namespace") + private @Nullable Output namespace; + + /** + * @return Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. + * + * Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces + * + */ + public Optional> namespace() { + return Optional.ofNullable(this.namespace); + } + + /** + * List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. + * + */ + @Import(name="ownerReferences") + private @Nullable Output> ownerReferences; + + /** + * @return List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. + * + */ + public Optional>> ownerReferences() { + return Optional.ofNullable(this.ownerReferences); + } + + /** + * An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources. + * + * Populated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * + */ + @Import(name="resourceVersion") + private @Nullable Output resourceVersion; + + /** + * @return An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources. + * + * Populated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * + */ + public Optional> resourceVersion() { + return Optional.ofNullable(this.resourceVersion); + } + + /** + * Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * + */ + @Import(name="selfLink") + private @Nullable Output selfLink; + + /** + * @return Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * + */ + public Optional> selfLink() { + return Optional.ofNullable(this.selfLink); + } + + /** + * UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations. + * + * Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * + */ + @Import(name="uid") + private @Nullable Output uid; + + /** + * @return UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations. + * + * Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * + */ + public Optional> uid() { + return Optional.ofNullable(this.uid); + } + + private ObjectMetaArgs() {} + + private ObjectMetaArgs(ObjectMetaArgs $) { + this.annotations = $.annotations; + this.clusterName = $.clusterName; + this.creationTimestamp = $.creationTimestamp; + this.deletionGracePeriodSeconds = $.deletionGracePeriodSeconds; + this.deletionTimestamp = $.deletionTimestamp; + this.finalizers = $.finalizers; + this.generateName = $.generateName; + this.generation = $.generation; + this.labels = $.labels; + this.managedFields = $.managedFields; + this.name = $.name; + this.namespace = $.namespace; + this.ownerReferences = $.ownerReferences; + this.resourceVersion = $.resourceVersion; + this.selfLink = $.selfLink; + this.uid = $.uid; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(ObjectMetaArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private ObjectMetaArgs $; + + public Builder() { + $ = new ObjectMetaArgs(); + } + + public Builder(ObjectMetaArgs defaults) { + $ = new ObjectMetaArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param annotations Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations + * + * @return builder + * + */ + public Builder annotations(@Nullable Output> annotations) { + $.annotations = annotations; + return this; + } + + /** + * @param annotations Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations + * + * @return builder + * + */ + public Builder annotations(Map annotations) { + return annotations(Output.of(annotations)); + } + + /** + * @param clusterName The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request. + * + * @return builder + * + */ + public Builder clusterName(@Nullable Output clusterName) { + $.clusterName = clusterName; + return this; + } + + /** + * @param clusterName The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request. + * + * @return builder + * + */ + public Builder clusterName(String clusterName) { + return clusterName(Output.of(clusterName)); + } + + /** + * @param creationTimestamp CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC. + * + * Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + * @return builder + * + */ + public Builder creationTimestamp(@Nullable Output creationTimestamp) { + $.creationTimestamp = creationTimestamp; + return this; + } + + /** + * @param creationTimestamp CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC. + * + * Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + * @return builder + * + */ + public Builder creationTimestamp(String creationTimestamp) { + return creationTimestamp(Output.of(creationTimestamp)); + } + + /** + * @param deletionGracePeriodSeconds Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only. + * + * @return builder + * + */ + public Builder deletionGracePeriodSeconds(@Nullable Output deletionGracePeriodSeconds) { + $.deletionGracePeriodSeconds = deletionGracePeriodSeconds; + return this; + } + + /** + * @param deletionGracePeriodSeconds Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only. + * + * @return builder + * + */ + public Builder deletionGracePeriodSeconds(Integer deletionGracePeriodSeconds) { + return deletionGracePeriodSeconds(Output.of(deletionGracePeriodSeconds)); + } + + /** + * @param deletionTimestamp DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested. + * + * Populated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + * @return builder + * + */ + public Builder deletionTimestamp(@Nullable Output deletionTimestamp) { + $.deletionTimestamp = deletionTimestamp; + return this; + } + + /** + * @param deletionTimestamp DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested. + * + * Populated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + * @return builder + * + */ + public Builder deletionTimestamp(String deletionTimestamp) { + return deletionTimestamp(Output.of(deletionTimestamp)); + } + + /** + * @param finalizers Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list. + * + * @return builder + * + */ + public Builder finalizers(@Nullable Output> finalizers) { + $.finalizers = finalizers; + return this; + } + + /** + * @param finalizers Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list. + * + * @return builder + * + */ + public Builder finalizers(List finalizers) { + return finalizers(Output.of(finalizers)); + } + + /** + * @param finalizers Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list. + * + * @return builder + * + */ + public Builder finalizers(String... finalizers) { + return finalizers(List.of(finalizers)); + } + + /** + * @param generateName GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. + * + * If this field is specified and the generated name exists, the server will return a 409. + * + * Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency + * + * @return builder + * + */ + public Builder generateName(@Nullable Output generateName) { + $.generateName = generateName; + return this; + } + + /** + * @param generateName GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. + * + * If this field is specified and the generated name exists, the server will return a 409. + * + * Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency + * + * @return builder + * + */ + public Builder generateName(String generateName) { + return generateName(Output.of(generateName)); + } + + /** + * @param generation A sequence number representing a specific generation of the desired state. Populated by the system. Read-only. + * + * @return builder + * + */ + public Builder generation(@Nullable Output generation) { + $.generation = generation; + return this; + } + + /** + * @param generation A sequence number representing a specific generation of the desired state. Populated by the system. Read-only. + * + * @return builder + * + */ + public Builder generation(Integer generation) { + return generation(Output.of(generation)); + } + + /** + * @param labels Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + * + * @return builder + * + */ + public Builder labels(@Nullable Output> labels) { + $.labels = labels; + return this; + } + + /** + * @param labels Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + * + * @return builder + * + */ + public Builder labels(Map labels) { + return labels(Output.of(labels)); + } + + /** + * @param managedFields ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like "ci-cd". The set of fields is always in the version that the workflow used when modifying the object. + * + * @return builder + * + */ + public Builder managedFields(@Nullable Output> managedFields) { + $.managedFields = managedFields; + return this; + } + + /** + * @param managedFields ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like "ci-cd". The set of fields is always in the version that the workflow used when modifying the object. + * + * @return builder + * + */ + public Builder managedFields(List managedFields) { + return managedFields(Output.of(managedFields)); + } + + /** + * @param managedFields ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like "ci-cd". The set of fields is always in the version that the workflow used when modifying the object. + * + * @return builder + * + */ + public Builder managedFields(ManagedFieldsEntryArgs... managedFields) { + return managedFields(List.of(managedFields)); + } + + /** + * @param name Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * + * @return builder + * + */ + public Builder name(@Nullable Output name) { + $.name = name; + return this; + } + + /** + * @param name Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * + * @return builder + * + */ + public Builder name(String name) { + return name(Output.of(name)); + } + + /** + * @param namespace Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. + * + * Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces + * + * @return builder + * + */ + public Builder namespace(@Nullable Output namespace) { + $.namespace = namespace; + return this; + } + + /** + * @param namespace Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. + * + * Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces + * + * @return builder + * + */ + public Builder namespace(String namespace) { + return namespace(Output.of(namespace)); + } + + /** + * @param ownerReferences List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. + * + * @return builder + * + */ + public Builder ownerReferences(@Nullable Output> ownerReferences) { + $.ownerReferences = ownerReferences; + return this; + } + + /** + * @param ownerReferences List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. + * + * @return builder + * + */ + public Builder ownerReferences(List ownerReferences) { + return ownerReferences(Output.of(ownerReferences)); + } + + /** + * @param ownerReferences List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. + * + * @return builder + * + */ + public Builder ownerReferences(OwnerReferenceArgs... ownerReferences) { + return ownerReferences(List.of(ownerReferences)); + } + + /** + * @param resourceVersion An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources. + * + * Populated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * + * @return builder + * + */ + public Builder resourceVersion(@Nullable Output resourceVersion) { + $.resourceVersion = resourceVersion; + return this; + } + + /** + * @param resourceVersion An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources. + * + * Populated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * + * @return builder + * + */ + public Builder resourceVersion(String resourceVersion) { + return resourceVersion(Output.of(resourceVersion)); + } + + /** + * @param selfLink Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * + * @return builder + * + */ + public Builder selfLink(@Nullable Output selfLink) { + $.selfLink = selfLink; + return this; + } + + /** + * @param selfLink Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * + * @return builder + * + */ + public Builder selfLink(String selfLink) { + return selfLink(Output.of(selfLink)); + } + + /** + * @param uid UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations. + * + * Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * + * @return builder + * + */ + public Builder uid(@Nullable Output uid) { + $.uid = uid; + return this; + } + + /** + * @param uid UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations. + * + * Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * + * @return builder + * + */ + public Builder uid(String uid) { + return uid(Output.of(uid)); + } + + public ObjectMetaArgs build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/OwnerReferenceArgs.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/OwnerReferenceArgs.java new file mode 100644 index 00000000000..f1f39b0aeb9 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/inputs/OwnerReferenceArgs.java @@ -0,0 +1,286 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.meta_v1.inputs; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.exceptions.MissingRequiredPropertyException; +import java.lang.Boolean; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +/** + * OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field. + * + */ +public final class OwnerReferenceArgs extends com.pulumi.resources.ResourceArgs { + + public static final OwnerReferenceArgs Empty = new OwnerReferenceArgs(); + + /** + * API version of the referent. + * + */ + @Import(name="apiVersion", required=true) + private Output apiVersion; + + /** + * @return API version of the referent. + * + */ + public Output apiVersion() { + return this.apiVersion; + } + + /** + * If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. + * + */ + @Import(name="blockOwnerDeletion") + private @Nullable Output blockOwnerDeletion; + + /** + * @return If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. + * + */ + public Optional> blockOwnerDeletion() { + return Optional.ofNullable(this.blockOwnerDeletion); + } + + /** + * If true, this reference points to the managing controller. + * + */ + @Import(name="controller") + private @Nullable Output controller; + + /** + * @return If true, this reference points to the managing controller. + * + */ + public Optional> controller() { + return Optional.ofNullable(this.controller); + } + + /** + * Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + @Import(name="kind", required=true) + private Output kind; + + /** + * @return Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + public Output kind() { + return this.kind; + } + + /** + * Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * + */ + @Import(name="name", required=true) + private Output name; + + /** + * @return Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * + */ + public Output name() { + return this.name; + } + + /** + * UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * + */ + @Import(name="uid", required=true) + private Output uid; + + /** + * @return UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * + */ + public Output uid() { + return this.uid; + } + + private OwnerReferenceArgs() {} + + private OwnerReferenceArgs(OwnerReferenceArgs $) { + this.apiVersion = $.apiVersion; + this.blockOwnerDeletion = $.blockOwnerDeletion; + this.controller = $.controller; + this.kind = $.kind; + this.name = $.name; + this.uid = $.uid; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(OwnerReferenceArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private OwnerReferenceArgs $; + + public Builder() { + $ = new OwnerReferenceArgs(); + } + + public Builder(OwnerReferenceArgs defaults) { + $ = new OwnerReferenceArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param apiVersion API version of the referent. + * + * @return builder + * + */ + public Builder apiVersion(Output apiVersion) { + $.apiVersion = apiVersion; + return this; + } + + /** + * @param apiVersion API version of the referent. + * + * @return builder + * + */ + public Builder apiVersion(String apiVersion) { + return apiVersion(Output.of(apiVersion)); + } + + /** + * @param blockOwnerDeletion If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. + * + * @return builder + * + */ + public Builder blockOwnerDeletion(@Nullable Output blockOwnerDeletion) { + $.blockOwnerDeletion = blockOwnerDeletion; + return this; + } + + /** + * @param blockOwnerDeletion If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. + * + * @return builder + * + */ + public Builder blockOwnerDeletion(Boolean blockOwnerDeletion) { + return blockOwnerDeletion(Output.of(blockOwnerDeletion)); + } + + /** + * @param controller If true, this reference points to the managing controller. + * + * @return builder + * + */ + public Builder controller(@Nullable Output controller) { + $.controller = controller; + return this; + } + + /** + * @param controller If true, this reference points to the managing controller. + * + * @return builder + * + */ + public Builder controller(Boolean controller) { + return controller(Output.of(controller)); + } + + /** + * @param kind Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + * @return builder + * + */ + public Builder kind(Output kind) { + $.kind = kind; + return this; + } + + /** + * @param kind Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + * @return builder + * + */ + public Builder kind(String kind) { + return kind(Output.of(kind)); + } + + /** + * @param name Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * + * @return builder + * + */ + public Builder name(Output name) { + $.name = name; + return this; + } + + /** + * @param name Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * + * @return builder + * + */ + public Builder name(String name) { + return name(Output.of(name)); + } + + /** + * @param uid UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * + * @return builder + * + */ + public Builder uid(Output uid) { + $.uid = uid; + return this; + } + + /** + * @param uid UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * + * @return builder + * + */ + public Builder uid(String uid) { + return uid(Output.of(uid)); + } + + public OwnerReferenceArgs build() { + if ($.apiVersion == null) { + throw new MissingRequiredPropertyException("OwnerReferenceArgs", "apiVersion"); + } + if ($.kind == null) { + throw new MissingRequiredPropertyException("OwnerReferenceArgs", "kind"); + } + if ($.name == null) { + throw new MissingRequiredPropertyException("OwnerReferenceArgs", "name"); + } + if ($.uid == null) { + throw new MissingRequiredPropertyException("OwnerReferenceArgs", "uid"); + } + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ListMeta.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ListMeta.java new file mode 100644 index 00000000000..3d7fc77558b --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ListMeta.java @@ -0,0 +1,121 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.meta_v1.outputs; + +import com.pulumi.core.annotations.CustomType; +import java.lang.Integer; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + +@CustomType +public final class ListMeta { + /** + * @return continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message. + * + */ + private @Nullable String continue_; + /** + * @return remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact. + * + */ + private @Nullable Integer remainingItemCount; + /** + * @return String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * + */ + private @Nullable String resourceVersion; + /** + * @return Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * + */ + private @Nullable String selfLink; + + private ListMeta() {} + /** + * @return continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message. + * + */ + public Optional continue_() { + return Optional.ofNullable(this.continue_); + } + /** + * @return remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact. + * + */ + public Optional remainingItemCount() { + return Optional.ofNullable(this.remainingItemCount); + } + /** + * @return String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * + */ + public Optional resourceVersion() { + return Optional.ofNullable(this.resourceVersion); + } + /** + * @return Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * + */ + public Optional selfLink() { + return Optional.ofNullable(this.selfLink); + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(ListMeta defaults) { + return new Builder(defaults); + } + @CustomType.Builder + public static final class Builder { + private @Nullable String continue_; + private @Nullable Integer remainingItemCount; + private @Nullable String resourceVersion; + private @Nullable String selfLink; + public Builder() {} + public Builder(ListMeta defaults) { + Objects.requireNonNull(defaults); + this.continue_ = defaults.continue_; + this.remainingItemCount = defaults.remainingItemCount; + this.resourceVersion = defaults.resourceVersion; + this.selfLink = defaults.selfLink; + } + + @CustomType.Setter("continue") + public Builder continue_(@Nullable String continue_) { + + this.continue_ = continue_; + return this; + } + @CustomType.Setter + public Builder remainingItemCount(@Nullable Integer remainingItemCount) { + + this.remainingItemCount = remainingItemCount; + return this; + } + @CustomType.Setter + public Builder resourceVersion(@Nullable String resourceVersion) { + + this.resourceVersion = resourceVersion; + return this; + } + @CustomType.Setter + public Builder selfLink(@Nullable String selfLink) { + + this.selfLink = selfLink; + return this; + } + public ListMeta build() { + final var _resultValue = new ListMeta(); + _resultValue.continue_ = continue_; + _resultValue.remainingItemCount = remainingItemCount; + _resultValue.resourceVersion = resourceVersion; + _resultValue.selfLink = selfLink; + return _resultValue; + } + } +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ManagedFieldsEntry.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ManagedFieldsEntry.java new file mode 100644 index 00000000000..bafd97b6daf --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ManagedFieldsEntry.java @@ -0,0 +1,184 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.meta_v1.outputs; + +import com.google.gson.JsonElement; +import com.pulumi.core.annotations.CustomType; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + +@CustomType +public final class ManagedFieldsEntry { + /** + * @return APIVersion defines the version of this resource that this field set applies to. The format is "group/version" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted. + * + */ + private @Nullable String apiVersion; + /** + * @return FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: "FieldsV1" + * + */ + private @Nullable String fieldsType; + /** + * @return FieldsV1 holds the first JSON version format as described in the "FieldsV1" type. + * + */ + private @Nullable JsonElement fieldsV1; + /** + * @return Manager is an identifier of the workflow managing these fields. + * + */ + private @Nullable String manager; + /** + * @return Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'. + * + */ + private @Nullable String operation; + /** + * @return Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource. + * + */ + private @Nullable String subresource; + /** + * @return Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over. + * + */ + private @Nullable String time; + + private ManagedFieldsEntry() {} + /** + * @return APIVersion defines the version of this resource that this field set applies to. The format is "group/version" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted. + * + */ + public Optional apiVersion() { + return Optional.ofNullable(this.apiVersion); + } + /** + * @return FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: "FieldsV1" + * + */ + public Optional fieldsType() { + return Optional.ofNullable(this.fieldsType); + } + /** + * @return FieldsV1 holds the first JSON version format as described in the "FieldsV1" type. + * + */ + public Optional fieldsV1() { + return Optional.ofNullable(this.fieldsV1); + } + /** + * @return Manager is an identifier of the workflow managing these fields. + * + */ + public Optional manager() { + return Optional.ofNullable(this.manager); + } + /** + * @return Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'. + * + */ + public Optional operation() { + return Optional.ofNullable(this.operation); + } + /** + * @return Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource. + * + */ + public Optional subresource() { + return Optional.ofNullable(this.subresource); + } + /** + * @return Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over. + * + */ + public Optional time() { + return Optional.ofNullable(this.time); + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(ManagedFieldsEntry defaults) { + return new Builder(defaults); + } + @CustomType.Builder + public static final class Builder { + private @Nullable String apiVersion; + private @Nullable String fieldsType; + private @Nullable JsonElement fieldsV1; + private @Nullable String manager; + private @Nullable String operation; + private @Nullable String subresource; + private @Nullable String time; + public Builder() {} + public Builder(ManagedFieldsEntry defaults) { + Objects.requireNonNull(defaults); + this.apiVersion = defaults.apiVersion; + this.fieldsType = defaults.fieldsType; + this.fieldsV1 = defaults.fieldsV1; + this.manager = defaults.manager; + this.operation = defaults.operation; + this.subresource = defaults.subresource; + this.time = defaults.time; + } + + @CustomType.Setter + public Builder apiVersion(@Nullable String apiVersion) { + + this.apiVersion = apiVersion; + return this; + } + @CustomType.Setter + public Builder fieldsType(@Nullable String fieldsType) { + + this.fieldsType = fieldsType; + return this; + } + @CustomType.Setter + public Builder fieldsV1(@Nullable JsonElement fieldsV1) { + + this.fieldsV1 = fieldsV1; + return this; + } + @CustomType.Setter + public Builder manager(@Nullable String manager) { + + this.manager = manager; + return this; + } + @CustomType.Setter + public Builder operation(@Nullable String operation) { + + this.operation = operation; + return this; + } + @CustomType.Setter + public Builder subresource(@Nullable String subresource) { + + this.subresource = subresource; + return this; + } + @CustomType.Setter + public Builder time(@Nullable String time) { + + this.time = time; + return this; + } + public ManagedFieldsEntry build() { + final var _resultValue = new ManagedFieldsEntry(); + _resultValue.apiVersion = apiVersion; + _resultValue.fieldsType = fieldsType; + _resultValue.fieldsV1 = fieldsV1; + _resultValue.manager = manager; + _resultValue.operation = operation; + _resultValue.subresource = subresource; + _resultValue.time = time; + return _resultValue; + } + } +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ObjectMeta.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ObjectMeta.java new file mode 100644 index 00000000000..dc013e5d964 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/ObjectMeta.java @@ -0,0 +1,414 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.meta_v1.outputs; + +import com.pulumi.core.annotations.CustomType; +import com.pulumi.kubernetes.meta_v1.outputs.ManagedFieldsEntry; +import com.pulumi.kubernetes.meta_v1.outputs.OwnerReference; +import java.lang.Integer; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + +@CustomType +public final class ObjectMeta { + /** + * @return Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations + * + */ + private @Nullable Map annotations; + /** + * @return The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request. + * + */ + private @Nullable String clusterName; + /** + * @return CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC. + * + * Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + private @Nullable String creationTimestamp; + /** + * @return Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only. + * + */ + private @Nullable Integer deletionGracePeriodSeconds; + /** + * @return DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested. + * + * Populated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + private @Nullable String deletionTimestamp; + /** + * @return Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list. + * + */ + private @Nullable List finalizers; + /** + * @return GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. + * + * If this field is specified and the generated name exists, the server will return a 409. + * + * Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency + * + */ + private @Nullable String generateName; + /** + * @return A sequence number representing a specific generation of the desired state. Populated by the system. Read-only. + * + */ + private @Nullable Integer generation; + /** + * @return Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + * + */ + private @Nullable Map labels; + /** + * @return ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like "ci-cd". The set of fields is always in the version that the workflow used when modifying the object. + * + */ + private @Nullable List managedFields; + /** + * @return Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * + */ + private @Nullable String name; + /** + * @return Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. + * + * Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces + * + */ + private @Nullable String namespace; + /** + * @return List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. + * + */ + private @Nullable List ownerReferences; + /** + * @return An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources. + * + * Populated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * + */ + private @Nullable String resourceVersion; + /** + * @return Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * + */ + private @Nullable String selfLink; + /** + * @return UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations. + * + * Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * + */ + private @Nullable String uid; + + private ObjectMeta() {} + /** + * @return Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations + * + */ + public Map annotations() { + return this.annotations == null ? Map.of() : this.annotations; + } + /** + * @return The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request. + * + */ + public Optional clusterName() { + return Optional.ofNullable(this.clusterName); + } + /** + * @return CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC. + * + * Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + public Optional creationTimestamp() { + return Optional.ofNullable(this.creationTimestamp); + } + /** + * @return Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only. + * + */ + public Optional deletionGracePeriodSeconds() { + return Optional.ofNullable(this.deletionGracePeriodSeconds); + } + /** + * @return DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested. + * + * Populated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + * + */ + public Optional deletionTimestamp() { + return Optional.ofNullable(this.deletionTimestamp); + } + /** + * @return Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list. + * + */ + public List finalizers() { + return this.finalizers == null ? List.of() : this.finalizers; + } + /** + * @return GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server. + * + * If this field is specified and the generated name exists, the server will return a 409. + * + * Applied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency + * + */ + public Optional generateName() { + return Optional.ofNullable(this.generateName); + } + /** + * @return A sequence number representing a specific generation of the desired state. Populated by the system. Read-only. + * + */ + public Optional generation() { + return Optional.ofNullable(this.generation); + } + /** + * @return Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + * + */ + public Map labels() { + return this.labels == null ? Map.of() : this.labels; + } + /** + * @return ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like "ci-cd". The set of fields is always in the version that the workflow used when modifying the object. + * + */ + public List managedFields() { + return this.managedFields == null ? List.of() : this.managedFields; + } + /** + * @return Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * + */ + public Optional name() { + return Optional.ofNullable(this.name); + } + /** + * @return Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. + * + * Must be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces + * + */ + public Optional namespace() { + return Optional.ofNullable(this.namespace); + } + /** + * @return List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller. + * + */ + public List ownerReferences() { + return this.ownerReferences == null ? List.of() : this.ownerReferences; + } + /** + * @return An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources. + * + * Populated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency + * + */ + public Optional resourceVersion() { + return Optional.ofNullable(this.resourceVersion); + } + /** + * @return Deprecated: selfLink is a legacy read-only field that is no longer populated by the system. + * + */ + public Optional selfLink() { + return Optional.ofNullable(this.selfLink); + } + /** + * @return UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations. + * + * Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * + */ + public Optional uid() { + return Optional.ofNullable(this.uid); + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(ObjectMeta defaults) { + return new Builder(defaults); + } + @CustomType.Builder + public static final class Builder { + private @Nullable Map annotations; + private @Nullable String clusterName; + private @Nullable String creationTimestamp; + private @Nullable Integer deletionGracePeriodSeconds; + private @Nullable String deletionTimestamp; + private @Nullable List finalizers; + private @Nullable String generateName; + private @Nullable Integer generation; + private @Nullable Map labels; + private @Nullable List managedFields; + private @Nullable String name; + private @Nullable String namespace; + private @Nullable List ownerReferences; + private @Nullable String resourceVersion; + private @Nullable String selfLink; + private @Nullable String uid; + public Builder() {} + public Builder(ObjectMeta defaults) { + Objects.requireNonNull(defaults); + this.annotations = defaults.annotations; + this.clusterName = defaults.clusterName; + this.creationTimestamp = defaults.creationTimestamp; + this.deletionGracePeriodSeconds = defaults.deletionGracePeriodSeconds; + this.deletionTimestamp = defaults.deletionTimestamp; + this.finalizers = defaults.finalizers; + this.generateName = defaults.generateName; + this.generation = defaults.generation; + this.labels = defaults.labels; + this.managedFields = defaults.managedFields; + this.name = defaults.name; + this.namespace = defaults.namespace; + this.ownerReferences = defaults.ownerReferences; + this.resourceVersion = defaults.resourceVersion; + this.selfLink = defaults.selfLink; + this.uid = defaults.uid; + } + + @CustomType.Setter + public Builder annotations(@Nullable Map annotations) { + + this.annotations = annotations; + return this; + } + @CustomType.Setter + public Builder clusterName(@Nullable String clusterName) { + + this.clusterName = clusterName; + return this; + } + @CustomType.Setter + public Builder creationTimestamp(@Nullable String creationTimestamp) { + + this.creationTimestamp = creationTimestamp; + return this; + } + @CustomType.Setter + public Builder deletionGracePeriodSeconds(@Nullable Integer deletionGracePeriodSeconds) { + + this.deletionGracePeriodSeconds = deletionGracePeriodSeconds; + return this; + } + @CustomType.Setter + public Builder deletionTimestamp(@Nullable String deletionTimestamp) { + + this.deletionTimestamp = deletionTimestamp; + return this; + } + @CustomType.Setter + public Builder finalizers(@Nullable List finalizers) { + + this.finalizers = finalizers; + return this; + } + public Builder finalizers(String... finalizers) { + return finalizers(List.of(finalizers)); + } + @CustomType.Setter + public Builder generateName(@Nullable String generateName) { + + this.generateName = generateName; + return this; + } + @CustomType.Setter + public Builder generation(@Nullable Integer generation) { + + this.generation = generation; + return this; + } + @CustomType.Setter + public Builder labels(@Nullable Map labels) { + + this.labels = labels; + return this; + } + @CustomType.Setter + public Builder managedFields(@Nullable List managedFields) { + + this.managedFields = managedFields; + return this; + } + public Builder managedFields(ManagedFieldsEntry... managedFields) { + return managedFields(List.of(managedFields)); + } + @CustomType.Setter + public Builder name(@Nullable String name) { + + this.name = name; + return this; + } + @CustomType.Setter + public Builder namespace(@Nullable String namespace) { + + this.namespace = namespace; + return this; + } + @CustomType.Setter + public Builder ownerReferences(@Nullable List ownerReferences) { + + this.ownerReferences = ownerReferences; + return this; + } + public Builder ownerReferences(OwnerReference... ownerReferences) { + return ownerReferences(List.of(ownerReferences)); + } + @CustomType.Setter + public Builder resourceVersion(@Nullable String resourceVersion) { + + this.resourceVersion = resourceVersion; + return this; + } + @CustomType.Setter + public Builder selfLink(@Nullable String selfLink) { + + this.selfLink = selfLink; + return this; + } + @CustomType.Setter + public Builder uid(@Nullable String uid) { + + this.uid = uid; + return this; + } + public ObjectMeta build() { + final var _resultValue = new ObjectMeta(); + _resultValue.annotations = annotations; + _resultValue.clusterName = clusterName; + _resultValue.creationTimestamp = creationTimestamp; + _resultValue.deletionGracePeriodSeconds = deletionGracePeriodSeconds; + _resultValue.deletionTimestamp = deletionTimestamp; + _resultValue.finalizers = finalizers; + _resultValue.generateName = generateName; + _resultValue.generation = generation; + _resultValue.labels = labels; + _resultValue.managedFields = managedFields; + _resultValue.name = name; + _resultValue.namespace = namespace; + _resultValue.ownerReferences = ownerReferences; + _resultValue.resourceVersion = resourceVersion; + _resultValue.selfLink = selfLink; + _resultValue.uid = uid; + return _resultValue; + } + } +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/OwnerReference.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/OwnerReference.java new file mode 100644 index 00000000000..ffc1150e321 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/meta_v1/outputs/OwnerReference.java @@ -0,0 +1,172 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.meta_v1.outputs; + +import com.pulumi.core.annotations.CustomType; +import com.pulumi.exceptions.MissingRequiredPropertyException; +import java.lang.Boolean; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + +@CustomType +public final class OwnerReference { + /** + * @return API version of the referent. + * + */ + private String apiVersion; + /** + * @return If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. + * + */ + private @Nullable Boolean blockOwnerDeletion; + /** + * @return If true, this reference points to the managing controller. + * + */ + private @Nullable Boolean controller; + /** + * @return Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + private String kind; + /** + * @return Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * + */ + private String name; + /** + * @return UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * + */ + private String uid; + + private OwnerReference() {} + /** + * @return API version of the referent. + * + */ + public String apiVersion() { + return this.apiVersion; + } + /** + * @return If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs "delete" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned. + * + */ + public Optional blockOwnerDeletion() { + return Optional.ofNullable(this.blockOwnerDeletion); + } + /** + * @return If true, this reference points to the managing controller. + * + */ + public Optional controller() { + return Optional.ofNullable(this.controller); + } + /** + * @return Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + * + */ + public String kind() { + return this.kind; + } + /** + * @return Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names + * + */ + public String name() { + return this.name; + } + /** + * @return UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids + * + */ + public String uid() { + return this.uid; + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(OwnerReference defaults) { + return new Builder(defaults); + } + @CustomType.Builder + public static final class Builder { + private String apiVersion; + private @Nullable Boolean blockOwnerDeletion; + private @Nullable Boolean controller; + private String kind; + private String name; + private String uid; + public Builder() {} + public Builder(OwnerReference defaults) { + Objects.requireNonNull(defaults); + this.apiVersion = defaults.apiVersion; + this.blockOwnerDeletion = defaults.blockOwnerDeletion; + this.controller = defaults.controller; + this.kind = defaults.kind; + this.name = defaults.name; + this.uid = defaults.uid; + } + + @CustomType.Setter + public Builder apiVersion(String apiVersion) { + if (apiVersion == null) { + throw new MissingRequiredPropertyException("OwnerReference", "apiVersion"); + } + this.apiVersion = apiVersion; + return this; + } + @CustomType.Setter + public Builder blockOwnerDeletion(@Nullable Boolean blockOwnerDeletion) { + + this.blockOwnerDeletion = blockOwnerDeletion; + return this; + } + @CustomType.Setter + public Builder controller(@Nullable Boolean controller) { + + this.controller = controller; + return this; + } + @CustomType.Setter + public Builder kind(String kind) { + if (kind == null) { + throw new MissingRequiredPropertyException("OwnerReference", "kind"); + } + this.kind = kind; + return this; + } + @CustomType.Setter + public Builder name(String name) { + if (name == null) { + throw new MissingRequiredPropertyException("OwnerReference", "name"); + } + this.name = name; + return this; + } + @CustomType.Setter + public Builder uid(String uid) { + if (uid == null) { + throw new MissingRequiredPropertyException("OwnerReference", "uid"); + } + this.uid = uid; + return this; + } + public OwnerReference build() { + final var _resultValue = new OwnerReference(); + _resultValue.apiVersion = apiVersion; + _resultValue.blockOwnerDeletion = blockOwnerDeletion; + _resultValue.controller = controller; + _resultValue.kind = kind; + _resultValue.name = name; + _resultValue.uid = uid; + return _resultValue; + } + } +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroup.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroup.java new file mode 100644 index 00000000000..930b2e0a856 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroup.java @@ -0,0 +1,70 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.yaml_v2; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Export; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.kubernetes.Utilities; +import com.pulumi.kubernetes.yaml_v2.ConfigGroupArgs; +import java.lang.Object; +import java.util.List; +import java.util.Optional; +import javax.annotation.Nullable; + +/** + * A non-overlay component resource. + * + */ +@ResourceType(type="kubernetes:yaml/v2:ConfigGroup") +public class ConfigGroup extends com.pulumi.resources.ComponentResource { + /** + * Resources created by the ConfigGroup. + * + */ + @Export(name="resources", refs={List.class,Object.class}, tree="[0,1]") + private Output> resources; + + /** + * @return Resources created by the ConfigGroup. + * + */ + public Output>> resources() { + return Codegen.optional(this.resources); + } + + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public ConfigGroup(String name) { + this(name, ConfigGroupArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public ConfigGroup(String name, @Nullable ConfigGroupArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public ConfigGroup(String name, @Nullable ConfigGroupArgs args, @Nullable com.pulumi.resources.ComponentResourceOptions options) { + super("kubernetes:yaml/v2:ConfigGroup", name, args == null ? ConfigGroupArgs.Empty : args, makeResourceOptions(options, Codegen.empty()), true); + } + + private static com.pulumi.resources.ComponentResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.ComponentResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.ComponentResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.ComponentResourceOptions.merge(defaultOptions, options, id); + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroupArgs.java b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroupArgs.java new file mode 100644 index 00000000000..b746d30e145 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/java/src/main/java/com/pulumi/kubernetes/yaml_v2/ConfigGroupArgs.java @@ -0,0 +1,257 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.kubernetes.yaml_v2; + +import com.pulumi.core.Either; +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.Object; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class ConfigGroupArgs extends com.pulumi.resources.ResourceArgs { + + public static final ConfigGroupArgs Empty = new ConfigGroupArgs(); + + /** + * Set of paths or a URLs that uniquely identify files. + * + */ + @Import(name="files") + private @Nullable Output>> files; + + /** + * @return Set of paths or a URLs that uniquely identify files. + * + */ + public Optional>>> files() { + return Optional.ofNullable(this.files); + } + + /** + * Objects representing Kubernetes resources. + * + */ + @Import(name="objs") + private @Nullable Output>> objs; + + /** + * @return Objects representing Kubernetes resources. + * + */ + public Optional>>> objs() { + return Optional.ofNullable(this.objs); + } + + /** + * An optional prefix for the auto-generated resource names. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName". + * + */ + @Import(name="resourcePrefix") + private @Nullable Output resourcePrefix; + + /** + * @return An optional prefix for the auto-generated resource names. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName". + * + */ + public Optional> resourcePrefix() { + return Optional.ofNullable(this.resourcePrefix); + } + + /** + * YAML text containing Kubernetes resource definitions. + * + */ + @Import(name="yaml") + private @Nullable Output>> yaml; + + /** + * @return YAML text containing Kubernetes resource definitions. + * + */ + public Optional>>> yaml() { + return Optional.ofNullable(this.yaml); + } + + private ConfigGroupArgs() {} + + private ConfigGroupArgs(ConfigGroupArgs $) { + this.files = $.files; + this.objs = $.objs; + this.resourcePrefix = $.resourcePrefix; + this.yaml = $.yaml; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(ConfigGroupArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private ConfigGroupArgs $; + + public Builder() { + $ = new ConfigGroupArgs(); + } + + public Builder(ConfigGroupArgs defaults) { + $ = new ConfigGroupArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param files Set of paths or a URLs that uniquely identify files. + * + * @return builder + * + */ + public Builder files(@Nullable Output>> files) { + $.files = files; + return this; + } + + /** + * @param files Set of paths or a URLs that uniquely identify files. + * + * @return builder + * + */ + public Builder files(Either> files) { + return files(Output.of(files)); + } + + /** + * @param files Set of paths or a URLs that uniquely identify files. + * + * @return builder + * + */ + public Builder files(String files) { + return files(Either.ofLeft(files)); + } + + /** + * @param files Set of paths or a URLs that uniquely identify files. + * + * @return builder + * + */ + public Builder files(List files) { + return files(Either.ofRight(files)); + } + + /** + * @param objs Objects representing Kubernetes resources. + * + * @return builder + * + */ + public Builder objs(@Nullable Output>> objs) { + $.objs = objs; + return this; + } + + /** + * @param objs Objects representing Kubernetes resources. + * + * @return builder + * + */ + public Builder objs(Either> objs) { + return objs(Output.of(objs)); + } + + /** + * @param objs Objects representing Kubernetes resources. + * + * @return builder + * + */ + public Builder objs(Object objs) { + return objs(Either.ofLeft(objs)); + } + + /** + * @param objs Objects representing Kubernetes resources. + * + * @return builder + * + */ + public Builder objs(List objs) { + return objs(Either.ofRight(objs)); + } + + /** + * @param resourcePrefix An optional prefix for the auto-generated resource names. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName". + * + * @return builder + * + */ + public Builder resourcePrefix(@Nullable Output resourcePrefix) { + $.resourcePrefix = resourcePrefix; + return this; + } + + /** + * @param resourcePrefix An optional prefix for the auto-generated resource names. Example: A resource created with resourcePrefix="foo" would produce a resource named "foo-resourceName". + * + * @return builder + * + */ + public Builder resourcePrefix(String resourcePrefix) { + return resourcePrefix(Output.of(resourcePrefix)); + } + + /** + * @param yaml YAML text containing Kubernetes resource definitions. + * + * @return builder + * + */ + public Builder yaml(@Nullable Output>> yaml) { + $.yaml = yaml; + return this; + } + + /** + * @param yaml YAML text containing Kubernetes resource definitions. + * + * @return builder + * + */ + public Builder yaml(Either> yaml) { + return yaml(Output.of(yaml)); + } + + /** + * @param yaml YAML text containing Kubernetes resource definitions. + * + * @return builder + * + */ + public Builder yaml(String yaml) { + return yaml(Either.ofLeft(yaml)); + } + + /** + * @param yaml YAML text containing Kubernetes resource definitions. + * + * @return builder + * + */ + public Builder yaml(List yaml) { + return yaml(Either.ofRight(yaml)); + } + + public ConfigGroupArgs build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/kubernetes20/schema.json b/pkg/codegen/testing/test/testdata/kubernetes20/schema.json new file mode 100644 index 00000000000..d50f6f68a9c --- /dev/null +++ b/pkg/codegen/testing/test/testdata/kubernetes20/schema.json @@ -0,0 +1,852 @@ +{ + "name": "kubernetes", + "displayName": "Kubernetes", + "description": "A Pulumi package for creating and managing Kubernetes resources.", + "keywords": [ + "pulumi", + "kubernetes", + "category/cloud", + "kind/native" + ], + "homepage": "https://pulumi.com", + "license": "Apache-2.0", + "repository": "https://github.com/pulumi/pulumi-kubernetes", + "publisher": "Pulumi", + "language": { + "csharp": { + "compatibility": "kubernetes20", + "dictionaryConstructors": true, + "namespaces": { + "": "Provider", + "core/v1": "Core.V1", + "helm.sh": "Helm", + "helm.sh/v3": "Helm.V3", + "meta/v1": "Meta.V1", + "yaml": "Yaml" + }, + "packageReferences": { + "Glob": "1.1.5", + "Pulumi": "3.*" + } + }, + "go": { + "generateExtraInputTypes": true, + "generateResourceContainerTypes": true, + "importBasePath": "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes", + "internalModuleName": "utilities", + "moduleToPackage": { + "core/v1": "core/v1", + "helm.sh": "helm", + "helm.sh/v3": "helm/v3", + "meta/v1": "meta/v1" + }, + "packageImportAliases": { + "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1": "corev1", + "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/helm/v3": "helmv3", + "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1": "metav1", + "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml/v2": "yamlv2" + } + }, + "java": { + "packages": { + "core/v1": "core.v1", + "helm.sh/v3": "helm.v3", + "meta/v1": "meta.v1" + } + }, + "nodejs": { + "compatibility": "kubernetes20", + "dependencies": { + "@pulumi/pulumi": "^3.25.0", + "@types/glob": "^5.0.35", + "@types/node-fetch": "^2.1.4", + "@types/tmp": "^0.0.33", + "glob": "^7.1.2", + "node-fetch": "^2.3.0", + "shell-quote": "^1.6.1", + "tmp": "^0.0.33" + }, + "moduleToPackage": { + "core/v1": "core/v1", + "helm.sh": "helm", + "helm.sh/v3": "helm/v3", + "meta/v1": "meta/v1" + }, + "readme": "The Kubernetes provider package offers support for all Kubernetes resources and their properties.\nResources are exposed as types from modules based on Kubernetes API groups such as 'apps', 'core',\n'rbac', and 'storage', among many others. Additionally, support for deploying Helm charts ('helm')\nand YAML files ('yaml') is available in this package. Using this package allows you to\nprogrammatically declare instances of any Kubernetes resources and any supported resource version\nusing infrastructure as code, which Pulumi then uses to drive the Kubernetes API.\n\nIf this is your first time using this package, these two resources may be helpful:\n\n* [Kubernetes Getting Started Guide](https://www.pulumi.com/docs/quickstart/kubernetes/): Get up and running quickly.\n* [Kubernetes Pulumi Setup Documentation](https://www.pulumi.com/docs/quickstart/kubernetes/configure/): How to configure Pulumi\n for use with your Kubernetes cluster.\n\nUse the navigation below to see detailed documentation for each of the supported Kubernetes resources.\n" + }, + "python": { + "compatibility": "kubernetes20", + "moduleNameOverrides": { + "core/v1": "core/v1", + "helm.sh": "helm", + "helm.sh/v3": "helm/v3", + "meta/v1": "meta/v1" + }, + "pyproject": { + "enabled": true + }, + "readme": "The Kubernetes provider package offers support for all Kubernetes resources and their properties.\nResources are exposed as types from modules based on Kubernetes API groups such as 'apps', 'core',\n'rbac', and 'storage', among many others. Additionally, support for deploying Helm charts ('helm')\nand YAML files ('yaml') is available in this package. Using this package allows you to\nprogrammatically declare instances of any Kubernetes resources and any supported resource version\nusing infrastructure as code, which Pulumi then uses to drive the Kubernetes API.\n\nIf this is your first time using this package, these two resources may be helpful:\n\n* [Kubernetes Getting Started Guide](https://www.pulumi.com/docs/quickstart/kubernetes/): Get up and running quickly.\n* [Kubernetes Pulumi Setup Documentation](https://www.pulumi.com/docs/quickstart/kubernetes/configure/): How to configure Pulumi\n for use with your Kubernetes cluster.\n", + "requires": { + "pulumi": ">=3.25.0,<4.0.0", + "requests": ">=2.21,<3.0" + }, + "usesIOClasses": true + } + }, + "config": { + "variables": { + "kubeconfig": { + "type": "string", + "description": "The contents of a kubeconfig file or the path to a kubeconfig file. If this is set, this config will be used instead of $KUBECONFIG.", + "language": { + "csharp": { + "name": "KubeConfig" + } + } + }, + "namespace": { + "type": "string", + "description": "If present, the default namespace to use. This flag is ignored for cluster-scoped resources.\n\nA namespace can be specified in multiple places, and the precedence is as follows:\n1. `.metadata.namespace` set on the resource.\n2. This `namespace` parameter.\n3. `namespace` set for the active context in the kubeconfig." + } + } + }, + "types": { + "kubernetes:core/v1:ConfigMap": { + "description": "ConfigMap holds configuration data for pods to consume.", + "properties": { + "apiVersion": { + "type": "string", + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "const": "v1" + }, + "binaryData": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet." + }, + "data": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process." + }, + "immutable": { + "type": "boolean", + "description": "Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil." + }, + "kind": { + "type": "string", + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "const": "ConfigMap" + }, + "metadata": { + "$ref": "#/types/kubernetes:meta/v1:ObjectMeta", + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata" + } + }, + "type": "object", + "language": { + "nodejs": { + "requiredOutputs": [ + "apiVersion", + "binaryData", + "data", + "immutable", + "kind", + "metadata" + ] + } + } + }, + "kubernetes:index:KubeClientSettings": { + "description": "Options for tuning the Kubernetes client used by a Provider.", + "properties": { + "timeout": { + "type": "integer", + "description": "Maximum time in seconds to wait before cancelling a HTTP request to the Kubernetes server. Default value is 32.", + "defaultInfo": { + "environment": [ + "PULUMI_K8S_CLIENT_TIMEOUT" + ] + } + } + }, + "type": "object" + }, + "kubernetes:meta/v1:ListMeta": { + "description": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.", + "properties": { + "continue": { + "type": "string", + "description": "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message." + }, + "remainingItemCount": { + "type": "integer", + "description": "remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact." + }, + "resourceVersion": { + "type": "string", + "description": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency" + }, + "selfLink": { + "type": "string", + "description": "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system." + } + }, + "type": "object", + "language": { + "nodejs": { + "requiredOutputs": [ + "continue", + "remainingItemCount", + "resourceVersion", + "selfLink" + ] + } + } + }, + "kubernetes:meta/v1:ManagedFieldsEntry": { + "description": "ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource that the fieldset applies to.", + "properties": { + "apiVersion": { + "type": "string", + "description": "APIVersion defines the version of this resource that this field set applies to. The format is \"group/version\" just like the top-level APIVersion field. It is necessary to track the version of a field set because it cannot be automatically converted." + }, + "fieldsType": { + "type": "string", + "description": "FieldsType is the discriminator for the different fields format and version. There is currently only one possible value: \"FieldsV1\"" + }, + "fieldsV1": { + "type": "object", + "$ref": "pulumi.json#/Json", + "description": "FieldsV1 holds the first JSON version format as described in the \"FieldsV1\" type." + }, + "manager": { + "type": "string", + "description": "Manager is an identifier of the workflow managing these fields." + }, + "operation": { + "type": "string", + "description": "Operation is the type of operation which lead to this ManagedFieldsEntry being created. The only valid values for this field are 'Apply' and 'Update'." + }, + "subresource": { + "type": "string", + "description": "Subresource is the name of the subresource used to update that object, or empty string if the object was updated through the main resource. The value of this field is used to distinguish between managers, even if they share the same name. For example, a status update will be distinct from a regular update using the same manager name. Note that the APIVersion field is not related to the Subresource field and it always corresponds to the version of the main resource." + }, + "time": { + "type": "string", + "description": "Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over." + } + }, + "type": "object", + "language": { + "nodejs": { + "requiredOutputs": [ + "apiVersion", + "fieldsType", + "fieldsV1", + "manager", + "operation", + "subresource", + "time" + ] + } + } + }, + "kubernetes:meta/v1:ObjectMeta": { + "description": "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.", + "properties": { + "annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations" + }, + "clusterName": { + "type": "string", + "description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request." + }, + "creationTimestamp": { + "type": "string", + "description": "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata" + }, + "deletionGracePeriodSeconds": { + "type": "integer", + "description": "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only." + }, + "deletionTimestamp": { + "type": "string", + "description": "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata" + }, + "finalizers": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list." + }, + "generateName": { + "type": "string", + "description": "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will return a 409.\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency" + }, + "generation": { + "type": "integer", + "description": "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only." + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels" + }, + "managedFields": { + "type": "array", + "items": { + "$ref": "#/types/kubernetes:meta/v1:ManagedFieldsEntry" + }, + "description": "ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like \"ci-cd\". The set of fields is always in the version that the workflow used when modifying the object." + }, + "name": { + "type": "string", + "description": "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names" + }, + "namespace": { + "type": "string", + "description": "Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces" + }, + "ownerReferences": { + "type": "array", + "items": { + "$ref": "#/types/kubernetes:meta/v1:OwnerReference" + }, + "description": "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller." + }, + "resourceVersion": { + "type": "string", + "description": "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency" + }, + "selfLink": { + "type": "string", + "description": "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system." + }, + "uid": { + "type": "string", + "description": "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids" + } + }, + "type": "object", + "language": { + "nodejs": { + "requiredOutputs": [ + "annotations", + "clusterName", + "creationTimestamp", + "deletionGracePeriodSeconds", + "deletionTimestamp", + "finalizers", + "generateName", + "generation", + "labels", + "managedFields", + "name", + "namespace", + "ownerReferences", + "resourceVersion", + "selfLink", + "uid" + ] + } + } + }, + "kubernetes:meta/v1:OwnerReference": { + "description": "OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.", + "properties": { + "apiVersion": { + "type": "string", + "description": "API version of the referent." + }, + "blockOwnerDeletion": { + "type": "boolean", + "description": "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned." + }, + "controller": { + "type": "boolean", + "description": "If true, this reference points to the managing controller." + }, + "kind": { + "type": "string", + "description": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + }, + "name": { + "type": "string", + "description": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names" + }, + "uid": { + "type": "string", + "description": "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids" + } + }, + "type": "object", + "required": [ + "apiVersion", + "kind", + "name", + "uid" + ], + "language": { + "nodejs": { + "requiredOutputs": [ + "apiVersion", + "blockOwnerDeletion", + "controller", + "kind", + "name", + "uid" + ] + } + } + }, + "kubernetes:pkg/version:Info": { + "description": "Info contains versioning information. how we'll want to distribute that information.", + "properties": { + "buildDate": { + "type": "string" + }, + "compiler": { + "type": "string" + }, + "gitCommit": { + "type": "string" + }, + "gitTreeState": { + "type": "string" + }, + "gitVersion": { + "type": "string" + }, + "goVersion": { + "type": "string" + }, + "major": { + "type": "string" + }, + "minor": { + "type": "string" + }, + "platform": { + "type": "string" + } + }, + "type": "object", + "required": [ + "buildDate", + "compiler", + "gitCommit", + "gitTreeState", + "gitVersion", + "goVersion", + "major", + "minor", + "platform" + ], + "language": { + "nodejs": { + "requiredOutputs": [ + "buildDate", + "compiler", + "gitCommit", + "gitTreeState", + "gitVersion", + "goVersion", + "major", + "minor", + "platform" + ] + } + } + } + }, + "provider": { + "description": "The provider type for the kubernetes package.", + "type": "object", + "inputProperties": { + "kubeClientSettings": { + "$ref": "#/types/kubernetes:index:KubeClientSettings", + "description": "Options for tuning the Kubernetes client used by a Provider." + }, + "kubeconfig": { + "type": "string", + "description": "The contents of a kubeconfig file or the path to a kubeconfig file.", + "defaultInfo": { + "environment": [ + "KUBECONFIG" + ] + }, + "language": { + "csharp": { + "name": "KubeConfig" + } + } + }, + "namespace": { + "type": "string", + "description": "If present, the default namespace to use. This flag is ignored for cluster-scoped resources.\n\nA namespace can be specified in multiple places, and the precedence is as follows:\n1. `.metadata.namespace` set on the resource.\n2. This `namespace` parameter.\n3. `namespace` set for the active context in the kubeconfig." + } + } + }, + "resources": { + "kubernetes:core/v1:ConfigMap": { + "description": "A non-overlay, non-component, Kubernetes resource.", + "properties": { + "apiVersion": { + "type": "string", + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "const": "v1" + }, + "binaryData": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet." + }, + "data": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process." + }, + "immutable": { + "type": "boolean", + "description": "Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil." + }, + "kind": { + "type": "string", + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "const": "ConfigMap" + }, + "metadata": { + "$ref": "#/types/kubernetes:meta/v1:ObjectMeta", + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata" + } + }, + "type": "object", + "required": [ + "apiVersion", + "binaryData", + "data", + "immutable", + "kind", + "metadata" + ], + "language": { + "nodejs": { + "requiredOutputs": [ + "apiVersion", + "binaryData", + "data", + "immutable", + "kind", + "metadata" + ] + } + }, + "inputProperties": { + "apiVersion": { + "type": "string", + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "const": "v1" + }, + "binaryData": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet." + }, + "data": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process." + }, + "immutable": { + "type": "boolean", + "description": "Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil." + }, + "kind": { + "type": "string", + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "const": "ConfigMap" + }, + "metadata": { + "$ref": "#/types/kubernetes:meta/v1:ObjectMeta", + "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata" + } + } + }, + "kubernetes:core/v1:ConfigMapList": { + "description": "A Kubernetes list resource.", + "properties": { + "apiVersion": { + "type": "string", + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "const": "v1" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/types/kubernetes:core/v1:ConfigMap" + }, + "description": "Items is the list of ConfigMaps." + }, + "kind": { + "type": "string", + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "const": "ConfigMapList" + }, + "metadata": { + "$ref": "#/types/kubernetes:meta/v1:ListMeta", + "description": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata" + } + }, + "type": "object", + "required": [ + "apiVersion", + "items", + "kind", + "metadata" + ], + "language": { + "nodejs": { + "requiredOutputs": [ + "apiVersion", + "items", + "kind", + "metadata" + ] + } + }, + "inputProperties": { + "apiVersion": { + "type": "string", + "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + "const": "v1" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/types/kubernetes:core/v1:ConfigMap" + }, + "description": "Items is the list of ConfigMaps." + }, + "kind": { + "type": "string", + "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "const": "ConfigMapList" + }, + "metadata": { + "$ref": "#/types/kubernetes:meta/v1:ListMeta", + "description": "More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata" + } + }, + "requiredInputs": [ + "items" + ] + }, + "kubernetes:helm.sh/v3:Release": { + "description": "A non-overlay, non-component, non-Kubernetes resource.", + "properties": { + "chart": { + "type": "string", + "description": "Chart name to be installed. A path may be used." + }, + "valueYamlFiles": { + "type": "array", + "items": { + "$ref": "pulumi.json#/Asset" + }, + "description": "List of assets (raw yaml files). Content is read and merged with values (with values taking precedence)." + }, + "values": { + "type": "object", + "additionalProperties": { + "$ref": "pulumi.json#/Any" + }, + "description": "Custom values set for the release." + } + }, + "type": "object", + "required": [ + "chart" + ], + "language": { + "nodejs": { + "requiredOutputs": [ + "chart", + "values" + ] + } + }, + "inputProperties": { + "chart": { + "type": "string", + "description": "Chart name to be installed. A path may be used." + }, + "valueYamlFiles": { + "type": "array", + "items": { + "$ref": "pulumi.json#/Asset" + }, + "description": "List of assets (raw yaml files). Content is read and merged with values." + }, + "values": { + "type": "object", + "additionalProperties": { + "$ref": "pulumi.json#/Any" + }, + "description": "Custom values set for the release." + } + }, + "requiredInputs": [ + "chart" + ] + }, + "kubernetes:yaml/v2:ConfigGroup": { + "description": "A non-overlay component resource.", + "properties": { + "resources": { + "type": "array", + "items": { + "$ref": "pulumi.json#/Any" + }, + "description": "Resources created by the ConfigGroup." + } + }, + "type": "object", + "inputProperties": { + "files": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "Set of paths or a URLs that uniquely identify files." + }, + "objs": { + "oneOf": [ + { + "$ref": "pulumi.json#/Any" + }, + { + "type": "array", + "items": { + "$ref": "pulumi.json#/Any" + } + } + ], + "description": "Objects representing Kubernetes resources." + }, + "resourcePrefix": { + "type": "string", + "description": "An optional prefix for the auto-generated resource names. Example: A resource created with resourcePrefix=\"foo\" would produce a resource named \"foo-resourceName\"." + }, + "yaml": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "YAML text containing Kubernetes resource definitions." + } + }, + "isComponent": true + }, + "kubernetes:yaml:ConfigGroup": { + "description": "An overlay component resource.", + "properties": { + "resources": { + "type": "string", + "description": "Resources created by the ConfigGroup." + } + }, + "type": "object", + "isOverlay": true, + "inputProperties": { + "files": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "Set of paths or a URLs that uniquely identify files." + }, + "objs": { + "oneOf": [ + { + "$ref": "pulumi.json#/Any" + }, + { + "type": "array", + "items": { + "$ref": "pulumi.json#/Any" + } + } + ], + "description": "Objects representing Kubernetes resources." + }, + "resourcePrefix": { + "type": "string", + "description": "An optional prefix for the auto-generated resource names. Example: A resource created with resourcePrefix=\"foo\" would produce a resource named \"foo-resourceName\"." + }, + "transformations": { + "type": "array", + "items": { + "$ref": "pulumi.json#/Any" + }, + "description": "A set of transformations to apply to Kubernetes resource definitions before registering with engine." + }, + "yaml": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "YAML text containing Kubernetes resource definitions." + } + }, + "isComponent": true + } + } +} \ No newline at end of file diff --git a/pkg/codegen/testing/test/testdata/legacy-names/java/README.md b/pkg/codegen/testing/test/testdata/legacy-names/java/README.md new file mode 100644 index 00000000000..6b0d347bb27 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/legacy-names/java/README.md @@ -0,0 +1 @@ +test description diff --git a/pkg/codegen/testing/test/testdata/legacy-names/java/build.gradle b/pkg/codegen/testing/test/testdata/legacy-names/java/build.gradle new file mode 100644 index 00000000000..d9972b850f0 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/legacy-names/java/build.gradle @@ -0,0 +1,152 @@ +// *** WARNING: this file was generated by pulumi-java-gen *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +plugins { + id("signing") + id("java-library") + id("maven-publish") +} + +group = "com.pulumi" + +def resolvedVersion = System.getenv("PACKAGE_VERSION") ?: + (project.version == "unspecified" + ? "1.0.0" + : project.version) + +def signingKey = System.getenv("SIGNING_KEY") +def signingPassword = System.getenv("SIGNING_PASSWORD") +def publishRepoURL = System.getenv("PUBLISH_REPO_URL") +def publishRepoUsername = System.getenv("PUBLISH_REPO_USERNAME") +def publishRepoPassword = System.getenv("PUBLISH_REPO_PASSWORD") + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } +} + +compileJava { + options.fork = true + options.forkOptions.jvmArgs.addAll(["-Xmx16g"]) + options.encoding = "UTF-8" +} + +repositories { + mavenLocal() + maven { // The google mirror is less flaky than mavenCentral() + url("https://maven-central.storage-download.googleapis.com/maven2/") + } + mavenCentral() +} + +dependencies { + implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("com.google.code.gson:gson:2.8.9") + implementation("com.pulumi:pulumi:0.0.1") +} + +task sourcesJar(type: Jar) { + from sourceSets.main.allJava + archiveClassifier.set('sources') +} + +task javadocJar(type: Jar) { + from javadoc + archiveClassifier.set('javadoc') + zip64 = true +} + +def genPulumiResources = tasks.register('genPulumiResources') { + doLast { + def resourcesDir = sourceSets.main.output.resourcesDir + def subDir = project.name.replace(".", "/") + def outDir = file("$resourcesDir/$subDir") + outDir.mkdirs() + new File(outDir, "version.txt").text = resolvedVersion + def info = new Object() + info.metaClass.resource = true + info.metaClass.name = "legacy_names" + info.metaClass.version = resolvedVersion + def infoJson = new groovy.json.JsonBuilder(info).toPrettyString() + new File(outDir, "plugin.json").text = infoJson + } +} + +jar.configure { + dependsOn genPulumiResources +} + +publishing { + publications { + mainPublication(MavenPublication) { + groupId = "com.pulumi" + artifactId = "legacy_names" + version = resolvedVersion + from components.java + artifact sourcesJar + artifact javadocJar + + pom { + inceptionYear = "" + name = "" + packaging = "jar" + description = "test description" + + url = "https://github.com/pulumi/pulumi-java" + + scm { + connection = "git@github.com/pulumi/pulumi-java.git" + developerConnection = "git@github.com/pulumi/pulumi-java.git" + url = "https://github.com/pulumi/pulumi-java" + } + + licenses { + license { + name = "" + url = "" + } + } + + developers { + developer { + id = "" + name = "" + email = "" + } + } + } + } + } + + if (publishRepoURL) { + repositories { + maven { + name = "PublishRepo" + url = publishRepoURL + credentials { + username = publishRepoUsername + password = publishRepoPassword + } + } + } + } +} + +javadoc { + if (JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } + options.jFlags("-Xmx8g", "-Xms512m") +} + +jar { + zip64 = true +} + +if (signingKey) { + signing { + useInMemoryPgpKeys(signingKey, signingPassword) + sign publishing.publications.mainPublication + } +} \ No newline at end of file diff --git a/pkg/codegen/testing/test/testdata/legacy-names/java/codegen-manifest.json b/pkg/codegen/testing/test/testdata/legacy-names/java/codegen-manifest.json new file mode 100644 index 00000000000..c260c4483d4 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/legacy-names/java/codegen-manifest.json @@ -0,0 +1,14 @@ +{ + "emittedFiles": [ + "README.md", + "build.gradle", + "settings.gradle", + "src/main/java/com/pulumi/legacy_names/Example_resource.java", + "src/main/java/com/pulumi/legacy_names/Example_resourceArgs.java", + "src/main/java/com/pulumi/legacy_names/HTTP_module/inputs/RequestArgs.java", + "src/main/java/com/pulumi/legacy_names/Provider.java", + "src/main/java/com/pulumi/legacy_names/ProviderArgs.java", + "src/main/java/com/pulumi/legacy_names/Utilities.java", + "src/main/java/com/pulumi/legacy_names/enums/Enum_XYZ.java" + ] +} diff --git a/pkg/codegen/testing/test/testdata/legacy-names/java/settings.gradle b/pkg/codegen/testing/test/testdata/legacy-names/java/settings.gradle new file mode 100644 index 00000000000..be0b3b0ef96 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/legacy-names/java/settings.gradle @@ -0,0 +1,14 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +pluginManagement { + repositories { + maven { // The google mirror is less flaky than mavenCentral() + url("https://maven-central.storage-download.googleapis.com/maven2/") + } + gradlePluginPortal() + } +} + +rootProject.name = "com.pulumi.legacy_names" +include("lib") diff --git a/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Example_resource.java b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Example_resource.java new file mode 100644 index 00000000000..ab1dbe57f48 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Example_resource.java @@ -0,0 +1,87 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.legacy_names; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Export; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.legacy_names.Example_resourceArgs; +import com.pulumi.legacy_names.Utilities; +import com.pulumi.legacy_names.enums.Enum_XYZ; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.annotation.Nullable; + +@ResourceType(type="legacy_names:index:example_resource") +public class Example_resource extends com.pulumi.resources.CustomResource { + @Export(name="URL", refs={String.class}, tree="[0]") + private Output URL; + + public Output> URL() { + return Codegen.optional(this.URL); + } + @Export(name="good_URLs", refs={List.class,String.class}, tree="[0,1]") + private Output> good_URLs; + + public Output>> good_URLs() { + return Codegen.optional(this.good_URLs); + } + @Export(name="map_enum", refs={List.class,Map.class,String.class,Enum_XYZ.class}, tree="[0,[1,2,3]]") + private Output>> map_enum; + + public Output>>> map_enum() { + return Codegen.optional(this.map_enum); + } + + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public Example_resource(String name) { + this(name, Example_resourceArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public Example_resource(String name, @Nullable Example_resourceArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public Example_resource(String name, @Nullable Example_resourceArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("legacy_names:index:example_resource", name, args == null ? Example_resourceArgs.Empty : args, makeResourceOptions(options, Codegen.empty())); + } + + private Example_resource(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("legacy_names:index:example_resource", name, null, makeResourceOptions(options, id)); + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + + /** + * 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 options Optional settings to control the behavior of the CustomResource. + */ + public static Example_resource get(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + return new Example_resource(name, id, options); + } +} diff --git a/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Example_resourceArgs.java b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Example_resourceArgs.java new file mode 100644 index 00000000000..7ac1ff1ecc1 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Example_resourceArgs.java @@ -0,0 +1,88 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.legacy_names; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.legacy_names.HTTP_module.inputs.RequestArgs; +import com.pulumi.legacy_names.enums.Enum_XYZ; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class Example_resourceArgs extends com.pulumi.resources.ResourceArgs { + + public static final Example_resourceArgs Empty = new Example_resourceArgs(); + + @Import(name="map_enum") + private @Nullable Output>> map_enum; + + public Optional>>> map_enum() { + return Optional.ofNullable(this.map_enum); + } + + @Import(name="request_HTTP") + private @Nullable Output request_HTTP; + + public Optional> request_HTTP() { + return Optional.ofNullable(this.request_HTTP); + } + + private Example_resourceArgs() {} + + private Example_resourceArgs(Example_resourceArgs $) { + this.map_enum = $.map_enum; + this.request_HTTP = $.request_HTTP; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(Example_resourceArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private Example_resourceArgs $; + + public Builder() { + $ = new Example_resourceArgs(); + } + + public Builder(Example_resourceArgs defaults) { + $ = new Example_resourceArgs(Objects.requireNonNull(defaults)); + } + + public Builder map_enum(@Nullable Output>> map_enum) { + $.map_enum = map_enum; + return this; + } + + public Builder map_enum(List> map_enum) { + return map_enum(Output.of(map_enum)); + } + + public Builder map_enum(Map... map_enum) { + return map_enum(List.of(map_enum)); + } + + public Builder request_HTTP(@Nullable Output request_HTTP) { + $.request_HTTP = request_HTTP; + return this; + } + + public Builder request_HTTP(RequestArgs request_HTTP) { + return request_HTTP(Output.of(request_HTTP)); + } + + public Example_resourceArgs build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/HTTP_module/inputs/RequestArgs.java b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/HTTP_module/inputs/RequestArgs.java new file mode 100644 index 00000000000..47c09d5aaad --- /dev/null +++ b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/HTTP_module/inputs/RequestArgs.java @@ -0,0 +1,80 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.legacy_names.HTTP_module.inputs; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class RequestArgs extends com.pulumi.resources.ResourceArgs { + + public static final RequestArgs Empty = new RequestArgs(); + + @Import(name="URL") + private @Nullable Output URL; + + public Optional> URL() { + return Optional.ofNullable(this.URL); + } + + @Import(name="content_body") + private @Nullable Output content_body; + + public Optional> content_body() { + return Optional.ofNullable(this.content_body); + } + + private RequestArgs() {} + + private RequestArgs(RequestArgs $) { + this.URL = $.URL; + this.content_body = $.content_body; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(RequestArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private RequestArgs $; + + public Builder() { + $ = new RequestArgs(); + } + + public Builder(RequestArgs defaults) { + $ = new RequestArgs(Objects.requireNonNull(defaults)); + } + + public Builder URL(@Nullable Output URL) { + $.URL = URL; + return this; + } + + public Builder URL(String URL) { + return URL(Output.of(URL)); + } + + public Builder content_body(@Nullable Output content_body) { + $.content_body = content_body; + return this; + } + + public Builder content_body(String content_body) { + return content_body(Output.of(content_body)); + } + + public RequestArgs build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Provider.java b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Provider.java new file mode 100644 index 00000000000..c7d391d8a85 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Provider.java @@ -0,0 +1,47 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.legacy_names; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.legacy_names.ProviderArgs; +import com.pulumi.legacy_names.Utilities; +import javax.annotation.Nullable; + +@ResourceType(type="pulumi:providers:legacy_names") +public class Provider extends com.pulumi.resources.ProviderResource { + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public Provider(String name) { + this(name, ProviderArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public Provider(String name, @Nullable ProviderArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public Provider(String name, @Nullable ProviderArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("legacy_names", name, args == null ? ProviderArgs.Empty : args, makeResourceOptions(options, Codegen.empty())); + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + +} diff --git a/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/ProviderArgs.java b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/ProviderArgs.java new file mode 100644 index 00000000000..fe97880ebdf --- /dev/null +++ b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/ProviderArgs.java @@ -0,0 +1,28 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.legacy_names; + + + + +public final class ProviderArgs extends com.pulumi.resources.ResourceArgs { + + public static final ProviderArgs Empty = new ProviderArgs(); + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private ProviderArgs $; + + public Builder() { + $ = new ProviderArgs(); + } + public ProviderArgs build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Utilities.java b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Utilities.java new file mode 100644 index 00000000000..ab988e8008f --- /dev/null +++ b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/Utilities.java @@ -0,0 +1,89 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.legacy_names; + + + + + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Optional; +import java.util.stream.Collectors; +import javax.annotation.Nullable; +import com.pulumi.core.internal.Environment; +import com.pulumi.deployment.InvokeOptions; + +public class Utilities { + + public static Optional getEnv(String... names) { + for (var n : names) { + var value = Environment.getEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvBoolean(String... names) { + for (var n : names) { + var value = Environment.getBooleanEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvInteger(String... names) { + for (var n : names) { + var value = Environment.getIntegerEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvDouble(String... names) { + for (var n : names) { + var value = Environment.getDoubleEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static InvokeOptions withVersion(@Nullable InvokeOptions options) { + if (options != null && options.getVersion().isPresent()) { + return options; + } + return new InvokeOptions( + options == null ? null : options.getParent().orElse(null), + options == null ? null : options.getProvider().orElse(null), + getVersion() + ); + } + + private static final String version; + public static String getVersion() { + return version; + } + + static { + var resourceName = "com/pulumi/legacy_names/version.txt"; + var versionFile = Utilities.class.getClassLoader().getResourceAsStream(resourceName); + if (versionFile == null) { + throw new IllegalStateException( + String.format("expected resource '%s' on Classpath, not found", resourceName) + ); + } + version = new BufferedReader(new InputStreamReader(versionFile)) + .lines() + .collect(Collectors.joining("\n")) + .trim(); + } +} diff --git a/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/enums/Enum_XYZ.java b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/enums/Enum_XYZ.java new file mode 100644 index 00000000000..00ef9263343 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/legacy-names/java/src/main/java/com/pulumi/legacy_names/enums/Enum_XYZ.java @@ -0,0 +1,35 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.legacy_names.enums; + +import com.pulumi.core.annotations.EnumType; +import java.lang.String; +import java.util.Objects; +import java.util.StringJoiner; + + @EnumType + public enum Enum_XYZ { + Plain("A"), + Snake_case("B"), + SHA256("C"), + SHA256_hash("D"); + + private final String value; + + Enum_XYZ(String value) { + this.value = Objects.requireNonNull(value); + } + + @EnumType.Converter + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return new StringJoiner(", ", "Enum_XYZ[", "]") + .add("value='" + this.value + "'") + .toString(); + } + } diff --git a/pkg/codegen/testing/test/testdata/legacy-names/schema.json b/pkg/codegen/testing/test/testdata/legacy-names/schema.json new file mode 100644 index 00000000000..f9071c480eb --- /dev/null +++ b/pkg/codegen/testing/test/testdata/legacy-names/schema.json @@ -0,0 +1,81 @@ +{ + "name": "legacy_names", + "version": "1.0.0", + "types":{ + "legacy_names:index:enum_XYZ": { + "type": "string", + "enum": [ + { + "name": "plain", + "value": "A" + }, + { + "name": "snake_case", + "value": "B" + }, + { + "name": "SHA256", + "value": "C" + }, + { + "name": "SHA256_hash", + "value": "D" + } + ] + }, + "legacy_names:HTTP_module:request": { + "type": "object", + "properties": { + "URL": { + "type": "string" + }, + "content_body": { + "type": "string" + } + } + } + }, + "resources": { + "legacy_names:index:example_resource": { + "properties":{ + "URL": { + "type": "string" + }, + "good_URLs": { + "type": "array", + "items": { + "type": "string" + } + }, + "map_enum": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "$ref": "#/types/legacy_names:index:enum_XYZ" + } + } + } + }, + "inputProperties": { + "map_enum": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "$ref": "#/types/legacy_names:index:enum_XYZ" + } + } + }, + "request_HTTP": { + "$ref": "#/types/legacy_names:HTTP_module:request" + } + } + } + }, + "language": { + "go": { + "importBasePath": "legacy-names/legacy_names" + } + } +} \ No newline at end of file diff --git a/pkg/codegen/testing/test/testdata/plain-and-default/java/src/main/java/com/pulumi/foobar/ModuleResource.java b/pkg/codegen/testing/test/testdata/plain-and-default/java/src/main/java/com/pulumi/foobar/ModuleResource.java index 531bef1560d..506e65c5c86 100644 --- a/pkg/codegen/testing/test/testdata/plain-and-default/java/src/main/java/com/pulumi/foobar/ModuleResource.java +++ b/pkg/codegen/testing/test/testdata/plain-and-default/java/src/main/java/com/pulumi/foobar/ModuleResource.java @@ -15,11 +15,11 @@ @ResourceType(type="foobar::ModuleResource") public class ModuleResource extends com.pulumi.resources.CustomResource { - @Export(name="optional_bool", refs={Boolean.class}, tree="[0]") - private Output optional_bool; + @Export(name="optionalBool", refs={Boolean.class}, tree="[0]") + private Output optionalBool; - public Output> optional_bool() { - return Codegen.optional(this.optional_bool); + public Output> optionalBool() { + return Codegen.optional(this.optionalBool); } /** @@ -54,9 +54,9 @@ private ModuleResource(String name, Output id, @Nullable com.pulumi.reso private static ModuleResourceArgs makeArgs(ModuleResourceArgs args) { var builder = args == null ? ModuleResourceArgs.builder() : ModuleResourceArgs.builder(args); return builder - .optional_const("val") - .plain_optional_const("val") - .plain_required_const("val") + .optionalConst("val") + .plainOptionalConst("val") + .plainRequiredConst("val") .build(); } diff --git a/pkg/codegen/testing/test/testdata/plain-and-default/java/src/main/java/com/pulumi/foobar/ModuleResourceArgs.java b/pkg/codegen/testing/test/testdata/plain-and-default/java/src/main/java/com/pulumi/foobar/ModuleResourceArgs.java index 6f3bd7385b1..1924f35122d 100644 --- a/pkg/codegen/testing/test/testdata/plain-and-default/java/src/main/java/com/pulumi/foobar/ModuleResourceArgs.java +++ b/pkg/codegen/testing/test/testdata/plain-and-default/java/src/main/java/com/pulumi/foobar/ModuleResourceArgs.java @@ -20,145 +20,145 @@ public final class ModuleResourceArgs extends com.pulumi.resources.ResourceArgs public static final ModuleResourceArgs Empty = new ModuleResourceArgs(); - @Import(name="optional_bool") - private @Nullable Output optional_bool; + @Import(name="optionalBool") + private @Nullable Output optionalBool; - public Optional> optional_bool() { - return Optional.ofNullable(this.optional_bool); + public Optional> optionalBool() { + return Optional.ofNullable(this.optionalBool); } - @Import(name="optional_const") - private @Nullable Output optional_const; + @Import(name="optionalConst") + private @Nullable Output optionalConst; - public Optional> optional_const() { - return Optional.ofNullable(this.optional_const); + public Optional> optionalConst() { + return Optional.ofNullable(this.optionalConst); } - @Import(name="optional_enum") - private @Nullable Output optional_enum; + @Import(name="optionalEnum") + private @Nullable Output optionalEnum; - public Optional> optional_enum() { - return Optional.ofNullable(this.optional_enum); + public Optional> optionalEnum() { + return Optional.ofNullable(this.optionalEnum); } - @Import(name="optional_number") - private @Nullable Output optional_number; + @Import(name="optionalNumber") + private @Nullable Output optionalNumber; - public Optional> optional_number() { - return Optional.ofNullable(this.optional_number); + public Optional> optionalNumber() { + return Optional.ofNullable(this.optionalNumber); } - @Import(name="optional_string") - private @Nullable Output optional_string; + @Import(name="optionalString") + private @Nullable Output optionalString; - public Optional> optional_string() { - return Optional.ofNullable(this.optional_string); + public Optional> optionalString() { + return Optional.ofNullable(this.optionalString); } - @Import(name="plain_optional_bool") - private @Nullable Boolean plain_optional_bool; + @Import(name="plainOptionalBool") + private @Nullable Boolean plainOptionalBool; - public Optional plain_optional_bool() { - return Optional.ofNullable(this.plain_optional_bool); + public Optional plainOptionalBool() { + return Optional.ofNullable(this.plainOptionalBool); } - @Import(name="plain_optional_const") - private @Nullable String plain_optional_const; + @Import(name="plainOptionalConst") + private @Nullable String plainOptionalConst; - public Optional plain_optional_const() { - return Optional.ofNullable(this.plain_optional_const); + public Optional plainOptionalConst() { + return Optional.ofNullable(this.plainOptionalConst); } - @Import(name="plain_optional_number") - private @Nullable Double plain_optional_number; + @Import(name="plainOptionalNumber") + private @Nullable Double plainOptionalNumber; - public Optional plain_optional_number() { - return Optional.ofNullable(this.plain_optional_number); + public Optional plainOptionalNumber() { + return Optional.ofNullable(this.plainOptionalNumber); } - @Import(name="plain_optional_string") - private @Nullable String plain_optional_string; + @Import(name="plainOptionalString") + private @Nullable String plainOptionalString; - public Optional plain_optional_string() { - return Optional.ofNullable(this.plain_optional_string); + public Optional plainOptionalString() { + return Optional.ofNullable(this.plainOptionalString); } - @Import(name="plain_required_bool", required=true) - private Boolean plain_required_bool; + @Import(name="plainRequiredBool", required=true) + private Boolean plainRequiredBool; - public Boolean plain_required_bool() { - return this.plain_required_bool; + public Boolean plainRequiredBool() { + return this.plainRequiredBool; } - @Import(name="plain_required_const", required=true) - private String plain_required_const; + @Import(name="plainRequiredConst", required=true) + private String plainRequiredConst; - public String plain_required_const() { - return this.plain_required_const; + public String plainRequiredConst() { + return this.plainRequiredConst; } - @Import(name="plain_required_number", required=true) - private Double plain_required_number; + @Import(name="plainRequiredNumber", required=true) + private Double plainRequiredNumber; - public Double plain_required_number() { - return this.plain_required_number; + public Double plainRequiredNumber() { + return this.plainRequiredNumber; } - @Import(name="plain_required_string", required=true) - private String plain_required_string; + @Import(name="plainRequiredString", required=true) + private String plainRequiredString; - public String plain_required_string() { - return this.plain_required_string; + public String plainRequiredString() { + return this.plainRequiredString; } - @Import(name="required_bool", required=true) - private Output required_bool; + @Import(name="requiredBool", required=true) + private Output requiredBool; - public Output required_bool() { - return this.required_bool; + public Output requiredBool() { + return this.requiredBool; } - @Import(name="required_enum", required=true) - private Output required_enum; + @Import(name="requiredEnum", required=true) + private Output requiredEnum; - public Output required_enum() { - return this.required_enum; + public Output requiredEnum() { + return this.requiredEnum; } - @Import(name="required_number", required=true) - private Output required_number; + @Import(name="requiredNumber", required=true) + private Output requiredNumber; - public Output required_number() { - return this.required_number; + public Output requiredNumber() { + return this.requiredNumber; } - @Import(name="required_string", required=true) - private Output required_string; + @Import(name="requiredString", required=true) + private Output requiredString; - public Output required_string() { - return this.required_string; + public Output requiredString() { + return this.requiredString; } private ModuleResourceArgs() {} private ModuleResourceArgs(ModuleResourceArgs $) { - this.optional_bool = $.optional_bool; - this.optional_const = $.optional_const; - this.optional_enum = $.optional_enum; - this.optional_number = $.optional_number; - this.optional_string = $.optional_string; - this.plain_optional_bool = $.plain_optional_bool; - this.plain_optional_const = $.plain_optional_const; - this.plain_optional_number = $.plain_optional_number; - this.plain_optional_string = $.plain_optional_string; - this.plain_required_bool = $.plain_required_bool; - this.plain_required_const = $.plain_required_const; - this.plain_required_number = $.plain_required_number; - this.plain_required_string = $.plain_required_string; - this.required_bool = $.required_bool; - this.required_enum = $.required_enum; - this.required_number = $.required_number; - this.required_string = $.required_string; + this.optionalBool = $.optionalBool; + this.optionalConst = $.optionalConst; + this.optionalEnum = $.optionalEnum; + this.optionalNumber = $.optionalNumber; + this.optionalString = $.optionalString; + this.plainOptionalBool = $.plainOptionalBool; + this.plainOptionalConst = $.plainOptionalConst; + this.plainOptionalNumber = $.plainOptionalNumber; + this.plainOptionalString = $.plainOptionalString; + this.plainRequiredBool = $.plainRequiredBool; + this.plainRequiredConst = $.plainRequiredConst; + this.plainRequiredNumber = $.plainRequiredNumber; + this.plainRequiredString = $.plainRequiredString; + this.requiredBool = $.requiredBool; + this.requiredEnum = $.requiredEnum; + this.requiredNumber = $.requiredNumber; + this.requiredString = $.requiredString; } public static Builder builder() { @@ -179,145 +179,145 @@ public Builder(ModuleResourceArgs defaults) { $ = new ModuleResourceArgs(Objects.requireNonNull(defaults)); } - public Builder optional_bool(@Nullable Output optional_bool) { - $.optional_bool = optional_bool; + public Builder optionalBool(@Nullable Output optionalBool) { + $.optionalBool = optionalBool; return this; } - public Builder optional_bool(Boolean optional_bool) { - return optional_bool(Output.of(optional_bool)); + public Builder optionalBool(Boolean optionalBool) { + return optionalBool(Output.of(optionalBool)); } - public Builder optional_const(@Nullable Output optional_const) { - $.optional_const = optional_const; + public Builder optionalConst(@Nullable Output optionalConst) { + $.optionalConst = optionalConst; return this; } - public Builder optional_const(String optional_const) { - return optional_const(Output.of(optional_const)); + public Builder optionalConst(String optionalConst) { + return optionalConst(Output.of(optionalConst)); } - public Builder optional_enum(@Nullable Output optional_enum) { - $.optional_enum = optional_enum; + public Builder optionalEnum(@Nullable Output optionalEnum) { + $.optionalEnum = optionalEnum; return this; } - public Builder optional_enum(EnumThing optional_enum) { - return optional_enum(Output.of(optional_enum)); + public Builder optionalEnum(EnumThing optionalEnum) { + return optionalEnum(Output.of(optionalEnum)); } - public Builder optional_number(@Nullable Output optional_number) { - $.optional_number = optional_number; + public Builder optionalNumber(@Nullable Output optionalNumber) { + $.optionalNumber = optionalNumber; return this; } - public Builder optional_number(Double optional_number) { - return optional_number(Output.of(optional_number)); + public Builder optionalNumber(Double optionalNumber) { + return optionalNumber(Output.of(optionalNumber)); } - public Builder optional_string(@Nullable Output optional_string) { - $.optional_string = optional_string; + public Builder optionalString(@Nullable Output optionalString) { + $.optionalString = optionalString; return this; } - public Builder optional_string(String optional_string) { - return optional_string(Output.of(optional_string)); + public Builder optionalString(String optionalString) { + return optionalString(Output.of(optionalString)); } - public Builder plain_optional_bool(@Nullable Boolean plain_optional_bool) { - $.plain_optional_bool = plain_optional_bool; + public Builder plainOptionalBool(@Nullable Boolean plainOptionalBool) { + $.plainOptionalBool = plainOptionalBool; return this; } - public Builder plain_optional_const(@Nullable String plain_optional_const) { - $.plain_optional_const = plain_optional_const; + public Builder plainOptionalConst(@Nullable String plainOptionalConst) { + $.plainOptionalConst = plainOptionalConst; return this; } - public Builder plain_optional_number(@Nullable Double plain_optional_number) { - $.plain_optional_number = plain_optional_number; + public Builder plainOptionalNumber(@Nullable Double plainOptionalNumber) { + $.plainOptionalNumber = plainOptionalNumber; return this; } - public Builder plain_optional_string(@Nullable String plain_optional_string) { - $.plain_optional_string = plain_optional_string; + public Builder plainOptionalString(@Nullable String plainOptionalString) { + $.plainOptionalString = plainOptionalString; return this; } - public Builder plain_required_bool(Boolean plain_required_bool) { - $.plain_required_bool = plain_required_bool; + public Builder plainRequiredBool(Boolean plainRequiredBool) { + $.plainRequiredBool = plainRequiredBool; return this; } - public Builder plain_required_const(String plain_required_const) { - $.plain_required_const = plain_required_const; + public Builder plainRequiredConst(String plainRequiredConst) { + $.plainRequiredConst = plainRequiredConst; return this; } - public Builder plain_required_number(Double plain_required_number) { - $.plain_required_number = plain_required_number; + public Builder plainRequiredNumber(Double plainRequiredNumber) { + $.plainRequiredNumber = plainRequiredNumber; return this; } - public Builder plain_required_string(String plain_required_string) { - $.plain_required_string = plain_required_string; + public Builder plainRequiredString(String plainRequiredString) { + $.plainRequiredString = plainRequiredString; return this; } - public Builder required_bool(Output required_bool) { - $.required_bool = required_bool; + public Builder requiredBool(Output requiredBool) { + $.requiredBool = requiredBool; return this; } - public Builder required_bool(Boolean required_bool) { - return required_bool(Output.of(required_bool)); + public Builder requiredBool(Boolean requiredBool) { + return requiredBool(Output.of(requiredBool)); } - public Builder required_enum(Output required_enum) { - $.required_enum = required_enum; + public Builder requiredEnum(Output requiredEnum) { + $.requiredEnum = requiredEnum; return this; } - public Builder required_enum(EnumThing required_enum) { - return required_enum(Output.of(required_enum)); + public Builder requiredEnum(EnumThing requiredEnum) { + return requiredEnum(Output.of(requiredEnum)); } - public Builder required_number(Output required_number) { - $.required_number = required_number; + public Builder requiredNumber(Output requiredNumber) { + $.requiredNumber = requiredNumber; return this; } - public Builder required_number(Double required_number) { - return required_number(Output.of(required_number)); + public Builder requiredNumber(Double requiredNumber) { + return requiredNumber(Output.of(requiredNumber)); } - public Builder required_string(Output required_string) { - $.required_string = required_string; + public Builder requiredString(Output requiredString) { + $.requiredString = requiredString; return this; } - public Builder required_string(String required_string) { - return required_string(Output.of(required_string)); + public Builder requiredString(String requiredString) { + return requiredString(Output.of(requiredString)); } public ModuleResourceArgs build() { - $.optional_bool = Codegen.booleanProp("optional_bool").output().arg($.optional_bool).def(true).getNullable(); - $.optional_const = Codegen.stringProp("optional_const").output().arg($.optional_const).def("another").getNullable(); - $.optional_enum = Codegen.objectProp("optional_enum", EnumThing.class).output().arg($.optional_enum).def(EnumThing.Eight).getNullable(); - $.optional_number = Codegen.doubleProp("optional_number").output().arg($.optional_number).def(4.2e+01).getNullable(); - $.optional_string = Codegen.stringProp("optional_string").output().arg($.optional_string).def("buzzer").getNullable(); - $.plain_optional_bool = Codegen.booleanProp("plain_optional_bool").arg($.plain_optional_bool).def(true).getNullable(); - $.plain_optional_const = Codegen.stringProp("plain_optional_const").arg($.plain_optional_const).def("another").getNullable(); - $.plain_optional_number = Codegen.doubleProp("plain_optional_number").arg($.plain_optional_number).def(4.2e+01).getNullable(); - $.plain_optional_string = Codegen.stringProp("plain_optional_string").arg($.plain_optional_string).def("buzzer").getNullable(); - $.plain_required_bool = Codegen.booleanProp("plain_required_bool").arg($.plain_required_bool).def(true).require(); - $.plain_required_const = Codegen.stringProp("plain_required_const").arg($.plain_required_const).def("another").require(); - $.plain_required_number = Codegen.doubleProp("plain_required_number").arg($.plain_required_number).def(4.2e+01).require(); - $.plain_required_string = Codegen.stringProp("plain_required_string").arg($.plain_required_string).def("buzzer").require(); - $.required_bool = Codegen.booleanProp("required_bool").output().arg($.required_bool).def(true).require(); - $.required_enum = Codegen.objectProp("required_enum", EnumThing.class).output().arg($.required_enum).def(EnumThing.Four).require(); - $.required_number = Codegen.doubleProp("required_number").output().arg($.required_number).def(4.2e+01).require(); - $.required_string = Codegen.stringProp("required_string").output().arg($.required_string).def("buzzer").require(); + $.optionalBool = Codegen.booleanProp("optionalBool").output().arg($.optionalBool).def(true).getNullable(); + $.optionalConst = Codegen.stringProp("optionalConst").output().arg($.optionalConst).def("another").getNullable(); + $.optionalEnum = Codegen.objectProp("optionalEnum", EnumThing.class).output().arg($.optionalEnum).def(EnumThing.Eight).getNullable(); + $.optionalNumber = Codegen.doubleProp("optionalNumber").output().arg($.optionalNumber).def(4.2e+01).getNullable(); + $.optionalString = Codegen.stringProp("optionalString").output().arg($.optionalString).def("buzzer").getNullable(); + $.plainOptionalBool = Codegen.booleanProp("plainOptionalBool").arg($.plainOptionalBool).def(true).getNullable(); + $.plainOptionalConst = Codegen.stringProp("plainOptionalConst").arg($.plainOptionalConst).def("another").getNullable(); + $.plainOptionalNumber = Codegen.doubleProp("plainOptionalNumber").arg($.plainOptionalNumber).def(4.2e+01).getNullable(); + $.plainOptionalString = Codegen.stringProp("plainOptionalString").arg($.plainOptionalString).def("buzzer").getNullable(); + $.plainRequiredBool = Codegen.booleanProp("plainRequiredBool").arg($.plainRequiredBool).def(true).require(); + $.plainRequiredConst = Codegen.stringProp("plainRequiredConst").arg($.plainRequiredConst).def("another").require(); + $.plainRequiredNumber = Codegen.doubleProp("plainRequiredNumber").arg($.plainRequiredNumber).def(4.2e+01).require(); + $.plainRequiredString = Codegen.stringProp("plainRequiredString").arg($.plainRequiredString).def("buzzer").require(); + $.requiredBool = Codegen.booleanProp("requiredBool").output().arg($.requiredBool).def(true).require(); + $.requiredEnum = Codegen.objectProp("requiredEnum", EnumThing.class).output().arg($.requiredEnum).def(EnumThing.Four).require(); + $.requiredNumber = Codegen.doubleProp("requiredNumber").output().arg($.requiredNumber).def(4.2e+01).require(); + $.requiredString = Codegen.stringProp("requiredString").output().arg($.requiredString).def("buzzer").require(); return $; } } diff --git a/pkg/codegen/testing/test/testdata/regress-go-15478/java/README.md b/pkg/codegen/testing/test/testdata/regress-go-15478/java/README.md new file mode 100644 index 00000000000..6b0d347bb27 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-go-15478/java/README.md @@ -0,0 +1 @@ +test description diff --git a/pkg/codegen/testing/test/testdata/regress-go-15478/java/build.gradle b/pkg/codegen/testing/test/testdata/regress-go-15478/java/build.gradle new file mode 100644 index 00000000000..4aa1a32d329 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-go-15478/java/build.gradle @@ -0,0 +1,152 @@ +// *** WARNING: this file was generated by pulumi-java-gen *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +plugins { + id("signing") + id("java-library") + id("maven-publish") +} + +group = "com.pulumi" + +def resolvedVersion = System.getenv("PACKAGE_VERSION") ?: + (project.version == "unspecified" + ? "1.0.0" + : project.version) + +def signingKey = System.getenv("SIGNING_KEY") +def signingPassword = System.getenv("SIGNING_PASSWORD") +def publishRepoURL = System.getenv("PUBLISH_REPO_URL") +def publishRepoUsername = System.getenv("PUBLISH_REPO_USERNAME") +def publishRepoPassword = System.getenv("PUBLISH_REPO_PASSWORD") + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } +} + +compileJava { + options.fork = true + options.forkOptions.jvmArgs.addAll(["-Xmx16g"]) + options.encoding = "UTF-8" +} + +repositories { + mavenLocal() + maven { // The google mirror is less flaky than mavenCentral() + url("https://maven-central.storage-download.googleapis.com/maven2/") + } + mavenCentral() +} + +dependencies { + implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("com.google.code.gson:gson:2.8.9") + implementation("com.pulumi:pulumi:0.0.1") +} + +task sourcesJar(type: Jar) { + from sourceSets.main.allJava + archiveClassifier.set('sources') +} + +task javadocJar(type: Jar) { + from javadoc + archiveClassifier.set('javadoc') + zip64 = true +} + +def genPulumiResources = tasks.register('genPulumiResources') { + doLast { + def resourcesDir = sourceSets.main.output.resourcesDir + def subDir = project.name.replace(".", "/") + def outDir = file("$resourcesDir/$subDir") + outDir.mkdirs() + new File(outDir, "version.txt").text = resolvedVersion + def info = new Object() + info.metaClass.resource = true + info.metaClass.name = "nestedTypes" + info.metaClass.version = resolvedVersion + def infoJson = new groovy.json.JsonBuilder(info).toPrettyString() + new File(outDir, "plugin.json").text = infoJson + } +} + +jar.configure { + dependsOn genPulumiResources +} + +publishing { + publications { + mainPublication(MavenPublication) { + groupId = "com.pulumi" + artifactId = "nestedTypes" + version = resolvedVersion + from components.java + artifact sourcesJar + artifact javadocJar + + pom { + inceptionYear = "" + name = "" + packaging = "jar" + description = "test description" + + url = "https://github.com/pulumi/pulumi-java" + + scm { + connection = "git@github.com/pulumi/pulumi-java.git" + developerConnection = "git@github.com/pulumi/pulumi-java.git" + url = "https://github.com/pulumi/pulumi-java" + } + + licenses { + license { + name = "" + url = "" + } + } + + developers { + developer { + id = "" + name = "" + email = "" + } + } + } + } + } + + if (publishRepoURL) { + repositories { + maven { + name = "PublishRepo" + url = publishRepoURL + credentials { + username = publishRepoUsername + password = publishRepoPassword + } + } + } + } +} + +javadoc { + if (JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } + options.jFlags("-Xmx8g", "-Xms512m") +} + +jar { + zip64 = true +} + +if (signingKey) { + signing { + useInMemoryPgpKeys(signingKey, signingPassword) + sign publishing.publications.mainPublication + } +} \ No newline at end of file diff --git a/pkg/codegen/testing/test/testdata/regress-go-15478/java/codegen-manifest.json b/pkg/codegen/testing/test/testdata/regress-go-15478/java/codegen-manifest.json new file mode 100644 index 00000000000..9505b8cd2ca --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-go-15478/java/codegen-manifest.json @@ -0,0 +1,13 @@ +{ + "emittedFiles": [ + "README.md", + "build.gradle", + "settings.gradle", + "src/main/java/com/pulumi/nestedTypes/Provider.java", + "src/main/java/com/pulumi/nestedTypes/ProviderArgs.java", + "src/main/java/com/pulumi/nestedTypes/Resource.java", + "src/main/java/com/pulumi/nestedTypes/ResourceArgs.java", + "src/main/java/com/pulumi/nestedTypes/Utilities.java", + "src/main/java/com/pulumi/nestedTypes/outputs/NestedType.java" + ] +} diff --git a/pkg/codegen/testing/test/testdata/regress-go-15478/java/settings.gradle b/pkg/codegen/testing/test/testdata/regress-go-15478/java/settings.gradle new file mode 100644 index 00000000000..cf4b304cc81 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-go-15478/java/settings.gradle @@ -0,0 +1,14 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +pluginManagement { + repositories { + maven { // The google mirror is less flaky than mavenCentral() + url("https://maven-central.storage-download.googleapis.com/maven2/") + } + gradlePluginPortal() + } +} + +rootProject.name = "com.pulumi.nestedTypes" +include("lib") diff --git a/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/Provider.java b/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/Provider.java new file mode 100644 index 00000000000..5678de02f95 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/Provider.java @@ -0,0 +1,47 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.nestedTypes; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.nestedTypes.ProviderArgs; +import com.pulumi.nestedTypes.Utilities; +import javax.annotation.Nullable; + +@ResourceType(type="pulumi:providers:nestedTypes") +public class Provider extends com.pulumi.resources.ProviderResource { + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public Provider(String name) { + this(name, ProviderArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public Provider(String name, @Nullable ProviderArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public Provider(String name, @Nullable ProviderArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("nestedTypes", name, args == null ? ProviderArgs.Empty : args, makeResourceOptions(options, Codegen.empty())); + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + +} diff --git a/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/ProviderArgs.java b/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/ProviderArgs.java new file mode 100644 index 00000000000..f797e2adf7a --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/ProviderArgs.java @@ -0,0 +1,28 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.nestedTypes; + + + + +public final class ProviderArgs extends com.pulumi.resources.ResourceArgs { + + public static final ProviderArgs Empty = new ProviderArgs(); + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private ProviderArgs $; + + public Builder() { + $ = new ProviderArgs(); + } + public ProviderArgs build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/Resource.java b/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/Resource.java new file mode 100644 index 00000000000..67bd63b3805 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/Resource.java @@ -0,0 +1,72 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.nestedTypes; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Export; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.nestedTypes.ResourceArgs; +import com.pulumi.nestedTypes.Utilities; +import com.pulumi.nestedTypes.outputs.NestedType; +import java.util.Optional; +import javax.annotation.Nullable; + +@ResourceType(type="nestedTypes:index:Resource") +public class Resource extends com.pulumi.resources.CustomResource { + @Export(name="nested", refs={NestedType.class}, tree="[0]") + private Output nested; + + public Output> nested() { + return Codegen.optional(this.nested); + } + + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public Resource(String name) { + this(name, ResourceArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public Resource(String name, @Nullable ResourceArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public Resource(String name, @Nullable ResourceArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("nestedTypes:index:Resource", name, args == null ? ResourceArgs.Empty : args, makeResourceOptions(options, Codegen.empty())); + } + + private Resource(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("nestedTypes:index:Resource", name, null, makeResourceOptions(options, id)); + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + + /** + * 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 options Optional settings to control the behavior of the CustomResource. + */ + public static Resource get(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + return new Resource(name, id, options); + } +} diff --git a/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/ResourceArgs.java b/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/ResourceArgs.java new file mode 100644 index 00000000000..69cc011284e --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/ResourceArgs.java @@ -0,0 +1,28 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.nestedTypes; + + + + +public final class ResourceArgs extends com.pulumi.resources.ResourceArgs { + + public static final ResourceArgs Empty = new ResourceArgs(); + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private ResourceArgs $; + + public Builder() { + $ = new ResourceArgs(); + } + public ResourceArgs build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/Utilities.java b/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/Utilities.java new file mode 100644 index 00000000000..d5971fdcab7 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/Utilities.java @@ -0,0 +1,89 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.nestedTypes; + + + + + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Optional; +import java.util.stream.Collectors; +import javax.annotation.Nullable; +import com.pulumi.core.internal.Environment; +import com.pulumi.deployment.InvokeOptions; + +public class Utilities { + + public static Optional getEnv(String... names) { + for (var n : names) { + var value = Environment.getEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvBoolean(String... names) { + for (var n : names) { + var value = Environment.getBooleanEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvInteger(String... names) { + for (var n : names) { + var value = Environment.getIntegerEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvDouble(String... names) { + for (var n : names) { + var value = Environment.getDoubleEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static InvokeOptions withVersion(@Nullable InvokeOptions options) { + if (options != null && options.getVersion().isPresent()) { + return options; + } + return new InvokeOptions( + options == null ? null : options.getParent().orElse(null), + options == null ? null : options.getProvider().orElse(null), + getVersion() + ); + } + + private static final String version; + public static String getVersion() { + return version; + } + + static { + var resourceName = "com/pulumi/nestedTypes/version.txt"; + var versionFile = Utilities.class.getClassLoader().getResourceAsStream(resourceName); + if (versionFile == null) { + throw new IllegalStateException( + String.format("expected resource '%s' on Classpath, not found", resourceName) + ); + } + version = new BufferedReader(new InputStreamReader(versionFile)) + .lines() + .collect(Collectors.joining("\n")) + .trim(); + } +} diff --git a/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/outputs/NestedType.java b/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/outputs/NestedType.java new file mode 100644 index 00000000000..abe61b44385 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-go-15478/java/src/main/java/com/pulumi/nestedTypes/outputs/NestedType.java @@ -0,0 +1,66 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.nestedTypes.outputs; + +import com.pulumi.core.annotations.CustomType; +import com.pulumi.exceptions.MissingRequiredPropertyException; +import java.lang.String; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Nullable; + +@CustomType +public final class NestedType { + private List>> data; + private @Nullable Map>> nestedMaps; + + private NestedType() {} + public List>> data() { + return this.data; + } + public Map>> nestedMaps() { + return this.nestedMaps == null ? Map.of() : this.nestedMaps; + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(NestedType defaults) { + return new Builder(defaults); + } + @CustomType.Builder + public static final class Builder { + private List>> data; + private @Nullable Map>> nestedMaps; + public Builder() {} + public Builder(NestedType defaults) { + Objects.requireNonNull(defaults); + this.data = defaults.data; + this.nestedMaps = defaults.nestedMaps; + } + + @CustomType.Setter + public Builder data(List>> data) { + if (data == null) { + throw new MissingRequiredPropertyException("NestedType", "data"); + } + this.data = data; + return this; + } + @CustomType.Setter + public Builder nestedMaps(@Nullable Map>> nestedMaps) { + + this.nestedMaps = nestedMaps; + return this; + } + public NestedType build() { + final var _resultValue = new NestedType(); + _resultValue.data = data; + _resultValue.nestedMaps = nestedMaps; + return _resultValue; + } + } +} diff --git a/pkg/codegen/testing/test/testdata/regress-go-15478/schema.json b/pkg/codegen/testing/test/testdata/regress-go-15478/schema.json new file mode 100644 index 00000000000..ba5bb157f17 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-go-15478/schema.json @@ -0,0 +1,52 @@ +{ + "name": "nestedTypes", + "version": "1.0.0", + "types": { + "nestedTypes:index:NestedType": { + "properties": { + "data": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "nestedMaps": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "type": "object", + "required": [ + "data" + ] + } + }, + "resources": { + "nestedTypes:index:Resource": { + "properties": { + "nested": { + "$ref": "#/types/nestedTypes:index:NestedType" + } + } + } + }, + "language": { + "go": { + "importBasePath": "regress-go-15478/nestedTypes" + } + } +} \ No newline at end of file diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/README.md b/pkg/codegen/testing/test/testdata/regress-py-12980/java/README.md new file mode 100644 index 00000000000..6b0d347bb27 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/README.md @@ -0,0 +1 @@ +test description diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/build.gradle b/pkg/codegen/testing/test/testdata/regress-py-12980/java/build.gradle new file mode 100644 index 00000000000..d44c55fbde6 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/build.gradle @@ -0,0 +1,152 @@ +// *** WARNING: this file was generated by pulumi-java-gen *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +plugins { + id("signing") + id("java-library") + id("maven-publish") +} + +group = "com.pulumi" + +def resolvedVersion = System.getenv("PACKAGE_VERSION") ?: + (project.version == "unspecified" + ? "0.0.1" + : project.version) + +def signingKey = System.getenv("SIGNING_KEY") +def signingPassword = System.getenv("SIGNING_PASSWORD") +def publishRepoURL = System.getenv("PUBLISH_REPO_URL") +def publishRepoUsername = System.getenv("PUBLISH_REPO_USERNAME") +def publishRepoPassword = System.getenv("PUBLISH_REPO_PASSWORD") + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } +} + +compileJava { + options.fork = true + options.forkOptions.jvmArgs.addAll(["-Xmx16g"]) + options.encoding = "UTF-8" +} + +repositories { + mavenLocal() + maven { // The google mirror is less flaky than mavenCentral() + url("https://maven-central.storage-download.googleapis.com/maven2/") + } + mavenCentral() +} + +dependencies { + implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("com.google.code.gson:gson:2.8.9") + implementation("com.pulumi:pulumi:0.0.1") +} + +task sourcesJar(type: Jar) { + from sourceSets.main.allJava + archiveClassifier.set('sources') +} + +task javadocJar(type: Jar) { + from javadoc + archiveClassifier.set('javadoc') + zip64 = true +} + +def genPulumiResources = tasks.register('genPulumiResources') { + doLast { + def resourcesDir = sourceSets.main.output.resourcesDir + def subDir = project.name.replace(".", "/") + def outDir = file("$resourcesDir/$subDir") + outDir.mkdirs() + new File(outDir, "version.txt").text = resolvedVersion + def info = new Object() + info.metaClass.resource = true + info.metaClass.name = "myPkg" + info.metaClass.version = resolvedVersion + def infoJson = new groovy.json.JsonBuilder(info).toPrettyString() + new File(outDir, "plugin.json").text = infoJson + } +} + +jar.configure { + dependsOn genPulumiResources +} + +publishing { + publications { + mainPublication(MavenPublication) { + groupId = "com.pulumi" + artifactId = "myPkg" + version = resolvedVersion + from components.java + artifact sourcesJar + artifact javadocJar + + pom { + inceptionYear = "" + name = "" + packaging = "jar" + description = "test description" + + url = "https://github.com/pulumi/pulumi-java" + + scm { + connection = "git@github.com/pulumi/pulumi-java.git" + developerConnection = "git@github.com/pulumi/pulumi-java.git" + url = "https://github.com/pulumi/pulumi-java" + } + + licenses { + license { + name = "" + url = "" + } + } + + developers { + developer { + id = "" + name = "" + email = "" + } + } + } + } + } + + if (publishRepoURL) { + repositories { + maven { + name = "PublishRepo" + url = publishRepoURL + credentials { + username = publishRepoUsername + password = publishRepoPassword + } + } + } + } +} + +javadoc { + if (JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } + options.jFlags("-Xmx8g", "-Xms512m") +} + +jar { + zip64 = true +} + +if (signingKey) { + signing { + useInMemoryPgpKeys(signingKey, signingPassword) + sign publishing.publications.mainPublication + } +} \ No newline at end of file diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/codegen-manifest.json b/pkg/codegen/testing/test/testdata/regress-py-12980/java/codegen-manifest.json new file mode 100644 index 00000000000..1d2a8985160 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/codegen-manifest.json @@ -0,0 +1,20 @@ +{ + "emittedFiles": [ + "README.md", + "build.gradle", + "settings.gradle", + "src/main/java/com/pulumi/myPkg/Provider.java", + "src/main/java/com/pulumi/myPkg/ProviderArgs.java", + "src/main/java/com/pulumi/myPkg/Utilities.java", + "src/main/java/com/pulumi/myPkg/myMod_childA/MemberA1.java", + "src/main/java/com/pulumi/myPkg/myMod_childA/MemberA1Args.java", + "src/main/java/com/pulumi/myPkg/myMod_childA/enums/EnumA.java", + "src/main/java/com/pulumi/myPkg/myMod_childA/outputs/ObjectA.java", + "src/main/java/com/pulumi/myPkg/myMod_childB/MemberB1.java", + "src/main/java/com/pulumi/myPkg/myMod_childB/MemberB1Args.java", + "src/main/java/com/pulumi/myPkg/myMod_childB/MemberB2.java", + "src/main/java/com/pulumi/myPkg/myMod_childB/MemberB2Args.java", + "src/main/java/com/pulumi/myPkg/myMod_childB/enums/EnumB.java", + "src/main/java/com/pulumi/myPkg/myMod_childB/outputs/ObjectB.java" + ] +} diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/settings.gradle b/pkg/codegen/testing/test/testdata/regress-py-12980/java/settings.gradle new file mode 100644 index 00000000000..2cd6b9d796f --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/settings.gradle @@ -0,0 +1,14 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +pluginManagement { + repositories { + maven { // The google mirror is less flaky than mavenCentral() + url("https://maven-central.storage-download.googleapis.com/maven2/") + } + gradlePluginPortal() + } +} + +rootProject.name = "com.pulumi.myPkg" +include("lib") diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/Provider.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/Provider.java new file mode 100644 index 00000000000..6fcc20d9f80 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/Provider.java @@ -0,0 +1,47 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.myPkg.ProviderArgs; +import com.pulumi.myPkg.Utilities; +import javax.annotation.Nullable; + +@ResourceType(type="pulumi:providers:myPkg") +public class Provider extends com.pulumi.resources.ProviderResource { + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public Provider(String name) { + this(name, ProviderArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public Provider(String name, @Nullable ProviderArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public Provider(String name, @Nullable ProviderArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("myPkg", name, args == null ? ProviderArgs.Empty : args, makeResourceOptions(options, Codegen.empty())); + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + +} diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/ProviderArgs.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/ProviderArgs.java new file mode 100644 index 00000000000..9d878c523dd --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/ProviderArgs.java @@ -0,0 +1,28 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg; + + + + +public final class ProviderArgs extends com.pulumi.resources.ResourceArgs { + + public static final ProviderArgs Empty = new ProviderArgs(); + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private ProviderArgs $; + + public Builder() { + $ = new ProviderArgs(); + } + public ProviderArgs build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/Utilities.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/Utilities.java new file mode 100644 index 00000000000..477901977a2 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/Utilities.java @@ -0,0 +1,89 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg; + + + + + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Optional; +import java.util.stream.Collectors; +import javax.annotation.Nullable; +import com.pulumi.core.internal.Environment; +import com.pulumi.deployment.InvokeOptions; + +public class Utilities { + + public static Optional getEnv(String... names) { + for (var n : names) { + var value = Environment.getEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvBoolean(String... names) { + for (var n : names) { + var value = Environment.getBooleanEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvInteger(String... names) { + for (var n : names) { + var value = Environment.getIntegerEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvDouble(String... names) { + for (var n : names) { + var value = Environment.getDoubleEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static InvokeOptions withVersion(@Nullable InvokeOptions options) { + if (options != null && options.getVersion().isPresent()) { + return options; + } + return new InvokeOptions( + options == null ? null : options.getParent().orElse(null), + options == null ? null : options.getProvider().orElse(null), + getVersion() + ); + } + + private static final String version; + public static String getVersion() { + return version; + } + + static { + var resourceName = "com/pulumi/myPkg/version.txt"; + var versionFile = Utilities.class.getClassLoader().getResourceAsStream(resourceName); + if (versionFile == null) { + throw new IllegalStateException( + String.format("expected resource '%s' on Classpath, not found", resourceName) + ); + } + version = new BufferedReader(new InputStreamReader(versionFile)) + .lines() + .collect(Collectors.joining("\n")) + .trim(); + } +} diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/MemberA1.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/MemberA1.java new file mode 100644 index 00000000000..c5c1cfe8b72 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/MemberA1.java @@ -0,0 +1,47 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg.myMod_childA; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.myPkg.Utilities; +import com.pulumi.myPkg.myMod_childA.MemberA1Args; +import javax.annotation.Nullable; + +@ResourceType(type="myPkg:myMod/childA:MemberA1") +public class MemberA1 extends com.pulumi.resources.ComponentResource { + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public MemberA1(String name) { + this(name, MemberA1Args.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public MemberA1(String name, @Nullable MemberA1Args args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public MemberA1(String name, @Nullable MemberA1Args args, @Nullable com.pulumi.resources.ComponentResourceOptions options) { + super("myPkg:myMod/childA:MemberA1", name, args == null ? MemberA1Args.Empty : args, makeResourceOptions(options, Codegen.empty()), true); + } + + private static com.pulumi.resources.ComponentResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.ComponentResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.ComponentResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.ComponentResourceOptions.merge(defaultOptions, options, id); + } + +} diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/MemberA1Args.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/MemberA1Args.java new file mode 100644 index 00000000000..b8221ea45a5 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/MemberA1Args.java @@ -0,0 +1,28 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg.myMod_childA; + + + + +public final class MemberA1Args extends com.pulumi.resources.ResourceArgs { + + public static final MemberA1Args Empty = new MemberA1Args(); + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private MemberA1Args $; + + public Builder() { + $ = new MemberA1Args(); + } + public MemberA1Args build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/enums/EnumA.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/enums/EnumA.java new file mode 100644 index 00000000000..9881673281a --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/enums/EnumA.java @@ -0,0 +1,33 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg.myMod_childA.enums; + +import com.pulumi.core.annotations.EnumType; +import java.lang.String; +import java.util.Objects; +import java.util.StringJoiner; + + @EnumType + public enum EnumA { + A1("a1"), + A2("a2"); + + private final String value; + + EnumA(String value) { + this.value = Objects.requireNonNull(value); + } + + @EnumType.Converter + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return new StringJoiner(", ", "EnumA[", "]") + .add("value='" + this.value + "'") + .toString(); + } + } diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/outputs/ObjectA.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/outputs/ObjectA.java new file mode 100644 index 00000000000..76d5df09d5d --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childA/outputs/ObjectA.java @@ -0,0 +1,49 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg.myMod_childA.outputs; + +import com.pulumi.core.annotations.CustomType; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + +@CustomType +public final class ObjectA { + private @Nullable String propA; + + private ObjectA() {} + public Optional propA() { + return Optional.ofNullable(this.propA); + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(ObjectA defaults) { + return new Builder(defaults); + } + @CustomType.Builder + public static final class Builder { + private @Nullable String propA; + public Builder() {} + public Builder(ObjectA defaults) { + Objects.requireNonNull(defaults); + this.propA = defaults.propA; + } + + @CustomType.Setter + public Builder propA(@Nullable String propA) { + + this.propA = propA; + return this; + } + public ObjectA build() { + final var _resultValue = new ObjectA(); + _resultValue.propA = propA; + return _resultValue; + } + } +} diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB1.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB1.java new file mode 100644 index 00000000000..c162ff0a02e --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB1.java @@ -0,0 +1,47 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg.myMod_childB; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.myPkg.Utilities; +import com.pulumi.myPkg.myMod_childB.MemberB1Args; +import javax.annotation.Nullable; + +@ResourceType(type="myPkg:myMod/childB:MemberB1") +public class MemberB1 extends com.pulumi.resources.ComponentResource { + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public MemberB1(String name) { + this(name, MemberB1Args.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public MemberB1(String name, @Nullable MemberB1Args args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public MemberB1(String name, @Nullable MemberB1Args args, @Nullable com.pulumi.resources.ComponentResourceOptions options) { + super("myPkg:myMod/childB:MemberB1", name, args == null ? MemberB1Args.Empty : args, makeResourceOptions(options, Codegen.empty()), true); + } + + private static com.pulumi.resources.ComponentResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.ComponentResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.ComponentResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.ComponentResourceOptions.merge(defaultOptions, options, id); + } + +} diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB1Args.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB1Args.java new file mode 100644 index 00000000000..e12fb420c0e --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB1Args.java @@ -0,0 +1,28 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg.myMod_childB; + + + + +public final class MemberB1Args extends com.pulumi.resources.ResourceArgs { + + public static final MemberB1Args Empty = new MemberB1Args(); + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private MemberB1Args $; + + public Builder() { + $ = new MemberB1Args(); + } + public MemberB1Args build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB2.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB2.java new file mode 100644 index 00000000000..3e4a265c75e --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB2.java @@ -0,0 +1,92 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg.myMod_childB; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Export; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.myPkg.Utilities; +import com.pulumi.myPkg.myMod_childA.MemberA1; +import com.pulumi.myPkg.myMod_childA.enums.EnumA; +import com.pulumi.myPkg.myMod_childA.outputs.ObjectA; +import com.pulumi.myPkg.myMod_childB.MemberB1; +import com.pulumi.myPkg.myMod_childB.MemberB2Args; +import com.pulumi.myPkg.myMod_childB.enums.EnumB; +import com.pulumi.myPkg.myMod_childB.outputs.ObjectB; +import java.util.Optional; +import javax.annotation.Nullable; + +@ResourceType(type="myPkg:myMod/childB:MemberB2") +public class MemberB2 extends com.pulumi.resources.ComponentResource { + @Export(name="enumFromDifferentModule", refs={EnumA.class}, tree="[0]") + private Output enumFromDifferentModule; + + public Output> enumFromDifferentModule() { + return Codegen.optional(this.enumFromDifferentModule); + } + @Export(name="enumFromSameModule", refs={EnumB.class}, tree="[0]") + private Output enumFromSameModule; + + public Output> enumFromSameModule() { + return Codegen.optional(this.enumFromSameModule); + } + @Export(name="objectFromDifferentModule", refs={ObjectA.class}, tree="[0]") + private Output objectFromDifferentModule; + + public Output> objectFromDifferentModule() { + return Codegen.optional(this.objectFromDifferentModule); + } + @Export(name="objectFromSameModule", refs={ObjectB.class}, tree="[0]") + private Output objectFromSameModule; + + public Output> objectFromSameModule() { + return Codegen.optional(this.objectFromSameModule); + } + @Export(name="resourceFromDifferentModule", refs={MemberA1.class}, tree="[0]") + private Output resourceFromDifferentModule; + + public Output> resourceFromDifferentModule() { + return Codegen.optional(this.resourceFromDifferentModule); + } + @Export(name="resourceFromSameModule", refs={MemberB1.class}, tree="[0]") + private Output resourceFromSameModule; + + public Output> resourceFromSameModule() { + return Codegen.optional(this.resourceFromSameModule); + } + + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public MemberB2(String name) { + this(name, MemberB2Args.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public MemberB2(String name, @Nullable MemberB2Args args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public MemberB2(String name, @Nullable MemberB2Args args, @Nullable com.pulumi.resources.ComponentResourceOptions options) { + super("myPkg:myMod/childB:MemberB2", name, args == null ? MemberB2Args.Empty : args, makeResourceOptions(options, Codegen.empty()), true); + } + + private static com.pulumi.resources.ComponentResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.ComponentResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.ComponentResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.ComponentResourceOptions.merge(defaultOptions, options, id); + } + +} diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB2Args.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB2Args.java new file mode 100644 index 00000000000..b4afcb5c8d8 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/MemberB2Args.java @@ -0,0 +1,28 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg.myMod_childB; + + + + +public final class MemberB2Args extends com.pulumi.resources.ResourceArgs { + + public static final MemberB2Args Empty = new MemberB2Args(); + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private MemberB2Args $; + + public Builder() { + $ = new MemberB2Args(); + } + public MemberB2Args build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/enums/EnumB.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/enums/EnumB.java new file mode 100644 index 00000000000..18921e6600d --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/enums/EnumB.java @@ -0,0 +1,33 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg.myMod_childB.enums; + +import com.pulumi.core.annotations.EnumType; +import java.lang.String; +import java.util.Objects; +import java.util.StringJoiner; + + @EnumType + public enum EnumB { + B1("b1"), + B2("b2"); + + private final String value; + + EnumB(String value) { + this.value = Objects.requireNonNull(value); + } + + @EnumType.Converter + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return new StringJoiner(", ", "EnumB[", "]") + .add("value='" + this.value + "'") + .toString(); + } + } diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/outputs/ObjectB.java b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/outputs/ObjectB.java new file mode 100644 index 00000000000..1db04de99ad --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/java/src/main/java/com/pulumi/myPkg/myMod_childB/outputs/ObjectB.java @@ -0,0 +1,49 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.myPkg.myMod_childB.outputs; + +import com.pulumi.core.annotations.CustomType; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + +@CustomType +public final class ObjectB { + private @Nullable String propB; + + private ObjectB() {} + public Optional propB() { + return Optional.ofNullable(this.propB); + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(ObjectB defaults) { + return new Builder(defaults); + } + @CustomType.Builder + public static final class Builder { + private @Nullable String propB; + public Builder() {} + public Builder(ObjectB defaults) { + Objects.requireNonNull(defaults); + this.propB = defaults.propB; + } + + @CustomType.Setter + public Builder propB(@Nullable String propB) { + + this.propB = propB; + return this; + } + public ObjectB build() { + final var _resultValue = new ObjectB(); + _resultValue.propB = propB; + return _resultValue; + } + } +} diff --git a/pkg/codegen/testing/test/testdata/regress-py-12980/schema.json b/pkg/codegen/testing/test/testdata/regress-py-12980/schema.json new file mode 100644 index 00000000000..6ac8e6303e4 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/regress-py-12980/schema.json @@ -0,0 +1,82 @@ +{ + "name": "myPkg", + "description": "Test imports across different module names", + "types": { + "myPkg:myMod/childA:EnumA": { + "type": "string", + "enum": [ + { + "name": "A1", + "value": "a1" + }, + { + "name": "A2", + "value": "a2" + } + ] + }, + "myPkg:myMod/childB:EnumB": { + "type": "string", + "enum": [ + { + "name": "B1", + "value": "b1" + }, + { + "name": "B2", + "value": "b2" + } + ] + }, + "myPkg:myMod/childA:ObjectA": { + "type": "object", + "properties": { + "propA": { + "type": "string" + } + } + }, + "myPkg:myMod/childB:ObjectB": { + "type": "object", + "properties": { + "propB": { + "type": "string" + } + } + } + }, + "resources": { + "myPkg:myMod/childA:MemberA1": { + "isComponent": true + }, + "myPkg:myMod/childB:MemberB1": { + "isComponent": true + }, + "myPkg:myMod/childB:MemberB2": { + "isComponent": true, + "properties": { + "resourceFromDifferentModule": { + "$ref": "#/resources/myPkg:myMod/childA:MemberA1" + }, + "resourceFromSameModule": { + "$ref": "#/resources/myPkg:myMod/childB:MemberB1" + }, + "enumFromDifferentModule": { + "$ref": "#/types/myPkg:myMod/childA:EnumA" + }, + "enumFromSameModule": { + "$ref": "#/types/myPkg:myMod/childB:EnumB" + }, + "objectFromDifferentModule": { + "$ref": "#/types/myPkg:myMod/childA:ObjectA" + }, + "objectFromSameModule": { + "$ref": "#/types/myPkg:myMod/childB:ObjectB" + } + } + } + }, + "language": { + "python": {} + } +} \ No newline at end of file diff --git a/pkg/codegen/testing/test/testdata/replace-on-change/java/src/main/java/com/pulumi/example/NoRecursive.java b/pkg/codegen/testing/test/testdata/replace-on-change/java/src/main/java/com/pulumi/example/NoRecursive.java index 344d9013d3b..a59958e8e57 100644 --- a/pkg/codegen/testing/test/testdata/replace-on-change/java/src/main/java/com/pulumi/example/NoRecursive.java +++ b/pkg/codegen/testing/test/testdata/replace-on-change/java/src/main/java/com/pulumi/example/NoRecursive.java @@ -22,11 +22,11 @@ public class NoRecursive extends com.pulumi.resources.CustomResource { public Output> rec() { return Codegen.optional(this.rec); } - @Export(name="replace", refs={String.class}, tree="[0]") - private Output replace; + @Export(name="replaceMe", refs={String.class}, tree="[0]") + private Output replaceMe; - public Output> replace() { - return Codegen.optional(this.replace); + public Output> replaceMe() { + return Codegen.optional(this.replaceMe); } /** diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/README.md b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/README.md new file mode 100644 index 00000000000..6b0d347bb27 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/README.md @@ -0,0 +1 @@ +test description diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/build.gradle b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/build.gradle new file mode 100644 index 00000000000..34bad0c1c0c --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/build.gradle @@ -0,0 +1,152 @@ +// *** WARNING: this file was generated by pulumi-java-gen *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +plugins { + id("signing") + id("java-library") + id("maven-publish") +} + +group = "com.pulumi" + +def resolvedVersion = System.getenv("PACKAGE_VERSION") ?: + (project.version == "unspecified" + ? "0.1.0" + : project.version) + +def signingKey = System.getenv("SIGNING_KEY") +def signingPassword = System.getenv("SIGNING_PASSWORD") +def publishRepoURL = System.getenv("PUBLISH_REPO_URL") +def publishRepoUsername = System.getenv("PUBLISH_REPO_USERNAME") +def publishRepoPassword = System.getenv("PUBLISH_REPO_PASSWORD") + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } +} + +compileJava { + options.fork = true + options.forkOptions.jvmArgs.addAll(["-Xmx16g"]) + options.encoding = "UTF-8" +} + +repositories { + mavenLocal() + maven { // The google mirror is less flaky than mavenCentral() + url("https://maven-central.storage-download.googleapis.com/maven2/") + } + mavenCentral() +} + +dependencies { + implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("com.google.code.gson:gson:2.8.9") + implementation("com.pulumi:pulumi:0.0.1") +} + +task sourcesJar(type: Jar) { + from sourceSets.main.allJava + archiveClassifier.set('sources') +} + +task javadocJar(type: Jar) { + from javadoc + archiveClassifier.set('javadoc') + zip64 = true +} + +def genPulumiResources = tasks.register('genPulumiResources') { + doLast { + def resourcesDir = sourceSets.main.output.resourcesDir + def subDir = project.name.replace(".", "/") + def outDir = file("$resourcesDir/$subDir") + outDir.mkdirs() + new File(outDir, "version.txt").text = resolvedVersion + def info = new Object() + info.metaClass.resource = true + info.metaClass.name = "credentials" + info.metaClass.version = resolvedVersion + def infoJson = new groovy.json.JsonBuilder(info).toPrettyString() + new File(outDir, "plugin.json").text = infoJson + } +} + +jar.configure { + dependsOn genPulumiResources +} + +publishing { + publications { + mainPublication(MavenPublication) { + groupId = "com.pulumi" + artifactId = "credentials" + version = resolvedVersion + from components.java + artifact sourcesJar + artifact javadocJar + + pom { + inceptionYear = "" + name = "" + packaging = "jar" + description = "test description" + + url = "https://github.com/pulumi/pulumi-java" + + scm { + connection = "git@github.com/pulumi/pulumi-java.git" + developerConnection = "git@github.com/pulumi/pulumi-java.git" + url = "https://github.com/pulumi/pulumi-java" + } + + licenses { + license { + name = "" + url = "" + } + } + + developers { + developer { + id = "" + name = "" + email = "" + } + } + } + } + } + + if (publishRepoURL) { + repositories { + maven { + name = "PublishRepo" + url = publishRepoURL + credentials { + username = publishRepoUsername + password = publishRepoPassword + } + } + } + } +} + +javadoc { + if (JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } + options.jFlags("-Xmx8g", "-Xms512m") +} + +jar { + zip64 = true +} + +if (signingKey) { + signing { + useInMemoryPgpKeys(signingKey, signingPassword) + sign publishing.publications.mainPublication + } +} \ No newline at end of file diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/codegen-manifest.json b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/codegen-manifest.json new file mode 100644 index 00000000000..c4312ac9f4d --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/codegen-manifest.json @@ -0,0 +1,16 @@ +{ + "emittedFiles": [ + "README.md", + "build.gradle", + "settings.gradle", + "src/main/java/com/pulumi/credentials/Config.java", + "src/main/java/com/pulumi/credentials/Provider.java", + "src/main/java/com/pulumi/credentials/ProviderArgs.java", + "src/main/java/com/pulumi/credentials/User.java", + "src/main/java/com/pulumi/credentials/UserArgs.java", + "src/main/java/com/pulumi/credentials/Utilities.java", + "src/main/java/com/pulumi/credentials/enums/HashKind.java", + "src/main/java/com/pulumi/credentials/inputs/Shared.java", + "src/main/java/com/pulumi/credentials/inputs/SharedArgs.java" + ] +} diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/settings.gradle b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/settings.gradle new file mode 100644 index 00000000000..452340bf7ac --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/settings.gradle @@ -0,0 +1,14 @@ +// *** WARNING: this file was generated by pulumi-java-gen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +pluginManagement { + repositories { + maven { // The google mirror is less flaky than mavenCentral() + url("https://maven-central.storage-download.googleapis.com/maven2/") + } + gradlePluginPortal() + } +} + +rootProject.name = "com.pulumi.credentials" +include("lib") diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/Config.java b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/Config.java new file mode 100644 index 00000000000..2f6a1ea804a --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/Config.java @@ -0,0 +1,39 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.credentials; + +import com.pulumi.core.internal.Codegen; +import com.pulumi.credentials.enums.HashKind; +import com.pulumi.credentials.inputs.Shared; +import java.lang.String; +import java.util.Optional; + +public final class Config { + + private static final com.pulumi.Config config = com.pulumi.Config.of("credentials"); +/** + * The (entirely uncryptographic) hash function used to encode the "password". + * + */ + public HashKind hash() { + return Codegen.objectProp("hash", HashKind.class).config(config).require(); + } +/** + * The password. It is very secret. + * + */ + public Optional password() { + return Codegen.stringProp("password").config(config).env("FOO").def("").get(); + } + public Shared shared() { + return Codegen.objectProp("shared", Shared.class).config(config).require(); + } +/** + * The username. Its important but not secret. + * + */ + public String user() { + return Codegen.stringProp("user").config(config).require(); + } +} diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/Provider.java b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/Provider.java new file mode 100644 index 00000000000..b2c85f89340 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/Provider.java @@ -0,0 +1,83 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.credentials; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Export; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.credentials.ProviderArgs; +import com.pulumi.credentials.Utilities; +import java.lang.String; +import java.util.List; +import java.util.Optional; +import javax.annotation.Nullable; + +@ResourceType(type="pulumi:providers:credentials") +public class Provider extends com.pulumi.resources.ProviderResource { + /** + * The password. It is very secret. + * + */ + @Export(name="password", refs={String.class}, tree="[0]") + private Output password; + + /** + * @return The password. It is very secret. + * + */ + public Output> password() { + return Codegen.optional(this.password); + } + /** + * The username. Its important but not secret. + * + */ + @Export(name="user", refs={String.class}, tree="[0]") + private Output user; + + /** + * @return The username. Its important but not secret. + * + */ + public Output user() { + return this.user; + } + + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public Provider(String name) { + this(name, ProviderArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public Provider(String name, ProviderArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public Provider(String name, ProviderArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("credentials", name, args == null ? ProviderArgs.Empty : args, makeResourceOptions(options, Codegen.empty())); + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .additionalSecretOutputs(List.of( + "password" + )) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + +} diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/ProviderArgs.java b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/ProviderArgs.java new file mode 100644 index 00000000000..5ab0d06df2e --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/ProviderArgs.java @@ -0,0 +1,188 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.credentials; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.core.internal.Codegen; +import com.pulumi.credentials.enums.HashKind; +import com.pulumi.credentials.inputs.SharedArgs; +import com.pulumi.exceptions.MissingRequiredPropertyException; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class ProviderArgs extends com.pulumi.resources.ResourceArgs { + + public static final ProviderArgs Empty = new ProviderArgs(); + + /** + * The (entirely uncryptographic) hash function used to encode the "password". + * + */ + @Import(name="hash", required=true, json=true) + private Output hash; + + /** + * @return The (entirely uncryptographic) hash function used to encode the "password". + * + */ + public Output hash() { + return this.hash; + } + + /** + * The password. It is very secret. + * + */ + @Import(name="password") + private @Nullable Output password; + + /** + * @return The password. It is very secret. + * + */ + public Optional> password() { + return Optional.ofNullable(this.password); + } + + @Import(name="shared", required=true, json=true) + private Output shared; + + public Output shared() { + return this.shared; + } + + /** + * The username. Its important but not secret. + * + */ + @Import(name="user", required=true) + private Output user; + + /** + * @return The username. Its important but not secret. + * + */ + public Output user() { + return this.user; + } + + private ProviderArgs() {} + + private ProviderArgs(ProviderArgs $) { + this.hash = $.hash; + this.password = $.password; + this.shared = $.shared; + this.user = $.user; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(ProviderArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private ProviderArgs $; + + public Builder() { + $ = new ProviderArgs(); + } + + public Builder(ProviderArgs defaults) { + $ = new ProviderArgs(Objects.requireNonNull(defaults)); + } + + /** + * @param hash The (entirely uncryptographic) hash function used to encode the "password". + * + * @return builder + * + */ + public Builder hash(Output hash) { + $.hash = hash; + return this; + } + + /** + * @param hash The (entirely uncryptographic) hash function used to encode the "password". + * + * @return builder + * + */ + public Builder hash(HashKind hash) { + return hash(Output.of(hash)); + } + + /** + * @param password The password. It is very secret. + * + * @return builder + * + */ + public Builder password(@Nullable Output password) { + $.password = password; + return this; + } + + /** + * @param password The password. It is very secret. + * + * @return builder + * + */ + public Builder password(String password) { + return password(Output.of(password)); + } + + public Builder shared(Output shared) { + $.shared = shared; + return this; + } + + public Builder shared(SharedArgs shared) { + return shared(Output.of(shared)); + } + + /** + * @param user The username. Its important but not secret. + * + * @return builder + * + */ + public Builder user(Output user) { + $.user = user; + return this; + } + + /** + * @param user The username. Its important but not secret. + * + * @return builder + * + */ + public Builder user(String user) { + return user(Output.of(user)); + } + + public ProviderArgs build() { + if ($.hash == null) { + throw new MissingRequiredPropertyException("ProviderArgs", "hash"); + } + $.password = Codegen.stringProp("password").secret().arg($.password).env("FOO").def("").getNullable(); + if ($.shared == null) { + throw new MissingRequiredPropertyException("ProviderArgs", "shared"); + } + if ($.user == null) { + throw new MissingRequiredPropertyException("ProviderArgs", "user"); + } + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/User.java b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/User.java new file mode 100644 index 00000000000..c8e703de676 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/User.java @@ -0,0 +1,77 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.credentials; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Export; +import com.pulumi.core.annotations.ResourceType; +import com.pulumi.core.internal.Codegen; +import com.pulumi.credentials.UserArgs; +import com.pulumi.credentials.Utilities; +import java.lang.String; +import javax.annotation.Nullable; + +@ResourceType(type="credentials:index:User") +public class User extends com.pulumi.resources.CustomResource { + @Export(name="name", refs={String.class}, tree="[0]") + private Output name; + + public Output name() { + return this.name; + } + @Export(name="password", refs={String.class}, tree="[0]") + private Output password; + + public Output password() { + return this.password; + } + + /** + * + * @param name The _unique_ name of the resulting resource. + */ + public User(String name) { + this(name, UserArgs.Empty); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + */ + public User(String name, UserArgs args) { + this(name, args, null); + } + /** + * + * @param name The _unique_ name of the resulting resource. + * @param args The arguments to use to populate this resource's properties. + * @param options A bag of options that control this resource's behavior. + */ + public User(String name, UserArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("credentials:index:User", name, args == null ? UserArgs.Empty : args, makeResourceOptions(options, Codegen.empty())); + } + + private User(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + super("credentials:index:User", name, null, makeResourceOptions(options, id)); + } + + private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { + var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() + .version(Utilities.getVersion()) + .build(); + return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); + } + + /** + * 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 options Optional settings to control the behavior of the CustomResource. + */ + public static User get(String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { + return new User(name, id, options); + } +} diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/UserArgs.java b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/UserArgs.java new file mode 100644 index 00000000000..2632e659175 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/UserArgs.java @@ -0,0 +1,65 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.credentials; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import com.pulumi.credentials.inputs.SharedArgs; +import com.pulumi.exceptions.MissingRequiredPropertyException; +import java.util.Objects; + + +public final class UserArgs extends com.pulumi.resources.ResourceArgs { + + public static final UserArgs Empty = new UserArgs(); + + @Import(name="shared", required=true) + private Output shared; + + public Output shared() { + return this.shared; + } + + private UserArgs() {} + + private UserArgs(UserArgs $) { + this.shared = $.shared; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(UserArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private UserArgs $; + + public Builder() { + $ = new UserArgs(); + } + + public Builder(UserArgs defaults) { + $ = new UserArgs(Objects.requireNonNull(defaults)); + } + + public Builder shared(Output shared) { + $.shared = shared; + return this; + } + + public Builder shared(SharedArgs shared) { + return shared(Output.of(shared)); + } + + public UserArgs build() { + if ($.shared == null) { + throw new MissingRequiredPropertyException("UserArgs", "shared"); + } + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/Utilities.java b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/Utilities.java new file mode 100644 index 00000000000..ac1a27f61db --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/Utilities.java @@ -0,0 +1,89 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.credentials; + + + + + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Optional; +import java.util.stream.Collectors; +import javax.annotation.Nullable; +import com.pulumi.core.internal.Environment; +import com.pulumi.deployment.InvokeOptions; + +public class Utilities { + + public static Optional getEnv(String... names) { + for (var n : names) { + var value = Environment.getEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvBoolean(String... names) { + for (var n : names) { + var value = Environment.getBooleanEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvInteger(String... names) { + for (var n : names) { + var value = Environment.getIntegerEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static Optional getEnvDouble(String... names) { + for (var n : names) { + var value = Environment.getDoubleEnvironmentVariable(n); + if (value.isValue()) { + return Optional.of(value.value()); + } + } + return Optional.empty(); + } + + public static InvokeOptions withVersion(@Nullable InvokeOptions options) { + if (options != null && options.getVersion().isPresent()) { + return options; + } + return new InvokeOptions( + options == null ? null : options.getParent().orElse(null), + options == null ? null : options.getProvider().orElse(null), + getVersion() + ); + } + + private static final String version; + public static String getVersion() { + return version; + } + + static { + var resourceName = "com/pulumi/credentials/version.txt"; + var versionFile = Utilities.class.getClassLoader().getResourceAsStream(resourceName); + if (versionFile == null) { + throw new IllegalStateException( + String.format("expected resource '%s' on Classpath, not found", resourceName) + ); + } + version = new BufferedReader(new InputStreamReader(versionFile)) + .lines() + .collect(Collectors.joining("\n")) + .trim(); + } +} diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/enums/HashKind.java b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/enums/HashKind.java new file mode 100644 index 00000000000..61fd4043701 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/enums/HashKind.java @@ -0,0 +1,41 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.credentials.enums; + +import com.pulumi.core.annotations.EnumType; +import java.lang.String; +import java.util.Objects; +import java.util.StringJoiner; + + @EnumType + public enum HashKind { + /** + * Adler32 implements the Adler-32 checksum. + * + */ + Adler32("Adler32"), + /** + * CRC32 implements the 32-bit cyclic redundancy check, or CRC-32, checksum. + * + */ + CRC32("CRC32"); + + private final String value; + + HashKind(String value) { + this.value = Objects.requireNonNull(value); + } + + @EnumType.Converter + public String getValue() { + return this.value; + } + + @Override + public String toString() { + return new StringJoiner(", ", "HashKind[", "]") + .add("value='" + this.value + "'") + .toString(); + } + } diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/inputs/Shared.java b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/inputs/Shared.java new file mode 100644 index 00000000000..227d841a13d --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/inputs/Shared.java @@ -0,0 +1,49 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.credentials.inputs; + +import com.pulumi.core.annotations.CustomType; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + +@CustomType +public final class Shared { + private @Nullable String foo; + + private Shared() {} + public Optional foo() { + return Optional.ofNullable(this.foo); + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Shared defaults) { + return new Builder(defaults); + } + @CustomType.Builder + public static final class Builder { + private @Nullable String foo; + public Builder() {} + public Builder(Shared defaults) { + Objects.requireNonNull(defaults); + this.foo = defaults.foo; + } + + @CustomType.Setter + public Builder foo(@Nullable String foo) { + + this.foo = foo; + return this; + } + public Shared build() { + final var _resultValue = new Shared(); + _resultValue.foo = foo; + return _resultValue; + } + } +} diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/inputs/SharedArgs.java b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/inputs/SharedArgs.java new file mode 100644 index 00000000000..c4be406f4d2 --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/java/src/main/java/com/pulumi/credentials/inputs/SharedArgs.java @@ -0,0 +1,63 @@ +// *** WARNING: this file was generated by test. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +package com.pulumi.credentials.inputs; + +import com.pulumi.core.Output; +import com.pulumi.core.annotations.Import; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import javax.annotation.Nullable; + + +public final class SharedArgs extends com.pulumi.resources.ResourceArgs { + + public static final SharedArgs Empty = new SharedArgs(); + + @Import(name="foo") + private @Nullable Output foo; + + public Optional> foo() { + return Optional.ofNullable(this.foo); + } + + private SharedArgs() {} + + private SharedArgs(SharedArgs $) { + this.foo = $.foo; + } + + public static Builder builder() { + return new Builder(); + } + public static Builder builder(SharedArgs defaults) { + return new Builder(defaults); + } + + public static final class Builder { + private SharedArgs $; + + public Builder() { + $ = new SharedArgs(); + } + + public Builder(SharedArgs defaults) { + $ = new SharedArgs(Objects.requireNonNull(defaults)); + } + + public Builder foo(@Nullable Output foo) { + $.foo = foo; + return this; + } + + public Builder foo(String foo) { + return foo(Output.of(foo)); + } + + public SharedArgs build() { + return $; + } + } + +} diff --git a/pkg/codegen/testing/test/testdata/using-shared-types-in-config/schema.json b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/schema.json new file mode 100644 index 00000000000..2d78cb0941d --- /dev/null +++ b/pkg/codegen/testing/test/testdata/using-shared-types-in-config/schema.json @@ -0,0 +1,144 @@ +{ + "name": "credentials", + "version": "0.1.0", + "language": { + "go": { + "importBasePath": "using-shared-types-in-config/credentials", + "generateExtraInputTypes": true + } + }, + "meta": { + "moduleFormat": "(.*)" + }, + "config": { + "variables": { + "hash": { + "$ref": "#/types/credentials:index:HashKind", + "description": "The (entirely uncryptographic) hash function used to encode the \"password\"." + }, + "password": { + "type": "string", + "description": "The password. It is very secret.", + "default": "", + "defaultInfo": { + "environment": [ + "FOO" + ] + }, + "secret": true + }, + "shared": { + "$ref": "#/types/credentials:index:Shared" + }, + "user": { + "type": "string", + "description": "The username. Its important but not secret." + } + }, + "defaults": [ + "hash", + "shared", + "user" + ] + }, + "types": { + "credentials:index:HashKind": { + "type": "string", + "enum": [ + { + "description": "Adler32 implements the Adler-32 checksum.", + "value": "Adler32" + }, + { + "description": "CRC32 implements the 32-bit cyclic redundancy check, or CRC-32, checksum.", + "value": "CRC32" + } + ] + }, + "credentials:index:Shared": { + "properties": { + "foo": { + "type": "string" + } + }, + "type": "object" + } + }, + "provider": { + "properties": { + "password": { + "type": "string", + "description": "The password. It is very secret.", + "default": "", + "defaultInfo": { + "environment": [ + "FOO" + ] + }, + "secret": true + }, + "user": { + "type": "string", + "description": "The username. Its important but not secret." + } + }, + "type": "object", + "required": [ + "user" + ], + "inputProperties": { + "hash": { + "$ref": "#/types/credentials:index:HashKind", + "description": "The (entirely uncryptographic) hash function used to encode the \"password\"." + }, + "password": { + "type": "string", + "description": "The password. It is very secret.", + "default": "", + "defaultInfo": { + "environment": [ + "FOO" + ] + }, + "secret": true + }, + "shared": { + "$ref": "#/types/credentials:index:Shared" + }, + "user": { + "type": "string", + "description": "The username. Its important but not secret." + } + }, + "requiredInputs": [ + "hash", + "shared", + "user" + ] + }, + "resources": { + "credentials:index:User": { + "properties": { + "name": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "type": "object", + "required": [ + "name", + "password" + ], + "inputProperties": { + "shared": { + "$ref": "#/types/credentials:index:Shared" + } + }, + "requiredInputs": [ + "shared" + ] + } + } +} \ No newline at end of file diff --git a/pulumi b/pulumi index 8ff72bf9fa8..bdb813ae669 160000 --- a/pulumi +++ b/pulumi @@ -1 +1 @@ -Subproject commit 8ff72bf9fa846f1e2603c535162f860cbecc9c11 +Subproject commit bdb813ae66935c2c562172eddec5d63373d40e29 diff --git a/tests/integration/java_integration_test.go b/tests/integration/java_integration_test.go index 0cccd335ffa..c231a5077a9 100644 --- a/tests/integration/java_integration_test.go +++ b/tests/integration/java_integration_test.go @@ -23,6 +23,9 @@ func TestIntegrations(t *testing.T) { Quick: true, DebugUpdates: false, DebugLogLevel: 0, + // Stack references will change on refresh due to steps changing outputs and self stack + // references. + SkipRefresh: true, Env: []string{ "PULUMI_EXCESSIVE_DEBUG_OUTPUT=false", },