Skip to content

Commit

Permalink
Merge pull request #105 from equinix/update-java-gen
Browse files Browse the repository at this point in the history
updated makefile and regenerate java sdk
  • Loading branch information
ocobles authored Jul 9, 2024
2 parents 61c7252 + 0c794f1 commit 2cdef69
Show file tree
Hide file tree
Showing 529 changed files with 9,161 additions and 3,181 deletions.
1 change: 0 additions & 1 deletion .upgrade-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
upstream-provider-name: terraform-provider-equinix
remove-plugins: true
pr-reviewers: equinix/governor-devrel-engineering
javaVersion: "v0.9.8"
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ TFGEN := pulumi-tfgen-${PACK}
PROVIDER := pulumi-resource-${PACK}
VERSION := $(shell pulumictl get version)
JAVA_GEN := pulumi-java-gen
JAVA_GEN_VERSION := v0.9.8
JAVA_GROUP_ID := com.${ORG}.pulumi
JAVA_ARTIFACT_ID := ${PACK}
TESTPARALLELISM := 4
Expand All @@ -31,18 +30,18 @@ development: install_plugins provider lint_provider build_sdks install_sdks clea
build: install_plugins provider build_sdks install_sdks
only_build: build

tfgen: install_plugins upstream
tfgen: cleanup install_plugins upstream
(cd provider && go build -o $(WORKING_DIR)/bin/${TFGEN} -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION}" ${PROJECT}/${PROVIDER_PATH}/cmd/${TFGEN})
$(WORKING_DIR)/bin/${TFGEN} schema --out provider/cmd/${PROVIDER}
(cd provider && VERSION=$(VERSION) go generate cmd/${PROVIDER}/main.go)

bin/pulumi-java-gen:
pulumictl download-binary -n pulumi-language-java -v $(JAVA_GEN_VERSION) -r pulumi/pulumi-java
bin/pulumi-java-gen: .pulumi-java-gen.version
pulumictl download-binary -n pulumi-language-java -v v$(shell cat .pulumi-java-gen.version) -r pulumi/pulumi-java

provider: tfgen install_plugins # build the provider binary
(cd provider && go build -o $(WORKING_DIR)/bin/${PROVIDER} -ldflags "-X ${PROJECT}/${VERSION_PATH}=${VERSION} -X github.com/equinix/terraform-provider-equinix/version.ProviderVersion=${VERSION}" ${PROJECT}/${PROVIDER_PATH}/cmd/${PROVIDER})

build_sdks: build_nodejs build_python build_go build_dotnet build_java # build all the sdks
build_sdks: clean build_nodejs build_python build_go build_dotnet build_java # build all the sdks

build_nodejs: VERSION := $(shell pulumictl get version --language javascript)
build_nodejs: upstream
Expand Down Expand Up @@ -119,7 +118,8 @@ build_java: bin/pulumi-java-gen patch_java_schema upstream
rm -f build.gradle.bak
cd sdk/java/ && \
printf "module fake_java_module // Exclude this directory from Go tools\n\ngo 1.17\n" > go.mod && \
gradle --console=plain build
gradle --console=plain build && \
gradle --console=plain javadoc

patch_java_schema:
echo "patch_java_schema: copy schema.json to schema-java.json " && \
Expand All @@ -137,8 +137,8 @@ lint_provider: provider # lint the provider code
cd provider && golangci-lint run -c ../.golangci.yml

cleanup: # cleans up the temporary directory
rm -r $(WORKING_DIR)/bin
rm -f provider/cmd/${PROVIDER}/schema.go
- rm -r $(WORKING_DIR)/bin
- rm -f provider/cmd/${PROVIDER}/schema.go

