diff --git a/README.md b/README.md
index a28def5..9900f28 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ make it easier to consume in Java.
## Usage
This library is published on [Maven
-Central](https://search.maven.org/artifact/com.ngrok/ngrok-api-client).
+Central](https://search.maven.org/artifact/com.ngrok/ngrok-api-client-java).
In your Maven `pom.xml` file, add:
@@ -14,8 +14,8 @@ In your Maven `pom.xml` file, add:
com.ngrok
- ngrok-api-client
- ${ngrok-api-client.version}
+ ngrok-api-client-java
+ ${ngrok-api-client-java.version}
```
diff --git a/docs/CNAME b/docs/CNAME
deleted file mode 100644
index a6af7b0..0000000
--- a/docs/CNAME
+++ /dev/null
@@ -1 +0,0 @@
-java-api.docs.ngrok.com
diff --git a/pom.xml b/pom.xml
index 25f8936..dfa2156 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
com.ngrok
- ngrok-api-client-java
+ ngrok-api-java
0.1.0-SNAPSHOT
ngrok Java API client
@@ -48,6 +48,7 @@
3.19.0
2.12.3
5.7.2
+ 1.7.32
2.27.2
1.1.0
@@ -87,6 +88,12 @@
${assertj.version}
test
+
+ org.slf4j
+ slf4j-simple
+ ${slf4j.version}
+ test
+
com.github.tomakehurst
wiremock
@@ -141,6 +148,10 @@
org.assertj
assertj-core
+
+ org.slf4j
+ slf4j-simple
+
com.github.tomakehurst
wiremock
@@ -218,8 +229,8 @@
1.6.8
true
- ossrh
- https://oss.sonatype.org/
+ ossrh-ngrok
+ https://s01.oss.sonatype.org/
true
@@ -228,13 +239,31 @@
maven-release-plugin
2.5.3
+ clean verify exec:exec@publish-docs
true
false
release
- v@{project.version}
+ @{project.version}
deploy
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 3.0.0
+
+
+ publish-docs
+
+ exec
+
+
+ ${project.basedir}/scripts/publish-docs.sh
+ ${project.basedir}
+
+
+
+
diff --git a/scripts/publish-docs.sh b/scripts/publish-docs.sh
new file mode 100755
index 0000000..96134d6
--- /dev/null
+++ b/scripts/publish-docs.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+set -e
+
+rm -rf docs/
+mkdir docs
+echo 'java-api.docs.ngrok.com' >docs/CNAME
+cp -av target/apidocs/* docs
+git add docs/
+git commit -m 'Update docs' -- docs/
diff --git a/src/main/java/com/ngrok/Ngrok.java b/src/main/java/com/ngrok/Ngrok.java
index f2e6a50..12dd281 100644
--- a/src/main/java/com/ngrok/Ngrok.java
+++ b/src/main/java/com/ngrok/Ngrok.java
@@ -45,6 +45,8 @@ public class Ngrok {
* Abuse Reports allow you to submit take-down requests for URLs hosted by
* ngrok that violate ngrok's terms of service.
*
+ * See also https://ngrok.com/docs/api#api-abuse-reports.
+ *
* @return a service client
*/
public AbuseReports abuseReports() {
@@ -60,6 +62,8 @@ public class Ngrok {
* on your
* ngrok.com dashboard.
*
+ * See also https://ngrok.com/docs/api#api-api-keys.
+ *
* @return a service client
*/
public ApiKeys apiKeys() {
@@ -73,6 +77,8 @@ public class Ngrok {
* this CA. Certificate Authorities are used only for mTLS validation only and
* thus a private key is not included in the resource.
*
+ * See also https://ngrok.com/docs/api#api-certificate-authorities.
+ *
* @return a service client
*/
public CertificateAuthorities certificateAuthorities() {
@@ -86,6 +92,8 @@ public class Ngrok {
* ngrok.yml
* configuration file with the authtoken property.
*
+ * See also https://ngrok.com/docs/api#api-credentials.
+ *
* @return a service client
*/
public Credentials credentials() {
@@ -97,6 +105,8 @@ public class Ngrok {
* traffic to a domain or address is handled. Endpoint configurations are only
* applied to Domains and TCP Addresses they have been attached to.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-configurations.
+ *
* @return a service client
*/
public EndpointConfigurations endpointConfigurations() {
@@ -106,6 +116,8 @@ public class Ngrok {
/**
* Creates a service client for EventStreams.
*
+ * See also https://ngrok.com/docs/api#api-event-streams.
+ *
* @return a service client
*/
public EventStreams eventStreams() {
@@ -115,6 +127,8 @@ public class Ngrok {
/**
* Creates a service client for EventDestinations.
*
+ * See also https://ngrok.com/docs/api#api-event-destinations.
+ *
* @return a service client
*/
public EventDestinations eventDestinations() {
@@ -124,6 +138,8 @@ public class Ngrok {
/**
* Creates a service client for EventSubscriptions.
*
+ * See also https://ngrok.com/docs/api#api-event-subscriptions.
+ *
* @return a service client
*/
public EventSubscriptions eventSubscriptions() {
@@ -133,6 +149,8 @@ public class Ngrok {
/**
* Creates a service client for EventSources.
*
+ * See also https://ngrok.com/docs/api#api-event-sources.
+ *
* @return a service client
*/
public EventSources eventSources() {
@@ -146,6 +164,8 @@ public class Ngrok {
* Policy module. They can also be used with IP Restrictions to control source
* IP ranges that can start tunnel sessions and connect to the API and dashboard.
*
+ * See also https://ngrok.com/docs/api#api-ip-policies.
+ *
* @return a service client
*/
public IpPolicies ipPolicies() {
@@ -156,6 +176,8 @@ public class Ngrok {
* IP Policy Rules are the IPv4 or IPv6 CIDRs entries that
* make up an IP Policy.
*
+ * See also https://ngrok.com/docs/api#api-ip-policy-rules.
+ *
* @return a service client
*/
public IpPolicyRules ipPolicyRules() {
@@ -170,6 +192,8 @@ public class Ngrok {
* requests, log in to the dashboard, start ngrok agents, and connect to your
* public-facing endpoints.
*
+ * See also https://ngrok.com/docs/api#api-ip-restrictions.
+ *
* @return a service client
*/
public IpRestrictions ipRestrictions() {
@@ -180,6 +204,8 @@ public class Ngrok {
* The IP Whitelist is deprecated and will be removed. Use an IP Restriction
* with an endpoints type instead.
*
+ * See also https://ngrok.com/docs/api#api-ip-whitelist.
+ *
* @return a service client
*/
public IpWhitelist ipWhitelist() {
@@ -191,6 +217,8 @@ public class Ngrok {
* TCP address hostnames and ports are assigned by ngrok, they cannot be
* chosen.
*
+ * See also https://ngrok.com/docs/api#api-reserved-addrs.
+ *
* @return a service client
*/
public ReservedAddrs reservedAddrs() {
@@ -203,6 +231,8 @@ public class Ngrok {
* that you own by creating a CNAME record specified in the returned resource.
* This CNAME record points traffic for that domain to ngrok's edge servers.
*
+ * See also https://ngrok.com/docs/api#api-reserved-domains.
+ *
* @return a service client
*/
public ReservedDomains reservedDomains() {
@@ -213,6 +243,8 @@ public class Ngrok {
* An SSH Certificate Authority is a pair of an SSH Certificate and its private
* key that can be used to sign other SSH host and user certificates.
*
+ * See also https://ngrok.com/docs/api#api-ssh-certificate-authorities.
+ *
* @return a service client
*/
public SshCertificateAuthorities sshCertificateAuthorities() {
@@ -223,6 +255,8 @@ public class Ngrok {
* SSH Credentials are SSH public keys that can be used to start SSH tunnels
* via the ngrok SSH tunnel gateway.
*
+ * See also https://ngrok.com/docs/api#api-ssh-credentials.
+ *
* @return a service client
*/
public SshCredentials sshCredentials() {
@@ -234,6 +268,8 @@ public class Ngrok {
* server to assert its authenticity to connecting SSH clients who trust the
* SSH Certificate Authority that was used to sign the certificate.
*
+ * See also https://ngrok.com/docs/api#api-ssh-host-certificates.
+ *
* @return a service client
*/
public SshHostCertificates sshHostCertificates() {
@@ -245,6 +281,8 @@ public class Ngrok {
* server to authenticate their connection. The SSH server must trust the SSH
* Certificate Authority used to sign the certificate.
*
+ * See also https://ngrok.com/docs/api#api-ssh-user-certificates.
+ *
* @return a service client
*/
public SshUserCertificates sshUserCertificates() {
@@ -258,6 +296,8 @@ public class Ngrok {
* provisioned by ngrok automatically for domains on which you have enabled
* automated certificate provisioning.
*
+ * See also https://ngrok.com/docs/api#api-tls-certificates.
+ *
* @return a service client
*/
public TlsCertificates tlsCertificates() {
@@ -269,6 +309,8 @@ public class Ngrok {
* sessions that are running and connected to the ngrok service. Each tunnel
* session can include one or more Tunnels.
*
+ * See also https://ngrok.com/docs/api#api-tunnel-sessions.
+ *
* @return a service client
*/
public TunnelSessions tunnelSessions() {
@@ -279,6 +321,8 @@ public class Ngrok {
* Tunnels provide endpoints to access services exposed by a running ngrok
* agent tunnel session or an SSH reverse tunnel session.
*
+ * See also https://ngrok.com/docs/api#api-tunnels.
+ *
* @return a service client
*/
public Tunnels tunnels() {
@@ -303,6 +347,8 @@ public class Ngrok {
/**
* Creates a service client for {@link EndpointLoggingModule}.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-logging-module
+ *
* @return a service client
*/
public EndpointLoggingModule logging() {
@@ -312,6 +358,8 @@ public class Ngrok {
/**
* Creates a service client for {@link EndpointCircuitBreakerModule}.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-circuit-breaker-module
+ *
* @return a service client
*/
public EndpointCircuitBreakerModule circuitBreaker() {
@@ -321,6 +369,8 @@ public class Ngrok {
/**
* Creates a service client for {@link EndpointCompressionModule}.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-compression-module
+ *
* @return a service client
*/
public EndpointCompressionModule compression() {
@@ -330,6 +380,8 @@ public class Ngrok {
/**
* Creates a service client for {@link EndpointTlsTerminationModule}.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-tls-termination-module
+ *
* @return a service client
*/
public EndpointTlsTerminationModule tlsTermination() {
@@ -339,6 +391,8 @@ public class Ngrok {
/**
* Creates a service client for {@link EndpointIpPolicyModule}.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-ip-policy-module
+ *
* @return a service client
*/
public EndpointIpPolicyModule ipPolicy() {
@@ -348,6 +402,8 @@ public class Ngrok {
/**
* Creates a service client for {@link EndpointMutualTlsModule}.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-mutual-tls-module
+ *
* @return a service client
*/
public EndpointMutualTlsModule mutualTls() {
@@ -357,6 +413,8 @@ public class Ngrok {
/**
* Creates a service client for {@link EndpointRequestHeadersModule}.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-request-headers-module
+ *
* @return a service client
*/
public EndpointRequestHeadersModule requestHeaders() {
@@ -366,6 +424,8 @@ public class Ngrok {
/**
* Creates a service client for {@link EndpointResponseHeadersModule}.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-response-headers-module
+ *
* @return a service client
*/
public EndpointResponseHeadersModule responseHeaders() {
@@ -375,6 +435,8 @@ public class Ngrok {
/**
* Creates a service client for {@link EndpointOAuthModule}.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-o-auth-module
+ *
* @return a service client
*/
public EndpointOAuthModule oauth() {
@@ -384,6 +446,8 @@ public class Ngrok {
/**
* Creates a service client for {@link EndpointWebhookValidationModule}.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-webhook-validation-module
+ *
* @return a service client
*/
public EndpointWebhookValidationModule webhookValidation() {
@@ -393,6 +457,8 @@ public class Ngrok {
/**
* Creates a service client for {@link EndpointSamlModule}.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-saml-module
+ *
* @return a service client
*/
public EndpointSamlModule saml() {
@@ -402,6 +468,8 @@ public class Ngrok {
/**
* Creates a service client for {@link EndpointOidcModule}.
*
+ * See also https://ngrok.com/docs/api#api-endpoint-oidc-module
+ *
* @return a service client
*/
public EndpointOidcModule oidc() {
diff --git a/src/main/java/com/ngrok/definitions/AbuseReport.java b/src/main/java/com/ngrok/definitions/AbuseReport.java
index cae5e5a..de90a2f 100644
--- a/src/main/java/com/ngrok/definitions/AbuseReport.java
+++ b/src/main/java/com/ngrok/definitions/AbuseReport.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,18 +14,25 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class AbuseReport {
@JsonProperty("id")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String id;
@JsonProperty("uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.net.URI uri;
@JsonProperty("created_at")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.time.OffsetDateTime createdAt;
@JsonProperty("urls")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List urls;
@JsonProperty("metadata")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String metadata;
@JsonProperty("status")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String status;
@JsonProperty("hostnames")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List hostnames;
/**
diff --git a/src/main/java/com/ngrok/definitions/AbuseReportHostname.java b/src/main/java/com/ngrok/definitions/AbuseReportHostname.java
index 36b7aa3..3fa1931 100644
--- a/src/main/java/com/ngrok/definitions/AbuseReportHostname.java
+++ b/src/main/java/com/ngrok/definitions/AbuseReportHostname.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,8 +14,10 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class AbuseReportHostname {
@JsonProperty("hostname")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String hostname;
@JsonProperty("status")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String status;
/**
diff --git a/src/main/java/com/ngrok/definitions/ApiKey.java b/src/main/java/com/ngrok/definitions/ApiKey.java
index 64b24a6..58f47ba 100644
--- a/src/main/java/com/ngrok/definitions/ApiKey.java
+++ b/src/main/java/com/ngrok/definitions/ApiKey.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,16 +14,22 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class ApiKey {
@JsonProperty("id")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String id;
@JsonProperty("uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.net.URI uri;
@JsonProperty("description")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String description;
@JsonProperty("metadata")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String metadata;
@JsonProperty("created_at")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.time.OffsetDateTime createdAt;
@JsonProperty("token")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional token;
/**
diff --git a/src/main/java/com/ngrok/definitions/ApiKeyList.java b/src/main/java/com/ngrok/definitions/ApiKeyList.java
index 7871a33..d6a6fc7 100644
--- a/src/main/java/com/ngrok/definitions/ApiKeyList.java
+++ b/src/main/java/com/ngrok/definitions/ApiKeyList.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,10 +14,13 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class ApiKeyList implements Pageable {
@JsonProperty("keys")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List keys;
@JsonProperty("uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.net.URI uri;
@JsonProperty("next_page_uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional nextPageUri;
/**
diff --git a/src/main/java/com/ngrok/definitions/AwsAuth.java b/src/main/java/com/ngrok/definitions/AwsAuth.java
index 5f29f9e..33fce02 100644
--- a/src/main/java/com/ngrok/definitions/AwsAuth.java
+++ b/src/main/java/com/ngrok/definitions/AwsAuth.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,9 +13,94 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class AwsAuth {
+ /**
+ * Builder class for {@link AwsAuth}.
+ */
+ public static class Builder {
+ private Optional role = Optional.empty();
+ private Optional creds = Optional.empty();
+
+ private Builder(
+ ) {
+ }
+
+ /**
+ * A role for ngrok to assume on your behalf to deposit events into your AWS
+ * account.
+ *
+ * @param role the value of the role parameter as a {@link AwsRole}
+ * @return this builder instance
+ */
+ public Builder role(final AwsRole role) {
+ this.role = Optional.of(Objects.requireNonNull(role, "role is required"));
+ return this;
+ }
+
+ /**
+ * A role for ngrok to assume on your behalf to deposit events into your AWS
+ * account.
+ *
+ * @param role the value of the role parameter as a {@link AwsRole}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder role(final Optional role) {
+ this.role = Objects.requireNonNull(role, "role is required");
+ return this;
+ }
+
+ /**
+ * Credentials to your AWS account if you prefer ngrok to sign in with long-term
+ * access keys.
+ *
+ * @param creds the value of the creds parameter as a {@link AwsCredentials}
+ * @return this builder instance
+ */
+ public Builder creds(final AwsCredentials creds) {
+ this.creds = Optional.of(Objects.requireNonNull(creds, "creds is required"));
+ return this;
+ }
+
+ /**
+ * Credentials to your AWS account if you prefer ngrok to sign in with long-term
+ * access keys.
+ *
+ * @param creds the value of the creds parameter as a {@link AwsCredentials}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder creds(final Optional creds) {
+ this.creds = Objects.requireNonNull(creds, "creds is required");
+ return this;
+ }
+
+ /**
+ * Constructs the {@link AwsAuth} instance.
+ *
+ * @return a new {@link AwsAuth}
+ */
+ public AwsAuth build() {
+ return new AwsAuth(
+ this.role,
+ this.creds
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link AwsAuth} type.
+ *
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ ) {
+ return new Builder (
+ );
+ }
+
@JsonProperty("role")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional role;
@JsonProperty("creds")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional creds;
/**
@@ -24,7 +110,7 @@ public class AwsAuth {
* @param creds Credentials to your AWS account if you prefer ngrok to sign in with long-term access keys.
*/
@JsonCreator
- public AwsAuth(
+ private AwsAuth(
@JsonProperty("role") final Optional role,
@JsonProperty("creds") final Optional creds
) {
diff --git a/src/main/java/com/ngrok/definitions/AwsCredentials.java b/src/main/java/com/ngrok/definitions/AwsCredentials.java
index cf8a265..a4ae2de 100644
--- a/src/main/java/com/ngrok/definitions/AwsCredentials.java
+++ b/src/main/java/com/ngrok/definitions/AwsCredentials.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,9 +13,56 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class AwsCredentials {
+ /**
+ * Builder class for {@link AwsCredentials}.
+ */
+ public static class Builder {
+ private final String awsAccessKeyId;
+ private final String awsSecretAccessKey;
+
+ private Builder(
+ final String awsAccessKeyId,
+ final String awsSecretAccessKey
+ ) {
+ this.awsAccessKeyId = Objects.requireNonNull(awsAccessKeyId, "awsAccessKeyId is required");
+ this.awsSecretAccessKey = Objects.requireNonNull(awsSecretAccessKey, "awsSecretAccessKey is required");
+ }
+
+ /**
+ * Constructs the {@link AwsCredentials} instance.
+ *
+ * @return a new {@link AwsCredentials}
+ */
+ public AwsCredentials build() {
+ return new AwsCredentials(
+ this.awsAccessKeyId,
+ Optional.of(this.awsSecretAccessKey)
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link AwsCredentials} type.
+ *
+ * @param awsAccessKeyId The ID portion of an AWS access key.
+ * @param awsSecretAccessKey The secret portion of an AWS access key.
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ final String awsAccessKeyId,
+ final String awsSecretAccessKey
+ ) {
+ return new Builder (
+ awsAccessKeyId,
+ awsSecretAccessKey
+ );
+ }
+
@JsonProperty("aws_access_key_id")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String awsAccessKeyId;
@JsonProperty("aws_secret_access_key")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional awsSecretAccessKey;
/**
@@ -24,7 +72,7 @@ public class AwsCredentials {
* @param awsSecretAccessKey The secret portion of an AWS access key.
*/
@JsonCreator
- public AwsCredentials(
+ private AwsCredentials(
@JsonProperty("aws_access_key_id") final String awsAccessKeyId,
@JsonProperty("aws_secret_access_key") final Optional awsSecretAccessKey
) {
diff --git a/src/main/java/com/ngrok/definitions/AwsRole.java b/src/main/java/com/ngrok/definitions/AwsRole.java
index 8594c0f..e167eef 100644
--- a/src/main/java/com/ngrok/definitions/AwsRole.java
+++ b/src/main/java/com/ngrok/definitions/AwsRole.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,7 +13,46 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class AwsRole {
+ /**
+ * Builder class for {@link AwsRole}.
+ */
+ public static class Builder {
+ private final String roleArn;
+
+ private Builder(
+ final String roleArn
+ ) {
+ this.roleArn = Objects.requireNonNull(roleArn, "roleArn is required");
+ }
+
+ /**
+ * Constructs the {@link AwsRole} instance.
+ *
+ * @return a new {@link AwsRole}
+ */
+ public AwsRole build() {
+ return new AwsRole(
+ this.roleArn
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link AwsRole} type.
+ *
+ * @param roleArn An ARN that specifies the role that ngrok should use to deliver to the configured target.
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ final String roleArn
+ ) {
+ return new Builder (
+ roleArn
+ );
+ }
+
@JsonProperty("role_arn")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String roleArn;
/**
@@ -21,7 +61,7 @@ public class AwsRole {
* @param roleArn An ARN that specifies the role that ngrok should use to deliver to the configured target.
*/
@JsonCreator
- public AwsRole(
+ private AwsRole(
@JsonProperty("role_arn") final String roleArn
) {
this.roleArn = Objects.requireNonNull(roleArn, "roleArn is required");
diff --git a/src/main/java/com/ngrok/definitions/CertificateAuthority.java b/src/main/java/com/ngrok/definitions/CertificateAuthority.java
index 7feddcb..c6742b4 100644
--- a/src/main/java/com/ngrok/definitions/CertificateAuthority.java
+++ b/src/main/java/com/ngrok/definitions/CertificateAuthority.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,26 +14,37 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class CertificateAuthority {
@JsonProperty("id")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String id;
@JsonProperty("uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.net.URI uri;
@JsonProperty("created_at")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.time.OffsetDateTime createdAt;
@JsonProperty("description")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String description;
@JsonProperty("metadata")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String metadata;
@JsonProperty("ca_pem")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String caPem;
@JsonProperty("subject_common_name")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String subjectCommonName;
@JsonProperty("not_before")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.time.OffsetDateTime notBefore;
@JsonProperty("not_after")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.time.OffsetDateTime notAfter;
@JsonProperty("key_usages")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List keyUsages;
@JsonProperty("extended_key_usages")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List extendedKeyUsages;
/**
diff --git a/src/main/java/com/ngrok/definitions/CertificateAuthorityList.java b/src/main/java/com/ngrok/definitions/CertificateAuthorityList.java
index 76d7362..3938f18 100644
--- a/src/main/java/com/ngrok/definitions/CertificateAuthorityList.java
+++ b/src/main/java/com/ngrok/definitions/CertificateAuthorityList.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,10 +14,13 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class CertificateAuthorityList implements Pageable {
@JsonProperty("certificate_authorities")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List certificateAuthorities;
@JsonProperty("uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.net.URI uri;
@JsonProperty("next_page_uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional nextPageUri;
/**
diff --git a/src/main/java/com/ngrok/definitions/Credential.java b/src/main/java/com/ngrok/definitions/Credential.java
index e2c3ad1..896e71a 100644
--- a/src/main/java/com/ngrok/definitions/Credential.java
+++ b/src/main/java/com/ngrok/definitions/Credential.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,18 +14,25 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Credential {
@JsonProperty("id")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String id;
@JsonProperty("uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.net.URI uri;
@JsonProperty("created_at")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.time.OffsetDateTime createdAt;
@JsonProperty("description")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String description;
@JsonProperty("metadata")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String metadata;
@JsonProperty("token")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional token;
@JsonProperty("acl")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List acl;
/**
diff --git a/src/main/java/com/ngrok/definitions/CredentialList.java b/src/main/java/com/ngrok/definitions/CredentialList.java
index a2fb3fc..8d87d56 100644
--- a/src/main/java/com/ngrok/definitions/CredentialList.java
+++ b/src/main/java/com/ngrok/definitions/CredentialList.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,10 +14,13 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class CredentialList implements Pageable {
@JsonProperty("credentials")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List credentials;
@JsonProperty("uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.net.URI uri;
@JsonProperty("next_page_uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional nextPageUri;
/**
diff --git a/src/main/java/com/ngrok/definitions/EndpointCircuitBreaker.java b/src/main/java/com/ngrok/definitions/EndpointCircuitBreaker.java
index 58c5035..b03d000 100644
--- a/src/main/java/com/ngrok/definitions/EndpointCircuitBreaker.java
+++ b/src/main/java/com/ngrok/definitions/EndpointCircuitBreaker.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,17 +13,206 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointCircuitBreaker {
+ /**
+ * Builder class for {@link EndpointCircuitBreaker}.
+ */
+ public static class Builder {
+ private Optional enabled = Optional.empty();
+ private Optional trippedDuration = Optional.empty();
+ private Optional rollingWindow = Optional.empty();
+ private Optional numBuckets = Optional.empty();
+ private Optional volumeThreshold = Optional.empty();
+ private Optional errorThresholdPercentage = Optional.empty();
+
+ private Builder(
+ ) {
+ }
+
+ /**
+ * true if the module will be applied to traffic, false
+ * to disable. default true if unspecified
+ *
+ * @param enabled the value of the enabled parameter as a {@link boolean}
+ * @return this builder instance
+ */
+ public Builder enabled(final boolean enabled) {
+ this.enabled = Optional.of(Objects.requireNonNull(enabled, "enabled is required"));
+ return this;
+ }
+
+ /**
+ * true if the module will be applied to traffic, false
+ * to disable. default true if unspecified
+ *
+ * @param enabled the value of the enabled parameter as a {@link boolean}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder enabled(final Optional enabled) {
+ this.enabled = Objects.requireNonNull(enabled, "enabled is required");
+ return this;
+ }
+
+ /**
+ * Integer number of seconds after which the circuit is tripped to wait before
+ * re-evaluating upstream health
+ *
+ * @param trippedDuration the value of the tripped_duration parameter as a {@link java.time.Duration}
+ * @return this builder instance
+ */
+ public Builder trippedDuration(final java.time.Duration trippedDuration) {
+ this.trippedDuration = Optional.of(Objects.requireNonNull(trippedDuration, "trippedDuration is required"));
+ return this;
+ }
+
+ /**
+ * Integer number of seconds after which the circuit is tripped to wait before
+ * re-evaluating upstream health
+ *
+ * @param trippedDuration the value of the tripped_duration parameter as a {@link java.time.Duration}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder trippedDuration(final Optional trippedDuration) {
+ this.trippedDuration = Objects.requireNonNull(trippedDuration, "trippedDuration is required");
+ return this;
+ }
+
+ /**
+ * Integer number of seconds in the statistical rolling window that metrics are
+ * retained for.
+ *
+ * @param rollingWindow the value of the rolling_window parameter as a {@link long}
+ * @return this builder instance
+ */
+ public Builder rollingWindow(final long rollingWindow) {
+ this.rollingWindow = Optional.of(Objects.requireNonNull(rollingWindow, "rollingWindow is required"));
+ return this;
+ }
+
+ /**
+ * Integer number of seconds in the statistical rolling window that metrics are
+ * retained for.
+ *
+ * @param rollingWindow the value of the rolling_window parameter as a {@link long}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder rollingWindow(final Optional rollingWindow) {
+ this.rollingWindow = Objects.requireNonNull(rollingWindow, "rollingWindow is required");
+ return this;
+ }
+
+ /**
+ * Integer number of buckets into which metrics are retained. Max 128.
+ *
+ * @param numBuckets the value of the num_buckets parameter as a {@link long}
+ * @return this builder instance
+ */
+ public Builder numBuckets(final long numBuckets) {
+ this.numBuckets = Optional.of(Objects.requireNonNull(numBuckets, "numBuckets is required"));
+ return this;
+ }
+
+ /**
+ * Integer number of buckets into which metrics are retained. Max 128.
+ *
+ * @param numBuckets the value of the num_buckets parameter as a {@link long}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder numBuckets(final Optional numBuckets) {
+ this.numBuckets = Objects.requireNonNull(numBuckets, "numBuckets is required");
+ return this;
+ }
+
+ /**
+ * Integer number of requests in a rolling window that will trip the circuit.
+ * Helpful if traffic volume is low.
+ *
+ * @param volumeThreshold the value of the volume_threshold parameter as a {@link long}
+ * @return this builder instance
+ */
+ public Builder volumeThreshold(final long volumeThreshold) {
+ this.volumeThreshold = Optional.of(Objects.requireNonNull(volumeThreshold, "volumeThreshold is required"));
+ return this;
+ }
+
+ /**
+ * Integer number of requests in a rolling window that will trip the circuit.
+ * Helpful if traffic volume is low.
+ *
+ * @param volumeThreshold the value of the volume_threshold parameter as a {@link long}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder volumeThreshold(final Optional volumeThreshold) {
+ this.volumeThreshold = Objects.requireNonNull(volumeThreshold, "volumeThreshold is required");
+ return this;
+ }
+
+ /**
+ * Error threshold percentage should be between 0 - 1.0, not 0-100.0
+ *
+ * @param errorThresholdPercentage the value of the error_threshold_percentage parameter as a {@link double}
+ * @return this builder instance
+ */
+ public Builder errorThresholdPercentage(final double errorThresholdPercentage) {
+ this.errorThresholdPercentage = Optional.of(Objects.requireNonNull(errorThresholdPercentage, "errorThresholdPercentage is required"));
+ return this;
+ }
+
+ /**
+ * Error threshold percentage should be between 0 - 1.0, not 0-100.0
+ *
+ * @param errorThresholdPercentage the value of the error_threshold_percentage parameter as a {@link double}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder errorThresholdPercentage(final Optional errorThresholdPercentage) {
+ this.errorThresholdPercentage = Objects.requireNonNull(errorThresholdPercentage, "errorThresholdPercentage is required");
+ return this;
+ }
+
+ /**
+ * Constructs the {@link EndpointCircuitBreaker} instance.
+ *
+ * @return a new {@link EndpointCircuitBreaker}
+ */
+ public EndpointCircuitBreaker build() {
+ return new EndpointCircuitBreaker(
+ this.enabled,
+ this.trippedDuration.orElse(java.time.Duration.ZERO),
+ this.rollingWindow.orElse(0L),
+ this.numBuckets.orElse(0L),
+ this.volumeThreshold.orElse(0L),
+ this.errorThresholdPercentage.orElse(0.0d)
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link EndpointCircuitBreaker} type.
+ *
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ ) {
+ return new Builder (
+ );
+ }
+
@JsonProperty("enabled")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional enabled;
@JsonProperty("tripped_duration")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.time.Duration trippedDuration;
@JsonProperty("rolling_window")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final long rollingWindow;
@JsonProperty("num_buckets")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final long numBuckets;
@JsonProperty("volume_threshold")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final long volumeThreshold;
@JsonProperty("error_threshold_percentage")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final double errorThresholdPercentage;
/**
@@ -36,13 +226,13 @@ public class EndpointCircuitBreaker {
* @param errorThresholdPercentage Error threshold percentage should be between 0 - 1.0, not 0-100.0
*/
@JsonCreator
- public EndpointCircuitBreaker(
+ private EndpointCircuitBreaker(
@JsonProperty("enabled") final Optional enabled,
@JsonProperty("tripped_duration") final java.time.Duration trippedDuration,
- @JsonProperty("rolling_window") final long rollingWindow,
- @JsonProperty("num_buckets") final long numBuckets,
- @JsonProperty("volume_threshold") final long volumeThreshold,
- @JsonProperty("error_threshold_percentage") final double errorThresholdPercentage
+ @JsonProperty("rolling_window") final Long rollingWindow,
+ @JsonProperty("num_buckets") final Long numBuckets,
+ @JsonProperty("volume_threshold") final Long volumeThreshold,
+ @JsonProperty("error_threshold_percentage") final Double errorThresholdPercentage
) {
this.enabled = enabled != null ? enabled : Optional.empty();
this.trippedDuration = Objects.requireNonNull(trippedDuration, "trippedDuration is required");
diff --git a/src/main/java/com/ngrok/definitions/EndpointCompression.java b/src/main/java/com/ngrok/definitions/EndpointCompression.java
index 7a213c4..f7d2d97 100644
--- a/src/main/java/com/ngrok/definitions/EndpointCompression.java
+++ b/src/main/java/com/ngrok/definitions/EndpointCompression.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,7 +13,65 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointCompression {
+ /**
+ * Builder class for {@link EndpointCompression}.
+ */
+ public static class Builder {
+ private Optional enabled = Optional.empty();
+
+ private Builder(
+ ) {
+ }
+
+ /**
+ * true if the module will be applied to traffic, false
+ * to disable. default true if unspecified
+ *
+ * @param enabled the value of the enabled parameter as a {@link boolean}
+ * @return this builder instance
+ */
+ public Builder enabled(final boolean enabled) {
+ this.enabled = Optional.of(Objects.requireNonNull(enabled, "enabled is required"));
+ return this;
+ }
+
+ /**
+ * true if the module will be applied to traffic, false
+ * to disable. default true if unspecified
+ *
+ * @param enabled the value of the enabled parameter as a {@link boolean}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder enabled(final Optional enabled) {
+ this.enabled = Objects.requireNonNull(enabled, "enabled is required");
+ return this;
+ }
+
+ /**
+ * Constructs the {@link EndpointCompression} instance.
+ *
+ * @return a new {@link EndpointCompression}
+ */
+ public EndpointCompression build() {
+ return new EndpointCompression(
+ this.enabled
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link EndpointCompression} type.
+ *
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ ) {
+ return new Builder (
+ );
+ }
+
@JsonProperty("enabled")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional enabled;
/**
@@ -21,7 +80,7 @@ public class EndpointCompression {
* @param enabled true if the module will be applied to traffic, false to disable. default true if unspecified
*/
@JsonCreator
- public EndpointCompression(
+ private EndpointCompression(
@JsonProperty("enabled") final Optional enabled
) {
this.enabled = enabled != null ? enabled : Optional.empty();
diff --git a/src/main/java/com/ngrok/definitions/EndpointConfiguration.java b/src/main/java/com/ngrok/definitions/EndpointConfiguration.java
index eea7a8f..34da73e 100644
--- a/src/main/java/com/ngrok/definitions/EndpointConfiguration.java
+++ b/src/main/java/com/ngrok/definitions/EndpointConfiguration.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,40 +14,58 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointConfiguration {
@JsonProperty("id")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String id;
@JsonProperty("type")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String type;
@JsonProperty("description")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String description;
@JsonProperty("metadata")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String metadata;
@JsonProperty("created_at")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.time.OffsetDateTime createdAt;
@JsonProperty("uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.net.URI uri;
@JsonProperty("circuit_breaker")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional circuitBreaker;
@JsonProperty("compression")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional compression;
@JsonProperty("request_headers")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional requestHeaders;
@JsonProperty("response_headers")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional responseHeaders;
@JsonProperty("ip_policy")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional ipPolicy;
@JsonProperty("mutual_tls")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional mutualTls;
@JsonProperty("tls_termination")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional tlsTermination;
@JsonProperty("webhook_validation")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional webhookValidation;
@JsonProperty("oauth")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional oauth;
@JsonProperty("logging")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional logging;
@JsonProperty("saml")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional saml;
@JsonProperty("oidc")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional oidc;
/**
diff --git a/src/main/java/com/ngrok/definitions/EndpointConfigurationList.java b/src/main/java/com/ngrok/definitions/EndpointConfigurationList.java
index a518a99..598adb9 100644
--- a/src/main/java/com/ngrok/definitions/EndpointConfigurationList.java
+++ b/src/main/java/com/ngrok/definitions/EndpointConfigurationList.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,10 +14,13 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointConfigurationList implements Pageable {
@JsonProperty("endpoint_configurations")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List endpointConfigurations;
@JsonProperty("uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.net.URI uri;
@JsonProperty("next_page_uri")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional nextPageUri;
/**
diff --git a/src/main/java/com/ngrok/definitions/EndpointIpPolicy.java b/src/main/java/com/ngrok/definitions/EndpointIpPolicy.java
index e0a1c07..6d4263c 100644
--- a/src/main/java/com/ngrok/definitions/EndpointIpPolicy.java
+++ b/src/main/java/com/ngrok/definitions/EndpointIpPolicy.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,8 +14,10 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointIpPolicy {
@JsonProperty("enabled")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional enabled;
@JsonProperty("ip_policies")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List[ ipPolicies;
/**
diff --git a/src/main/java/com/ngrok/definitions/EndpointIpPolicyMutate.java b/src/main/java/com/ngrok/definitions/EndpointIpPolicyMutate.java
index aa92c5c..ee571b9 100644
--- a/src/main/java/com/ngrok/definitions/EndpointIpPolicyMutate.java
+++ b/src/main/java/com/ngrok/definitions/EndpointIpPolicyMutate.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,9 +13,94 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointIpPolicyMutate {
+ /**
+ * Builder class for {@link EndpointIpPolicyMutate}.
+ */
+ public static class Builder {
+ private Optional enabled = Optional.empty();
+ private Optional> ipPolicyIds = Optional.empty();
+
+ private Builder(
+ ) {
+ }
+
+ /**
+ * ]true if the module will be applied to traffic, false
+ * to disable. default true if unspecified
+ *
+ * @param enabled the value of the enabled parameter as a {@link boolean}
+ * @return this builder instance
+ */
+ public Builder enabled(final boolean enabled) {
+ this.enabled = Optional.of(Objects.requireNonNull(enabled, "enabled is required"));
+ return this;
+ }
+
+ /**
+ * true if the module will be applied to traffic, false
+ * to disable. default true if unspecified
+ *
+ * @param enabled the value of the enabled parameter as a {@link boolean}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder enabled(final Optional enabled) {
+ this.enabled = Objects.requireNonNull(enabled, "enabled is required");
+ return this;
+ }
+
+ /**
+ * list of all IP policies that will be used to check if a source IP is allowed
+ * access to the endpoint
+ *
+ * @param ipPolicyIds the value of the ip_policy_ids parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder ipPolicyIds(final java.util.List ipPolicyIds) {
+ this.ipPolicyIds = Optional.of(Objects.requireNonNull(ipPolicyIds, "ipPolicyIds is required"));
+ return this;
+ }
+
+ /**
+ * list of all IP policies that will be used to check if a source IP is allowed
+ * access to the endpoint
+ *
+ * @param ipPolicyIds the value of the ip_policy_ids parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder ipPolicyIds(final Optional> ipPolicyIds) {
+ this.ipPolicyIds = Objects.requireNonNull(ipPolicyIds, "ipPolicyIds is required");
+ return this;
+ }
+
+ /**
+ * Constructs the {@link EndpointIpPolicyMutate} instance.
+ *
+ * @return a new {@link EndpointIpPolicyMutate}
+ */
+ public EndpointIpPolicyMutate build() {
+ return new EndpointIpPolicyMutate(
+ this.enabled,
+ this.ipPolicyIds.orElse(java.util.Collections.emptyList())
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link EndpointIpPolicyMutate} type.
+ *
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ ) {
+ return new Builder (
+ );
+ }
+
@JsonProperty("enabled")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional enabled;
@JsonProperty("ip_policy_ids")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List ipPolicyIds;
/**
@@ -24,7 +110,7 @@ public class EndpointIpPolicyMutate {
* @param ipPolicyIds list of all IP policies that will be used to check if a source IP is allowed access to the endpoint
*/
@JsonCreator
- public EndpointIpPolicyMutate(
+ private EndpointIpPolicyMutate(
@JsonProperty("enabled") final Optional enabled,
@JsonProperty("ip_policy_ids") final java.util.List ipPolicyIds
) {
diff --git a/src/main/java/com/ngrok/definitions/EndpointLogging.java b/src/main/java/com/ngrok/definitions/EndpointLogging.java
index 1cd9097..5834eee 100644
--- a/src/main/java/com/ngrok/definitions/EndpointLogging.java
+++ b/src/main/java/com/ngrok/definitions/EndpointLogging.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,8 +14,10 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointLogging {
@JsonProperty("enabled")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional enabled;
@JsonProperty("event_streams")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List[ eventStreams;
/**
diff --git a/src/main/java/com/ngrok/definitions/EndpointLoggingMutate.java b/src/main/java/com/ngrok/definitions/EndpointLoggingMutate.java
index ddc4964..034cecd 100644
--- a/src/main/java/com/ngrok/definitions/EndpointLoggingMutate.java
+++ b/src/main/java/com/ngrok/definitions/EndpointLoggingMutate.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,9 +13,94 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointLoggingMutate {
+ /**
+ * Builder class for {@link EndpointLoggingMutate}.
+ */
+ public static class Builder {
+ private Optional enabled = Optional.empty();
+ private Optional> eventStreamIds = Optional.empty();
+
+ private Builder(
+ ) {
+ }
+
+ /**
+ * ]true if the module will be applied to traffic, false
+ * to disable. default true if unspecified
+ *
+ * @param enabled the value of the enabled parameter as a {@link boolean}
+ * @return this builder instance
+ */
+ public Builder enabled(final boolean enabled) {
+ this.enabled = Optional.of(Objects.requireNonNull(enabled, "enabled is required"));
+ return this;
+ }
+
+ /**
+ * true if the module will be applied to traffic, false
+ * to disable. default true if unspecified
+ *
+ * @param enabled the value of the enabled parameter as a {@link boolean}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder enabled(final Optional enabled) {
+ this.enabled = Objects.requireNonNull(enabled, "enabled is required");
+ return this;
+ }
+
+ /**
+ * list of all EventStreams that will be used to configure and export this
+ * endpoint's logs
+ *
+ * @param eventStreamIds the value of the event_stream_ids parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder eventStreamIds(final java.util.List eventStreamIds) {
+ this.eventStreamIds = Optional.of(Objects.requireNonNull(eventStreamIds, "eventStreamIds is required"));
+ return this;
+ }
+
+ /**
+ * list of all EventStreams that will be used to configure and export this
+ * endpoint's logs
+ *
+ * @param eventStreamIds the value of the event_stream_ids parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder eventStreamIds(final Optional> eventStreamIds) {
+ this.eventStreamIds = Objects.requireNonNull(eventStreamIds, "eventStreamIds is required");
+ return this;
+ }
+
+ /**
+ * Constructs the {@link EndpointLoggingMutate} instance.
+ *
+ * @return a new {@link EndpointLoggingMutate}
+ */
+ public EndpointLoggingMutate build() {
+ return new EndpointLoggingMutate(
+ this.enabled,
+ this.eventStreamIds.orElse(java.util.Collections.emptyList())
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link EndpointLoggingMutate} type.
+ *
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ ) {
+ return new Builder (
+ );
+ }
+
@JsonProperty("enabled")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional enabled;
@JsonProperty("event_stream_ids")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List eventStreamIds;
/**
@@ -24,7 +110,7 @@ public class EndpointLoggingMutate {
* @param eventStreamIds list of all EventStreams that will be used to configure and export this endpoint's logs
*/
@JsonCreator
- public EndpointLoggingMutate(
+ private EndpointLoggingMutate(
@JsonProperty("enabled") final Optional enabled,
@JsonProperty("event_stream_ids") final java.util.List eventStreamIds
) {
diff --git a/src/main/java/com/ngrok/definitions/EndpointMutualTls.java b/src/main/java/com/ngrok/definitions/EndpointMutualTls.java
index b29f318..48dc25e 100644
--- a/src/main/java/com/ngrok/definitions/EndpointMutualTls.java
+++ b/src/main/java/com/ngrok/definitions/EndpointMutualTls.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -13,8 +14,10 @@ import java.util.Optional;
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointMutualTls {
@JsonProperty("enabled")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional enabled;
@JsonProperty("certificate_authorities")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List[ certificateAuthorities;
/**
diff --git a/src/main/java/com/ngrok/definitions/EndpointMutualTlsMutate.java b/src/main/java/com/ngrok/definitions/EndpointMutualTlsMutate.java
index 6b13ac2..ff38f0a 100644
--- a/src/main/java/com/ngrok/definitions/EndpointMutualTlsMutate.java
+++ b/src/main/java/com/ngrok/definitions/EndpointMutualTlsMutate.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,9 +13,94 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointMutualTlsMutate {
+ /**
+ * Builder class for {@link EndpointMutualTlsMutate}.
+ */
+ public static class Builder {
+ private Optional enabled = Optional.empty();
+ private Optional> certificateAuthorityIds = Optional.empty();
+
+ private Builder(
+ ) {
+ }
+
+ /**
+ * ]true if the module will be applied to traffic, false
+ * to disable. default true if unspecified
+ *
+ * @param enabled the value of the enabled parameter as a {@link boolean}
+ * @return this builder instance
+ */
+ public Builder enabled(final boolean enabled) {
+ this.enabled = Optional.of(Objects.requireNonNull(enabled, "enabled is required"));
+ return this;
+ }
+
+ /**
+ * true if the module will be applied to traffic, false
+ * to disable. default true if unspecified
+ *
+ * @param enabled the value of the enabled parameter as a {@link boolean}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder enabled(final Optional enabled) {
+ this.enabled = Objects.requireNonNull(enabled, "enabled is required");
+ return this;
+ }
+
+ /**
+ * list of certificate authorities that will be used to validate the TLS client
+ * certificate presnted by the initiatiator of the TLS connection
+ *
+ * @param certificateAuthorityIds the value of the certificate_authority_ids parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder certificateAuthorityIds(final java.util.List certificateAuthorityIds) {
+ this.certificateAuthorityIds = Optional.of(Objects.requireNonNull(certificateAuthorityIds, "certificateAuthorityIds is required"));
+ return this;
+ }
+
+ /**
+ * list of certificate authorities that will be used to validate the TLS client
+ * certificate presnted by the initiatiator of the TLS connection
+ *
+ * @param certificateAuthorityIds the value of the certificate_authority_ids parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder certificateAuthorityIds(final Optional> certificateAuthorityIds) {
+ this.certificateAuthorityIds = Objects.requireNonNull(certificateAuthorityIds, "certificateAuthorityIds is required");
+ return this;
+ }
+
+ /**
+ * Constructs the {@link EndpointMutualTlsMutate} instance.
+ *
+ * @return a new {@link EndpointMutualTlsMutate}
+ */
+ public EndpointMutualTlsMutate build() {
+ return new EndpointMutualTlsMutate(
+ this.enabled,
+ this.certificateAuthorityIds.orElse(java.util.Collections.emptyList())
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link EndpointMutualTlsMutate} type.
+ *
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ ) {
+ return new Builder (
+ );
+ }
+
@JsonProperty("enabled")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional enabled;
@JsonProperty("certificate_authority_ids")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List certificateAuthorityIds;
/**
@@ -24,7 +110,7 @@ public class EndpointMutualTlsMutate {
* @param certificateAuthorityIds list of certificate authorities that will be used to validate the TLS client certificate presnted by the initiatiator of the TLS connection
*/
@JsonCreator
- public EndpointMutualTlsMutate(
+ private EndpointMutualTlsMutate(
@JsonProperty("enabled") final Optional enabled,
@JsonProperty("certificate_authority_ids") final java.util.List certificateAuthorityIds
) {
diff --git a/src/main/java/com/ngrok/definitions/EndpointOAuth.java b/src/main/java/com/ngrok/definitions/EndpointOAuth.java
index 88bb85f..d004d37 100644
--- a/src/main/java/com/ngrok/definitions/EndpointOAuth.java
+++ b/src/main/java/com/ngrok/definitions/EndpointOAuth.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,19 +13,247 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointOAuth {
+ /**
+ * Builder class for {@link EndpointOAuth}.
+ */
+ public static class Builder {
+ private Optional enabled = Optional.empty();
+ private Optional provider = Optional.empty();
+ private Optional optionsPassthrough = Optional.empty();
+ private Optional cookiePrefix = Optional.empty();
+ private Optional inactivityTimeout = Optional.empty();
+ private Optional maximumDuration = Optional.empty();
+ private Optional authCheckInterval = Optional.empty();
+
+ private Builder(
+ ) {
+ }
+
+ /**
+ * true if the module will be applied to traffic, false
+ * to disable. default true if unspecified
+ *
+ * @param enabled the value of the enabled parameter as a {@link boolean}
+ * @return this builder instance
+ */
+ public Builder enabled(final boolean enabled) {
+ this.enabled = Optional.of(Objects.requireNonNull(enabled, "enabled is required"));
+ return this;
+ }
+
+ /**
+ * true if the module will be applied to traffic, false
+ * to disable. default true if unspecified
+ *
+ * @param enabled the value of the enabled parameter as a {@link boolean}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder enabled(final Optional enabled) {
+ this.enabled = Objects.requireNonNull(enabled, "enabled is required");
+ return this;
+ }
+
+ /**
+ * an object which defines the identity provider to use for authentication and
+ * configuration for who may access the endpoint
+ *
+ * @param provider the value of the provider parameter as a {@link EndpointOAuthProvider}
+ * @return this builder instance
+ */
+ public Builder provider(final EndpointOAuthProvider provider) {
+ this.provider = Optional.of(Objects.requireNonNull(provider, "provider is required"));
+ return this;
+ }
+
+ /**
+ * an object which defines the identity provider to use for authentication and
+ * configuration for who may access the endpoint
+ *
+ * @param provider the value of the provider parameter as a {@link EndpointOAuthProvider}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder provider(final Optional provider) {
+ this.provider = Objects.requireNonNull(provider, "provider is required");
+ return this;
+ }
+
+ /**
+ * Do not enforce authentication on HTTP OPTIONS requests. necessary if you are
+ * supporting CORS.
+ *
+ * @param optionsPassthrough the value of the options_passthrough parameter as a {@link boolean}
+ * @return this builder instance
+ */
+ public Builder optionsPassthrough(final boolean optionsPassthrough) {
+ this.optionsPassthrough = Optional.of(Objects.requireNonNull(optionsPassthrough, "optionsPassthrough is required"));
+ return this;
+ }
+
+ /**
+ * Do not enforce authentication on HTTP OPTIONS requests. necessary if you are
+ * supporting CORS.
+ *
+ * @param optionsPassthrough the value of the options_passthrough parameter as a {@link boolean}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder optionsPassthrough(final Optional optionsPassthrough) {
+ this.optionsPassthrough = Objects.requireNonNull(optionsPassthrough, "optionsPassthrough is required");
+ return this;
+ }
+
+ /**
+ * the prefix of the session cookie that ngrok sets on the http client to cache
+ * authentication. default is 'ngrok.'
+ *
+ * @param cookiePrefix the value of the cookie_prefix parameter as a {@link String}
+ * @return this builder instance
+ */
+ public Builder cookiePrefix(final String cookiePrefix) {
+ this.cookiePrefix = Optional.of(Objects.requireNonNull(cookiePrefix, "cookiePrefix is required"));
+ return this;
+ }
+
+ /**
+ * the prefix of the session cookie that ngrok sets on the http client to cache
+ * authentication. default is 'ngrok.'
+ *
+ * @param cookiePrefix the value of the cookie_prefix parameter as a {@link String}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder cookiePrefix(final Optional cookiePrefix) {
+ this.cookiePrefix = Objects.requireNonNull(cookiePrefix, "cookiePrefix is required");
+ return this;
+ }
+
+ /**
+ * Integer number of seconds of inactivity after which if the user has not accessed
+ * the endpoint, their session will time out and they will be forced to
+ * reauthenticate.
+ *
+ * @param inactivityTimeout the value of the inactivity_timeout parameter as a {@link long}
+ * @return this builder instance
+ */
+ public Builder inactivityTimeout(final long inactivityTimeout) {
+ this.inactivityTimeout = Optional.of(Objects.requireNonNull(inactivityTimeout, "inactivityTimeout is required"));
+ return this;
+ }
+
+ /**
+ * Integer number of seconds of inactivity after which if the user has not accessed
+ * the endpoint, their session will time out and they will be forced to
+ * reauthenticate.
+ *
+ * @param inactivityTimeout the value of the inactivity_timeout parameter as a {@link long}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder inactivityTimeout(final Optional inactivityTimeout) {
+ this.inactivityTimeout = Objects.requireNonNull(inactivityTimeout, "inactivityTimeout is required");
+ return this;
+ }
+
+ /**
+ * Integer number of seconds of the maximum duration of an authenticated session.
+ * After this period is exceeded, a user must reauthenticate.
+ *
+ * @param maximumDuration the value of the maximum_duration parameter as a {@link java.time.Duration}
+ * @return this builder instance
+ */
+ public Builder maximumDuration(final java.time.Duration maximumDuration) {
+ this.maximumDuration = Optional.of(Objects.requireNonNull(maximumDuration, "maximumDuration is required"));
+ return this;
+ }
+
+ /**
+ * Integer number of seconds of the maximum duration of an authenticated session.
+ * After this period is exceeded, a user must reauthenticate.
+ *
+ * @param maximumDuration the value of the maximum_duration parameter as a {@link java.time.Duration}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder maximumDuration(final Optional maximumDuration) {
+ this.maximumDuration = Objects.requireNonNull(maximumDuration, "maximumDuration is required");
+ return this;
+ }
+
+ /**
+ * Integer number of seconds after which ngrok guarantees it will refresh user
+ * state from the identity provider and recheck whether the user is still
+ * authorized to access the endpoint. This is the preferred tunable to use to
+ * enforce a minimum amount of time after which a revoked user will no longer be
+ * able to access the resource.
+ *
+ * @param authCheckInterval the value of the auth_check_interval parameter as a {@link long}
+ * @return this builder instance
+ */
+ public Builder authCheckInterval(final long authCheckInterval) {
+ this.authCheckInterval = Optional.of(Objects.requireNonNull(authCheckInterval, "authCheckInterval is required"));
+ return this;
+ }
+
+ /**
+ * Integer number of seconds after which ngrok guarantees it will refresh user
+ * state from the identity provider and recheck whether the user is still
+ * authorized to access the endpoint. This is the preferred tunable to use to
+ * enforce a minimum amount of time after which a revoked user will no longer be
+ * able to access the resource.
+ *
+ * @param authCheckInterval the value of the auth_check_interval parameter as a {@link long}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder authCheckInterval(final Optional authCheckInterval) {
+ this.authCheckInterval = Objects.requireNonNull(authCheckInterval, "authCheckInterval is required");
+ return this;
+ }
+
+ /**
+ * Constructs the {@link EndpointOAuth} instance.
+ *
+ * @return a new {@link EndpointOAuth}
+ */
+ public EndpointOAuth build() {
+ return new EndpointOAuth(
+ this.enabled,
+ this.provider.orElse(null),
+ this.optionsPassthrough.orElse(false),
+ this.cookiePrefix.orElse(""),
+ this.inactivityTimeout.orElse(0L),
+ this.maximumDuration.orElse(java.time.Duration.ZERO),
+ this.authCheckInterval.orElse(0L)
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link EndpointOAuth} type.
+ *
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ ) {
+ return new Builder (
+ );
+ }
+
@JsonProperty("enabled")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional enabled;
@JsonProperty("provider")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final EndpointOAuthProvider provider;
@JsonProperty("options_passthrough")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final boolean optionsPassthrough;
@JsonProperty("cookie_prefix")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final String cookiePrefix;
@JsonProperty("inactivity_timeout")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final long inactivityTimeout;
@JsonProperty("maximum_duration")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.time.Duration maximumDuration;
@JsonProperty("auth_check_interval")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final long authCheckInterval;
/**
@@ -39,14 +268,14 @@ public class EndpointOAuth {
* @param authCheckInterval Integer number of seconds after which ngrok guarantees it will refresh user state from the identity provider and recheck whether the user is still authorized to access the endpoint. This is the preferred tunable to use to enforce a minimum amount of time after which a revoked user will no longer be able to access the resource.
*/
@JsonCreator
- public EndpointOAuth(
+ private EndpointOAuth(
@JsonProperty("enabled") final Optional enabled,
@JsonProperty("provider") final EndpointOAuthProvider provider,
- @JsonProperty("options_passthrough") final boolean optionsPassthrough,
+ @JsonProperty("options_passthrough") final Boolean optionsPassthrough,
@JsonProperty("cookie_prefix") final String cookiePrefix,
- @JsonProperty("inactivity_timeout") final long inactivityTimeout,
+ @JsonProperty("inactivity_timeout") final Long inactivityTimeout,
@JsonProperty("maximum_duration") final java.time.Duration maximumDuration,
- @JsonProperty("auth_check_interval") final long authCheckInterval
+ @JsonProperty("auth_check_interval") final Long authCheckInterval
) {
this.enabled = enabled != null ? enabled : Optional.empty();
this.provider = Objects.requireNonNull(provider, "provider is required");
diff --git a/src/main/java/com/ngrok/definitions/EndpointOAuthFacebook.java b/src/main/java/com/ngrok/definitions/EndpointOAuthFacebook.java
index adbd7b7..a2bf455 100644
--- a/src/main/java/com/ngrok/definitions/EndpointOAuthFacebook.java
+++ b/src/main/java/com/ngrok/definitions/EndpointOAuthFacebook.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,15 +13,193 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointOAuthFacebook {
+ /**
+ * Builder class for {@link EndpointOAuthFacebook}.
+ */
+ public static class Builder {
+ private Optional clientId = Optional.empty();
+ private Optional clientSecret = Optional.empty();
+ private Optional> scopes = Optional.empty();
+ private Optional> emailAddresses = Optional.empty();
+ private Optional> emailDomains = Optional.empty();
+
+ private Builder(
+ ) {
+ }
+
+ /**
+ * the OAuth app client ID. retrieve it from the identity provider's dashboard
+ * where you created your own OAuth app. optional. if unspecified, ngrok will use
+ * its own managed oauth application which has additional restrictions. see the
+ * OAuth module docs for more details. if present, client_secret must be present as
+ * well.
+ *
+ * @param clientId the value of the client_id parameter as a {@link String}
+ * @return this builder instance
+ */
+ public Builder clientId(final String clientId) {
+ this.clientId = Optional.of(Objects.requireNonNull(clientId, "clientId is required"));
+ return this;
+ }
+
+ /**
+ * the OAuth app client ID. retrieve it from the identity provider's dashboard
+ * where you created your own OAuth app. optional. if unspecified, ngrok will use
+ * its own managed oauth application which has additional restrictions. see the
+ * OAuth module docs for more details. if present, client_secret must be present as
+ * well.
+ *
+ * @param clientId the value of the client_id parameter as a {@link String}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder clientId(final Optional clientId) {
+ this.clientId = Objects.requireNonNull(clientId, "clientId is required");
+ return this;
+ }
+
+ /**
+ * the OAuth app client secret. retrieve if from the identity provider's dashboard
+ * where you created your own OAuth app. optional, see all of the caveats in the
+ * docs for client_id.
+ *
+ * @param clientSecret the value of the client_secret parameter as a {@link String}
+ * @return this builder instance
+ */
+ public Builder clientSecret(final String clientSecret) {
+ this.clientSecret = Optional.of(Objects.requireNonNull(clientSecret, "clientSecret is required"));
+ return this;
+ }
+
+ /**
+ * the OAuth app client secret. retrieve if from the identity provider's dashboard
+ * where you created your own OAuth app. optional, see all of the caveats in the
+ * docs for client_id.
+ *
+ * @param clientSecret the value of the client_secret parameter as a {@link String}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder clientSecret(final Optional clientSecret) {
+ this.clientSecret = Objects.requireNonNull(clientSecret, "clientSecret is required");
+ return this;
+ }
+
+ /**
+ * a list of provider-specific OAuth scopes with the permissions your OAuth app
+ * would like to ask for. these may not be set if you are using the ngrok-managed
+ * oauth app (i.e. you must pass both client_id and
+ * client_secret to set scopes)
+ *
+ * @param scopes the value of the scopes parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder scopes(final java.util.List scopes) {
+ this.scopes = Optional.of(Objects.requireNonNull(scopes, "scopes is required"));
+ return this;
+ }
+
+ /**
+ * a list of provider-specific OAuth scopes with the permissions your OAuth app
+ * would like to ask for. these may not be set if you are using the ngrok-managed
+ * oauth app (i.e. you must pass both client_id and
+ * client_secret to set scopes)
+ *
+ * @param scopes the value of the scopes parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder scopes(final Optional> scopes) {
+ this.scopes = Objects.requireNonNull(scopes, "scopes is required");
+ return this;
+ }
+
+ /**
+ * a list of email addresses of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailAddresses the value of the email_addresses parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder emailAddresses(final java.util.List emailAddresses) {
+ this.emailAddresses = Optional.of(Objects.requireNonNull(emailAddresses, "emailAddresses is required"));
+ return this;
+ }
+
+ /**
+ * a list of email addresses of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailAddresses the value of the email_addresses parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder emailAddresses(final Optional> emailAddresses) {
+ this.emailAddresses = Objects.requireNonNull(emailAddresses, "emailAddresses is required");
+ return this;
+ }
+
+ /**
+ * a list of email domains of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailDomains the value of the email_domains parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder emailDomains(final java.util.List emailDomains) {
+ this.emailDomains = Optional.of(Objects.requireNonNull(emailDomains, "emailDomains is required"));
+ return this;
+ }
+
+ /**
+ * a list of email domains of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailDomains the value of the email_domains parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder emailDomains(final Optional> emailDomains) {
+ this.emailDomains = Objects.requireNonNull(emailDomains, "emailDomains is required");
+ return this;
+ }
+
+ /**
+ * Constructs the {@link EndpointOAuthFacebook} instance.
+ *
+ * @return a new {@link EndpointOAuthFacebook}
+ */
+ public EndpointOAuthFacebook build() {
+ return new EndpointOAuthFacebook(
+ this.clientId,
+ this.clientSecret,
+ this.scopes.orElse(java.util.Collections.emptyList()),
+ this.emailAddresses.orElse(java.util.Collections.emptyList()),
+ this.emailDomains.orElse(java.util.Collections.emptyList())
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link EndpointOAuthFacebook} type.
+ *
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ ) {
+ return new Builder (
+ );
+ }
+
@JsonProperty("client_id")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional clientId;
@JsonProperty("client_secret")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional clientSecret;
@JsonProperty("scopes")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List scopes;
@JsonProperty("email_addresses")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List emailAddresses;
@JsonProperty("email_domains")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List emailDomains;
/**
@@ -33,7 +212,7 @@ public class EndpointOAuthFacebook {
* @param emailDomains a list of email domains of users authenticated by identity provider who are allowed access to the endpoint
*/
@JsonCreator
- public EndpointOAuthFacebook(
+ private EndpointOAuthFacebook(
@JsonProperty("client_id") final Optional clientId,
@JsonProperty("client_secret") final Optional clientSecret,
@JsonProperty("scopes") final java.util.List scopes,
diff --git a/src/main/java/com/ngrok/definitions/EndpointOAuthGitHub.java b/src/main/java/com/ngrok/definitions/EndpointOAuthGitHub.java
index 491d876..7a56d08 100644
--- a/src/main/java/com/ngrok/definitions/EndpointOAuthGitHub.java
+++ b/src/main/java/com/ngrok/definitions/EndpointOAuthGitHub.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,19 +13,255 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointOAuthGitHub {
+ /**
+ * Builder class for {@link EndpointOAuthGitHub}.
+ */
+ public static class Builder {
+ private Optional clientId = Optional.empty();
+ private Optional clientSecret = Optional.empty();
+ private Optional> scopes = Optional.empty();
+ private Optional> emailAddresses = Optional.empty();
+ private Optional> emailDomains = Optional.empty();
+ private Optional> teams = Optional.empty();
+ private Optional> organizations = Optional.empty();
+
+ private Builder(
+ ) {
+ }
+
+ /**
+ * the OAuth app client ID. retrieve it from the identity provider's dashboard
+ * where you created your own OAuth app. optional. if unspecified, ngrok will use
+ * its own managed oauth application which has additional restrictions. see the
+ * OAuth module docs for more details. if present, client_secret must be present as
+ * well.
+ *
+ * @param clientId the value of the client_id parameter as a {@link String}
+ * @return this builder instance
+ */
+ public Builder clientId(final String clientId) {
+ this.clientId = Optional.of(Objects.requireNonNull(clientId, "clientId is required"));
+ return this;
+ }
+
+ /**
+ * the OAuth app client ID. retrieve it from the identity provider's dashboard
+ * where you created your own OAuth app. optional. if unspecified, ngrok will use
+ * its own managed oauth application which has additional restrictions. see the
+ * OAuth module docs for more details. if present, client_secret must be present as
+ * well.
+ *
+ * @param clientId the value of the client_id parameter as a {@link String}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder clientId(final Optional clientId) {
+ this.clientId = Objects.requireNonNull(clientId, "clientId is required");
+ return this;
+ }
+
+ /**
+ * the OAuth app client secret. retrieve if from the identity provider's dashboard
+ * where you created your own OAuth app. optional, see all of the caveats in the
+ * docs for client_id.
+ *
+ * @param clientSecret the value of the client_secret parameter as a {@link String}
+ * @return this builder instance
+ */
+ public Builder clientSecret(final String clientSecret) {
+ this.clientSecret = Optional.of(Objects.requireNonNull(clientSecret, "clientSecret is required"));
+ return this;
+ }
+
+ /**
+ * the OAuth app client secret. retrieve if from the identity provider's dashboard
+ * where you created your own OAuth app. optional, see all of the caveats in the
+ * docs for client_id.
+ *
+ * @param clientSecret the value of the client_secret parameter as a {@link String}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder clientSecret(final Optional clientSecret) {
+ this.clientSecret = Objects.requireNonNull(clientSecret, "clientSecret is required");
+ return this;
+ }
+
+ /**
+ * a list of provider-specific OAuth scopes with the permissions your OAuth app
+ * would like to ask for. these may not be set if you are using the ngrok-managed
+ * oauth app (i.e. you must pass both client_id and
+ * client_secret to set scopes)
+ *
+ * @param scopes the value of the scopes parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder scopes(final java.util.List scopes) {
+ this.scopes = Optional.of(Objects.requireNonNull(scopes, "scopes is required"));
+ return this;
+ }
+
+ /**
+ * a list of provider-specific OAuth scopes with the permissions your OAuth app
+ * would like to ask for. these may not be set if you are using the ngrok-managed
+ * oauth app (i.e. you must pass both client_id and
+ * client_secret to set scopes)
+ *
+ * @param scopes the value of the scopes parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder scopes(final Optional> scopes) {
+ this.scopes = Objects.requireNonNull(scopes, "scopes is required");
+ return this;
+ }
+
+ /**
+ * a list of email addresses of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailAddresses the value of the email_addresses parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder emailAddresses(final java.util.List emailAddresses) {
+ this.emailAddresses = Optional.of(Objects.requireNonNull(emailAddresses, "emailAddresses is required"));
+ return this;
+ }
+
+ /**
+ * a list of email addresses of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailAddresses the value of the email_addresses parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder emailAddresses(final Optional> emailAddresses) {
+ this.emailAddresses = Objects.requireNonNull(emailAddresses, "emailAddresses is required");
+ return this;
+ }
+
+ /**
+ * a list of email domains of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailDomains the value of the email_domains parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder emailDomains(final java.util.List emailDomains) {
+ this.emailDomains = Optional.of(Objects.requireNonNull(emailDomains, "emailDomains is required"));
+ return this;
+ }
+
+ /**
+ * a list of email domains of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailDomains the value of the email_domains parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder emailDomains(final Optional> emailDomains) {
+ this.emailDomains = Objects.requireNonNull(emailDomains, "emailDomains is required");
+ return this;
+ }
+
+ /**
+ * a list of github teams identifiers. users will be allowed access to the endpoint
+ * if they are a member of any of these teams. identifiers should be in the 'slug'
+ * format qualified with the org name, e.g. org-name/team-name
+ *
+ * @param teams the value of the teams parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder teams(final java.util.List teams) {
+ this.teams = Optional.of(Objects.requireNonNull(teams, "teams is required"));
+ return this;
+ }
+
+ /**
+ * a list of github teams identifiers. users will be allowed access to the endpoint
+ * if they are a member of any of these teams. identifiers should be in the 'slug'
+ * format qualified with the org name, e.g. org-name/team-name
+ *
+ * @param teams the value of the teams parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder teams(final Optional> teams) {
+ this.teams = Objects.requireNonNull(teams, "teams is required");
+ return this;
+ }
+
+ /**
+ * a list of github org identifiers. users who are members of any of the listed
+ * organizations will be allowed access. identifiers should be the organization's
+ * 'slug'
+ *
+ * @param organizations the value of the organizations parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder organizations(final java.util.List organizations) {
+ this.organizations = Optional.of(Objects.requireNonNull(organizations, "organizations is required"));
+ return this;
+ }
+
+ /**
+ * a list of github org identifiers. users who are members of any of the listed
+ * organizations will be allowed access. identifiers should be the organization's
+ * 'slug'
+ *
+ * @param organizations the value of the organizations parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder organizations(final Optional> organizations) {
+ this.organizations = Objects.requireNonNull(organizations, "organizations is required");
+ return this;
+ }
+
+ /**
+ * Constructs the {@link EndpointOAuthGitHub} instance.
+ *
+ * @return a new {@link EndpointOAuthGitHub}
+ */
+ public EndpointOAuthGitHub build() {
+ return new EndpointOAuthGitHub(
+ this.clientId,
+ this.clientSecret,
+ this.scopes.orElse(java.util.Collections.emptyList()),
+ this.emailAddresses.orElse(java.util.Collections.emptyList()),
+ this.emailDomains.orElse(java.util.Collections.emptyList()),
+ this.teams.orElse(java.util.Collections.emptyList()),
+ this.organizations.orElse(java.util.Collections.emptyList())
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link EndpointOAuthGitHub} type.
+ *
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ ) {
+ return new Builder (
+ );
+ }
+
@JsonProperty("client_id")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional clientId;
@JsonProperty("client_secret")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional clientSecret;
@JsonProperty("scopes")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List scopes;
@JsonProperty("email_addresses")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List emailAddresses;
@JsonProperty("email_domains")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List emailDomains;
@JsonProperty("teams")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List teams;
@JsonProperty("organizations")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List organizations;
/**
@@ -39,7 +276,7 @@ public class EndpointOAuthGitHub {
* @param organizations a list of github org identifiers. users who are members of any of the listed organizations will be allowed access. identifiers should be the organization's 'slug'
*/
@JsonCreator
- public EndpointOAuthGitHub(
+ private EndpointOAuthGitHub(
@JsonProperty("client_id") final Optional clientId,
@JsonProperty("client_secret") final Optional clientSecret,
@JsonProperty("scopes") final java.util.List scopes,
diff --git a/src/main/java/com/ngrok/definitions/EndpointOAuthGoogle.java b/src/main/java/com/ngrok/definitions/EndpointOAuthGoogle.java
index 4c781f8..9f2140b 100644
--- a/src/main/java/com/ngrok/definitions/EndpointOAuthGoogle.java
+++ b/src/main/java/com/ngrok/definitions/EndpointOAuthGoogle.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,15 +13,193 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointOAuthGoogle {
+ /**
+ * Builder class for {@link EndpointOAuthGoogle}.
+ */
+ public static class Builder {
+ private Optional clientId = Optional.empty();
+ private Optional clientSecret = Optional.empty();
+ private Optional> scopes = Optional.empty();
+ private Optional> emailAddresses = Optional.empty();
+ private Optional> emailDomains = Optional.empty();
+
+ private Builder(
+ ) {
+ }
+
+ /**
+ * the OAuth app client ID. retrieve it from the identity provider's dashboard
+ * where you created your own OAuth app. optional. if unspecified, ngrok will use
+ * its own managed oauth application which has additional restrictions. see the
+ * OAuth module docs for more details. if present, client_secret must be present as
+ * well.
+ *
+ * @param clientId the value of the client_id parameter as a {@link String}
+ * @return this builder instance
+ */
+ public Builder clientId(final String clientId) {
+ this.clientId = Optional.of(Objects.requireNonNull(clientId, "clientId is required"));
+ return this;
+ }
+
+ /**
+ * the OAuth app client ID. retrieve it from the identity provider's dashboard
+ * where you created your own OAuth app. optional. if unspecified, ngrok will use
+ * its own managed oauth application which has additional restrictions. see the
+ * OAuth module docs for more details. if present, client_secret must be present as
+ * well.
+ *
+ * @param clientId the value of the client_id parameter as a {@link String}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder clientId(final Optional clientId) {
+ this.clientId = Objects.requireNonNull(clientId, "clientId is required");
+ return this;
+ }
+
+ /**
+ * the OAuth app client secret. retrieve if from the identity provider's dashboard
+ * where you created your own OAuth app. optional, see all of the caveats in the
+ * docs for client_id.
+ *
+ * @param clientSecret the value of the client_secret parameter as a {@link String}
+ * @return this builder instance
+ */
+ public Builder clientSecret(final String clientSecret) {
+ this.clientSecret = Optional.of(Objects.requireNonNull(clientSecret, "clientSecret is required"));
+ return this;
+ }
+
+ /**
+ * the OAuth app client secret. retrieve if from the identity provider's dashboard
+ * where you created your own OAuth app. optional, see all of the caveats in the
+ * docs for client_id.
+ *
+ * @param clientSecret the value of the client_secret parameter as a {@link String}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder clientSecret(final Optional clientSecret) {
+ this.clientSecret = Objects.requireNonNull(clientSecret, "clientSecret is required");
+ return this;
+ }
+
+ /**
+ * a list of provider-specific OAuth scopes with the permissions your OAuth app
+ * would like to ask for. these may not be set if you are using the ngrok-managed
+ * oauth app (i.e. you must pass both client_id and
+ * client_secret to set scopes)
+ *
+ * @param scopes the value of the scopes parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder scopes(final java.util.List scopes) {
+ this.scopes = Optional.of(Objects.requireNonNull(scopes, "scopes is required"));
+ return this;
+ }
+
+ /**
+ * a list of provider-specific OAuth scopes with the permissions your OAuth app
+ * would like to ask for. these may not be set if you are using the ngrok-managed
+ * oauth app (i.e. you must pass both client_id and
+ * client_secret to set scopes)
+ *
+ * @param scopes the value of the scopes parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder scopes(final Optional> scopes) {
+ this.scopes = Objects.requireNonNull(scopes, "scopes is required");
+ return this;
+ }
+
+ /**
+ * a list of email addresses of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailAddresses the value of the email_addresses parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder emailAddresses(final java.util.List emailAddresses) {
+ this.emailAddresses = Optional.of(Objects.requireNonNull(emailAddresses, "emailAddresses is required"));
+ return this;
+ }
+
+ /**
+ * a list of email addresses of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailAddresses the value of the email_addresses parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder emailAddresses(final Optional> emailAddresses) {
+ this.emailAddresses = Objects.requireNonNull(emailAddresses, "emailAddresses is required");
+ return this;
+ }
+
+ /**
+ * a list of email domains of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailDomains the value of the email_domains parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder emailDomains(final java.util.List emailDomains) {
+ this.emailDomains = Optional.of(Objects.requireNonNull(emailDomains, "emailDomains is required"));
+ return this;
+ }
+
+ /**
+ * a list of email domains of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailDomains the value of the email_domains parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder emailDomains(final Optional> emailDomains) {
+ this.emailDomains = Objects.requireNonNull(emailDomains, "emailDomains is required");
+ return this;
+ }
+
+ /**
+ * Constructs the {@link EndpointOAuthGoogle} instance.
+ *
+ * @return a new {@link EndpointOAuthGoogle}
+ */
+ public EndpointOAuthGoogle build() {
+ return new EndpointOAuthGoogle(
+ this.clientId,
+ this.clientSecret,
+ this.scopes.orElse(java.util.Collections.emptyList()),
+ this.emailAddresses.orElse(java.util.Collections.emptyList()),
+ this.emailDomains.orElse(java.util.Collections.emptyList())
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link EndpointOAuthGoogle} type.
+ *
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ ) {
+ return new Builder (
+ );
+ }
+
@JsonProperty("client_id")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional clientId;
@JsonProperty("client_secret")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional clientSecret;
@JsonProperty("scopes")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List scopes;
@JsonProperty("email_addresses")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List emailAddresses;
@JsonProperty("email_domains")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List emailDomains;
/**
@@ -33,7 +212,7 @@ public class EndpointOAuthGoogle {
* @param emailDomains a list of email domains of users authenticated by identity provider who are allowed access to the endpoint
*/
@JsonCreator
- public EndpointOAuthGoogle(
+ private EndpointOAuthGoogle(
@JsonProperty("client_id") final Optional clientId,
@JsonProperty("client_secret") final Optional clientSecret,
@JsonProperty("scopes") final java.util.List scopes,
diff --git a/src/main/java/com/ngrok/definitions/EndpointOAuthMicrosoft.java b/src/main/java/com/ngrok/definitions/EndpointOAuthMicrosoft.java
index c83909a..1aca943 100644
--- a/src/main/java/com/ngrok/definitions/EndpointOAuthMicrosoft.java
+++ b/src/main/java/com/ngrok/definitions/EndpointOAuthMicrosoft.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,15 +13,193 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointOAuthMicrosoft {
+ /**
+ * Builder class for {@link EndpointOAuthMicrosoft}.
+ */
+ public static class Builder {
+ private Optional clientId = Optional.empty();
+ private Optional clientSecret = Optional.empty();
+ private Optional> scopes = Optional.empty();
+ private Optional> emailAddresses = Optional.empty();
+ private Optional> emailDomains = Optional.empty();
+
+ private Builder(
+ ) {
+ }
+
+ /**
+ * the OAuth app client ID. retrieve it from the identity provider's dashboard
+ * where you created your own OAuth app. optional. if unspecified, ngrok will use
+ * its own managed oauth application which has additional restrictions. see the
+ * OAuth module docs for more details. if present, client_secret must be present as
+ * well.
+ *
+ * @param clientId the value of the client_id parameter as a {@link String}
+ * @return this builder instance
+ */
+ public Builder clientId(final String clientId) {
+ this.clientId = Optional.of(Objects.requireNonNull(clientId, "clientId is required"));
+ return this;
+ }
+
+ /**
+ * the OAuth app client ID. retrieve it from the identity provider's dashboard
+ * where you created your own OAuth app. optional. if unspecified, ngrok will use
+ * its own managed oauth application which has additional restrictions. see the
+ * OAuth module docs for more details. if present, client_secret must be present as
+ * well.
+ *
+ * @param clientId the value of the client_id parameter as a {@link String}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder clientId(final Optional clientId) {
+ this.clientId = Objects.requireNonNull(clientId, "clientId is required");
+ return this;
+ }
+
+ /**
+ * the OAuth app client secret. retrieve if from the identity provider's dashboard
+ * where you created your own OAuth app. optional, see all of the caveats in the
+ * docs for client_id.
+ *
+ * @param clientSecret the value of the client_secret parameter as a {@link String}
+ * @return this builder instance
+ */
+ public Builder clientSecret(final String clientSecret) {
+ this.clientSecret = Optional.of(Objects.requireNonNull(clientSecret, "clientSecret is required"));
+ return this;
+ }
+
+ /**
+ * the OAuth app client secret. retrieve if from the identity provider's dashboard
+ * where you created your own OAuth app. optional, see all of the caveats in the
+ * docs for client_id.
+ *
+ * @param clientSecret the value of the client_secret parameter as a {@link String}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder clientSecret(final Optional clientSecret) {
+ this.clientSecret = Objects.requireNonNull(clientSecret, "clientSecret is required");
+ return this;
+ }
+
+ /**
+ * a list of provider-specific OAuth scopes with the permissions your OAuth app
+ * would like to ask for. these may not be set if you are using the ngrok-managed
+ * oauth app (i.e. you must pass both client_id and
+ * client_secret to set scopes)
+ *
+ * @param scopes the value of the scopes parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder scopes(final java.util.List scopes) {
+ this.scopes = Optional.of(Objects.requireNonNull(scopes, "scopes is required"));
+ return this;
+ }
+
+ /**
+ * a list of provider-specific OAuth scopes with the permissions your OAuth app
+ * would like to ask for. these may not be set if you are using the ngrok-managed
+ * oauth app (i.e. you must pass both client_id and
+ * client_secret to set scopes)
+ *
+ * @param scopes the value of the scopes parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder scopes(final Optional> scopes) {
+ this.scopes = Objects.requireNonNull(scopes, "scopes is required");
+ return this;
+ }
+
+ /**
+ * a list of email addresses of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailAddresses the value of the email_addresses parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder emailAddresses(final java.util.List emailAddresses) {
+ this.emailAddresses = Optional.of(Objects.requireNonNull(emailAddresses, "emailAddresses is required"));
+ return this;
+ }
+
+ /**
+ * a list of email addresses of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailAddresses the value of the email_addresses parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder emailAddresses(final Optional> emailAddresses) {
+ this.emailAddresses = Objects.requireNonNull(emailAddresses, "emailAddresses is required");
+ return this;
+ }
+
+ /**
+ * a list of email domains of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailDomains the value of the email_domains parameter as a {@link java.util.List}
+ * @return this builder instance
+ */
+ public Builder emailDomains(final java.util.List emailDomains) {
+ this.emailDomains = Optional.of(Objects.requireNonNull(emailDomains, "emailDomains is required"));
+ return this;
+ }
+
+ /**
+ * a list of email domains of users authenticated by identity provider who are
+ * allowed access to the endpoint
+ *
+ * @param emailDomains the value of the email_domains parameter as a {@link java.util.List}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder emailDomains(final Optional> emailDomains) {
+ this.emailDomains = Objects.requireNonNull(emailDomains, "emailDomains is required");
+ return this;
+ }
+
+ /**
+ * Constructs the {@link EndpointOAuthMicrosoft} instance.
+ *
+ * @return a new {@link EndpointOAuthMicrosoft}
+ */
+ public EndpointOAuthMicrosoft build() {
+ return new EndpointOAuthMicrosoft(
+ this.clientId,
+ this.clientSecret,
+ this.scopes.orElse(java.util.Collections.emptyList()),
+ this.emailAddresses.orElse(java.util.Collections.emptyList()),
+ this.emailDomains.orElse(java.util.Collections.emptyList())
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link EndpointOAuthMicrosoft} type.
+ *
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ ) {
+ return new Builder (
+ );
+ }
+
@JsonProperty("client_id")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional clientId;
@JsonProperty("client_secret")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional clientSecret;
@JsonProperty("scopes")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List scopes;
@JsonProperty("email_addresses")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List emailAddresses;
@JsonProperty("email_domains")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final java.util.List emailDomains;
/**
@@ -33,7 +212,7 @@ public class EndpointOAuthMicrosoft {
* @param emailDomains a list of email domains of users authenticated by identity provider who are allowed access to the endpoint
*/
@JsonCreator
- public EndpointOAuthMicrosoft(
+ private EndpointOAuthMicrosoft(
@JsonProperty("client_id") final Optional clientId,
@JsonProperty("client_secret") final Optional clientSecret,
@JsonProperty("scopes") final java.util.List scopes,
diff --git a/src/main/java/com/ngrok/definitions/EndpointOAuthProvider.java b/src/main/java/com/ngrok/definitions/EndpointOAuthProvider.java
index 089a900..5bb8ad9 100644
--- a/src/main/java/com/ngrok/definitions/EndpointOAuthProvider.java
+++ b/src/main/java/com/ngrok/definitions/EndpointOAuthProvider.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,13 +13,144 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointOAuthProvider {
+ /**
+ * Builder class for {@link EndpointOAuthProvider}.
+ */
+ public static class Builder {
+ private Optional github = Optional.empty();
+ private Optional facebook = Optional.empty();
+ private Optional microsoft = Optional.empty();
+ private Optional google = Optional.empty();
+
+ private Builder(
+ ) {
+ }
+
+ /**
+ * configuration for using github as the identity provider
+ *
+ * @param github the value of the github parameter as a {@link EndpointOAuthGitHub}
+ * @return this builder instance
+ */
+ public Builder github(final EndpointOAuthGitHub github) {
+ this.github = Optional.of(Objects.requireNonNull(github, "github is required"));
+ return this;
+ }
+
+ /**
+ * configuration for using github as the identity provider
+ *
+ * @param github the value of the github parameter as a {@link EndpointOAuthGitHub}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder github(final Optional github) {
+ this.github = Objects.requireNonNull(github, "github is required");
+ return this;
+ }
+
+ /**
+ * configuration for using facebook as the identity provider
+ *
+ * @param facebook the value of the facebook parameter as a {@link EndpointOAuthFacebook}
+ * @return this builder instance
+ */
+ public Builder facebook(final EndpointOAuthFacebook facebook) {
+ this.facebook = Optional.of(Objects.requireNonNull(facebook, "facebook is required"));
+ return this;
+ }
+
+ /**
+ * configuration for using facebook as the identity provider
+ *
+ * @param facebook the value of the facebook parameter as a {@link EndpointOAuthFacebook}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder facebook(final Optional facebook) {
+ this.facebook = Objects.requireNonNull(facebook, "facebook is required");
+ return this;
+ }
+
+ /**
+ * configuration for using microsoft as the identity provider
+ *
+ * @param microsoft the value of the microsoft parameter as a {@link EndpointOAuthMicrosoft}
+ * @return this builder instance
+ */
+ public Builder microsoft(final EndpointOAuthMicrosoft microsoft) {
+ this.microsoft = Optional.of(Objects.requireNonNull(microsoft, "microsoft is required"));
+ return this;
+ }
+
+ /**
+ * configuration for using microsoft as the identity provider
+ *
+ * @param microsoft the value of the microsoft parameter as a {@link EndpointOAuthMicrosoft}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder microsoft(final Optional microsoft) {
+ this.microsoft = Objects.requireNonNull(microsoft, "microsoft is required");
+ return this;
+ }
+
+ /**
+ * configuration for using google as the identity provider
+ *
+ * @param google the value of the google parameter as a {@link EndpointOAuthGoogle}
+ * @return this builder instance
+ */
+ public Builder google(final EndpointOAuthGoogle google) {
+ this.google = Optional.of(Objects.requireNonNull(google, "google is required"));
+ return this;
+ }
+
+ /**
+ * configuration for using google as the identity provider
+ *
+ * @param google the value of the google parameter as a {@link EndpointOAuthGoogle}, wrapped in an {@link Optional}
+ * @return this builder instance
+ */
+ public Builder google(final Optional google) {
+ this.google = Objects.requireNonNull(google, "google is required");
+ return this;
+ }
+
+ /**
+ * Constructs the {@link EndpointOAuthProvider} instance.
+ *
+ * @return a new {@link EndpointOAuthProvider}
+ */
+ public EndpointOAuthProvider build() {
+ return new EndpointOAuthProvider(
+ this.github,
+ this.facebook,
+ this.microsoft,
+ this.google
+ );
+ }
+ }
+
+ /**
+ * Creates a new builder for the {@link EndpointOAuthProvider} type.
+ *
+ * @return a new {@link Builder}
+ */
+ public static Builder newBuilder(
+ ) {
+ return new Builder (
+ );
+ }
+
@JsonProperty("github")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional github;
@JsonProperty("facebook")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional facebook;
@JsonProperty("microsoft")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional microsoft;
@JsonProperty("google")
+ @JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional google;
/**
@@ -30,7 +162,7 @@ public class EndpointOAuthProvider {
* @param google configuration for using google as the identity provider
*/
@JsonCreator
- public EndpointOAuthProvider(
+ private EndpointOAuthProvider(
@JsonProperty("github") final Optional github,
@JsonProperty("facebook") final Optional facebook,
@JsonProperty("microsoft") final Optional microsoft,
diff --git a/src/main/java/com/ngrok/definitions/EndpointOidc.java b/src/main/java/com/ngrok/definitions/EndpointOidc.java
index 4b4cd3f..6e3c75e 100644
--- a/src/main/java/com/ngrok/definitions/EndpointOidc.java
+++ b/src/main/java/com/ngrok/definitions/EndpointOidc.java
@@ -2,6 +2,7 @@ package com.ngrok.definitions;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -12,23 +13,291 @@ import java.util.Optional;
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class EndpointOidc {
+ /**
+ * Builder class for {@link EndpointOidc}.
+ */
+ public static class Builder {
+ private Optional enabled = Optional.empty();
+ private Optional optionsPassthrough = Optional.empty();
+ private Optional cookiePrefix = Optional.empty();
+ private Optional inactivityTimeout = Optional.empty();
+ private Optional maximumDuration = Optional.empty();
+ private Optional issuer = Optional.empty();
+ private Optional clientId = Optional.empty();
+ private Optional