help:
@grep '^[^.#]\+:\s\+.*#' Makefile | \
Expand Down
2 changes: 1 addition & 1 deletion sdk/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ repositories {
dependencies {
implementation("com.google.code.findbugs:jsr305:3.0.2")
implementation("com.google.code.gson:gson:2.8.9")
implementation("com.pulumi:pulumi:0.9.8")
implementation("com.pulumi:pulumi:0.12.0")
}

task sourcesJar(type: Jar) {
Expand Down
26 changes: 14 additions & 12 deletions sdk/java/src/main/java/com/equinix/pulumi/fabric/CloudRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
* * API: https://developer.equinix.com/dev-docs/fabric/api-reference/fabric-v4-apis#fabric-cloud-routers
*
* ## Example Usage
* ```java
* <pre>
* {@code
* package generated_program;
*
* import com.pulumi.Context;
Expand All @@ -57,33 +58,34 @@
*
* public static void stack(Context ctx) {
* final var config = ctx.config();
* final var metro = config.get(&#34;metro&#34;).orElse(&#34;FR&#34;);
* final var accountNum = config.get(&#34;accountNum&#34;);
* var router = new CloudRouter(&#34;router&#34;, CloudRouterArgs.builder()
* .name(&#34;My-Fabric-Cloud-Router&#34;)
* .type(&#34;XF_ROUTER&#34;)
* final var metro = config.get("metro").orElse("FR");
* final var accountNum = config.get("accountNum");
* var router = new CloudRouter("router", CloudRouterArgs.builder()
* .name("My-Fabric-Cloud-Router")
* .type("XF_ROUTER")
* .location(CloudRouterLocationArgs.builder()
* .metroCode(metro)
* .build())
* .package_(CloudRouterPackageArgs.builder()
* .code(&#34;BASIC&#34;)
* .code("BASIC")
* .build())
* .notifications(CloudRouterNotificationArgs.builder()
* .type(&#34;ALL&#34;)
* .emails(&#34;example@equinix.com&#34;)
* .type("ALL")
* .emails("example{@literal @}equinix.com")
* .build())
* .account(CloudRouterAccountArgs.builder()
* .accountNumber(272010)
* .build())
* .project(CloudRouterProjectArgs.builder()
* .projectId(&#34;995072000433550&#34;)
* .projectId("995072000433550")
* .build())
* .build());
*
* ctx.export(&#34;routerId&#34;, router.id());
* ctx.export("routerId", router.id());
* }
* }
* ```
* }
* </pre>
*
*/
@ResourceType(type="equinix:fabric/cloudRouter:CloudRouter")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.equinix.pulumi.fabric.inputs.CloudRouterProjectArgs;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Import;
import com.pulumi.exceptions.MissingRequiredPropertyException;
import java.lang.String;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -463,12 +464,24 @@ public Builder uuid(String uuid) {
}

public CloudRouterArgs build() {
$.account = Objects.requireNonNull($.account, "expected parameter 'account' to be non-null");
$.location = Objects.requireNonNull($.location, "expected parameter 'location' to be non-null");
$.notifications = Objects.requireNonNull($.notifications, "expected parameter 'notifications' to be non-null");
$.package_ = Objects.requireNonNull($.package_, "expected parameter 'package' to be non-null");
$.project = Objects.requireNonNull($.project, "expected parameter 'project' to be non-null");
$.type = Objects.requireNonNull($.type, "expected parameter 'type' to be non-null");
if ($.account == null) {
throw new MissingRequiredPropertyException("CloudRouterArgs", "account");
}
if ($.location == null) {
throw new MissingRequiredPropertyException("CloudRouterArgs", "location");
}
if ($.notifications == null) {
throw new MissingRequiredPropertyException("CloudRouterArgs", "notifications");
}
if ($.package_ == null) {
throw new MissingRequiredPropertyException("CloudRouterArgs", "package_");
}
if ($.project == null) {
throw new MissingRequiredPropertyException("CloudRouterArgs", "project");
}
if ($.type == null) {
throw new MissingRequiredPropertyException("CloudRouterArgs", "type");
}
return $;
}
}
Expand Down
56 changes: 29 additions & 27 deletions sdk/java/src/main/java/com/equinix/pulumi/fabric/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

/**
* ## Example Usage
* ```java
* <pre>
* {@code
* package generated_program;
*
* import com.pulumi.Context;
Expand Down Expand Up @@ -60,56 +61,56 @@
*
* public static void stack(Context ctx) {
* final var config = ctx.config();
* final var metro = config.get(&#34;metro&#34;).orElse(&#34;FR&#34;);
* final var speedInMbps = Integer.parseInt(config.get(&#34;speedInMbps&#34;).orElse(&#34;50&#34;));
* final var fabricPortName = config.get(&#34;fabricPortName&#34;).get().toString();
* final var awsRegion = config.get(&#34;awsRegion&#34;).orElse(&#34;eu-central-1&#34;);
* final var awsAccountId = config.get(&#34;awsAccountId&#34;).get().toString();
* System.out.println(System.getProperty(&#34;java.classpath&#34;));
* final var metro = config.get("metro").orElse("FR");
* final var speedInMbps = Integer.parseInt(config.get("speedInMbps").orElse("50"));
* final var fabricPortName = config.get("fabricPortName").get().toString();
* final var awsRegion = config.get("awsRegion").orElse("eu-central-1");
* final var awsAccountId = config.get("awsAccountId").get().toString();
* System.out.println(System.getProperty("java.classpath"));
* final var serviceProfileId = FabricFunctions.getServiceProfiles(GetServiceProfilesArgs.builder()
* .filter(GetServiceProfilesFilterArgs.builder()
* .property(&#34;/name&#34;)
* .operator(&#34;=&#34;)
* .values(&#34;AWS Direct Connect&#34;)
* .property("/name")
* .operator("=")
* .values("AWS Direct Connect")
* .build())
* .build()).applyValue(data -&gt; data.data().get(0).uuid().get());
* .build()).applyValue(data -> data.data().get(0).uuid().get());
*
* final var portId = FabricFunctions.getPorts(GetPortsArgs.builder()
* .filter(GetPortsFilterArgs.builder()
* .name(fabricPortName)
* .build())
* .build()).applyValue(data -&gt; data.data().get(0).uuid().get());
* .build()).applyValue(data -> data.data().get(0).uuid().get());
*
* var colo2Aws = new Connection(&#34;colo2Aws&#34;, ConnectionArgs.builder()
* .name(&#34;Pulumi-colo2Aws&#34;)
* .type(&#34;EVPL_VC&#34;)
* var colo2Aws = new Connection("colo2Aws", ConnectionArgs.builder()
* .name("Pulumi-colo2Aws")
* .type("EVPL_VC")
* .notifications(ConnectionNotificationArgs.builder()
* .type(&#34;ALL&#34;)
* .emails(&#34;example@equinix.com&#34;)
* .type("ALL")
* .emails("example{@literal @}equinix.com")
* .build())
* .bandwidth(speedInMbps)
* .redundancy(ConnectionRedundancyArgs.builder()
* .priority(&#34;PRIMARY&#34;)
* .priority("PRIMARY")
* .build())
* .aSide(ConnectionASideArgs.builder()
* .accessPoint(ConnectionASideAccessPointArgs.builder()
* .type(&#34;COLO&#34;)
* .type("COLO")
* .port(ConnectionASideAccessPointPortArgs.builder()
* .uuid(portId)
* .build())
* .linkProtocol(ConnectionASideAccessPointLinkProtocolArgs.builder()
* .type(&#34;DOT1Q&#34;)
* .type("DOT1Q")
* .vlanTag(1234)
* .build())
* .build())
* .build())
* .zSide(ConnectionZSideArgs.builder()
* .accessPoint(ConnectionZSideAccessPointArgs.builder()
* .type(&#34;SP&#34;)
* .type("SP")
* .authenticationKey(awsAccountId)
* .sellerRegion(awsRegion)
* .profile(ConnectionZSideAccessPointProfileArgs.builder()
* .type(&#34;L2_PROFILE&#34;)
* .type("L2_PROFILE")
* .uuid(serviceProfileId)
* .build())
* .location(ConnectionZSideAccessPointLocationArgs.builder()
Expand All @@ -119,13 +120,14 @@
* .build())
* .build());
*
* ctx.export(&#34;connectionId&#34;, colo2Aws.id());
* ctx.export(&#34;connectionStatus&#34;, colo2Aws.operation().applyValue(operation -&gt; operation.equinixStatus()));
* ctx.export(&#34;connectionProviderStatus&#34;, colo2Aws.operation().applyValue(operation -&gt; operation.providerStatus()));
* ctx.export(&#34;awsDirectConnectId&#34;, colo2Aws.zSide().applyValue(zSide -&gt; zSide.accessPoint().get().providerConnectionId()));
* ctx.export("connectionId", colo2Aws.id());
* ctx.export("connectionStatus", colo2Aws.operation().applyValue(operation -> operation.equinixStatus()));
* ctx.export("connectionProviderStatus", colo2Aws.operation().applyValue(operation -> operation.providerStatus()));
* ctx.export("awsDirectConnectId", colo2Aws.zSide().applyValue(zSide -> zSide.accessPoint().get().providerConnectionId()));
* }
* }
* ```
* }
* </pre>
*
*/
@ResourceType(type="equinix:fabric/connection:Connection")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.pulumi.core.Either;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Import;
import com.pulumi.exceptions.MissingRequiredPropertyException;
import java.lang.Integer;
import java.lang.Object;
import java.lang.String;
Expand Down Expand Up @@ -498,11 +499,21 @@ public Builder zSide(ConnectionZSideArgs zSide) {
}

public ConnectionArgs build() {
$.aSide = Objects.requireNonNull($.aSide, "expected parameter 'aSide' to be non-null");
$.bandwidth = Objects.requireNonNull($.bandwidth, "expected parameter 'bandwidth' to be non-null");
$.notifications = Objects.requireNonNull($.notifications, "expected parameter 'notifications' to be non-null");
$.type = Objects.requireNonNull($.type, "expected parameter 'type' to be non-null");
$.zSide = Objects.requireNonNull($.zSide, "expected parameter 'zSide' to be non-null");
if ($.aSide == null) {
throw new MissingRequiredPropertyException("ConnectionArgs", "aSide");
}
if ($.bandwidth == null) {
throw new MissingRequiredPropertyException("ConnectionArgs", "bandwidth");
}
if ($.notifications == null) {
throw new MissingRequiredPropertyException("ConnectionArgs", "notifications");
}
if ($.type == null) {
throw new MissingRequiredPropertyException("ConnectionArgs", "type");
}
if ($.zSide == null) {
throw new MissingRequiredPropertyException("ConnectionArgs", "zSide");
}
return $;
}
}
Expand Down
Loading

0 comments on commit 2cdef69

Please sign in to comment.