From 820ed96b4af178f3f9d28172e79ec9c24a2a2dd2 Mon Sep 17 00:00:00 2001 From: "Brian J. Tarricone" Date: Tue, 28 Sep 2021 08:06:04 +0000 Subject: [PATCH] cut new release for ngrok-api-java --- README.md | 6 +- docs/CNAME | 1 - pom.xml | 37 +- scripts/publish-docs.sh | 10 + src/main/java/com/ngrok/Ngrok.java | 68 ++++ .../com/ngrok/definitions/AbuseReport.java | 8 + .../definitions/AbuseReportHostname.java | 3 + .../java/com/ngrok/definitions/ApiKey.java | 7 + .../com/ngrok/definitions/ApiKeyList.java | 4 + .../java/com/ngrok/definitions/AwsAuth.java | 88 ++++- .../com/ngrok/definitions/AwsCredentials.java | 50 ++- .../java/com/ngrok/definitions/AwsRole.java | 42 ++- .../definitions/CertificateAuthority.java | 12 + .../definitions/CertificateAuthorityList.java | 4 + .../com/ngrok/definitions/Credential.java | 8 + .../com/ngrok/definitions/CredentialList.java | 4 + .../definitions/EndpointCircuitBreaker.java | 200 ++++++++++- .../definitions/EndpointCompression.java | 61 +++- .../definitions/EndpointConfiguration.java | 19 + .../EndpointConfigurationList.java | 4 + .../ngrok/definitions/EndpointIpPolicy.java | 3 + .../definitions/EndpointIpPolicyMutate.java | 88 ++++- .../ngrok/definitions/EndpointLogging.java | 3 + .../definitions/EndpointLoggingMutate.java | 88 ++++- .../ngrok/definitions/EndpointMutualTls.java | 3 + .../definitions/EndpointMutualTlsMutate.java | 88 ++++- .../com/ngrok/definitions/EndpointOAuth.java | 237 ++++++++++++- .../definitions/EndpointOAuthFacebook.java | 181 +++++++++- .../definitions/EndpointOAuthGitHub.java | 239 ++++++++++++- .../definitions/EndpointOAuthGoogle.java | 181 +++++++++- .../definitions/EndpointOAuthMicrosoft.java | 181 +++++++++- .../definitions/EndpointOAuthProvider.java | 134 +++++++- .../com/ngrok/definitions/EndpointOidc.java | 275 ++++++++++++++- .../definitions/EndpointRequestHeaders.java | 115 ++++++- .../definitions/EndpointResponseHeaders.java | 115 ++++++- .../com/ngrok/definitions/EndpointSaml.java | 22 +- .../ngrok/definitions/EndpointSamlMutate.java | 324 +++++++++++++++++- .../definitions/EndpointTlsTermination.java | 125 ++++++- .../EndpointWebhookValidation.java | 126 ++++++- .../ngrok/definitions/EventDestination.java | 8 + .../definitions/EventDestinationList.java | 4 + .../com/ngrok/definitions/EventSource.java | 3 + .../ngrok/definitions/EventSourceList.java | 3 + .../ngrok/definitions/EventSourceReplace.java | 59 +++- .../com/ngrok/definitions/EventStream.java | 12 +- .../ngrok/definitions/EventStreamList.java | 4 + .../ngrok/definitions/EventSubscription.java | 8 + .../definitions/EventSubscriptionList.java | 4 + .../com/ngrok/definitions/EventTarget.java | 109 +++++- .../EventTargetCloudwatchLogs.java | 88 ++++- .../definitions/EventTargetFirehose.java | 88 ++++- .../ngrok/definitions/EventTargetKinesis.java | 86 ++++- .../java/com/ngrok/definitions/IpPolicy.java | 7 + .../com/ngrok/definitions/IpPolicyList.java | 4 + .../com/ngrok/definitions/IpPolicyRule.java | 8 + .../ngrok/definitions/IpPolicyRuleList.java | 4 + .../com/ngrok/definitions/IpRestriction.java | 11 +- .../ngrok/definitions/IpRestrictionList.java | 4 + .../ngrok/definitions/IpWhitelistEntry.java | 7 + .../definitions/IpWhitelistEntryList.java | 4 + src/main/java/com/ngrok/definitions/Ref.java | 3 + .../com/ngrok/definitions/ReservedAddr.java | 9 + .../ngrok/definitions/ReservedAddrList.java | 4 + .../com/ngrok/definitions/ReservedDomain.java | 14 + .../definitions/ReservedDomainCertJob.java | 6 + .../ReservedDomainCertNsTarget.java | 3 + .../definitions/ReservedDomainCertPolicy.java | 88 ++++- .../definitions/ReservedDomainCertStatus.java | 3 + .../ngrok/definitions/ReservedDomainList.java | 4 + .../definitions/SshCertificateAuthority.java | 8 + .../SshCertificateAuthorityList.java | 4 + .../com/ngrok/definitions/SshCredential.java | 8 + .../ngrok/definitions/SshCredentialList.java | 4 + .../ngrok/definitions/SshHostCertificate.java | 13 + .../definitions/SshHostCertificateList.java | 4 + .../ngrok/definitions/SshUserCertificate.java | 15 + .../definitions/SshUserCertificateList.java | 4 + .../com/ngrok/definitions/TlsCertificate.java | 22 ++ .../ngrok/definitions/TlsCertificateList.java | 4 + .../ngrok/definitions/TlsCertificateSaNs.java | 3 + .../java/com/ngrok/definitions/Tunnel.java | 8 + .../com/ngrok/definitions/TunnelList.java | 4 + .../com/ngrok/definitions/TunnelSession.java | 11 + .../ngrok/definitions/TunnelSessionList.java | 4 + .../java/com/ngrok/services/AbuseReports.java | 26 +- src/main/java/com/ngrok/services/ApiKeys.java | 76 ++-- .../services/CertificateAuthorities.java | 76 ++-- .../java/com/ngrok/services/Credentials.java | 88 +++-- .../EndpointCircuitBreakerModule.java | 36 +- .../services/EndpointCompressionModule.java | 36 +- .../services/EndpointConfigurations.java | 176 +++++----- .../services/EndpointIpPolicyModule.java | 36 +- .../ngrok/services/EndpointLoggingModule.java | 36 +- .../services/EndpointMutualTlsModule.java | 36 +- .../ngrok/services/EndpointOAuthModule.java | 36 +- .../ngrok/services/EndpointOidcModule.java | 36 +- .../EndpointRequestHeadersModule.java | 36 +- .../EndpointResponseHeadersModule.java | 36 +- .../ngrok/services/EndpointSamlModule.java | 36 +- .../EndpointTlsTerminationModule.java | 36 +- .../EndpointWebhookValidationModule.java | 36 +- .../com/ngrok/services/EventDestinations.java | 92 ++--- .../java/com/ngrok/services/EventSources.java | 56 +-- .../java/com/ngrok/services/EventStreams.java | 112 +++--- .../ngrok/services/EventSubscriptions.java | 100 +++--- .../java/com/ngrok/services/IpPolicies.java | 76 ++-- .../com/ngrok/services/IpPolicyRules.java | 80 +++-- .../com/ngrok/services/IpRestrictions.java | 92 ++--- .../java/com/ngrok/services/IpWhitelist.java | 80 +++-- .../com/ngrok/services/ReservedAddrs.java | 98 +++--- .../com/ngrok/services/ReservedDomains.java | 152 ++++---- .../services/SshCertificateAuthorities.java | 88 +++-- .../com/ngrok/services/SshCredentials.java | 88 +++-- .../ngrok/services/SshHostCertificates.java | 92 ++--- .../ngrok/services/SshUserCertificates.java | 108 +++--- .../com/ngrok/services/TlsCertificates.java | 76 ++-- .../com/ngrok/services/TunnelSessions.java | 60 ++-- src/main/java/com/ngrok/services/Tunnels.java | 20 +- src/test/java/com/ngrok/ApiKeyTestBase.java | 14 +- .../com/ngrok/EventSubscriptionTestBase.java | 77 +++++ src/test/java/com/ngrok/TestBase.java | 12 +- .../com/ngrok/definitions/ApiKeyTest.java | 5 +- .../java/com/ngrok/services/ApiKeysTest.java | 56 ++- .../services/EventSubscriptionsTest.java | 301 ++++++++++++++++ 124 files changed, 5661 insertions(+), 1087 deletions(-) delete mode 100644 docs/CNAME create mode 100755 scripts/publish-docs.sh create mode 100644 src/test/java/com/ngrok/EventSubscriptionTestBase.java create mode 100644 src/test/java/com/ngrok/services/EventSubscriptionsTest.java 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 clientSecret = Optional.empty(); + private Optional> scopes = 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; + } + + /** + * 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; + } + + /** + * URL of the OIDC "OpenID provider". This is the base URL used for discovery. + * + * @param issuer the value of the issuer parameter as a {@link String} + * @return this builder instance + */ + public Builder issuer(final String issuer) { + this.issuer = Optional.of(Objects.requireNonNull(issuer, "issuer is required")); + return this; + } + + /** + * URL of the OIDC "OpenID provider". This is the base URL used for discovery. + * + * @param issuer the value of the issuer parameter as a {@link String}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder issuer(final Optional issuer) { + this.issuer = Objects.requireNonNull(issuer, "issuer is required"); + return this; + } + + /** + * The OIDC app's client ID and OIDC audience. + * + * @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 OIDC app's client ID and OIDC audience. + * + * @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 OIDC app's client secret. + * + * @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 OIDC app's client secret. + * + * @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; + } + + /** + * The set of scopes to request from the OIDC identity provider. + * + * @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; + } + + /** + * The set of scopes to request from the OIDC identity provider. + * + * @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; + } + + /** + * Constructs the {@link EndpointOidc} instance. + * + * @return a new {@link EndpointOidc} + */ + public EndpointOidc build() { + return new EndpointOidc( + this.enabled, + this.optionsPassthrough.orElse(false), + this.cookiePrefix.orElse(""), + this.inactivityTimeout.orElse(0L), + this.maximumDuration.orElse(java.time.Duration.ZERO), + this.issuer.orElse(""), + this.clientId.orElse(""), + this.clientSecret.orElse(""), + this.scopes.orElse(java.util.Collections.emptyList()) + ); + } + } + + /** + * Creates a new builder for the {@link EndpointOidc} 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("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("issuer") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String issuer; @JsonProperty("client_id") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String clientId; @JsonProperty("client_secret") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String clientSecret; @JsonProperty("scopes") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List scopes; /** @@ -45,11 +314,11 @@ public class EndpointOidc { * @param scopes The set of scopes to request from the OIDC identity provider. */ @JsonCreator - public EndpointOidc( + private EndpointOidc( @JsonProperty("enabled") final Optional enabled, - @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("issuer") final String issuer, @JsonProperty("client_id") final String clientId, diff --git a/src/main/java/com/ngrok/definitions/EndpointRequestHeaders.java b/src/main/java/com/ngrok/definitions/EndpointRequestHeaders.java index 6aeb9af..d17866c 100644 --- a/src/main/java/com/ngrok/definitions/EndpointRequestHeaders.java +++ b/src/main/java/com/ngrok/definitions/EndpointRequestHeaders.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,11 +13,123 @@ import java.util.Optional; */ @JsonIgnoreProperties(ignoreUnknown = true) public class EndpointRequestHeaders { + /** + * Builder class for {@link EndpointRequestHeaders}. + */ + public static class Builder { + private Optional enabled = Optional.empty(); + private Optional> add = Optional.empty(); + private Optional> remove = 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; + } + + /** + * a map of header key to header value that will be injected into the HTTP Request + * before being sent to the upstream application server + * + * @param add the value of the add parameter as a {@link java.util.Map} + * @return this builder instance + */ + public Builder add(final java.util.Map add) { + this.add = Optional.of(Objects.requireNonNull(add, "add is required")); + return this; + } + + /** + * a map of header key to header value that will be injected into the HTTP Request + * before being sent to the upstream application server + * + * @param add the value of the add parameter as a {@link java.util.Map}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder add(final Optional> add) { + this.add = Objects.requireNonNull(add, "add is required"); + return this; + } + + /** + * a list of header names that will be removed from the HTTP Request before being + * sent to the upstream application server + * + * @param remove the value of the remove parameter as a {@link java.util.List} + * @return this builder instance + */ + public Builder remove(final java.util.List remove) { + this.remove = Optional.of(Objects.requireNonNull(remove, "remove is required")); + return this; + } + + /** + * a list of header names that will be removed from the HTTP Request before being + * sent to the upstream application server + * + * @param remove the value of the remove parameter as a {@link java.util.List}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder remove(final Optional> remove) { + this.remove = Objects.requireNonNull(remove, "remove is required"); + return this; + } + + /** + * Constructs the {@link EndpointRequestHeaders} instance. + * + * @return a new {@link EndpointRequestHeaders} + */ + public EndpointRequestHeaders build() { + return new EndpointRequestHeaders( + this.enabled, + this.add.orElse(java.util.Collections.emptyMap()), + this.remove.orElse(java.util.Collections.emptyList()) + ); + } + } + + /** + * Creates a new builder for the {@link EndpointRequestHeaders} 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("add") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.Map add; @JsonProperty("remove") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List remove; /** @@ -27,7 +140,7 @@ public class EndpointRequestHeaders { * @param remove a list of header names that will be removed from the HTTP Request before being sent to the upstream application server */ @JsonCreator - public EndpointRequestHeaders( + private EndpointRequestHeaders( @JsonProperty("enabled") final Optional enabled, @JsonProperty("add") final java.util.Map add, @JsonProperty("remove") final java.util.List remove diff --git a/src/main/java/com/ngrok/definitions/EndpointResponseHeaders.java b/src/main/java/com/ngrok/definitions/EndpointResponseHeaders.java index 215953e..7667356 100644 --- a/src/main/java/com/ngrok/definitions/EndpointResponseHeaders.java +++ b/src/main/java/com/ngrok/definitions/EndpointResponseHeaders.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,11 +13,123 @@ import java.util.Optional; */ @JsonIgnoreProperties(ignoreUnknown = true) public class EndpointResponseHeaders { + /** + * Builder class for {@link EndpointResponseHeaders}. + */ + public static class Builder { + private Optional enabled = Optional.empty(); + private Optional> add = Optional.empty(); + private Optional> remove = 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; + } + + /** + * a map of header key to header value that will be injected into the HTTP Response + * returned to the HTTP client + * + * @param add the value of the add parameter as a {@link java.util.Map} + * @return this builder instance + */ + public Builder add(final java.util.Map add) { + this.add = Optional.of(Objects.requireNonNull(add, "add is required")); + return this; + } + + /** + * a map of header key to header value that will be injected into the HTTP Response + * returned to the HTTP client + * + * @param add the value of the add parameter as a {@link java.util.Map}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder add(final Optional> add) { + this.add = Objects.requireNonNull(add, "add is required"); + return this; + } + + /** + * a list of header names that will be removed from the HTTP Response returned to + * the HTTP client + * + * @param remove the value of the remove parameter as a {@link java.util.List} + * @return this builder instance + */ + public Builder remove(final java.util.List remove) { + this.remove = Optional.of(Objects.requireNonNull(remove, "remove is required")); + return this; + } + + /** + * a list of header names that will be removed from the HTTP Response returned to + * the HTTP client + * + * @param remove the value of the remove parameter as a {@link java.util.List}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder remove(final Optional> remove) { + this.remove = Objects.requireNonNull(remove, "remove is required"); + return this; + } + + /** + * Constructs the {@link EndpointResponseHeaders} instance. + * + * @return a new {@link EndpointResponseHeaders} + */ + public EndpointResponseHeaders build() { + return new EndpointResponseHeaders( + this.enabled, + this.add.orElse(java.util.Collections.emptyMap()), + this.remove.orElse(java.util.Collections.emptyList()) + ); + } + } + + /** + * Creates a new builder for the {@link EndpointResponseHeaders} 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("add") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.Map add; @JsonProperty("remove") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List remove; /** @@ -27,7 +140,7 @@ public class EndpointResponseHeaders { * @param remove a list of header names that will be removed from the HTTP Response returned to the HTTP client */ @JsonCreator - public EndpointResponseHeaders( + private EndpointResponseHeaders( @JsonProperty("enabled") final Optional enabled, @JsonProperty("add") final java.util.Map add, @JsonProperty("remove") final java.util.List remove diff --git a/src/main/java/com/ngrok/definitions/EndpointSaml.java b/src/main/java/com/ngrok/definitions/EndpointSaml.java index a4188a7..1ff385e 100644 --- a/src/main/java/com/ngrok/definitions/EndpointSaml.java +++ b/src/main/java/com/ngrok/definitions/EndpointSaml.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,34 +14,49 @@ import java.util.Optional; @JsonIgnoreProperties(ignoreUnknown = true) public class EndpointSaml { @JsonProperty("enabled") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional enabled; @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("idp_metadata") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String idpMetadata; @JsonProperty("force_authn") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final boolean forceAuthn; @JsonProperty("allow_idp_initiated") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional allowIdpInitiated; @JsonProperty("authorized_groups") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List authorizedGroups; @JsonProperty("entity_id") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String entityId; @JsonProperty("assertion_consumer_service_url") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.net.URI assertionConsumerServiceUrl; @JsonProperty("single_logout_url") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.net.URI singleLogoutUrl; @JsonProperty("request_signing_certificate_pem") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String requestSigningCertificatePem; @JsonProperty("metadata_url") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.net.URI metadataUrl; @JsonProperty("nameid_format") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String nameidFormat; /** @@ -65,12 +81,12 @@ public class EndpointSaml { @JsonCreator public EndpointSaml( @JsonProperty("enabled") final Optional enabled, - @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("idp_metadata") final String idpMetadata, - @JsonProperty("force_authn") final boolean forceAuthn, + @JsonProperty("force_authn") final Boolean forceAuthn, @JsonProperty("allow_idp_initiated") final Optional allowIdpInitiated, @JsonProperty("authorized_groups") final java.util.List authorizedGroups, @JsonProperty("entity_id") final String entityId, diff --git a/src/main/java/com/ngrok/definitions/EndpointSamlMutate.java b/src/main/java/com/ngrok/definitions/EndpointSamlMutate.java index dd511e6..b2a0372 100644 --- a/src/main/java/com/ngrok/definitions/EndpointSamlMutate.java +++ b/src/main/java/com/ngrok/definitions/EndpointSamlMutate.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,25 +13,340 @@ import java.util.Optional; */ @JsonIgnoreProperties(ignoreUnknown = true) public class EndpointSamlMutate { + /** + * Builder class for {@link EndpointSamlMutate}. + */ + 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 idpMetadata = Optional.empty(); + private Optional forceAuthn = Optional.empty(); + private Optional allowIdpInitiated = Optional.empty(); + private Optional> authorizedGroups = Optional.empty(); + private Optional nameidFormat = 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; + } + + /** + * 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; + } + + /** + * The full XML IdP EntityDescriptor. Your IdP may provide this to you as a a file + * to download or as a URL. + * + * @param idpMetadata the value of the idp_metadata parameter as a {@link String} + * @return this builder instance + */ + public Builder idpMetadata(final String idpMetadata) { + this.idpMetadata = Optional.of(Objects.requireNonNull(idpMetadata, "idpMetadata is required")); + return this; + } + + /** + * The full XML IdP EntityDescriptor. Your IdP may provide this to you as a a file + * to download or as a URL. + * + * @param idpMetadata the value of the idp_metadata parameter as a {@link String}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder idpMetadata(final Optional idpMetadata) { + this.idpMetadata = Objects.requireNonNull(idpMetadata, "idpMetadata is required"); + return this; + } + + /** + * If true, indicates that whenever we redirect a user to the IdP for + * authentication that the IdP must prompt the user for authentication credentials + * even if the user already has a valid session with the IdP. + * + * @param forceAuthn the value of the force_authn parameter as a {@link boolean} + * @return this builder instance + */ + public Builder forceAuthn(final boolean forceAuthn) { + this.forceAuthn = Optional.of(Objects.requireNonNull(forceAuthn, "forceAuthn is required")); + return this; + } + + /** + * If true, indicates that whenever we redirect a user to the IdP for + * authentication that the IdP must prompt the user for authentication credentials + * even if the user already has a valid session with the IdP. + * + * @param forceAuthn the value of the force_authn parameter as a {@link boolean}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder forceAuthn(final Optional forceAuthn) { + this.forceAuthn = Objects.requireNonNull(forceAuthn, "forceAuthn is required"); + return this; + } + + /** + * If true, the IdP may initiate a login directly (e.g. the user does not need to + * visit the endpoint first and then be redirected). The IdP should set the + * RelayState parameter to the target URL of the resource they want + * the user to be redirected to after the SAML login assertion has been processed. + * + * @param allowIdpInitiated the value of the allow_idp_initiated parameter as a {@link boolean} + * @return this builder instance + */ + public Builder allowIdpInitiated(final boolean allowIdpInitiated) { + this.allowIdpInitiated = Optional.of(Objects.requireNonNull(allowIdpInitiated, "allowIdpInitiated is required")); + return this; + } + + /** + * If true, the IdP may initiate a login directly (e.g. the user does not need to + * visit the endpoint first and then be redirected). The IdP should set the + * RelayState parameter to the target URL of the resource they want + * the user to be redirected to after the SAML login assertion has been processed. + * + * @param allowIdpInitiated the value of the allow_idp_initiated parameter as a {@link boolean}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder allowIdpInitiated(final Optional allowIdpInitiated) { + this.allowIdpInitiated = Objects.requireNonNull(allowIdpInitiated, "allowIdpInitiated is required"); + return this; + } + + /** + * If present, only users who are a member of one of the listed groups may access + * the target endpoint. + * + * @param authorizedGroups the value of the authorized_groups parameter as a {@link java.util.List} + * @return this builder instance + */ + public Builder authorizedGroups(final java.util.List authorizedGroups) { + this.authorizedGroups = Optional.of(Objects.requireNonNull(authorizedGroups, "authorizedGroups is required")); + return this; + } + + /** + * If present, only users who are a member of one of the listed groups may access + * the target endpoint. + * + * @param authorizedGroups the value of the authorized_groups parameter as a {@link java.util.List}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder authorizedGroups(final Optional> authorizedGroups) { + this.authorizedGroups = Objects.requireNonNull(authorizedGroups, "authorizedGroups is required"); + return this; + } + + /** + * Defines the name identifier format the SP expects the IdP to use in its + * assertions to identify subjects. If unspecified, a default value of + * urn:oasis:names:tc:SAML:2.0:nameid-format:persistent will be used. + * A subset of the allowed values enumerated by the SAML specification are + * supported. + * + * @param nameidFormat the value of the nameid_format parameter as a {@link String} + * @return this builder instance + */ + public Builder nameidFormat(final String nameidFormat) { + this.nameidFormat = Optional.of(Objects.requireNonNull(nameidFormat, "nameidFormat is required")); + return this; + } + + /** + * Defines the name identifier format the SP expects the IdP to use in its + * assertions to identify subjects. If unspecified, a default value of + * urn:oasis:names:tc:SAML:2.0:nameid-format:persistent will be used. + * A subset of the allowed values enumerated by the SAML specification are + * supported. + * + * @param nameidFormat the value of the nameid_format parameter as a {@link String}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder nameidFormat(final Optional nameidFormat) { + this.nameidFormat = Objects.requireNonNull(nameidFormat, "nameidFormat is required"); + return this; + } + + /** + * Constructs the {@link EndpointSamlMutate} instance. + * + * @return a new {@link EndpointSamlMutate} + */ + public EndpointSamlMutate build() { + return new EndpointSamlMutate( + this.enabled, + this.optionsPassthrough.orElse(false), + this.cookiePrefix.orElse(""), + this.inactivityTimeout.orElse(0L), + this.maximumDuration.orElse(java.time.Duration.ZERO), + this.idpMetadata.orElse(""), + this.forceAuthn.orElse(false), + this.allowIdpInitiated, + this.authorizedGroups.orElse(java.util.Collections.emptyList()), + this.nameidFormat.orElse("") + ); + } + } + + /** + * Creates a new builder for the {@link EndpointSamlMutate} 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("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("idp_metadata") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String idpMetadata; @JsonProperty("force_authn") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final boolean forceAuthn; @JsonProperty("allow_idp_initiated") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional allowIdpInitiated; @JsonProperty("authorized_groups") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List authorizedGroups; @JsonProperty("nameid_format") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String nameidFormat; /** @@ -48,14 +364,14 @@ public class EndpointSamlMutate { * @param nameidFormat Defines the name identifier format the SP expects the IdP to use in its assertions to identify subjects. If unspecified, a default value of urn:oasis:names:tc:SAML:2.0:nameid-format:persistent will be used. A subset of the allowed values enumerated by the SAML specification are supported. */ @JsonCreator - public EndpointSamlMutate( + private EndpointSamlMutate( @JsonProperty("enabled") final Optional enabled, - @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("idp_metadata") final String idpMetadata, - @JsonProperty("force_authn") final boolean forceAuthn, + @JsonProperty("force_authn") final Boolean forceAuthn, @JsonProperty("allow_idp_initiated") final Optional allowIdpInitiated, @JsonProperty("authorized_groups") final java.util.List authorizedGroups, @JsonProperty("nameid_format") final String nameidFormat diff --git a/src/main/java/com/ngrok/definitions/EndpointTlsTermination.java b/src/main/java/com/ngrok/definitions/EndpointTlsTermination.java index cdb8067..5e4a3eb 100644 --- a/src/main/java/com/ngrok/definitions/EndpointTlsTermination.java +++ b/src/main/java/com/ngrok/definitions/EndpointTlsTermination.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,11 +13,133 @@ import java.util.Optional; */ @JsonIgnoreProperties(ignoreUnknown = true) public class EndpointTlsTermination { + /** + * Builder class for {@link EndpointTlsTermination}. + */ + public static class Builder { + private Optional enabled = Optional.empty(); + private Optional terminateAt = Optional.empty(); + private Optional minVersion = 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; + } + + /** + * edge if the ngrok edge should terminate TLS traffic, + * upstream if TLS traffic should be passed through to the upstream + * ngrok agent / application server for termination. if upstream is + * chosen, most other modules will be disallowed because they rely on the ngrok + * edge being able to access the underlying traffic. + * + * @param terminateAt the value of the terminate_at parameter as a {@link String} + * @return this builder instance + */ + public Builder terminateAt(final String terminateAt) { + this.terminateAt = Optional.of(Objects.requireNonNull(terminateAt, "terminateAt is required")); + return this; + } + + /** + * edge if the ngrok edge should terminate TLS traffic, + * upstream if TLS traffic should be passed through to the upstream + * ngrok agent / application server for termination. if upstream is + * chosen, most other modules will be disallowed because they rely on the ngrok + * edge being able to access the underlying traffic. + * + * @param terminateAt the value of the terminate_at parameter as a {@link String}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder terminateAt(final Optional terminateAt) { + this.terminateAt = Objects.requireNonNull(terminateAt, "terminateAt is required"); + return this; + } + + /** + * The minimum TLS version used for termination and advertised to the client during + * the TLS handshake. if unspecified, ngrok will choose an industry-safe default. + * This value must be null if terminate_at is set to + * upstream. + * + * @param minVersion the value of the min_version parameter as a {@link String} + * @return this builder instance + */ + public Builder minVersion(final String minVersion) { + this.minVersion = Optional.of(Objects.requireNonNull(minVersion, "minVersion is required")); + return this; + } + + /** + * The minimum TLS version used for termination and advertised to the client during + * the TLS handshake. if unspecified, ngrok will choose an industry-safe default. + * This value must be null if terminate_at is set to + * upstream. + * + * @param minVersion the value of the min_version parameter as a {@link String}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder minVersion(final Optional minVersion) { + this.minVersion = Objects.requireNonNull(minVersion, "minVersion is required"); + return this; + } + + /** + * Constructs the {@link EndpointTlsTermination} instance. + * + * @return a new {@link EndpointTlsTermination} + */ + public EndpointTlsTermination build() { + return new EndpointTlsTermination( + this.enabled, + this.terminateAt.orElse(""), + this.minVersion + ); + } + } + + /** + * Creates a new builder for the {@link EndpointTlsTermination} 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("terminate_at") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String terminateAt; @JsonProperty("min_version") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional minVersion; /** @@ -27,7 +150,7 @@ public class EndpointTlsTermination { * @param minVersion The minimum TLS version used for termination and advertised to the client during the TLS handshake. if unspecified, ngrok will choose an industry-safe default. This value must be null if terminate_at is set to upstream. */ @JsonCreator - public EndpointTlsTermination( + private EndpointTlsTermination( @JsonProperty("enabled") final Optional enabled, @JsonProperty("terminate_at") final String terminateAt, @JsonProperty("min_version") final Optional minVersion diff --git a/src/main/java/com/ngrok/definitions/EndpointWebhookValidation.java b/src/main/java/com/ngrok/definitions/EndpointWebhookValidation.java index 8f3cb7b..ae6e70d 100644 --- a/src/main/java/com/ngrok/definitions/EndpointWebhookValidation.java +++ b/src/main/java/com/ngrok/definitions/EndpointWebhookValidation.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,22 +13,140 @@ import java.util.Optional; */ @JsonIgnoreProperties(ignoreUnknown = true) public class EndpointWebhookValidation { + /** + * Builder class for {@link EndpointWebhookValidation}. + */ + public static class Builder { + private Optional enabled = Optional.empty(); + private Optional provider = Optional.empty(); + private Optional secret = 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; + } + + /** + * a string indicating which webhook provider will be sending webhooks to this + * endpoint. Value must be one of the supported providers: SLACK, + * SNS, STRIPE, GITHUB, TWILIO, + * SHOPIFY, GITLAB, INTERCOM, + * SENDGRID. + * + * @param provider the value of the provider parameter as a {@link String} + * @return this builder instance + */ + public Builder provider(final String provider) { + this.provider = Optional.of(Objects.requireNonNull(provider, "provider is required")); + return this; + } + + /** + * a string indicating which webhook provider will be sending webhooks to this + * endpoint. Value must be one of the supported providers: SLACK, + * SNS, STRIPE, GITHUB, TWILIO, + * SHOPIFY, GITLAB, INTERCOM, + * SENDGRID. + * + * @param provider the value of the provider parameter as a {@link String}, 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; + } + + /** + * a string secret used to validate requests from the given provider. All providers + * except AWS SNS require a secret + * + * @param secret the value of the secret parameter as a {@link String} + * @return this builder instance + */ + public Builder secret(final String secret) { + this.secret = Optional.of(Objects.requireNonNull(secret, "secret is required")); + return this; + } + + /** + * a string secret used to validate requests from the given provider. All providers + * except AWS SNS require a secret + * + * @param secret the value of the secret parameter as a {@link String}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder secret(final Optional secret) { + this.secret = Objects.requireNonNull(secret, "secret is required"); + return this; + } + + /** + * Constructs the {@link EndpointWebhookValidation} instance. + * + * @return a new {@link EndpointWebhookValidation} + */ + public EndpointWebhookValidation build() { + return new EndpointWebhookValidation( + this.enabled, + this.provider.orElse(""), + this.secret.orElse("") + ); + } + } + + /** + * Creates a new builder for the {@link EndpointWebhookValidation} 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 String provider; @JsonProperty("secret") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String secret; /** * Creates a new instance of {@link EndpointWebhookValidation}. * * @param enabled true if the module will be applied to traffic, false to disable. default true if unspecified - * @param provider a string indicating which webhook provider will be sending webhooks to this endpoint. Value must be one of the supported providers: SLACK, SNS, STRIPE, GITHUB, TWILIO, SHOPIFY, GITLAB, INTERCOM. + * @param provider a string indicating which webhook provider will be sending webhooks to this endpoint. Value must be one of the supported providers: SLACK, SNS, STRIPE, GITHUB, TWILIO, SHOPIFY, GITLAB, INTERCOM, SENDGRID. * @param secret a string secret used to validate requests from the given provider. All providers except AWS SNS require a secret */ @JsonCreator - public EndpointWebhookValidation( + private EndpointWebhookValidation( @JsonProperty("enabled") final Optional enabled, @JsonProperty("provider") final String provider, @JsonProperty("secret") final String secret @@ -51,7 +170,8 @@ public class EndpointWebhookValidation { * a string indicating which webhook provider will be sending webhooks to this * endpoint. Value must be one of the supported providers: SLACK, * SNS, STRIPE, GITHUB, TWILIO, - * SHOPIFY, GITLAB, INTERCOM. + * SHOPIFY, GITLAB, INTERCOM, + * SENDGRID. * * @return the value of the property as a {@link String} */ diff --git a/src/main/java/com/ngrok/definitions/EventDestination.java b/src/main/java/com/ngrok/definitions/EventDestination.java index 5090d74..a21c346 100644 --- a/src/main/java/com/ngrok/definitions/EventDestination.java +++ b/src/main/java/com/ngrok/definitions/EventDestination.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 EventDestination { @JsonProperty("id") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String id; @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("description") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String description; @JsonProperty("format") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String format; @JsonProperty("target") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final EventTarget target; @JsonProperty("uri") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.net.URI uri; /** diff --git a/src/main/java/com/ngrok/definitions/EventDestinationList.java b/src/main/java/com/ngrok/definitions/EventDestinationList.java index 6f20cef..d47ed25 100644 --- a/src/main/java/com/ngrok/definitions/EventDestinationList.java +++ b/src/main/java/com/ngrok/definitions/EventDestinationList.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 EventDestinationList implements Pageable { @JsonProperty("event_destinations") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List eventDestinations; @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/EventSource.java b/src/main/java/com/ngrok/definitions/EventSource.java index 172acdc..9b50f43 100644 --- a/src/main/java/com/ngrok/definitions/EventSource.java +++ b/src/main/java/com/ngrok/definitions/EventSource.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 EventSource { @JsonProperty("type") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String type; @JsonProperty("uri") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.net.URI uri; /** diff --git a/src/main/java/com/ngrok/definitions/EventSourceList.java b/src/main/java/com/ngrok/definitions/EventSourceList.java index dc55cbb..49d4d62 100644 --- a/src/main/java/com/ngrok/definitions/EventSourceList.java +++ b/src/main/java/com/ngrok/definitions/EventSourceList.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 EventSourceList { @JsonProperty("sources") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List sources; @JsonProperty("uri") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.net.URI uri; /** diff --git a/src/main/java/com/ngrok/definitions/EventSourceReplace.java b/src/main/java/com/ngrok/definitions/EventSourceReplace.java index a944f6c..083a9af 100644 --- a/src/main/java/com/ngrok/definitions/EventSourceReplace.java +++ b/src/main/java/com/ngrok/definitions/EventSourceReplace.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,63 @@ import java.util.Optional; */ @JsonIgnoreProperties(ignoreUnknown = true) public class EventSourceReplace { + /** + * Builder class for {@link EventSourceReplace}. + */ + public static class Builder { + private Optional type = Optional.empty(); + + private Builder( + ) { + } + + /** + * Type of event for which an event subscription will trigger + * + * @param type the value of the type parameter as a {@link String} + * @return this builder instance + */ + public Builder type(final String type) { + this.type = Optional.of(Objects.requireNonNull(type, "type is required")); + return this; + } + + /** + * Type of event for which an event subscription will trigger + * + * @param type the value of the type parameter as a {@link String}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder type(final Optional type) { + this.type = Objects.requireNonNull(type, "type is required"); + return this; + } + + /** + * Constructs the {@link EventSourceReplace} instance. + * + * @return a new {@link EventSourceReplace} + */ + public EventSourceReplace build() { + return new EventSourceReplace( + this.type.orElse("") + ); + } + } + + /** + * Creates a new builder for the {@link EventSourceReplace} type. + * + * @return a new {@link Builder} + */ + public static Builder newBuilder( + ) { + return new Builder ( + ); + } + @JsonProperty("type") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String type; /** @@ -21,7 +78,7 @@ public class EventSourceReplace { * @param type Type of event for which an event subscription will trigger */ @JsonCreator - public EventSourceReplace( + private EventSourceReplace( @JsonProperty("type") final String type ) { this.type = Objects.requireNonNull(type, "type is required"); diff --git a/src/main/java/com/ngrok/definitions/EventStream.java b/src/main/java/com/ngrok/definitions/EventStream.java index 887e4d6..cbe8437 100644 --- a/src/main/java/com/ngrok/definitions/EventStream.java +++ b/src/main/java/com/ngrok/definitions/EventStream.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,22 +14,31 @@ import java.util.Optional; @JsonIgnoreProperties(ignoreUnknown = true) public class EventStream { @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("metadata") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String metadata; @JsonProperty("description") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String description; @JsonProperty("fields") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List fields; @JsonProperty("event_type") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String eventType; @JsonProperty("destination_ids") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List destinationIds; @JsonProperty("sampling_rate") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final double samplingRate; /** @@ -54,7 +64,7 @@ public class EventStream { @JsonProperty("fields") final java.util.List fields, @JsonProperty("event_type") final String eventType, @JsonProperty("destination_ids") final java.util.List destinationIds, - @JsonProperty("sampling_rate") final double samplingRate + @JsonProperty("sampling_rate") final Double samplingRate ) { this.id = Objects.requireNonNull(id, "id is required"); this.uri = Objects.requireNonNull(uri, "uri is required"); diff --git a/src/main/java/com/ngrok/definitions/EventStreamList.java b/src/main/java/com/ngrok/definitions/EventStreamList.java index e705e4f..792bf31 100644 --- a/src/main/java/com/ngrok/definitions/EventStreamList.java +++ b/src/main/java/com/ngrok/definitions/EventStreamList.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 EventStreamList implements Pageable { @JsonProperty("event_streams") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List eventStreams; @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/EventSubscription.java b/src/main/java/com/ngrok/definitions/EventSubscription.java index c4fe0b3..21f46e2 100644 --- a/src/main/java/com/ngrok/definitions/EventSubscription.java +++ b/src/main/java/com/ngrok/definitions/EventSubscription.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 EventSubscription { @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("metadata") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String metadata; @JsonProperty("description") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String description; @JsonProperty("sources") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List sources; @JsonProperty("destinations") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List destinations; /** diff --git a/src/main/java/com/ngrok/definitions/EventSubscriptionList.java b/src/main/java/com/ngrok/definitions/EventSubscriptionList.java index abde834..6a8ff3e 100644 --- a/src/main/java/com/ngrok/definitions/EventSubscriptionList.java +++ b/src/main/java/com/ngrok/definitions/EventSubscriptionList.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 EventSubscriptionList implements Pageable { @JsonProperty("event_subscriptions") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List eventSubscriptions; @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/EventTarget.java b/src/main/java/com/ngrok/definitions/EventTarget.java index f536ba7..0afeae6 100644 --- a/src/main/java/com/ngrok/definitions/EventTarget.java +++ b/src/main/java/com/ngrok/definitions/EventTarget.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,11 +13,117 @@ import java.util.Optional; */ @JsonIgnoreProperties(ignoreUnknown = true) public class EventTarget { + /** + * Builder class for {@link EventTarget}. + */ + public static class Builder { + private Optional firehose = Optional.empty(); + private Optional kinesis = Optional.empty(); + private Optional cloudwatchLogs = Optional.empty(); + + private Builder( + ) { + } + + /** + * Configuration used to send events to Amazon Kinesis Data Firehose. + * + * @param firehose the value of the firehose parameter as a {@link EventTargetFirehose} + * @return this builder instance + */ + public Builder firehose(final EventTargetFirehose firehose) { + this.firehose = Optional.of(Objects.requireNonNull(firehose, "firehose is required")); + return this; + } + + /** + * Configuration used to send events to Amazon Kinesis Data Firehose. + * + * @param firehose the value of the firehose parameter as a {@link EventTargetFirehose}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder firehose(final Optional firehose) { + this.firehose = Objects.requireNonNull(firehose, "firehose is required"); + return this; + } + + /** + * Configuration used to send events to Amazon Kinesis. + * + * @param kinesis the value of the kinesis parameter as a {@link EventTargetKinesis} + * @return this builder instance + */ + public Builder kinesis(final EventTargetKinesis kinesis) { + this.kinesis = Optional.of(Objects.requireNonNull(kinesis, "kinesis is required")); + return this; + } + + /** + * Configuration used to send events to Amazon Kinesis. + * + * @param kinesis the value of the kinesis parameter as a {@link EventTargetKinesis}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder kinesis(final Optional kinesis) { + this.kinesis = Objects.requireNonNull(kinesis, "kinesis is required"); + return this; + } + + /** + * Configuration used to send events to Amazon CloudWatch Logs. + * + * @param cloudwatchLogs the value of the cloudwatch_logs parameter as a {@link EventTargetCloudwatchLogs} + * @return this builder instance + */ + public Builder cloudwatchLogs(final EventTargetCloudwatchLogs cloudwatchLogs) { + this.cloudwatchLogs = Optional.of(Objects.requireNonNull(cloudwatchLogs, "cloudwatchLogs is required")); + return this; + } + + /** + * Configuration used to send events to Amazon CloudWatch Logs. + * + * @param cloudwatchLogs the value of the cloudwatch_logs parameter as a {@link EventTargetCloudwatchLogs}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder cloudwatchLogs(final Optional cloudwatchLogs) { + this.cloudwatchLogs = Objects.requireNonNull(cloudwatchLogs, "cloudwatchLogs is required"); + return this; + } + + /** + * Constructs the {@link EventTarget} instance. + * + * @return a new {@link EventTarget} + */ + public EventTarget build() { + return new EventTarget( + this.firehose, + this.kinesis, + this.cloudwatchLogs + ); + } + } + + /** + * Creates a new builder for the {@link EventTarget} type. + * + * @return a new {@link Builder} + */ + public static Builder newBuilder( + ) { + return new Builder ( + ); + } + @JsonProperty("firehose") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional firehose; @JsonProperty("kinesis") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional kinesis; @JsonProperty("cloudwatch_logs") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional cloudwatchLogs; /** @@ -27,7 +134,7 @@ public class EventTarget { * @param cloudwatchLogs Configuration used to send events to Amazon CloudWatch Logs. */ @JsonCreator - public EventTarget( + private EventTarget( @JsonProperty("firehose") final Optional firehose, @JsonProperty("kinesis") final Optional kinesis, @JsonProperty("cloudwatch_logs") final Optional cloudwatchLogs diff --git a/src/main/java/com/ngrok/definitions/EventTargetCloudwatchLogs.java b/src/main/java/com/ngrok/definitions/EventTargetCloudwatchLogs.java index 05e6e0e..749f8e7 100644 --- a/src/main/java/com/ngrok/definitions/EventTargetCloudwatchLogs.java +++ b/src/main/java/com/ngrok/definitions/EventTargetCloudwatchLogs.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 EventTargetCloudwatchLogs { + /** + * Builder class for {@link EventTargetCloudwatchLogs}. + */ + public static class Builder { + private Optional auth = Optional.empty(); + private Optional logGroupArn = Optional.empty(); + + private Builder( + ) { + } + + /** + * Configuration for how to authenticate into your AWS account. Exactly one of + * role or creds should be configured. + * + * @param auth the value of the auth parameter as a {@link AwsAuth} + * @return this builder instance + */ + public Builder auth(final AwsAuth auth) { + this.auth = Optional.of(Objects.requireNonNull(auth, "auth is required")); + return this; + } + + /** + * Configuration for how to authenticate into your AWS account. Exactly one of + * role or creds should be configured. + * + * @param auth the value of the auth parameter as a {@link AwsAuth}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder auth(final Optional auth) { + this.auth = Objects.requireNonNull(auth, "auth is required"); + return this; + } + + /** + * An Amazon Resource Name specifying the CloudWatch Logs group to deposit events + * into. + * + * @param logGroupArn the value of the log_group_arn parameter as a {@link String} + * @return this builder instance + */ + public Builder logGroupArn(final String logGroupArn) { + this.logGroupArn = Optional.of(Objects.requireNonNull(logGroupArn, "logGroupArn is required")); + return this; + } + + /** + * An Amazon Resource Name specifying the CloudWatch Logs group to deposit events + * into. + * + * @param logGroupArn the value of the log_group_arn parameter as a {@link String}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder logGroupArn(final Optional logGroupArn) { + this.logGroupArn = Objects.requireNonNull(logGroupArn, "logGroupArn is required"); + return this; + } + + /** + * Constructs the {@link EventTargetCloudwatchLogs} instance. + * + * @return a new {@link EventTargetCloudwatchLogs} + */ + public EventTargetCloudwatchLogs build() { + return new EventTargetCloudwatchLogs( + this.auth.orElse(null), + this.logGroupArn.orElse("") + ); + } + } + + /** + * Creates a new builder for the {@link EventTargetCloudwatchLogs} type. + * + * @return a new {@link Builder} + */ + public static Builder newBuilder( + ) { + return new Builder ( + ); + } + @JsonProperty("auth") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final AwsAuth auth; @JsonProperty("log_group_arn") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String logGroupArn; /** @@ -24,7 +110,7 @@ public class EventTargetCloudwatchLogs { * @param logGroupArn An Amazon Resource Name specifying the CloudWatch Logs group to deposit events into. */ @JsonCreator - public EventTargetCloudwatchLogs( + private EventTargetCloudwatchLogs( @JsonProperty("auth") final AwsAuth auth, @JsonProperty("log_group_arn") final String logGroupArn ) { diff --git a/src/main/java/com/ngrok/definitions/EventTargetFirehose.java b/src/main/java/com/ngrok/definitions/EventTargetFirehose.java index 92685ef..16f8331 100644 --- a/src/main/java/com/ngrok/definitions/EventTargetFirehose.java +++ b/src/main/java/com/ngrok/definitions/EventTargetFirehose.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 EventTargetFirehose { + /** + * Builder class for {@link EventTargetFirehose}. + */ + public static class Builder { + private Optional auth = Optional.empty(); + private Optional deliveryStreamArn = Optional.empty(); + + private Builder( + ) { + } + + /** + * Configuration for how to authenticate into your AWS account. Exactly one of + * role or creds should be configured. + * + * @param auth the value of the auth parameter as a {@link AwsAuth} + * @return this builder instance + */ + public Builder auth(final AwsAuth auth) { + this.auth = Optional.of(Objects.requireNonNull(auth, "auth is required")); + return this; + } + + /** + * Configuration for how to authenticate into your AWS account. Exactly one of + * role or creds should be configured. + * + * @param auth the value of the auth parameter as a {@link AwsAuth}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder auth(final Optional auth) { + this.auth = Objects.requireNonNull(auth, "auth is required"); + return this; + } + + /** + * An Amazon Resource Name specifying the Firehose delivery stream to deposit + * events into. + * + * @param deliveryStreamArn the value of the delivery_stream_arn parameter as a {@link String} + * @return this builder instance + */ + public Builder deliveryStreamArn(final String deliveryStreamArn) { + this.deliveryStreamArn = Optional.of(Objects.requireNonNull(deliveryStreamArn, "deliveryStreamArn is required")); + return this; + } + + /** + * An Amazon Resource Name specifying the Firehose delivery stream to deposit + * events into. + * + * @param deliveryStreamArn the value of the delivery_stream_arn parameter as a {@link String}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder deliveryStreamArn(final Optional deliveryStreamArn) { + this.deliveryStreamArn = Objects.requireNonNull(deliveryStreamArn, "deliveryStreamArn is required"); + return this; + } + + /** + * Constructs the {@link EventTargetFirehose} instance. + * + * @return a new {@link EventTargetFirehose} + */ + public EventTargetFirehose build() { + return new EventTargetFirehose( + this.auth.orElse(null), + this.deliveryStreamArn.orElse("") + ); + } + } + + /** + * Creates a new builder for the {@link EventTargetFirehose} type. + * + * @return a new {@link Builder} + */ + public static Builder newBuilder( + ) { + return new Builder ( + ); + } + @JsonProperty("auth") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final AwsAuth auth; @JsonProperty("delivery_stream_arn") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String deliveryStreamArn; /** @@ -24,7 +110,7 @@ public class EventTargetFirehose { * @param deliveryStreamArn An Amazon Resource Name specifying the Firehose delivery stream to deposit events into. */ @JsonCreator - public EventTargetFirehose( + private EventTargetFirehose( @JsonProperty("auth") final AwsAuth auth, @JsonProperty("delivery_stream_arn") final String deliveryStreamArn ) { diff --git a/src/main/java/com/ngrok/definitions/EventTargetKinesis.java b/src/main/java/com/ngrok/definitions/EventTargetKinesis.java index 3fac724..bd049e1 100644 --- a/src/main/java/com/ngrok/definitions/EventTargetKinesis.java +++ b/src/main/java/com/ngrok/definitions/EventTargetKinesis.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,92 @@ import java.util.Optional; */ @JsonIgnoreProperties(ignoreUnknown = true) public class EventTargetKinesis { + /** + * Builder class for {@link EventTargetKinesis}. + */ + public static class Builder { + private Optional auth = Optional.empty(); + private Optional streamArn = Optional.empty(); + + private Builder( + ) { + } + + /** + * Configuration for how to authenticate into your AWS account. Exactly one of + * role or creds should be configured. + * + * @param auth the value of the auth parameter as a {@link AwsAuth} + * @return this builder instance + */ + public Builder auth(final AwsAuth auth) { + this.auth = Optional.of(Objects.requireNonNull(auth, "auth is required")); + return this; + } + + /** + * Configuration for how to authenticate into your AWS account. Exactly one of + * role or creds should be configured. + * + * @param auth the value of the auth parameter as a {@link AwsAuth}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder auth(final Optional auth) { + this.auth = Objects.requireNonNull(auth, "auth is required"); + return this; + } + + /** + * An Amazon Resource Name specifying the Kinesis stream to deposit events into. + * + * @param streamArn the value of the stream_arn parameter as a {@link String} + * @return this builder instance + */ + public Builder streamArn(final String streamArn) { + this.streamArn = Optional.of(Objects.requireNonNull(streamArn, "streamArn is required")); + return this; + } + + /** + * An Amazon Resource Name specifying the Kinesis stream to deposit events into. + * + * @param streamArn the value of the stream_arn parameter as a {@link String}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder streamArn(final Optional streamArn) { + this.streamArn = Objects.requireNonNull(streamArn, "streamArn is required"); + return this; + } + + /** + * Constructs the {@link EventTargetKinesis} instance. + * + * @return a new {@link EventTargetKinesis} + */ + public EventTargetKinesis build() { + return new EventTargetKinesis( + this.auth.orElse(null), + this.streamArn.orElse("") + ); + } + } + + /** + * Creates a new builder for the {@link EventTargetKinesis} type. + * + * @return a new {@link Builder} + */ + public static Builder newBuilder( + ) { + return new Builder ( + ); + } + @JsonProperty("auth") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final AwsAuth auth; @JsonProperty("stream_arn") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String streamArn; /** @@ -24,7 +108,7 @@ public class EventTargetKinesis { * @param streamArn An Amazon Resource Name specifying the Kinesis stream to deposit events into. */ @JsonCreator - public EventTargetKinesis( + private EventTargetKinesis( @JsonProperty("auth") final AwsAuth auth, @JsonProperty("stream_arn") final String streamArn ) { diff --git a/src/main/java/com/ngrok/definitions/IpPolicy.java b/src/main/java/com/ngrok/definitions/IpPolicy.java index fc5c03f..68989b4 100644 --- a/src/main/java/com/ngrok/definitions/IpPolicy.java +++ b/src/main/java/com/ngrok/definitions/IpPolicy.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 IpPolicy { @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("action") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String action; /** diff --git a/src/main/java/com/ngrok/definitions/IpPolicyList.java b/src/main/java/com/ngrok/definitions/IpPolicyList.java index 0e9b7ed..3bbd325 100644 --- a/src/main/java/com/ngrok/definitions/IpPolicyList.java +++ b/src/main/java/com/ngrok/definitions/IpPolicyList.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 IpPolicyList implements Pageable { @JsonProperty("ip_policies") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List ipPolicies; @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/IpPolicyRule.java b/src/main/java/com/ngrok/definitions/IpPolicyRule.java index b8e4a3f..f0185ec 100644 --- a/src/main/java/com/ngrok/definitions/IpPolicyRule.java +++ b/src/main/java/com/ngrok/definitions/IpPolicyRule.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 IpPolicyRule { @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("cidr") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String cidr; @JsonProperty("ip_policy") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Ref ipPolicy; /** diff --git a/src/main/java/com/ngrok/definitions/IpPolicyRuleList.java b/src/main/java/com/ngrok/definitions/IpPolicyRuleList.java index f3f33e3..3e8ee86 100644 --- a/src/main/java/com/ngrok/definitions/IpPolicyRuleList.java +++ b/src/main/java/com/ngrok/definitions/IpPolicyRuleList.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 IpPolicyRuleList implements Pageable { @JsonProperty("ip_policy_rules") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List ipPolicyRules; @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/IpRestriction.java b/src/main/java/com/ngrok/definitions/IpRestriction.java index c378370..24860a1 100644 --- a/src/main/java/com/ngrok/definitions/IpRestriction.java +++ b/src/main/java/com/ngrok/definitions/IpRestriction.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,20 +14,28 @@ import java.util.Optional; @JsonIgnoreProperties(ignoreUnknown = true) public class IpRestriction { @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("enforced") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final boolean enforced; @JsonProperty("type") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String type; @JsonProperty("ip_policies") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List ipPolicies; /** @@ -48,7 +57,7 @@ public class IpRestriction { @JsonProperty("created_at") final java.time.OffsetDateTime createdAt, @JsonProperty("description") final String description, @JsonProperty("metadata") final String metadata, - @JsonProperty("enforced") final boolean enforced, + @JsonProperty("enforced") final Boolean enforced, @JsonProperty("type") final String type, @JsonProperty("ip_policies") final java.util.List ipPolicies ) { diff --git a/src/main/java/com/ngrok/definitions/IpRestrictionList.java b/src/main/java/com/ngrok/definitions/IpRestrictionList.java index 1e93430..591978a 100644 --- a/src/main/java/com/ngrok/definitions/IpRestrictionList.java +++ b/src/main/java/com/ngrok/definitions/IpRestrictionList.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 IpRestrictionList implements Pageable { @JsonProperty("ip_restrictions") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List ipRestrictions; @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/IpWhitelistEntry.java b/src/main/java/com/ngrok/definitions/IpWhitelistEntry.java index 6acb26f..81f85dc 100644 --- a/src/main/java/com/ngrok/definitions/IpWhitelistEntry.java +++ b/src/main/java/com/ngrok/definitions/IpWhitelistEntry.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 IpWhitelistEntry { @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("ip_net") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String ipNet; /** diff --git a/src/main/java/com/ngrok/definitions/IpWhitelistEntryList.java b/src/main/java/com/ngrok/definitions/IpWhitelistEntryList.java index 4c63c20..33e924b 100644 --- a/src/main/java/com/ngrok/definitions/IpWhitelistEntryList.java +++ b/src/main/java/com/ngrok/definitions/IpWhitelistEntryList.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 IpWhitelistEntryList implements Pageable { @JsonProperty("whitelist") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List whitelist; @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/Ref.java b/src/main/java/com/ngrok/definitions/Ref.java index a7a34b5..75ee6e4 100644 --- a/src/main/java/com/ngrok/definitions/Ref.java +++ b/src/main/java/com/ngrok/definitions/Ref.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 Ref { @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; /** diff --git a/src/main/java/com/ngrok/definitions/ReservedAddr.java b/src/main/java/com/ngrok/definitions/ReservedAddr.java index 76acabc..c8391bf 100644 --- a/src/main/java/com/ngrok/definitions/ReservedAddr.java +++ b/src/main/java/com/ngrok/definitions/ReservedAddr.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,20 +14,28 @@ import java.util.Optional; @JsonIgnoreProperties(ignoreUnknown = true) public class ReservedAddr { @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("addr") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String addr; @JsonProperty("region") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String region; @JsonProperty("endpoint_configuration") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional endpointConfiguration; /** diff --git a/src/main/java/com/ngrok/definitions/ReservedAddrList.java b/src/main/java/com/ngrok/definitions/ReservedAddrList.java index 2435913..78e546c 100644 --- a/src/main/java/com/ngrok/definitions/ReservedAddrList.java +++ b/src/main/java/com/ngrok/definitions/ReservedAddrList.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 ReservedAddrList implements Pageable { @JsonProperty("reserved_addrs") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List reservedAddrs; @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/ReservedDomain.java b/src/main/java/com/ngrok/definitions/ReservedDomain.java index 9015a3b..ac3783b 100644 --- a/src/main/java/com/ngrok/definitions/ReservedDomain.java +++ b/src/main/java/com/ngrok/definitions/ReservedDomain.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,30 +14,43 @@ import java.util.Optional; @JsonIgnoreProperties(ignoreUnknown = true) public class ReservedDomain { @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("domain") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String domain; @JsonProperty("region") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String region; @JsonProperty("cname_target") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional cnameTarget; @JsonProperty("http_endpoint_configuration") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional httpEndpointConfiguration; @JsonProperty("https_endpoint_configuration") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional httpsEndpointConfiguration; @JsonProperty("certificate") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional certificate; @JsonProperty("certificate_management_policy") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional certificateManagementPolicy; @JsonProperty("certificate_management_status") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional certificateManagementStatus; /** diff --git a/src/main/java/com/ngrok/definitions/ReservedDomainCertJob.java b/src/main/java/com/ngrok/definitions/ReservedDomainCertJob.java index 409894d..bdad921 100644 --- a/src/main/java/com/ngrok/definitions/ReservedDomainCertJob.java +++ b/src/main/java/com/ngrok/definitions/ReservedDomainCertJob.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,14 +14,19 @@ import java.util.Optional; @JsonIgnoreProperties(ignoreUnknown = true) public class ReservedDomainCertJob { @JsonProperty("error_code") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional errorCode; @JsonProperty("msg") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String msg; @JsonProperty("started_at") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.time.OffsetDateTime startedAt; @JsonProperty("retries_at") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional retriesAt; @JsonProperty("ns_targets") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List nsTargets; /** diff --git a/src/main/java/com/ngrok/definitions/ReservedDomainCertNsTarget.java b/src/main/java/com/ngrok/definitions/ReservedDomainCertNsTarget.java index 4c7ed24..6624429 100644 --- a/src/main/java/com/ngrok/definitions/ReservedDomainCertNsTarget.java +++ b/src/main/java/com/ngrok/definitions/ReservedDomainCertNsTarget.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 ReservedDomainCertNsTarget { @JsonProperty("zone") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String zone; @JsonProperty("nameservers") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List nameservers; /** diff --git a/src/main/java/com/ngrok/definitions/ReservedDomainCertPolicy.java b/src/main/java/com/ngrok/definitions/ReservedDomainCertPolicy.java index f2e14dd..21088e9 100644 --- a/src/main/java/com/ngrok/definitions/ReservedDomainCertPolicy.java +++ b/src/main/java/com/ngrok/definitions/ReservedDomainCertPolicy.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 ReservedDomainCertPolicy { + /** + * Builder class for {@link ReservedDomainCertPolicy}. + */ + public static class Builder { + private Optional authority = Optional.empty(); + private Optional privateKeyType = Optional.empty(); + + private Builder( + ) { + } + + /** + * certificate authority to request certificates from. The only supported value is + * letsencrypt. + * + * @param authority the value of the authority parameter as a {@link String} + * @return this builder instance + */ + public Builder authority(final String authority) { + this.authority = Optional.of(Objects.requireNonNull(authority, "authority is required")); + return this; + } + + /** + * certificate authority to request certificates from. The only supported value is + * letsencrypt. + * + * @param authority the value of the authority parameter as a {@link String}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder authority(final Optional authority) { + this.authority = Objects.requireNonNull(authority, "authority is required"); + return this; + } + + /** + * type of private key to use when requesting certificates. Defaults to rsa, can be + * either rsa or ecdsa. + * + * @param privateKeyType the value of the private_key_type parameter as a {@link String} + * @return this builder instance + */ + public Builder privateKeyType(final String privateKeyType) { + this.privateKeyType = Optional.of(Objects.requireNonNull(privateKeyType, "privateKeyType is required")); + return this; + } + + /** + * type of private key to use when requesting certificates. Defaults to rsa, can be + * either rsa or ecdsa. + * + * @param privateKeyType the value of the private_key_type parameter as a {@link String}, wrapped in an {@link Optional} + * @return this builder instance + */ + public Builder privateKeyType(final Optional privateKeyType) { + this.privateKeyType = Objects.requireNonNull(privateKeyType, "privateKeyType is required"); + return this; + } + + /** + * Constructs the {@link ReservedDomainCertPolicy} instance. + * + * @return a new {@link ReservedDomainCertPolicy} + */ + public ReservedDomainCertPolicy build() { + return new ReservedDomainCertPolicy( + this.authority.orElse(""), + this.privateKeyType.orElse("") + ); + } + } + + /** + * Creates a new builder for the {@link ReservedDomainCertPolicy} type. + * + * @return a new {@link Builder} + */ + public static Builder newBuilder( + ) { + return new Builder ( + ); + } + @JsonProperty("authority") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String authority; @JsonProperty("private_key_type") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String privateKeyType; /** @@ -24,7 +110,7 @@ public class ReservedDomainCertPolicy { * @param privateKeyType type of private key to use when requesting certificates. Defaults to rsa, can be either rsa or ecdsa. */ @JsonCreator - public ReservedDomainCertPolicy( + private ReservedDomainCertPolicy( @JsonProperty("authority") final String authority, @JsonProperty("private_key_type") final String privateKeyType ) { diff --git a/src/main/java/com/ngrok/definitions/ReservedDomainCertStatus.java b/src/main/java/com/ngrok/definitions/ReservedDomainCertStatus.java index 5e565ab..3a93d5c 100644 --- a/src/main/java/com/ngrok/definitions/ReservedDomainCertStatus.java +++ b/src/main/java/com/ngrok/definitions/ReservedDomainCertStatus.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 ReservedDomainCertStatus { @JsonProperty("renews_at") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional renewsAt; @JsonProperty("provisioning_job") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional provisioningJob; /** diff --git a/src/main/java/com/ngrok/definitions/ReservedDomainList.java b/src/main/java/com/ngrok/definitions/ReservedDomainList.java index b850470..7fc1f06 100644 --- a/src/main/java/com/ngrok/definitions/ReservedDomainList.java +++ b/src/main/java/com/ngrok/definitions/ReservedDomainList.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 ReservedDomainList implements Pageable { @JsonProperty("reserved_domains") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List reservedDomains; @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/SshCertificateAuthority.java b/src/main/java/com/ngrok/definitions/SshCertificateAuthority.java index f49287e..e59259a 100644 --- a/src/main/java/com/ngrok/definitions/SshCertificateAuthority.java +++ b/src/main/java/com/ngrok/definitions/SshCertificateAuthority.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 SshCertificateAuthority { @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("public_key") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String publicKey; @JsonProperty("key_type") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String keyType; /** diff --git a/src/main/java/com/ngrok/definitions/SshCertificateAuthorityList.java b/src/main/java/com/ngrok/definitions/SshCertificateAuthorityList.java index d3a5039..ed6512d 100644 --- a/src/main/java/com/ngrok/definitions/SshCertificateAuthorityList.java +++ b/src/main/java/com/ngrok/definitions/SshCertificateAuthorityList.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 SshCertificateAuthorityList implements Pageable { @JsonProperty("ssh_certificate_authorities") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List sshCertificateAuthorities; @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/SshCredential.java b/src/main/java/com/ngrok/definitions/SshCredential.java index ec02083..7ab6a1a 100644 --- a/src/main/java/com/ngrok/definitions/SshCredential.java +++ b/src/main/java/com/ngrok/definitions/SshCredential.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 SshCredential { @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("public_key") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String publicKey; @JsonProperty("acl") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List acl; /** diff --git a/src/main/java/com/ngrok/definitions/SshCredentialList.java b/src/main/java/com/ngrok/definitions/SshCredentialList.java index 3507593..8d3a788 100644 --- a/src/main/java/com/ngrok/definitions/SshCredentialList.java +++ b/src/main/java/com/ngrok/definitions/SshCredentialList.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 SshCredentialList implements Pageable { @JsonProperty("ssh_credentials") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List sshCredentials; @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/SshHostCertificate.java b/src/main/java/com/ngrok/definitions/SshHostCertificate.java index cda8729..3b6e062 100644 --- a/src/main/java/com/ngrok/definitions/SshHostCertificate.java +++ b/src/main/java/com/ngrok/definitions/SshHostCertificate.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,28 +14,40 @@ import java.util.Optional; @JsonIgnoreProperties(ignoreUnknown = true) public class SshHostCertificate { @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("public_key") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String publicKey; @JsonProperty("key_type") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String keyType; @JsonProperty("ssh_certificate_authority_id") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String sshCertificateAuthorityId; @JsonProperty("principals") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List principals; @JsonProperty("valid_after") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.time.OffsetDateTime validAfter; @JsonProperty("valid_until") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.time.OffsetDateTime validUntil; @JsonProperty("certificate") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String certificate; /** diff --git a/src/main/java/com/ngrok/definitions/SshHostCertificateList.java b/src/main/java/com/ngrok/definitions/SshHostCertificateList.java index 926ec38..68e7aa1 100644 --- a/src/main/java/com/ngrok/definitions/SshHostCertificateList.java +++ b/src/main/java/com/ngrok/definitions/SshHostCertificateList.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 SshHostCertificateList implements Pageable { @JsonProperty("ssh_host_certificates") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List sshHostCertificates; @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/SshUserCertificate.java b/src/main/java/com/ngrok/definitions/SshUserCertificate.java index 3ac3ac7..75d3bad 100644 --- a/src/main/java/com/ngrok/definitions/SshUserCertificate.java +++ b/src/main/java/com/ngrok/definitions/SshUserCertificate.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,32 +14,46 @@ import java.util.Optional; @JsonIgnoreProperties(ignoreUnknown = true) public class SshUserCertificate { @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("public_key") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String publicKey; @JsonProperty("key_type") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String keyType; @JsonProperty("ssh_certificate_authority_id") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String sshCertificateAuthorityId; @JsonProperty("principals") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List principals; @JsonProperty("critical_options") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.Map criticalOptions; @JsonProperty("extensions") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.Map extensions; @JsonProperty("valid_after") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.time.OffsetDateTime validAfter; @JsonProperty("valid_until") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.time.OffsetDateTime validUntil; @JsonProperty("certificate") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String certificate; /** diff --git a/src/main/java/com/ngrok/definitions/SshUserCertificateList.java b/src/main/java/com/ngrok/definitions/SshUserCertificateList.java index d062616..8a4da25 100644 --- a/src/main/java/com/ngrok/definitions/SshUserCertificateList.java +++ b/src/main/java/com/ngrok/definitions/SshUserCertificateList.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 SshUserCertificateList implements Pageable { @JsonProperty("ssh_user_certificates") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List sshUserCertificates; @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/TlsCertificate.java b/src/main/java/com/ngrok/definitions/TlsCertificate.java index 47cd7e7..269e7e9 100644 --- a/src/main/java/com/ngrok/definitions/TlsCertificate.java +++ b/src/main/java/com/ngrok/definitions/TlsCertificate.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,46 +14,67 @@ import java.util.Optional; @JsonIgnoreProperties(ignoreUnknown = true) public class TlsCertificate { @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("certificate_pem") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String certificatePem; @JsonProperty("subject_common_name") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String subjectCommonName; @JsonProperty("subject_alternative_names") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final TlsCertificateSaNs subjectAlternativeNames; @JsonProperty("issued_at") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Optional issuedAt; @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; @JsonProperty("private_key_type") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String privateKeyType; @JsonProperty("issuer_common_name") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String issuerCommonName; @JsonProperty("serial_number") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String serialNumber; @JsonProperty("subject_organization") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String subjectOrganization; @JsonProperty("subject_organizational_unit") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String subjectOrganizationalUnit; @JsonProperty("subject_locality") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String subjectLocality; @JsonProperty("subject_province") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String subjectProvince; @JsonProperty("subject_country") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String subjectCountry; /** diff --git a/src/main/java/com/ngrok/definitions/TlsCertificateList.java b/src/main/java/com/ngrok/definitions/TlsCertificateList.java index 5a4107b..267cd56 100644 --- a/src/main/java/com/ngrok/definitions/TlsCertificateList.java +++ b/src/main/java/com/ngrok/definitions/TlsCertificateList.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 TlsCertificateList implements Pageable { @JsonProperty("tls_certificates") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List tlsCertificates; @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/TlsCertificateSaNs.java b/src/main/java/com/ngrok/definitions/TlsCertificateSaNs.java index 6f44744..24c2189 100644 --- a/src/main/java/com/ngrok/definitions/TlsCertificateSaNs.java +++ b/src/main/java/com/ngrok/definitions/TlsCertificateSaNs.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 TlsCertificateSaNs { @JsonProperty("dns_names") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List dnsNames; @JsonProperty("ips") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List ips; /** diff --git a/src/main/java/com/ngrok/definitions/Tunnel.java b/src/main/java/com/ngrok/definitions/Tunnel.java index eb15245..f2aaec1 100644 --- a/src/main/java/com/ngrok/definitions/Tunnel.java +++ b/src/main/java/com/ngrok/definitions/Tunnel.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 Tunnel { @JsonProperty("id") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String id; @JsonProperty("public_url") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.net.URI publicUrl; @JsonProperty("started_at") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.time.OffsetDateTime startedAt; @JsonProperty("metadata") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String metadata; @JsonProperty("proto") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String proto; @JsonProperty("region") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String region; @JsonProperty("tunnel_session") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Ref tunnelSession; /** diff --git a/src/main/java/com/ngrok/definitions/TunnelList.java b/src/main/java/com/ngrok/definitions/TunnelList.java index f8a129d..399f0c9 100644 --- a/src/main/java/com/ngrok/definitions/TunnelList.java +++ b/src/main/java/com/ngrok/definitions/TunnelList.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 TunnelList implements Pageable { @JsonProperty("tunnels") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List tunnels; @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/TunnelSession.java b/src/main/java/com/ngrok/definitions/TunnelSession.java index dc6d161..0becebf 100644 --- a/src/main/java/com/ngrok/definitions/TunnelSession.java +++ b/src/main/java/com/ngrok/definitions/TunnelSession.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,24 +14,34 @@ import java.util.Optional; @JsonIgnoreProperties(ignoreUnknown = true) public class TunnelSession { @JsonProperty("agent_version") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String agentVersion; @JsonProperty("credential") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Ref credential; @JsonProperty("id") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String id; @JsonProperty("ip") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String ip; @JsonProperty("metadata") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String metadata; @JsonProperty("os") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String os; @JsonProperty("region") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String region; @JsonProperty("started_at") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.time.OffsetDateTime startedAt; @JsonProperty("transport") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final String transport; @JsonProperty("uri") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.net.URI uri; /** diff --git a/src/main/java/com/ngrok/definitions/TunnelSessionList.java b/src/main/java/com/ngrok/definitions/TunnelSessionList.java index 85286fe..c84a5a2 100644 --- a/src/main/java/com/ngrok/definitions/TunnelSessionList.java +++ b/src/main/java/com/ngrok/definitions/TunnelSessionList.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 TunnelSessionList implements Pageable { @JsonProperty("tunnel_sessions") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final java.util.List tunnelSessions; @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/services/AbuseReports.java b/src/main/java/com/ngrok/services/AbuseReports.java index 80cf77d..202d0e5 100644 --- a/src/main/java/com/ngrok/services/AbuseReports.java +++ b/src/main/java/com/ngrok/services/AbuseReports.java @@ -14,6 +14,8 @@ import java.util.stream.Stream; /** * 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. */ public class AbuseReports { private final NgrokApiClient apiClient; @@ -30,11 +32,11 @@ public class AbuseReports { /** * A builder object encapsulating state for an unsent Create API call. */ - public class AbuseReportsCreateCallBuilder { + public class CreateCallBuilder { private final java.util.List urls; private String metadata = ""; - private AbuseReportsCreateCallBuilder( + private CreateCallBuilder( final java.util.List urls ) { this.urls = Objects.requireNonNull(urls, "urls is required"); @@ -46,7 +48,7 @@ public class AbuseReports { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public AbuseReportsCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -57,7 +59,7 @@ public class AbuseReports { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public AbuseReportsCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -100,13 +102,15 @@ public class AbuseReports { * response team. This API is only available to authorized accounts. Contact * abuse@ngrok.com to request access * + * See also https://ngrok.com/docs/api#api-abuse-reports-create. + * * @param urls a list of URLs containing suspected abusive content * @return a call builder for this API call */ - public AbuseReportsCreateCallBuilder create( + public CreateCallBuilder create( final java.util.List urls ) { - return new AbuseReportsCreateCallBuilder( + return new CreateCallBuilder( urls ); } @@ -114,10 +118,10 @@ public class AbuseReports { /** * A builder object encapsulating state for an unsent Get API call. */ - public class AbuseReportsGetCallBuilder { + public class GetCallBuilder { private final String id; - private AbuseReportsGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -156,13 +160,15 @@ public class AbuseReports { /** * Get the detailed status of abuse report by ID. * + * See also https://ngrok.com/docs/api#api-abuse-reports-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public AbuseReportsGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new AbuseReportsGetCallBuilder( + return new GetCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/ApiKeys.java b/src/main/java/com/ngrok/services/ApiKeys.java index 26d7911..0d3a59e 100644 --- a/src/main/java/com/ngrok/services/ApiKeys.java +++ b/src/main/java/com/ngrok/services/ApiKeys.java @@ -19,6 +19,8 @@ import java.util.stream.Stream; * key from the API Keys page * on your * ngrok.com dashboard. + * + * See also https://ngrok.com/docs/api#api-api-keys. */ public class ApiKeys { private final NgrokApiClient apiClient; @@ -35,11 +37,11 @@ public class ApiKeys { /** * A builder object encapsulating state for an unsent Create API call. */ - public class ApiKeysCreateCallBuilder { + public class CreateCallBuilder { private String description = ""; private String metadata = ""; - private ApiKeysCreateCallBuilder( + private CreateCallBuilder( ) { } @@ -50,7 +52,7 @@ public class ApiKeys { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public ApiKeysCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -62,7 +64,7 @@ public class ApiKeys { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ApiKeysCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -73,7 +75,7 @@ public class ApiKeys { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public ApiKeysCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -84,7 +86,7 @@ public class ApiKeys { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ApiKeysCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -126,21 +128,23 @@ public class ApiKeys { * Create a new API key. The generated API key can be used to authenticate to the * ngrok API. * + * See also https://ngrok.com/docs/api#api-api-keys-create. + * * @return a call builder for this API call */ - public ApiKeysCreateCallBuilder create( + public CreateCallBuilder create( ) { - return new ApiKeysCreateCallBuilder( + return new CreateCallBuilder( ); } /** * A builder object encapsulating state for an unsent Delete API call. */ - public class ApiKeysDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private ApiKeysDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -178,13 +182,15 @@ public class ApiKeys { /** * Delete an API key by ID * + * See also https://ngrok.com/docs/api#api-api-keys-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public ApiKeysDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new ApiKeysDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -192,10 +198,10 @@ public class ApiKeys { /** * A builder object encapsulating state for an unsent Get API call. */ - public class ApiKeysGetCallBuilder { + public class GetCallBuilder { private final String id; - private ApiKeysGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -234,13 +240,15 @@ public class ApiKeys { /** * Get the details of an API key by ID. * + * See also https://ngrok.com/docs/api#api-api-keys-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public ApiKeysGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new ApiKeysGetCallBuilder( + return new GetCallBuilder( id ); } @@ -248,11 +256,11 @@ public class ApiKeys { /** * A builder object encapsulating state for an unsent List API call. */ - public class ApiKeysListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private ApiKeysListCallBuilder( + private ListCallBuilder( ) { } @@ -262,7 +270,7 @@ public class ApiKeys { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public ApiKeysListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -273,7 +281,7 @@ public class ApiKeys { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ApiKeysListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -284,7 +292,7 @@ public class ApiKeys { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public ApiKeysListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -295,7 +303,7 @@ public class ApiKeys { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ApiKeysListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -336,23 +344,25 @@ public class ApiKeys { /** * List all API keys owned by this account * + * See also https://ngrok.com/docs/api#api-api-keys-list. + * * @return a call builder for this API call */ - public ApiKeysListCallBuilder list( + public ListCallBuilder list( ) { - return new ApiKeysListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class ApiKeysUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); - private ApiKeysUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -365,7 +375,7 @@ public class ApiKeys { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public ApiKeysUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -377,7 +387,7 @@ public class ApiKeys { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ApiKeysUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -388,7 +398,7 @@ public class ApiKeys { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public ApiKeysUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -399,7 +409,7 @@ public class ApiKeys { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ApiKeysUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -440,13 +450,15 @@ public class ApiKeys { /** * Update attributes of an API key by ID. * + * See also https://ngrok.com/docs/api#api-api-keys-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public ApiKeysUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new ApiKeysUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/CertificateAuthorities.java b/src/main/java/com/ngrok/services/CertificateAuthorities.java index 20d4d02..d17f63b 100644 --- a/src/main/java/com/ngrok/services/CertificateAuthorities.java +++ b/src/main/java/com/ngrok/services/CertificateAuthorities.java @@ -17,6 +17,8 @@ import java.util.stream.Stream; * to verify that the TLS certificate presented by a client has been signed by * 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. */ public class CertificateAuthorities { private final NgrokApiClient apiClient; @@ -33,12 +35,12 @@ public class CertificateAuthorities { /** * A builder object encapsulating state for an unsent Create API call. */ - public class CertificateAuthoritiesCreateCallBuilder { + public class CreateCallBuilder { private String description = ""; private String metadata = ""; private final String caPem; - private CertificateAuthoritiesCreateCallBuilder( + private CreateCallBuilder( final String caPem ) { this.caPem = Objects.requireNonNull(caPem, "caPem is required"); @@ -51,7 +53,7 @@ public class CertificateAuthorities { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public CertificateAuthoritiesCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -63,7 +65,7 @@ public class CertificateAuthorities { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public CertificateAuthoritiesCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -75,7 +77,7 @@ public class CertificateAuthorities { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public CertificateAuthoritiesCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -87,7 +89,7 @@ public class CertificateAuthorities { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public CertificateAuthoritiesCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -129,13 +131,15 @@ public class CertificateAuthorities { /** * Upload a new Certificate Authority * + * See also https://ngrok.com/docs/api#api-certificate-authorities-create. + * * @param caPem raw PEM of the Certificate Authority * @return a call builder for this API call */ - public CertificateAuthoritiesCreateCallBuilder create( + public CreateCallBuilder create( final String caPem ) { - return new CertificateAuthoritiesCreateCallBuilder( + return new CreateCallBuilder( caPem ); } @@ -143,10 +147,10 @@ public class CertificateAuthorities { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class CertificateAuthoritiesDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private CertificateAuthoritiesDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -184,13 +188,15 @@ public class CertificateAuthorities { /** * Delete a Certificate Authority * + * See also https://ngrok.com/docs/api#api-certificate-authorities-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public CertificateAuthoritiesDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new CertificateAuthoritiesDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -198,10 +204,10 @@ public class CertificateAuthorities { /** * A builder object encapsulating state for an unsent Get API call. */ - public class CertificateAuthoritiesGetCallBuilder { + public class GetCallBuilder { private final String id; - private CertificateAuthoritiesGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -240,13 +246,15 @@ public class CertificateAuthorities { /** * Get detailed information about a certficate authority * + * See also https://ngrok.com/docs/api#api-certificate-authorities-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public CertificateAuthoritiesGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new CertificateAuthoritiesGetCallBuilder( + return new GetCallBuilder( id ); } @@ -254,11 +262,11 @@ public class CertificateAuthorities { /** * A builder object encapsulating state for an unsent List API call. */ - public class CertificateAuthoritiesListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private CertificateAuthoritiesListCallBuilder( + private ListCallBuilder( ) { } @@ -268,7 +276,7 @@ public class CertificateAuthorities { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public CertificateAuthoritiesListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -279,7 +287,7 @@ public class CertificateAuthorities { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public CertificateAuthoritiesListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -290,7 +298,7 @@ public class CertificateAuthorities { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public CertificateAuthoritiesListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -301,7 +309,7 @@ public class CertificateAuthorities { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public CertificateAuthoritiesListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -342,23 +350,25 @@ public class CertificateAuthorities { /** * List all Certificate Authority on this account * + * See also https://ngrok.com/docs/api#api-certificate-authorities-list. + * * @return a call builder for this API call */ - public CertificateAuthoritiesListCallBuilder list( + public ListCallBuilder list( ) { - return new CertificateAuthoritiesListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class CertificateAuthoritiesUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); - private CertificateAuthoritiesUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -371,7 +381,7 @@ public class CertificateAuthorities { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public CertificateAuthoritiesUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -383,7 +393,7 @@ public class CertificateAuthorities { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public CertificateAuthoritiesUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -395,7 +405,7 @@ public class CertificateAuthorities { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public CertificateAuthoritiesUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -407,7 +417,7 @@ public class CertificateAuthorities { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public CertificateAuthoritiesUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -448,13 +458,15 @@ public class CertificateAuthorities { /** * Update attributes of a Certificate Authority by ID * + * See also https://ngrok.com/docs/api#api-certificate-authorities-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public CertificateAuthoritiesUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new CertificateAuthoritiesUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/Credentials.java b/src/main/java/com/ngrok/services/Credentials.java index e4e7d68..68287d3 100644 --- a/src/main/java/com/ngrok/services/Credentials.java +++ b/src/main/java/com/ngrok/services/Credentials.java @@ -17,6 +17,8 @@ import java.util.stream.Stream; * the ngrok authtoken command or by specifying it in the * ngrok.yml * configuration file with the authtoken property. + * + * See also https://ngrok.com/docs/api#api-credentials. */ public class Credentials { private final NgrokApiClient apiClient; @@ -33,12 +35,12 @@ public class Credentials { /** * A builder object encapsulating state for an unsent Create API call. */ - public class CredentialsCreateCallBuilder { + public class CreateCallBuilder { private String description = ""; private String metadata = ""; - private java.util.List acl = null; + private java.util.List acl = java.util.Collections.emptyList(); - private CredentialsCreateCallBuilder( + private CreateCallBuilder( ) { } @@ -49,7 +51,7 @@ public class Credentials { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public CredentialsCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -61,7 +63,7 @@ public class Credentials { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public CredentialsCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -73,7 +75,7 @@ public class Credentials { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public CredentialsCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -85,7 +87,7 @@ public class Credentials { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public CredentialsCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -106,7 +108,7 @@ public class Credentials { * @param acl the value of the acl parameter as a {@link java.util.List} * @return the call builder instance */ - public CredentialsCreateCallBuilder acl(final java.util.List acl) { + public CreateCallBuilder acl(final java.util.List acl) { this.acl = Objects.requireNonNull(acl, "acl is required"); return this; } @@ -127,8 +129,8 @@ public class Credentials { * @param acl the value of the acl parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public CredentialsCreateCallBuilder acl(final Optional> acl) { - this.acl = Objects.requireNonNull(acl, "acl is required").orElse(null); + public CreateCallBuilder acl(final Optional> acl) { + this.acl = Objects.requireNonNull(acl, "acl is required").orElse(java.util.Collections.emptyList()); return this; } @@ -172,21 +174,23 @@ public class Credentials { * the generated token is available. If you need it for future use, you must save * it securely yourself. * + * See also https://ngrok.com/docs/api#api-credentials-create. + * * @return a call builder for this API call */ - public CredentialsCreateCallBuilder create( + public CreateCallBuilder create( ) { - return new CredentialsCreateCallBuilder( + return new CreateCallBuilder( ); } /** * A builder object encapsulating state for an unsent Delete API call. */ - public class CredentialsDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private CredentialsDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -224,13 +228,15 @@ public class Credentials { /** * Delete a tunnel authtoken credential by ID * + * See also https://ngrok.com/docs/api#api-credentials-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public CredentialsDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new CredentialsDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -238,10 +244,10 @@ public class Credentials { /** * A builder object encapsulating state for an unsent Get API call. */ - public class CredentialsGetCallBuilder { + public class GetCallBuilder { private final String id; - private CredentialsGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -280,13 +286,15 @@ public class Credentials { /** * Get detailed information about a tunnel authtoken credential * + * See also https://ngrok.com/docs/api#api-credentials-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public CredentialsGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new CredentialsGetCallBuilder( + return new GetCallBuilder( id ); } @@ -294,11 +302,11 @@ public class Credentials { /** * A builder object encapsulating state for an unsent List API call. */ - public class CredentialsListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private CredentialsListCallBuilder( + private ListCallBuilder( ) { } @@ -308,7 +316,7 @@ public class Credentials { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public CredentialsListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -319,7 +327,7 @@ public class Credentials { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public CredentialsListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -330,7 +338,7 @@ public class Credentials { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public CredentialsListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -341,7 +349,7 @@ public class Credentials { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public CredentialsListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -382,24 +390,26 @@ public class Credentials { /** * List all tunnel authtoken credentials on this account * + * See also https://ngrok.com/docs/api#api-credentials-list. + * * @return a call builder for this API call */ - public CredentialsListCallBuilder list( + public ListCallBuilder list( ) { - return new CredentialsListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class CredentialsUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); private Optional> acl = Optional.empty(); - private CredentialsUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -412,7 +422,7 @@ public class Credentials { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public CredentialsUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -424,7 +434,7 @@ public class Credentials { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public CredentialsUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -436,7 +446,7 @@ public class Credentials { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public CredentialsUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -448,7 +458,7 @@ public class Credentials { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public CredentialsUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -469,7 +479,7 @@ public class Credentials { * @param acl the value of the acl parameter as a {@link java.util.List} * @return the call builder instance */ - public CredentialsUpdateCallBuilder acl(final java.util.List acl) { + public UpdateCallBuilder acl(final java.util.List acl) { this.acl = Optional.ofNullable(acl); return this; } @@ -490,7 +500,7 @@ public class Credentials { * @param acl the value of the acl parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public CredentialsUpdateCallBuilder acl(final Optional> acl) { + public UpdateCallBuilder acl(final Optional> acl) { this.acl = Objects.requireNonNull(acl, "acl is required"); return this; } @@ -532,13 +542,15 @@ public class Credentials { /** * Update attributes of an tunnel authtoken credential by ID * + * See also https://ngrok.com/docs/api#api-credentials-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public CredentialsUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new CredentialsUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointCircuitBreakerModule.java b/src/main/java/com/ngrok/services/EndpointCircuitBreakerModule.java index c2160c0..042daea 100644 --- a/src/main/java/com/ngrok/services/EndpointCircuitBreakerModule.java +++ b/src/main/java/com/ngrok/services/EndpointCircuitBreakerModule.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EndpointCircuitBreakerModule}. + * + * See also https://ngrok.com/docs/api#api-endpoint-circuit-breaker-module. */ public class EndpointCircuitBreakerModule { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EndpointCircuitBreakerModule { /** * A builder object encapsulating state for an unsent Replace API call. */ - public class EndpointCircuitBreakerModuleReplaceCallBuilder { + public class ReplaceCallBuilder { private final String id; private EndpointCircuitBreaker module = null; - private EndpointCircuitBreakerModuleReplaceCallBuilder( + private ReplaceCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -45,7 +47,7 @@ public class EndpointCircuitBreakerModule { * @param module the value of the module parameter as a {@link EndpointCircuitBreaker} * @return the call builder instance */ - public EndpointCircuitBreakerModuleReplaceCallBuilder module(final EndpointCircuitBreaker module) { + public ReplaceCallBuilder module(final EndpointCircuitBreaker module) { this.module = Objects.requireNonNull(module, "module is required"); return this; } @@ -56,7 +58,7 @@ public class EndpointCircuitBreakerModule { * @param module the value of the module parameter as an {@link Optional} of {@link EndpointCircuitBreaker} * @return the call builder instance */ - public EndpointCircuitBreakerModuleReplaceCallBuilder module(final Optional module) { + public ReplaceCallBuilder module(final Optional module) { this.module = Objects.requireNonNull(module, "module is required").orElse(null); return this; } @@ -96,13 +98,15 @@ public class EndpointCircuitBreakerModule { /** * Creates a call builder for the Replace API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-circuit-breaker-module-replace. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public EndpointCircuitBreakerModuleReplaceCallBuilder replace( + public ReplaceCallBuilder replace( final String id ) { - return new EndpointCircuitBreakerModuleReplaceCallBuilder( + return new ReplaceCallBuilder( id ); } @@ -110,10 +114,10 @@ public class EndpointCircuitBreakerModule { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointCircuitBreakerModuleGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointCircuitBreakerModuleGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -152,13 +156,15 @@ public class EndpointCircuitBreakerModule { /** * Creates a call builder for the Get API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-circuit-breaker-module-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointCircuitBreakerModuleGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointCircuitBreakerModuleGetCallBuilder( + return new GetCallBuilder( id ); } @@ -166,10 +172,10 @@ public class EndpointCircuitBreakerModule { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointCircuitBreakerModuleDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointCircuitBreakerModuleDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -207,13 +213,15 @@ public class EndpointCircuitBreakerModule { /** * Creates a call builder for the Delete API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-circuit-breaker-module-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointCircuitBreakerModuleDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointCircuitBreakerModuleDeleteCallBuilder( + return new DeleteCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointCompressionModule.java b/src/main/java/com/ngrok/services/EndpointCompressionModule.java index b5ee892..e0c843e 100644 --- a/src/main/java/com/ngrok/services/EndpointCompressionModule.java +++ b/src/main/java/com/ngrok/services/EndpointCompressionModule.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EndpointCompressionModule}. + * + * See also https://ngrok.com/docs/api#api-endpoint-compression-module. */ public class EndpointCompressionModule { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EndpointCompressionModule { /** * A builder object encapsulating state for an unsent Replace API call. */ - public class EndpointCompressionModuleReplaceCallBuilder { + public class ReplaceCallBuilder { private final String id; private EndpointCompression module = null; - private EndpointCompressionModuleReplaceCallBuilder( + private ReplaceCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -45,7 +47,7 @@ public class EndpointCompressionModule { * @param module the value of the module parameter as a {@link EndpointCompression} * @return the call builder instance */ - public EndpointCompressionModuleReplaceCallBuilder module(final EndpointCompression module) { + public ReplaceCallBuilder module(final EndpointCompression module) { this.module = Objects.requireNonNull(module, "module is required"); return this; } @@ -56,7 +58,7 @@ public class EndpointCompressionModule { * @param module the value of the module parameter as an {@link Optional} of {@link EndpointCompression} * @return the call builder instance */ - public EndpointCompressionModuleReplaceCallBuilder module(final Optional module) { + public ReplaceCallBuilder module(final Optional module) { this.module = Objects.requireNonNull(module, "module is required").orElse(null); return this; } @@ -96,13 +98,15 @@ public class EndpointCompressionModule { /** * Creates a call builder for the Replace API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-compression-module-replace. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public EndpointCompressionModuleReplaceCallBuilder replace( + public ReplaceCallBuilder replace( final String id ) { - return new EndpointCompressionModuleReplaceCallBuilder( + return new ReplaceCallBuilder( id ); } @@ -110,10 +114,10 @@ public class EndpointCompressionModule { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointCompressionModuleGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointCompressionModuleGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -152,13 +156,15 @@ public class EndpointCompressionModule { /** * Creates a call builder for the Get API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-compression-module-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointCompressionModuleGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointCompressionModuleGetCallBuilder( + return new GetCallBuilder( id ); } @@ -166,10 +172,10 @@ public class EndpointCompressionModule { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointCompressionModuleDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointCompressionModuleDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -207,13 +213,15 @@ public class EndpointCompressionModule { /** * Creates a call builder for the Delete API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-compression-module-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointCompressionModuleDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointCompressionModuleDeleteCallBuilder( + return new DeleteCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointConfigurations.java b/src/main/java/com/ngrok/services/EndpointConfigurations.java index 0fc2bf9..a3a15e1 100644 --- a/src/main/java/com/ngrok/services/EndpointConfigurations.java +++ b/src/main/java/com/ngrok/services/EndpointConfigurations.java @@ -15,6 +15,8 @@ import java.util.stream.Stream; * Endpoint Configurations are a reusable group of modules that encapsulate how * 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. */ public class EndpointConfigurations { private final NgrokApiClient apiClient; @@ -31,7 +33,7 @@ public class EndpointConfigurations { /** * A builder object encapsulating state for an unsent Create API call. */ - public class EndpointConfigurationsCreateCallBuilder { + public class CreateCallBuilder { private String type = ""; private String description = ""; private String metadata = ""; @@ -48,7 +50,7 @@ public class EndpointConfigurations { private Optional saml = Optional.empty(); private Optional oidc = Optional.empty(); - private EndpointConfigurationsCreateCallBuilder( + private CreateCallBuilder( ) { } @@ -59,7 +61,7 @@ public class EndpointConfigurations { * @param type the value of the type parameter as a {@link String} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder type(final String type) { + public CreateCallBuilder type(final String type) { this.type = Objects.requireNonNull(type, "type is required"); return this; } @@ -71,7 +73,7 @@ public class EndpointConfigurations { * @param type the value of the type parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder type(final Optional type) { + public CreateCallBuilder type(final Optional type) { this.type = Objects.requireNonNull(type, "type is required").orElse(""); return this; } @@ -83,7 +85,7 @@ public class EndpointConfigurations { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -95,7 +97,7 @@ public class EndpointConfigurations { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -107,7 +109,7 @@ public class EndpointConfigurations { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -119,7 +121,7 @@ public class EndpointConfigurations { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -130,7 +132,7 @@ public class EndpointConfigurations { * @param circuitBreaker the value of the circuit_breaker parameter as a {@link EndpointCircuitBreaker} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder circuitBreaker(final EndpointCircuitBreaker circuitBreaker) { + public CreateCallBuilder circuitBreaker(final EndpointCircuitBreaker circuitBreaker) { this.circuitBreaker = Optional.ofNullable(circuitBreaker); return this; } @@ -141,7 +143,7 @@ public class EndpointConfigurations { * @param circuitBreaker the value of the circuit_breaker parameter as an {@link Optional} of {@link EndpointCircuitBreaker} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder circuitBreaker(final Optional circuitBreaker) { + public CreateCallBuilder circuitBreaker(final Optional circuitBreaker) { this.circuitBreaker = Objects.requireNonNull(circuitBreaker, "circuitBreaker is required"); return this; } @@ -152,7 +154,7 @@ public class EndpointConfigurations { * @param compression the value of the compression parameter as a {@link EndpointCompression} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder compression(final EndpointCompression compression) { + public CreateCallBuilder compression(final EndpointCompression compression) { this.compression = Optional.ofNullable(compression); return this; } @@ -163,7 +165,7 @@ public class EndpointConfigurations { * @param compression the value of the compression parameter as an {@link Optional} of {@link EndpointCompression} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder compression(final Optional compression) { + public CreateCallBuilder compression(final Optional compression) { this.compression = Objects.requireNonNull(compression, "compression is required"); return this; } @@ -174,7 +176,7 @@ public class EndpointConfigurations { * @param requestHeaders the value of the request_headers parameter as a {@link EndpointRequestHeaders} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder requestHeaders(final EndpointRequestHeaders requestHeaders) { + public CreateCallBuilder requestHeaders(final EndpointRequestHeaders requestHeaders) { this.requestHeaders = Optional.ofNullable(requestHeaders); return this; } @@ -185,7 +187,7 @@ public class EndpointConfigurations { * @param requestHeaders the value of the request_headers parameter as an {@link Optional} of {@link EndpointRequestHeaders} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder requestHeaders(final Optional requestHeaders) { + public CreateCallBuilder requestHeaders(final Optional requestHeaders) { this.requestHeaders = Objects.requireNonNull(requestHeaders, "requestHeaders is required"); return this; } @@ -196,7 +198,7 @@ public class EndpointConfigurations { * @param responseHeaders the value of the response_headers parameter as a {@link EndpointResponseHeaders} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder responseHeaders(final EndpointResponseHeaders responseHeaders) { + public CreateCallBuilder responseHeaders(final EndpointResponseHeaders responseHeaders) { this.responseHeaders = Optional.ofNullable(responseHeaders); return this; } @@ -207,7 +209,7 @@ public class EndpointConfigurations { * @param responseHeaders the value of the response_headers parameter as an {@link Optional} of {@link EndpointResponseHeaders} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder responseHeaders(final Optional responseHeaders) { + public CreateCallBuilder responseHeaders(final Optional responseHeaders) { this.responseHeaders = Objects.requireNonNull(responseHeaders, "responseHeaders is required"); return this; } @@ -218,7 +220,7 @@ public class EndpointConfigurations { * @param ipPolicy the value of the ip_policy parameter as a {@link EndpointIpPolicyMutate} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder ipPolicy(final EndpointIpPolicyMutate ipPolicy) { + public CreateCallBuilder ipPolicy(final EndpointIpPolicyMutate ipPolicy) { this.ipPolicy = Optional.ofNullable(ipPolicy); return this; } @@ -229,7 +231,7 @@ public class EndpointConfigurations { * @param ipPolicy the value of the ip_policy parameter as an {@link Optional} of {@link EndpointIpPolicyMutate} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder ipPolicy(final Optional ipPolicy) { + public CreateCallBuilder ipPolicy(final Optional ipPolicy) { this.ipPolicy = Objects.requireNonNull(ipPolicy, "ipPolicy is required"); return this; } @@ -240,7 +242,7 @@ public class EndpointConfigurations { * @param mutualTls the value of the mutual_tls parameter as a {@link EndpointMutualTlsMutate} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder mutualTls(final EndpointMutualTlsMutate mutualTls) { + public CreateCallBuilder mutualTls(final EndpointMutualTlsMutate mutualTls) { this.mutualTls = Optional.ofNullable(mutualTls); return this; } @@ -251,7 +253,7 @@ public class EndpointConfigurations { * @param mutualTls the value of the mutual_tls parameter as an {@link Optional} of {@link EndpointMutualTlsMutate} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder mutualTls(final Optional mutualTls) { + public CreateCallBuilder mutualTls(final Optional mutualTls) { this.mutualTls = Objects.requireNonNull(mutualTls, "mutualTls is required"); return this; } @@ -262,7 +264,7 @@ public class EndpointConfigurations { * @param tlsTermination the value of the tls_termination parameter as a {@link EndpointTlsTermination} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder tlsTermination(final EndpointTlsTermination tlsTermination) { + public CreateCallBuilder tlsTermination(final EndpointTlsTermination tlsTermination) { this.tlsTermination = Optional.ofNullable(tlsTermination); return this; } @@ -273,7 +275,7 @@ public class EndpointConfigurations { * @param tlsTermination the value of the tls_termination parameter as an {@link Optional} of {@link EndpointTlsTermination} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder tlsTermination(final Optional tlsTermination) { + public CreateCallBuilder tlsTermination(final Optional tlsTermination) { this.tlsTermination = Objects.requireNonNull(tlsTermination, "tlsTermination is required"); return this; } @@ -284,7 +286,7 @@ public class EndpointConfigurations { * @param webhookValidation the value of the webhook_validation parameter as a {@link EndpointWebhookValidation} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder webhookValidation(final EndpointWebhookValidation webhookValidation) { + public CreateCallBuilder webhookValidation(final EndpointWebhookValidation webhookValidation) { this.webhookValidation = Optional.ofNullable(webhookValidation); return this; } @@ -295,7 +297,7 @@ public class EndpointConfigurations { * @param webhookValidation the value of the webhook_validation parameter as an {@link Optional} of {@link EndpointWebhookValidation} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder webhookValidation(final Optional webhookValidation) { + public CreateCallBuilder webhookValidation(final Optional webhookValidation) { this.webhookValidation = Objects.requireNonNull(webhookValidation, "webhookValidation is required"); return this; } @@ -306,7 +308,7 @@ public class EndpointConfigurations { * @param oauth the value of the oauth parameter as a {@link EndpointOAuth} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder oauth(final EndpointOAuth oauth) { + public CreateCallBuilder oauth(final EndpointOAuth oauth) { this.oauth = Optional.ofNullable(oauth); return this; } @@ -317,7 +319,7 @@ public class EndpointConfigurations { * @param oauth the value of the oauth parameter as an {@link Optional} of {@link EndpointOAuth} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder oauth(final Optional oauth) { + public CreateCallBuilder oauth(final Optional oauth) { this.oauth = Objects.requireNonNull(oauth, "oauth is required"); return this; } @@ -328,7 +330,7 @@ public class EndpointConfigurations { * @param logging the value of the logging parameter as a {@link EndpointLoggingMutate} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder logging(final EndpointLoggingMutate logging) { + public CreateCallBuilder logging(final EndpointLoggingMutate logging) { this.logging = Optional.ofNullable(logging); return this; } @@ -339,7 +341,7 @@ public class EndpointConfigurations { * @param logging the value of the logging parameter as an {@link Optional} of {@link EndpointLoggingMutate} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder logging(final Optional logging) { + public CreateCallBuilder logging(final Optional logging) { this.logging = Objects.requireNonNull(logging, "logging is required"); return this; } @@ -350,7 +352,7 @@ public class EndpointConfigurations { * @param saml the value of the saml parameter as a {@link EndpointSamlMutate} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder saml(final EndpointSamlMutate saml) { + public CreateCallBuilder saml(final EndpointSamlMutate saml) { this.saml = Optional.ofNullable(saml); return this; } @@ -361,7 +363,7 @@ public class EndpointConfigurations { * @param saml the value of the saml parameter as an {@link Optional} of {@link EndpointSamlMutate} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder saml(final Optional saml) { + public CreateCallBuilder saml(final Optional saml) { this.saml = Objects.requireNonNull(saml, "saml is required"); return this; } @@ -372,7 +374,7 @@ public class EndpointConfigurations { * @param oidc the value of the oidc parameter as a {@link EndpointOidc} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder oidc(final EndpointOidc oidc) { + public CreateCallBuilder oidc(final EndpointOidc oidc) { this.oidc = Optional.ofNullable(oidc); return this; } @@ -383,7 +385,7 @@ public class EndpointConfigurations { * @param oidc the value of the oidc parameter as an {@link Optional} of {@link EndpointOidc} * @return the call builder instance */ - public EndpointConfigurationsCreateCallBuilder oidc(final Optional oidc) { + public CreateCallBuilder oidc(final Optional oidc) { this.oidc = Objects.requireNonNull(oidc, "oidc is required"); return this; } @@ -437,21 +439,23 @@ public class EndpointConfigurations { /** * Create a new endpoint configuration * + * See also https://ngrok.com/docs/api#api-endpoint-configurations-create. + * * @return a call builder for this API call */ - public EndpointConfigurationsCreateCallBuilder create( + public CreateCallBuilder create( ) { - return new EndpointConfigurationsCreateCallBuilder( + return new CreateCallBuilder( ); } /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointConfigurationsDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointConfigurationsDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -490,13 +494,15 @@ public class EndpointConfigurations { * Delete an endpoint configuration. This operation will fail if the endpoint * configuration is still referenced by any reserved domain or reserved address. * + * See also https://ngrok.com/docs/api#api-endpoint-configurations-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointConfigurationsDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointConfigurationsDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -504,10 +510,10 @@ public class EndpointConfigurations { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointConfigurationsGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointConfigurationsGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -546,13 +552,15 @@ public class EndpointConfigurations { /** * Returns detailed information about an endpoint configuration * + * See also https://ngrok.com/docs/api#api-endpoint-configurations-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointConfigurationsGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointConfigurationsGetCallBuilder( + return new GetCallBuilder( id ); } @@ -560,11 +568,11 @@ public class EndpointConfigurations { /** * A builder object encapsulating state for an unsent List API call. */ - public class EndpointConfigurationsListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private EndpointConfigurationsListCallBuilder( + private ListCallBuilder( ) { } @@ -574,7 +582,7 @@ public class EndpointConfigurations { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public EndpointConfigurationsListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -585,7 +593,7 @@ public class EndpointConfigurations { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EndpointConfigurationsListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -596,7 +604,7 @@ public class EndpointConfigurations { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public EndpointConfigurationsListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -607,7 +615,7 @@ public class EndpointConfigurations { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EndpointConfigurationsListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -648,18 +656,20 @@ public class EndpointConfigurations { /** * Returns a list of all endpoint configurations on this account * + * See also https://ngrok.com/docs/api#api-endpoint-configurations-list. + * * @return a call builder for this API call */ - public EndpointConfigurationsListCallBuilder list( + public ListCallBuilder list( ) { - return new EndpointConfigurationsListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class EndpointConfigurationsUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); @@ -676,7 +686,7 @@ public class EndpointConfigurations { private Optional saml = Optional.empty(); private Optional oidc = Optional.empty(); - private EndpointConfigurationsUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -689,7 +699,7 @@ public class EndpointConfigurations { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -701,7 +711,7 @@ public class EndpointConfigurations { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -713,7 +723,7 @@ public class EndpointConfigurations { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -725,7 +735,7 @@ public class EndpointConfigurations { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -736,7 +746,7 @@ public class EndpointConfigurations { * @param circuitBreaker the value of the circuit_breaker parameter as a {@link EndpointCircuitBreaker} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder circuitBreaker(final EndpointCircuitBreaker circuitBreaker) { + public UpdateCallBuilder circuitBreaker(final EndpointCircuitBreaker circuitBreaker) { this.circuitBreaker = Optional.ofNullable(circuitBreaker); return this; } @@ -747,7 +757,7 @@ public class EndpointConfigurations { * @param circuitBreaker the value of the circuit_breaker parameter as an {@link Optional} of {@link EndpointCircuitBreaker} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder circuitBreaker(final Optional circuitBreaker) { + public UpdateCallBuilder circuitBreaker(final Optional circuitBreaker) { this.circuitBreaker = Objects.requireNonNull(circuitBreaker, "circuitBreaker is required"); return this; } @@ -758,7 +768,7 @@ public class EndpointConfigurations { * @param compression the value of the compression parameter as a {@link EndpointCompression} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder compression(final EndpointCompression compression) { + public UpdateCallBuilder compression(final EndpointCompression compression) { this.compression = Optional.ofNullable(compression); return this; } @@ -769,7 +779,7 @@ public class EndpointConfigurations { * @param compression the value of the compression parameter as an {@link Optional} of {@link EndpointCompression} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder compression(final Optional compression) { + public UpdateCallBuilder compression(final Optional compression) { this.compression = Objects.requireNonNull(compression, "compression is required"); return this; } @@ -780,7 +790,7 @@ public class EndpointConfigurations { * @param requestHeaders the value of the request_headers parameter as a {@link EndpointRequestHeaders} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder requestHeaders(final EndpointRequestHeaders requestHeaders) { + public UpdateCallBuilder requestHeaders(final EndpointRequestHeaders requestHeaders) { this.requestHeaders = Optional.ofNullable(requestHeaders); return this; } @@ -791,7 +801,7 @@ public class EndpointConfigurations { * @param requestHeaders the value of the request_headers parameter as an {@link Optional} of {@link EndpointRequestHeaders} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder requestHeaders(final Optional requestHeaders) { + public UpdateCallBuilder requestHeaders(final Optional requestHeaders) { this.requestHeaders = Objects.requireNonNull(requestHeaders, "requestHeaders is required"); return this; } @@ -802,7 +812,7 @@ public class EndpointConfigurations { * @param responseHeaders the value of the response_headers parameter as a {@link EndpointResponseHeaders} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder responseHeaders(final EndpointResponseHeaders responseHeaders) { + public UpdateCallBuilder responseHeaders(final EndpointResponseHeaders responseHeaders) { this.responseHeaders = Optional.ofNullable(responseHeaders); return this; } @@ -813,7 +823,7 @@ public class EndpointConfigurations { * @param responseHeaders the value of the response_headers parameter as an {@link Optional} of {@link EndpointResponseHeaders} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder responseHeaders(final Optional responseHeaders) { + public UpdateCallBuilder responseHeaders(final Optional responseHeaders) { this.responseHeaders = Objects.requireNonNull(responseHeaders, "responseHeaders is required"); return this; } @@ -824,7 +834,7 @@ public class EndpointConfigurations { * @param ipPolicy the value of the ip_policy parameter as a {@link EndpointIpPolicyMutate} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder ipPolicy(final EndpointIpPolicyMutate ipPolicy) { + public UpdateCallBuilder ipPolicy(final EndpointIpPolicyMutate ipPolicy) { this.ipPolicy = Optional.ofNullable(ipPolicy); return this; } @@ -835,7 +845,7 @@ public class EndpointConfigurations { * @param ipPolicy the value of the ip_policy parameter as an {@link Optional} of {@link EndpointIpPolicyMutate} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder ipPolicy(final Optional ipPolicy) { + public UpdateCallBuilder ipPolicy(final Optional ipPolicy) { this.ipPolicy = Objects.requireNonNull(ipPolicy, "ipPolicy is required"); return this; } @@ -846,7 +856,7 @@ public class EndpointConfigurations { * @param mutualTls the value of the mutual_tls parameter as a {@link EndpointMutualTlsMutate} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder mutualTls(final EndpointMutualTlsMutate mutualTls) { + public UpdateCallBuilder mutualTls(final EndpointMutualTlsMutate mutualTls) { this.mutualTls = Optional.ofNullable(mutualTls); return this; } @@ -857,7 +867,7 @@ public class EndpointConfigurations { * @param mutualTls the value of the mutual_tls parameter as an {@link Optional} of {@link EndpointMutualTlsMutate} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder mutualTls(final Optional mutualTls) { + public UpdateCallBuilder mutualTls(final Optional mutualTls) { this.mutualTls = Objects.requireNonNull(mutualTls, "mutualTls is required"); return this; } @@ -868,7 +878,7 @@ public class EndpointConfigurations { * @param tlsTermination the value of the tls_termination parameter as a {@link EndpointTlsTermination} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder tlsTermination(final EndpointTlsTermination tlsTermination) { + public UpdateCallBuilder tlsTermination(final EndpointTlsTermination tlsTermination) { this.tlsTermination = Optional.ofNullable(tlsTermination); return this; } @@ -879,7 +889,7 @@ public class EndpointConfigurations { * @param tlsTermination the value of the tls_termination parameter as an {@link Optional} of {@link EndpointTlsTermination} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder tlsTermination(final Optional tlsTermination) { + public UpdateCallBuilder tlsTermination(final Optional tlsTermination) { this.tlsTermination = Objects.requireNonNull(tlsTermination, "tlsTermination is required"); return this; } @@ -890,7 +900,7 @@ public class EndpointConfigurations { * @param webhookValidation the value of the webhook_validation parameter as a {@link EndpointWebhookValidation} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder webhookValidation(final EndpointWebhookValidation webhookValidation) { + public UpdateCallBuilder webhookValidation(final EndpointWebhookValidation webhookValidation) { this.webhookValidation = Optional.ofNullable(webhookValidation); return this; } @@ -901,7 +911,7 @@ public class EndpointConfigurations { * @param webhookValidation the value of the webhook_validation parameter as an {@link Optional} of {@link EndpointWebhookValidation} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder webhookValidation(final Optional webhookValidation) { + public UpdateCallBuilder webhookValidation(final Optional webhookValidation) { this.webhookValidation = Objects.requireNonNull(webhookValidation, "webhookValidation is required"); return this; } @@ -912,7 +922,7 @@ public class EndpointConfigurations { * @param oauth the value of the oauth parameter as a {@link EndpointOAuth} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder oauth(final EndpointOAuth oauth) { + public UpdateCallBuilder oauth(final EndpointOAuth oauth) { this.oauth = Optional.ofNullable(oauth); return this; } @@ -923,7 +933,7 @@ public class EndpointConfigurations { * @param oauth the value of the oauth parameter as an {@link Optional} of {@link EndpointOAuth} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder oauth(final Optional oauth) { + public UpdateCallBuilder oauth(final Optional oauth) { this.oauth = Objects.requireNonNull(oauth, "oauth is required"); return this; } @@ -934,7 +944,7 @@ public class EndpointConfigurations { * @param logging the value of the logging parameter as a {@link EndpointLoggingMutate} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder logging(final EndpointLoggingMutate logging) { + public UpdateCallBuilder logging(final EndpointLoggingMutate logging) { this.logging = Optional.ofNullable(logging); return this; } @@ -945,7 +955,7 @@ public class EndpointConfigurations { * @param logging the value of the logging parameter as an {@link Optional} of {@link EndpointLoggingMutate} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder logging(final Optional logging) { + public UpdateCallBuilder logging(final Optional logging) { this.logging = Objects.requireNonNull(logging, "logging is required"); return this; } @@ -956,7 +966,7 @@ public class EndpointConfigurations { * @param saml the value of the saml parameter as a {@link EndpointSamlMutate} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder saml(final EndpointSamlMutate saml) { + public UpdateCallBuilder saml(final EndpointSamlMutate saml) { this.saml = Optional.ofNullable(saml); return this; } @@ -967,7 +977,7 @@ public class EndpointConfigurations { * @param saml the value of the saml parameter as an {@link Optional} of {@link EndpointSamlMutate} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder saml(final Optional saml) { + public UpdateCallBuilder saml(final Optional saml) { this.saml = Objects.requireNonNull(saml, "saml is required"); return this; } @@ -978,7 +988,7 @@ public class EndpointConfigurations { * @param oidc the value of the oidc parameter as a {@link EndpointOidc} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder oidc(final EndpointOidc oidc) { + public UpdateCallBuilder oidc(final EndpointOidc oidc) { this.oidc = Optional.ofNullable(oidc); return this; } @@ -989,7 +999,7 @@ public class EndpointConfigurations { * @param oidc the value of the oidc parameter as an {@link Optional} of {@link EndpointOidc} * @return the call builder instance */ - public EndpointConfigurationsUpdateCallBuilder oidc(final Optional oidc) { + public UpdateCallBuilder oidc(final Optional oidc) { this.oidc = Objects.requireNonNull(oidc, "oidc is required"); return this; } @@ -1045,13 +1055,15 @@ public class EndpointConfigurations { * will completely replace the existing value. There is no way to delete an * existing module via this API, instead use the delete module API. * + * See also https://ngrok.com/docs/api#api-endpoint-configurations-update. + * * @param id unique identifier of this endpoint configuration * @return a call builder for this API call */ - public EndpointConfigurationsUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new EndpointConfigurationsUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointIpPolicyModule.java b/src/main/java/com/ngrok/services/EndpointIpPolicyModule.java index e1a6d77..1fb0b72 100644 --- a/src/main/java/com/ngrok/services/EndpointIpPolicyModule.java +++ b/src/main/java/com/ngrok/services/EndpointIpPolicyModule.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EndpointIpPolicyModule}. + * + * See also https://ngrok.com/docs/api#api-endpoint-ip-policy-module. */ public class EndpointIpPolicyModule { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EndpointIpPolicyModule { /** * A builder object encapsulating state for an unsent Replace API call. */ - public class EndpointIpPolicyModuleReplaceCallBuilder { + public class ReplaceCallBuilder { private final String id; private EndpointIpPolicyMutate module = null; - private EndpointIpPolicyModuleReplaceCallBuilder( + private ReplaceCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -45,7 +47,7 @@ public class EndpointIpPolicyModule { * @param module the value of the module parameter as a {@link EndpointIpPolicyMutate} * @return the call builder instance */ - public EndpointIpPolicyModuleReplaceCallBuilder module(final EndpointIpPolicyMutate module) { + public ReplaceCallBuilder module(final EndpointIpPolicyMutate module) { this.module = Objects.requireNonNull(module, "module is required"); return this; } @@ -56,7 +58,7 @@ public class EndpointIpPolicyModule { * @param module the value of the module parameter as an {@link Optional} of {@link EndpointIpPolicyMutate} * @return the call builder instance */ - public EndpointIpPolicyModuleReplaceCallBuilder module(final Optional module) { + public ReplaceCallBuilder module(final Optional module) { this.module = Objects.requireNonNull(module, "module is required").orElse(null); return this; } @@ -96,13 +98,15 @@ public class EndpointIpPolicyModule { /** * Creates a call builder for the Replace API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-ip-policy-module-replace. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public EndpointIpPolicyModuleReplaceCallBuilder replace( + public ReplaceCallBuilder replace( final String id ) { - return new EndpointIpPolicyModuleReplaceCallBuilder( + return new ReplaceCallBuilder( id ); } @@ -110,10 +114,10 @@ public class EndpointIpPolicyModule { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointIpPolicyModuleGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointIpPolicyModuleGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -152,13 +156,15 @@ public class EndpointIpPolicyModule { /** * Creates a call builder for the Get API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-ip-policy-module-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointIpPolicyModuleGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointIpPolicyModuleGetCallBuilder( + return new GetCallBuilder( id ); } @@ -166,10 +172,10 @@ public class EndpointIpPolicyModule { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointIpPolicyModuleDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointIpPolicyModuleDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -207,13 +213,15 @@ public class EndpointIpPolicyModule { /** * Creates a call builder for the Delete API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-ip-policy-module-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointIpPolicyModuleDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointIpPolicyModuleDeleteCallBuilder( + return new DeleteCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointLoggingModule.java b/src/main/java/com/ngrok/services/EndpointLoggingModule.java index 2b4e4a1..83ecf9e 100644 --- a/src/main/java/com/ngrok/services/EndpointLoggingModule.java +++ b/src/main/java/com/ngrok/services/EndpointLoggingModule.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EndpointLoggingModule}. + * + * See also https://ngrok.com/docs/api#api-endpoint-logging-module. */ public class EndpointLoggingModule { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EndpointLoggingModule { /** * A builder object encapsulating state for an unsent Replace API call. */ - public class EndpointLoggingModuleReplaceCallBuilder { + public class ReplaceCallBuilder { private final String id; private EndpointLoggingMutate module = null; - private EndpointLoggingModuleReplaceCallBuilder( + private ReplaceCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -45,7 +47,7 @@ public class EndpointLoggingModule { * @param module the value of the module parameter as a {@link EndpointLoggingMutate} * @return the call builder instance */ - public EndpointLoggingModuleReplaceCallBuilder module(final EndpointLoggingMutate module) { + public ReplaceCallBuilder module(final EndpointLoggingMutate module) { this.module = Objects.requireNonNull(module, "module is required"); return this; } @@ -56,7 +58,7 @@ public class EndpointLoggingModule { * @param module the value of the module parameter as an {@link Optional} of {@link EndpointLoggingMutate} * @return the call builder instance */ - public EndpointLoggingModuleReplaceCallBuilder module(final Optional module) { + public ReplaceCallBuilder module(final Optional module) { this.module = Objects.requireNonNull(module, "module is required").orElse(null); return this; } @@ -96,13 +98,15 @@ public class EndpointLoggingModule { /** * Creates a call builder for the Replace API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-logging-module-replace. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public EndpointLoggingModuleReplaceCallBuilder replace( + public ReplaceCallBuilder replace( final String id ) { - return new EndpointLoggingModuleReplaceCallBuilder( + return new ReplaceCallBuilder( id ); } @@ -110,10 +114,10 @@ public class EndpointLoggingModule { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointLoggingModuleGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointLoggingModuleGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -152,13 +156,15 @@ public class EndpointLoggingModule { /** * Creates a call builder for the Get API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-logging-module-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointLoggingModuleGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointLoggingModuleGetCallBuilder( + return new GetCallBuilder( id ); } @@ -166,10 +172,10 @@ public class EndpointLoggingModule { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointLoggingModuleDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointLoggingModuleDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -207,13 +213,15 @@ public class EndpointLoggingModule { /** * Creates a call builder for the Delete API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-logging-module-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointLoggingModuleDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointLoggingModuleDeleteCallBuilder( + return new DeleteCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointMutualTlsModule.java b/src/main/java/com/ngrok/services/EndpointMutualTlsModule.java index 03879de..8bba1be 100644 --- a/src/main/java/com/ngrok/services/EndpointMutualTlsModule.java +++ b/src/main/java/com/ngrok/services/EndpointMutualTlsModule.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EndpointMutualTlsModule}. + * + * See also https://ngrok.com/docs/api#api-endpoint-mutual-tls-module. */ public class EndpointMutualTlsModule { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EndpointMutualTlsModule { /** * A builder object encapsulating state for an unsent Replace API call. */ - public class EndpointMutualTlsModuleReplaceCallBuilder { + public class ReplaceCallBuilder { private final String id; private EndpointMutualTlsMutate module = null; - private EndpointMutualTlsModuleReplaceCallBuilder( + private ReplaceCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -45,7 +47,7 @@ public class EndpointMutualTlsModule { * @param module the value of the module parameter as a {@link EndpointMutualTlsMutate} * @return the call builder instance */ - public EndpointMutualTlsModuleReplaceCallBuilder module(final EndpointMutualTlsMutate module) { + public ReplaceCallBuilder module(final EndpointMutualTlsMutate module) { this.module = Objects.requireNonNull(module, "module is required"); return this; } @@ -56,7 +58,7 @@ public class EndpointMutualTlsModule { * @param module the value of the module parameter as an {@link Optional} of {@link EndpointMutualTlsMutate} * @return the call builder instance */ - public EndpointMutualTlsModuleReplaceCallBuilder module(final Optional module) { + public ReplaceCallBuilder module(final Optional module) { this.module = Objects.requireNonNull(module, "module is required").orElse(null); return this; } @@ -96,13 +98,15 @@ public class EndpointMutualTlsModule { /** * Creates a call builder for the Replace API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-mutual-tls-module-replace. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public EndpointMutualTlsModuleReplaceCallBuilder replace( + public ReplaceCallBuilder replace( final String id ) { - return new EndpointMutualTlsModuleReplaceCallBuilder( + return new ReplaceCallBuilder( id ); } @@ -110,10 +114,10 @@ public class EndpointMutualTlsModule { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointMutualTlsModuleGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointMutualTlsModuleGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -152,13 +156,15 @@ public class EndpointMutualTlsModule { /** * Creates a call builder for the Get API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-mutual-tls-module-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointMutualTlsModuleGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointMutualTlsModuleGetCallBuilder( + return new GetCallBuilder( id ); } @@ -166,10 +172,10 @@ public class EndpointMutualTlsModule { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointMutualTlsModuleDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointMutualTlsModuleDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -207,13 +213,15 @@ public class EndpointMutualTlsModule { /** * Creates a call builder for the Delete API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-mutual-tls-module-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointMutualTlsModuleDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointMutualTlsModuleDeleteCallBuilder( + return new DeleteCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointOAuthModule.java b/src/main/java/com/ngrok/services/EndpointOAuthModule.java index b418429..d2e1f54 100644 --- a/src/main/java/com/ngrok/services/EndpointOAuthModule.java +++ b/src/main/java/com/ngrok/services/EndpointOAuthModule.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EndpointOAuthModule}. + * + * See also https://ngrok.com/docs/api#api-endpoint-o-auth-module. */ public class EndpointOAuthModule { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EndpointOAuthModule { /** * A builder object encapsulating state for an unsent Replace API call. */ - public class EndpointOAuthModuleReplaceCallBuilder { + public class ReplaceCallBuilder { private final String id; private EndpointOAuth module = null; - private EndpointOAuthModuleReplaceCallBuilder( + private ReplaceCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -45,7 +47,7 @@ public class EndpointOAuthModule { * @param module the value of the module parameter as a {@link EndpointOAuth} * @return the call builder instance */ - public EndpointOAuthModuleReplaceCallBuilder module(final EndpointOAuth module) { + public ReplaceCallBuilder module(final EndpointOAuth module) { this.module = Objects.requireNonNull(module, "module is required"); return this; } @@ -56,7 +58,7 @@ public class EndpointOAuthModule { * @param module the value of the module parameter as an {@link Optional} of {@link EndpointOAuth} * @return the call builder instance */ - public EndpointOAuthModuleReplaceCallBuilder module(final Optional module) { + public ReplaceCallBuilder module(final Optional module) { this.module = Objects.requireNonNull(module, "module is required").orElse(null); return this; } @@ -96,13 +98,15 @@ public class EndpointOAuthModule { /** * Creates a call builder for the Replace API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-o-auth-module-replace. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public EndpointOAuthModuleReplaceCallBuilder replace( + public ReplaceCallBuilder replace( final String id ) { - return new EndpointOAuthModuleReplaceCallBuilder( + return new ReplaceCallBuilder( id ); } @@ -110,10 +114,10 @@ public class EndpointOAuthModule { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointOAuthModuleGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointOAuthModuleGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -152,13 +156,15 @@ public class EndpointOAuthModule { /** * Creates a call builder for the Get API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-o-auth-module-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointOAuthModuleGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointOAuthModuleGetCallBuilder( + return new GetCallBuilder( id ); } @@ -166,10 +172,10 @@ public class EndpointOAuthModule { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointOAuthModuleDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointOAuthModuleDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -207,13 +213,15 @@ public class EndpointOAuthModule { /** * Creates a call builder for the Delete API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-o-auth-module-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointOAuthModuleDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointOAuthModuleDeleteCallBuilder( + return new DeleteCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointOidcModule.java b/src/main/java/com/ngrok/services/EndpointOidcModule.java index 1f9fa4a..a799371 100644 --- a/src/main/java/com/ngrok/services/EndpointOidcModule.java +++ b/src/main/java/com/ngrok/services/EndpointOidcModule.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EndpointOidcModule}. + * + * See also https://ngrok.com/docs/api#api-endpoint-oidc-module. */ public class EndpointOidcModule { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EndpointOidcModule { /** * A builder object encapsulating state for an unsent Replace API call. */ - public class EndpointOidcModuleReplaceCallBuilder { + public class ReplaceCallBuilder { private final String id; private EndpointOidc module = null; - private EndpointOidcModuleReplaceCallBuilder( + private ReplaceCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -45,7 +47,7 @@ public class EndpointOidcModule { * @param module the value of the module parameter as a {@link EndpointOidc} * @return the call builder instance */ - public EndpointOidcModuleReplaceCallBuilder module(final EndpointOidc module) { + public ReplaceCallBuilder module(final EndpointOidc module) { this.module = Objects.requireNonNull(module, "module is required"); return this; } @@ -56,7 +58,7 @@ public class EndpointOidcModule { * @param module the value of the module parameter as an {@link Optional} of {@link EndpointOidc} * @return the call builder instance */ - public EndpointOidcModuleReplaceCallBuilder module(final Optional module) { + public ReplaceCallBuilder module(final Optional module) { this.module = Objects.requireNonNull(module, "module is required").orElse(null); return this; } @@ -96,13 +98,15 @@ public class EndpointOidcModule { /** * Creates a call builder for the Replace API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-oidc-module-replace. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public EndpointOidcModuleReplaceCallBuilder replace( + public ReplaceCallBuilder replace( final String id ) { - return new EndpointOidcModuleReplaceCallBuilder( + return new ReplaceCallBuilder( id ); } @@ -110,10 +114,10 @@ public class EndpointOidcModule { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointOidcModuleGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointOidcModuleGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -152,13 +156,15 @@ public class EndpointOidcModule { /** * Creates a call builder for the Get API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-oidc-module-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointOidcModuleGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointOidcModuleGetCallBuilder( + return new GetCallBuilder( id ); } @@ -166,10 +172,10 @@ public class EndpointOidcModule { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointOidcModuleDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointOidcModuleDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -207,13 +213,15 @@ public class EndpointOidcModule { /** * Creates a call builder for the Delete API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-oidc-module-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointOidcModuleDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointOidcModuleDeleteCallBuilder( + return new DeleteCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointRequestHeadersModule.java b/src/main/java/com/ngrok/services/EndpointRequestHeadersModule.java index 3e632da..601e1b4 100644 --- a/src/main/java/com/ngrok/services/EndpointRequestHeadersModule.java +++ b/src/main/java/com/ngrok/services/EndpointRequestHeadersModule.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EndpointRequestHeadersModule}. + * + * See also https://ngrok.com/docs/api#api-endpoint-request-headers-module. */ public class EndpointRequestHeadersModule { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EndpointRequestHeadersModule { /** * A builder object encapsulating state for an unsent Replace API call. */ - public class EndpointRequestHeadersModuleReplaceCallBuilder { + public class ReplaceCallBuilder { private final String id; private EndpointRequestHeaders module = null; - private EndpointRequestHeadersModuleReplaceCallBuilder( + private ReplaceCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -45,7 +47,7 @@ public class EndpointRequestHeadersModule { * @param module the value of the module parameter as a {@link EndpointRequestHeaders} * @return the call builder instance */ - public EndpointRequestHeadersModuleReplaceCallBuilder module(final EndpointRequestHeaders module) { + public ReplaceCallBuilder module(final EndpointRequestHeaders module) { this.module = Objects.requireNonNull(module, "module is required"); return this; } @@ -56,7 +58,7 @@ public class EndpointRequestHeadersModule { * @param module the value of the module parameter as an {@link Optional} of {@link EndpointRequestHeaders} * @return the call builder instance */ - public EndpointRequestHeadersModuleReplaceCallBuilder module(final Optional module) { + public ReplaceCallBuilder module(final Optional module) { this.module = Objects.requireNonNull(module, "module is required").orElse(null); return this; } @@ -96,13 +98,15 @@ public class EndpointRequestHeadersModule { /** * Creates a call builder for the Replace API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-request-headers-module-replace. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public EndpointRequestHeadersModuleReplaceCallBuilder replace( + public ReplaceCallBuilder replace( final String id ) { - return new EndpointRequestHeadersModuleReplaceCallBuilder( + return new ReplaceCallBuilder( id ); } @@ -110,10 +114,10 @@ public class EndpointRequestHeadersModule { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointRequestHeadersModuleGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointRequestHeadersModuleGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -152,13 +156,15 @@ public class EndpointRequestHeadersModule { /** * Creates a call builder for the Get API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-request-headers-module-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointRequestHeadersModuleGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointRequestHeadersModuleGetCallBuilder( + return new GetCallBuilder( id ); } @@ -166,10 +172,10 @@ public class EndpointRequestHeadersModule { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointRequestHeadersModuleDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointRequestHeadersModuleDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -207,13 +213,15 @@ public class EndpointRequestHeadersModule { /** * Creates a call builder for the Delete API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-request-headers-module-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointRequestHeadersModuleDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointRequestHeadersModuleDeleteCallBuilder( + return new DeleteCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointResponseHeadersModule.java b/src/main/java/com/ngrok/services/EndpointResponseHeadersModule.java index ef622e3..fe1fec6 100644 --- a/src/main/java/com/ngrok/services/EndpointResponseHeadersModule.java +++ b/src/main/java/com/ngrok/services/EndpointResponseHeadersModule.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EndpointResponseHeadersModule}. + * + * See also https://ngrok.com/docs/api#api-endpoint-response-headers-module. */ public class EndpointResponseHeadersModule { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EndpointResponseHeadersModule { /** * A builder object encapsulating state for an unsent Replace API call. */ - public class EndpointResponseHeadersModuleReplaceCallBuilder { + public class ReplaceCallBuilder { private final String id; private EndpointResponseHeaders module = null; - private EndpointResponseHeadersModuleReplaceCallBuilder( + private ReplaceCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -45,7 +47,7 @@ public class EndpointResponseHeadersModule { * @param module the value of the module parameter as a {@link EndpointResponseHeaders} * @return the call builder instance */ - public EndpointResponseHeadersModuleReplaceCallBuilder module(final EndpointResponseHeaders module) { + public ReplaceCallBuilder module(final EndpointResponseHeaders module) { this.module = Objects.requireNonNull(module, "module is required"); return this; } @@ -56,7 +58,7 @@ public class EndpointResponseHeadersModule { * @param module the value of the module parameter as an {@link Optional} of {@link EndpointResponseHeaders} * @return the call builder instance */ - public EndpointResponseHeadersModuleReplaceCallBuilder module(final Optional module) { + public ReplaceCallBuilder module(final Optional module) { this.module = Objects.requireNonNull(module, "module is required").orElse(null); return this; } @@ -96,13 +98,15 @@ public class EndpointResponseHeadersModule { /** * Creates a call builder for the Replace API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-response-headers-module-replace. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public EndpointResponseHeadersModuleReplaceCallBuilder replace( + public ReplaceCallBuilder replace( final String id ) { - return new EndpointResponseHeadersModuleReplaceCallBuilder( + return new ReplaceCallBuilder( id ); } @@ -110,10 +114,10 @@ public class EndpointResponseHeadersModule { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointResponseHeadersModuleGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointResponseHeadersModuleGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -152,13 +156,15 @@ public class EndpointResponseHeadersModule { /** * Creates a call builder for the Get API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-response-headers-module-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointResponseHeadersModuleGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointResponseHeadersModuleGetCallBuilder( + return new GetCallBuilder( id ); } @@ -166,10 +172,10 @@ public class EndpointResponseHeadersModule { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointResponseHeadersModuleDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointResponseHeadersModuleDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -207,13 +213,15 @@ public class EndpointResponseHeadersModule { /** * Creates a call builder for the Delete API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-response-headers-module-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointResponseHeadersModuleDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointResponseHeadersModuleDeleteCallBuilder( + return new DeleteCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointSamlModule.java b/src/main/java/com/ngrok/services/EndpointSamlModule.java index 861f4f4..876edf4 100644 --- a/src/main/java/com/ngrok/services/EndpointSamlModule.java +++ b/src/main/java/com/ngrok/services/EndpointSamlModule.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EndpointSamlModule}. + * + * See also https://ngrok.com/docs/api#api-endpoint-saml-module. */ public class EndpointSamlModule { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EndpointSamlModule { /** * A builder object encapsulating state for an unsent Replace API call. */ - public class EndpointSamlModuleReplaceCallBuilder { + public class ReplaceCallBuilder { private final String id; private EndpointSamlMutate module = null; - private EndpointSamlModuleReplaceCallBuilder( + private ReplaceCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -45,7 +47,7 @@ public class EndpointSamlModule { * @param module the value of the module parameter as a {@link EndpointSamlMutate} * @return the call builder instance */ - public EndpointSamlModuleReplaceCallBuilder module(final EndpointSamlMutate module) { + public ReplaceCallBuilder module(final EndpointSamlMutate module) { this.module = Objects.requireNonNull(module, "module is required"); return this; } @@ -56,7 +58,7 @@ public class EndpointSamlModule { * @param module the value of the module parameter as an {@link Optional} of {@link EndpointSamlMutate} * @return the call builder instance */ - public EndpointSamlModuleReplaceCallBuilder module(final Optional module) { + public ReplaceCallBuilder module(final Optional module) { this.module = Objects.requireNonNull(module, "module is required").orElse(null); return this; } @@ -96,13 +98,15 @@ public class EndpointSamlModule { /** * Creates a call builder for the Replace API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-saml-module-replace. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public EndpointSamlModuleReplaceCallBuilder replace( + public ReplaceCallBuilder replace( final String id ) { - return new EndpointSamlModuleReplaceCallBuilder( + return new ReplaceCallBuilder( id ); } @@ -110,10 +114,10 @@ public class EndpointSamlModule { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointSamlModuleGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointSamlModuleGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -152,13 +156,15 @@ public class EndpointSamlModule { /** * Creates a call builder for the Get API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-saml-module-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointSamlModuleGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointSamlModuleGetCallBuilder( + return new GetCallBuilder( id ); } @@ -166,10 +172,10 @@ public class EndpointSamlModule { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointSamlModuleDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointSamlModuleDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -207,13 +213,15 @@ public class EndpointSamlModule { /** * Creates a call builder for the Delete API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-saml-module-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointSamlModuleDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointSamlModuleDeleteCallBuilder( + return new DeleteCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointTlsTerminationModule.java b/src/main/java/com/ngrok/services/EndpointTlsTerminationModule.java index 9129642..1c8d8d5 100644 --- a/src/main/java/com/ngrok/services/EndpointTlsTerminationModule.java +++ b/src/main/java/com/ngrok/services/EndpointTlsTerminationModule.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EndpointTlsTerminationModule}. + * + * See also https://ngrok.com/docs/api#api-endpoint-tls-termination-module. */ public class EndpointTlsTerminationModule { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EndpointTlsTerminationModule { /** * A builder object encapsulating state for an unsent Replace API call. */ - public class EndpointTlsTerminationModuleReplaceCallBuilder { + public class ReplaceCallBuilder { private final String id; private EndpointTlsTermination module = null; - private EndpointTlsTerminationModuleReplaceCallBuilder( + private ReplaceCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -45,7 +47,7 @@ public class EndpointTlsTerminationModule { * @param module the value of the module parameter as a {@link EndpointTlsTermination} * @return the call builder instance */ - public EndpointTlsTerminationModuleReplaceCallBuilder module(final EndpointTlsTermination module) { + public ReplaceCallBuilder module(final EndpointTlsTermination module) { this.module = Objects.requireNonNull(module, "module is required"); return this; } @@ -56,7 +58,7 @@ public class EndpointTlsTerminationModule { * @param module the value of the module parameter as an {@link Optional} of {@link EndpointTlsTermination} * @return the call builder instance */ - public EndpointTlsTerminationModuleReplaceCallBuilder module(final Optional module) { + public ReplaceCallBuilder module(final Optional module) { this.module = Objects.requireNonNull(module, "module is required").orElse(null); return this; } @@ -96,13 +98,15 @@ public class EndpointTlsTerminationModule { /** * Creates a call builder for the Replace API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-tls-termination-module-replace. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public EndpointTlsTerminationModuleReplaceCallBuilder replace( + public ReplaceCallBuilder replace( final String id ) { - return new EndpointTlsTerminationModuleReplaceCallBuilder( + return new ReplaceCallBuilder( id ); } @@ -110,10 +114,10 @@ public class EndpointTlsTerminationModule { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointTlsTerminationModuleGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointTlsTerminationModuleGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -152,13 +156,15 @@ public class EndpointTlsTerminationModule { /** * Creates a call builder for the Get API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-tls-termination-module-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointTlsTerminationModuleGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointTlsTerminationModuleGetCallBuilder( + return new GetCallBuilder( id ); } @@ -166,10 +172,10 @@ public class EndpointTlsTerminationModule { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointTlsTerminationModuleDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointTlsTerminationModuleDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -207,13 +213,15 @@ public class EndpointTlsTerminationModule { /** * Creates a call builder for the Delete API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-tls-termination-module-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointTlsTerminationModuleDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointTlsTerminationModuleDeleteCallBuilder( + return new DeleteCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EndpointWebhookValidationModule.java b/src/main/java/com/ngrok/services/EndpointWebhookValidationModule.java index 0b9195c..8d2fc6d 100644 --- a/src/main/java/com/ngrok/services/EndpointWebhookValidationModule.java +++ b/src/main/java/com/ngrok/services/EndpointWebhookValidationModule.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EndpointWebhookValidationModule}. + * + * See also https://ngrok.com/docs/api#api-endpoint-webhook-validation-module. */ public class EndpointWebhookValidationModule { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EndpointWebhookValidationModule { /** * A builder object encapsulating state for an unsent Replace API call. */ - public class EndpointWebhookValidationModuleReplaceCallBuilder { + public class ReplaceCallBuilder { private final String id; private EndpointWebhookValidation module = null; - private EndpointWebhookValidationModuleReplaceCallBuilder( + private ReplaceCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -45,7 +47,7 @@ public class EndpointWebhookValidationModule { * @param module the value of the module parameter as a {@link EndpointWebhookValidation} * @return the call builder instance */ - public EndpointWebhookValidationModuleReplaceCallBuilder module(final EndpointWebhookValidation module) { + public ReplaceCallBuilder module(final EndpointWebhookValidation module) { this.module = Objects.requireNonNull(module, "module is required"); return this; } @@ -56,7 +58,7 @@ public class EndpointWebhookValidationModule { * @param module the value of the module parameter as an {@link Optional} of {@link EndpointWebhookValidation} * @return the call builder instance */ - public EndpointWebhookValidationModuleReplaceCallBuilder module(final Optional module) { + public ReplaceCallBuilder module(final Optional module) { this.module = Objects.requireNonNull(module, "module is required").orElse(null); return this; } @@ -96,13 +98,15 @@ public class EndpointWebhookValidationModule { /** * Creates a call builder for the Replace API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-webhook-validation-module-replace. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public EndpointWebhookValidationModuleReplaceCallBuilder replace( + public ReplaceCallBuilder replace( final String id ) { - return new EndpointWebhookValidationModuleReplaceCallBuilder( + return new ReplaceCallBuilder( id ); } @@ -110,10 +114,10 @@ public class EndpointWebhookValidationModule { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EndpointWebhookValidationModuleGetCallBuilder { + public class GetCallBuilder { private final String id; - private EndpointWebhookValidationModuleGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -152,13 +156,15 @@ public class EndpointWebhookValidationModule { /** * Creates a call builder for the Get API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-webhook-validation-module-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointWebhookValidationModuleGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EndpointWebhookValidationModuleGetCallBuilder( + return new GetCallBuilder( id ); } @@ -166,10 +172,10 @@ public class EndpointWebhookValidationModule { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EndpointWebhookValidationModuleDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EndpointWebhookValidationModuleDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -207,13 +213,15 @@ public class EndpointWebhookValidationModule { /** * Creates a call builder for the Delete API operation. * + * See also https://ngrok.com/docs/api#api-endpoint-webhook-validation-module-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EndpointWebhookValidationModuleDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EndpointWebhookValidationModuleDeleteCallBuilder( + return new DeleteCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EventDestinations.java b/src/main/java/com/ngrok/services/EventDestinations.java index 29f0ae6..f09c736 100644 --- a/src/main/java/com/ngrok/services/EventDestinations.java +++ b/src/main/java/com/ngrok/services/EventDestinations.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EventDestinations}. + * + * See also https://ngrok.com/docs/api#api-event-destinations. */ public class EventDestinations { private final NgrokApiClient apiClient; @@ -29,13 +31,13 @@ public class EventDestinations { /** * A builder object encapsulating state for an unsent Create API call. */ - public class EventDestinationsCreateCallBuilder { + public class CreateCallBuilder { private String metadata = ""; private String description = ""; private String format = ""; private EventTarget target = null; - private EventDestinationsCreateCallBuilder( + private CreateCallBuilder( ) { } @@ -46,7 +48,7 @@ public class EventDestinations { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public EventDestinationsCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -58,7 +60,7 @@ public class EventDestinations { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventDestinationsCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -69,7 +71,7 @@ public class EventDestinations { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public EventDestinationsCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -80,7 +82,7 @@ public class EventDestinations { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventDestinationsCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -92,7 +94,7 @@ public class EventDestinations { * @param format the value of the format parameter as a {@link String} * @return the call builder instance */ - public EventDestinationsCreateCallBuilder format(final String format) { + public CreateCallBuilder format(final String format) { this.format = Objects.requireNonNull(format, "format is required"); return this; } @@ -104,7 +106,7 @@ public class EventDestinations { * @param format the value of the format parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventDestinationsCreateCallBuilder format(final Optional format) { + public CreateCallBuilder format(final Optional format) { this.format = Objects.requireNonNull(format, "format is required").orElse(""); return this; } @@ -118,7 +120,7 @@ public class EventDestinations { * @param target the value of the target parameter as a {@link EventTarget} * @return the call builder instance */ - public EventDestinationsCreateCallBuilder target(final EventTarget target) { + public CreateCallBuilder target(final EventTarget target) { this.target = Objects.requireNonNull(target, "target is required"); return this; } @@ -132,7 +134,7 @@ public class EventDestinations { * @param target the value of the target parameter as an {@link Optional} of {@link EventTarget} * @return the call builder instance */ - public EventDestinationsCreateCallBuilder target(final Optional target) { + public CreateCallBuilder target(final Optional target) { this.target = Objects.requireNonNull(target, "target is required").orElse(null); return this; } @@ -177,21 +179,23 @@ public class EventDestinations { * associated with an Event Stream, and that Event Stream is associated with an * Endpoint Config. * + * See also https://ngrok.com/docs/api#api-event-destinations-create. + * * @return a call builder for this API call */ - public EventDestinationsCreateCallBuilder create( + public CreateCallBuilder create( ) { - return new EventDestinationsCreateCallBuilder( + return new CreateCallBuilder( ); } /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EventDestinationsDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EventDestinationsDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -231,13 +235,15 @@ public class EventDestinations { * Event Stream, this will throw an error until that Event Stream has removed that * reference. * + * See also https://ngrok.com/docs/api#api-event-destinations-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EventDestinationsDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EventDestinationsDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -245,10 +251,10 @@ public class EventDestinations { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EventDestinationsGetCallBuilder { + public class GetCallBuilder { private final String id; - private EventDestinationsGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -287,13 +293,15 @@ public class EventDestinations { /** * Get detailed information about an Event Destination by ID. * + * See also https://ngrok.com/docs/api#api-event-destinations-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EventDestinationsGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EventDestinationsGetCallBuilder( + return new GetCallBuilder( id ); } @@ -301,11 +309,11 @@ public class EventDestinations { /** * A builder object encapsulating state for an unsent List API call. */ - public class EventDestinationsListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private EventDestinationsListCallBuilder( + private ListCallBuilder( ) { } @@ -315,7 +323,7 @@ public class EventDestinations { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public EventDestinationsListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -326,7 +334,7 @@ public class EventDestinations { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventDestinationsListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -337,7 +345,7 @@ public class EventDestinations { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public EventDestinationsListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -348,7 +356,7 @@ public class EventDestinations { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventDestinationsListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -389,25 +397,27 @@ public class EventDestinations { /** * List all Event Destinations on this account. * + * See also https://ngrok.com/docs/api#api-event-destinations-list. + * * @return a call builder for this API call */ - public EventDestinationsListCallBuilder list( + public ListCallBuilder list( ) { - return new EventDestinationsListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class EventDestinationsUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional metadata = Optional.empty(); private Optional description = Optional.empty(); private Optional format = Optional.empty(); private Optional target = Optional.empty(); - private EventDestinationsUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -420,7 +430,7 @@ public class EventDestinations { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public EventDestinationsUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -432,7 +442,7 @@ public class EventDestinations { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventDestinationsUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -443,7 +453,7 @@ public class EventDestinations { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public EventDestinationsUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -454,7 +464,7 @@ public class EventDestinations { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventDestinationsUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -466,7 +476,7 @@ public class EventDestinations { * @param format the value of the format parameter as a {@link String} * @return the call builder instance */ - public EventDestinationsUpdateCallBuilder format(final String format) { + public UpdateCallBuilder format(final String format) { this.format = Optional.ofNullable(format); return this; } @@ -478,7 +488,7 @@ public class EventDestinations { * @param format the value of the format parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventDestinationsUpdateCallBuilder format(final Optional format) { + public UpdateCallBuilder format(final Optional format) { this.format = Objects.requireNonNull(format, "format is required"); return this; } @@ -492,7 +502,7 @@ public class EventDestinations { * @param target the value of the target parameter as a {@link EventTarget} * @return the call builder instance */ - public EventDestinationsUpdateCallBuilder target(final EventTarget target) { + public UpdateCallBuilder target(final EventTarget target) { this.target = Optional.ofNullable(target); return this; } @@ -506,7 +516,7 @@ public class EventDestinations { * @param target the value of the target parameter as an {@link Optional} of {@link EventTarget} * @return the call builder instance */ - public EventDestinationsUpdateCallBuilder target(final Optional target) { + public UpdateCallBuilder target(final Optional target) { this.target = Objects.requireNonNull(target, "target is required"); return this; } @@ -549,13 +559,15 @@ public class EventDestinations { /** * Update attributes of an Event Destination. * + * See also https://ngrok.com/docs/api#api-event-destinations-update. + * * @param id Unique identifier for this Event Destination. * @return a call builder for this API call */ - public EventDestinationsUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new EventDestinationsUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EventSources.java b/src/main/java/com/ngrok/services/EventSources.java index 85681ed..880ba6d 100644 --- a/src/main/java/com/ngrok/services/EventSources.java +++ b/src/main/java/com/ngrok/services/EventSources.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EventSources}. + * + * See also https://ngrok.com/docs/api#api-event-sources. */ public class EventSources { private final NgrokApiClient apiClient; @@ -29,11 +31,11 @@ public class EventSources { /** * A builder object encapsulating state for an unsent Create API call. */ - public class EventSourcesCreateCallBuilder { + public class CreateCallBuilder { private final String subscriptionId; private String type = ""; - private EventSourcesCreateCallBuilder( + private CreateCallBuilder( final String subscriptionId ) { this.subscriptionId = Objects.requireNonNull(subscriptionId, "subscriptionId is required"); @@ -45,7 +47,7 @@ public class EventSources { * @param type the value of the type parameter as a {@link String} * @return the call builder instance */ - public EventSourcesCreateCallBuilder type(final String type) { + public CreateCallBuilder type(final String type) { this.type = Objects.requireNonNull(type, "type is required"); return this; } @@ -56,7 +58,7 @@ public class EventSources { * @param type the value of the type parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventSourcesCreateCallBuilder type(final Optional type) { + public CreateCallBuilder type(final Optional type) { this.type = Objects.requireNonNull(type, "type is required").orElse(""); return this; } @@ -96,13 +98,15 @@ public class EventSources { /** * Add an additional type for which this event subscription will trigger * + * See also https://ngrok.com/docs/api#api-event-sources-create. + * * @param subscriptionId The unique identifier for the Event Subscription that this Event Source is attached to. * @return a call builder for this API call */ - public EventSourcesCreateCallBuilder create( + public CreateCallBuilder create( final String subscriptionId ) { - return new EventSourcesCreateCallBuilder( + return new CreateCallBuilder( subscriptionId ); } @@ -110,11 +114,11 @@ public class EventSources { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EventSourcesDeleteCallBuilder { + public class DeleteCallBuilder { private final String subscriptionId; private final String type; - private EventSourcesDeleteCallBuilder( + private DeleteCallBuilder( final String subscriptionId, final String type ) { @@ -154,15 +158,17 @@ public class EventSources { /** * Remove a type for which this event subscription will trigger * + * See also https://ngrok.com/docs/api#api-event-sources-delete. + * * @param subscriptionId The unique identifier for the Event Subscription that this Event Source is attached to. * @param type Type of event for which an event subscription will trigger * @return a call builder for this API call */ - public EventSourcesDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String subscriptionId, final String type ) { - return new EventSourcesDeleteCallBuilder( + return new DeleteCallBuilder( subscriptionId, type ); @@ -171,11 +177,11 @@ public class EventSources { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EventSourcesGetCallBuilder { + public class GetCallBuilder { private final String subscriptionId; private final String type; - private EventSourcesGetCallBuilder( + private GetCallBuilder( final String subscriptionId, final String type ) { @@ -216,15 +222,17 @@ public class EventSources { /** * Get the details for a given type that triggers for the given event subscription * + * See also https://ngrok.com/docs/api#api-event-sources-get. + * * @param subscriptionId The unique identifier for the Event Subscription that this Event Source is attached to. * @param type Type of event for which an event subscription will trigger * @return a call builder for this API call */ - public EventSourcesGetCallBuilder get( + public GetCallBuilder get( final String subscriptionId, final String type ) { - return new EventSourcesGetCallBuilder( + return new GetCallBuilder( subscriptionId, type ); @@ -233,10 +241,10 @@ public class EventSources { /** * A builder object encapsulating state for an unsent List API call. */ - public class EventSourcesListCallBuilder { + public class ListCallBuilder { private final String subscriptionId; - private EventSourcesListCallBuilder( + private ListCallBuilder( final String subscriptionId ) { this.subscriptionId = Objects.requireNonNull(subscriptionId, "subscriptionId is required"); @@ -275,13 +283,15 @@ public class EventSources { /** * List the types for which this event subscription will trigger * + * See also https://ngrok.com/docs/api#api-event-sources-list. + * * @param subscriptionId The unique identifier for the Event Subscription that this Event Source is attached to. * @return a call builder for this API call */ - public EventSourcesListCallBuilder list( + public ListCallBuilder list( final String subscriptionId ) { - return new EventSourcesListCallBuilder( + return new ListCallBuilder( subscriptionId ); } @@ -289,11 +299,11 @@ public class EventSources { /** * A builder object encapsulating state for an unsent Update API call. */ - public class EventSourcesUpdateCallBuilder { + public class UpdateCallBuilder { private final String subscriptionId; private final String type; - private EventSourcesUpdateCallBuilder( + private UpdateCallBuilder( final String subscriptionId, final String type ) { @@ -334,15 +344,17 @@ public class EventSources { /** * Update the type for which this event subscription will trigger * + * See also https://ngrok.com/docs/api#api-event-sources-update. + * * @param subscriptionId The unique identifier for the Event Subscription that this Event Source is attached to. * @param type Type of event for which an event subscription will trigger * @return a call builder for this API call */ - public EventSourcesUpdateCallBuilder update( + public UpdateCallBuilder update( final String subscriptionId, final String type ) { - return new EventSourcesUpdateCallBuilder( + return new UpdateCallBuilder( subscriptionId, type ); diff --git a/src/main/java/com/ngrok/services/EventStreams.java b/src/main/java/com/ngrok/services/EventStreams.java index 0dceda7..6908634 100644 --- a/src/main/java/com/ngrok/services/EventStreams.java +++ b/src/main/java/com/ngrok/services/EventStreams.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EventStreams}. + * + * See also https://ngrok.com/docs/api#api-event-streams. */ public class EventStreams { private final NgrokApiClient apiClient; @@ -29,15 +31,15 @@ public class EventStreams { /** * A builder object encapsulating state for an unsent Create API call. */ - public class EventStreamsCreateCallBuilder { + public class CreateCallBuilder { private String metadata = ""; private String description = ""; - private java.util.List fields = null; + private java.util.List fields = java.util.Collections.emptyList(); private String eventType = ""; - private java.util.List destinationIds = null; + private java.util.List destinationIds = java.util.Collections.emptyList(); private double samplingRate = 0.0d; - private EventStreamsCreateCallBuilder( + private CreateCallBuilder( ) { } @@ -48,7 +50,7 @@ public class EventStreams { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public EventStreamsCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -60,7 +62,7 @@ public class EventStreams { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventStreamsCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -71,7 +73,7 @@ public class EventStreams { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public EventStreamsCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -82,7 +84,7 @@ public class EventStreams { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventStreamsCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -93,7 +95,7 @@ public class EventStreams { * @param fields the value of the fields parameter as a {@link java.util.List} * @return the call builder instance */ - public EventStreamsCreateCallBuilder fields(final java.util.List fields) { + public CreateCallBuilder fields(final java.util.List fields) { this.fields = Objects.requireNonNull(fields, "fields is required"); return this; } @@ -104,8 +106,8 @@ public class EventStreams { * @param fields the value of the fields parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public EventStreamsCreateCallBuilder fields(final Optional> fields) { - this.fields = Objects.requireNonNull(fields, "fields is required").orElse(null); + public CreateCallBuilder fields(final Optional> fields) { + this.fields = Objects.requireNonNull(fields, "fields is required").orElse(java.util.Collections.emptyList()); return this; } @@ -116,7 +118,7 @@ public class EventStreams { * @param eventType the value of the event_type parameter as a {@link String} * @return the call builder instance */ - public EventStreamsCreateCallBuilder eventType(final String eventType) { + public CreateCallBuilder eventType(final String eventType) { this.eventType = Objects.requireNonNull(eventType, "eventType is required"); return this; } @@ -128,7 +130,7 @@ public class EventStreams { * @param eventType the value of the event_type parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventStreamsCreateCallBuilder eventType(final Optional eventType) { + public CreateCallBuilder eventType(final Optional eventType) { this.eventType = Objects.requireNonNull(eventType, "eventType is required").orElse(""); return this; } @@ -140,7 +142,7 @@ public class EventStreams { * @param destinationIds the value of the destination_ids parameter as a {@link java.util.List} * @return the call builder instance */ - public EventStreamsCreateCallBuilder destinationIds(final java.util.List destinationIds) { + public CreateCallBuilder destinationIds(final java.util.List destinationIds) { this.destinationIds = Objects.requireNonNull(destinationIds, "destinationIds is required"); return this; } @@ -152,8 +154,8 @@ public class EventStreams { * @param destinationIds the value of the destination_ids parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public EventStreamsCreateCallBuilder destinationIds(final Optional> destinationIds) { - this.destinationIds = Objects.requireNonNull(destinationIds, "destinationIds is required").orElse(null); + public CreateCallBuilder destinationIds(final Optional> destinationIds) { + this.destinationIds = Objects.requireNonNull(destinationIds, "destinationIds is required").orElse(java.util.Collections.emptyList()); return this; } @@ -164,7 +166,7 @@ public class EventStreams { * @param samplingRate the value of the sampling_rate parameter as a {@link double} * @return the call builder instance */ - public EventStreamsCreateCallBuilder samplingRate(final double samplingRate) { + public CreateCallBuilder samplingRate(final double samplingRate) { this.samplingRate = Objects.requireNonNull(samplingRate, "samplingRate is required"); return this; } @@ -176,7 +178,7 @@ public class EventStreams { * @param samplingRate the value of the sampling_rate parameter as an {@link Optional} of {@link double} * @return the call builder instance */ - public EventStreamsCreateCallBuilder samplingRate(final Optional samplingRate) { + public CreateCallBuilder samplingRate(final Optional samplingRate) { this.samplingRate = Objects.requireNonNull(samplingRate, "samplingRate is required").orElse(0.0d); return this; } @@ -222,21 +224,23 @@ public class EventStreams { * Create a new Event Stream. It will not apply to anything until you associate it * with one or more Endpoint Configs. * + * See also https://ngrok.com/docs/api#api-event-streams-create. + * * @return a call builder for this API call */ - public EventStreamsCreateCallBuilder create( + public CreateCallBuilder create( ) { - return new EventStreamsCreateCallBuilder( + return new CreateCallBuilder( ); } /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EventStreamsDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EventStreamsDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -274,13 +278,15 @@ public class EventStreams { /** * Delete an Event Stream. Associated Event Destinations will be preserved. * + * See also https://ngrok.com/docs/api#api-event-streams-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EventStreamsDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EventStreamsDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -288,10 +294,10 @@ public class EventStreams { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EventStreamsGetCallBuilder { + public class GetCallBuilder { private final String id; - private EventStreamsGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -330,13 +336,15 @@ public class EventStreams { /** * Get detailed information about an Event Stream by ID. * + * See also https://ngrok.com/docs/api#api-event-streams-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EventStreamsGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EventStreamsGetCallBuilder( + return new GetCallBuilder( id ); } @@ -344,11 +352,11 @@ public class EventStreams { /** * A builder object encapsulating state for an unsent List API call. */ - public class EventStreamsListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private EventStreamsListCallBuilder( + private ListCallBuilder( ) { } @@ -358,7 +366,7 @@ public class EventStreams { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public EventStreamsListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -369,7 +377,7 @@ public class EventStreams { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventStreamsListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -380,7 +388,7 @@ public class EventStreams { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public EventStreamsListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -391,7 +399,7 @@ public class EventStreams { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventStreamsListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -432,18 +440,20 @@ public class EventStreams { /** * List all Event Streams available on this account. * + * See also https://ngrok.com/docs/api#api-event-streams-list. + * * @return a call builder for this API call */ - public EventStreamsListCallBuilder list( + public ListCallBuilder list( ) { - return new EventStreamsListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class EventStreamsUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional metadata = Optional.empty(); private Optional description = Optional.empty(); @@ -451,7 +461,7 @@ public class EventStreams { private Optional> destinationIds = Optional.empty(); private Optional samplingRate = Optional.empty(); - private EventStreamsUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -464,7 +474,7 @@ public class EventStreams { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public EventStreamsUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -476,7 +486,7 @@ public class EventStreams { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventStreamsUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -487,7 +497,7 @@ public class EventStreams { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public EventStreamsUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -498,7 +508,7 @@ public class EventStreams { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventStreamsUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -509,7 +519,7 @@ public class EventStreams { * @param fields the value of the fields parameter as a {@link java.util.List} * @return the call builder instance */ - public EventStreamsUpdateCallBuilder fields(final java.util.List fields) { + public UpdateCallBuilder fields(final java.util.List fields) { this.fields = Optional.ofNullable(fields); return this; } @@ -520,7 +530,7 @@ public class EventStreams { * @param fields the value of the fields parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public EventStreamsUpdateCallBuilder fields(final Optional> fields) { + public UpdateCallBuilder fields(final Optional> fields) { this.fields = Objects.requireNonNull(fields, "fields is required"); return this; } @@ -532,7 +542,7 @@ public class EventStreams { * @param destinationIds the value of the destination_ids parameter as a {@link java.util.List} * @return the call builder instance */ - public EventStreamsUpdateCallBuilder destinationIds(final java.util.List destinationIds) { + public UpdateCallBuilder destinationIds(final java.util.List destinationIds) { this.destinationIds = Optional.ofNullable(destinationIds); return this; } @@ -544,7 +554,7 @@ public class EventStreams { * @param destinationIds the value of the destination_ids parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public EventStreamsUpdateCallBuilder destinationIds(final Optional> destinationIds) { + public UpdateCallBuilder destinationIds(final Optional> destinationIds) { this.destinationIds = Objects.requireNonNull(destinationIds, "destinationIds is required"); return this; } @@ -556,7 +566,7 @@ public class EventStreams { * @param samplingRate the value of the sampling_rate parameter as a {@link double} * @return the call builder instance */ - public EventStreamsUpdateCallBuilder samplingRate(final double samplingRate) { + public UpdateCallBuilder samplingRate(final double samplingRate) { this.samplingRate = Optional.ofNullable(samplingRate); return this; } @@ -568,7 +578,7 @@ public class EventStreams { * @param samplingRate the value of the sampling_rate parameter as an {@link Optional} of {@link double} * @return the call builder instance */ - public EventStreamsUpdateCallBuilder samplingRate(final Optional samplingRate) { + public UpdateCallBuilder samplingRate(final Optional samplingRate) { this.samplingRate = Objects.requireNonNull(samplingRate, "samplingRate is required"); return this; } @@ -612,13 +622,15 @@ public class EventStreams { /** * Update attributes of an Event Stream by ID. * + * See also https://ngrok.com/docs/api#api-event-streams-update. + * * @param id Unique identifier for this Event Stream. * @return a call builder for this API call */ - public EventStreamsUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new EventStreamsUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/EventSubscriptions.java b/src/main/java/com/ngrok/services/EventSubscriptions.java index 448450d..cecc247 100644 --- a/src/main/java/com/ngrok/services/EventSubscriptions.java +++ b/src/main/java/com/ngrok/services/EventSubscriptions.java @@ -13,6 +13,8 @@ import java.util.stream.Stream; /** * An API client for {@link EventSubscriptions}. + * + * See also https://ngrok.com/docs/api#api-event-subscriptions. */ public class EventSubscriptions { private final NgrokApiClient apiClient; @@ -29,13 +31,13 @@ public class EventSubscriptions { /** * A builder object encapsulating state for an unsent Create API call. */ - public class EventSubscriptionsCreateCallBuilder { + public class CreateCallBuilder { private String metadata = ""; private String description = ""; - private java.util.List sources = null; - private java.util.List destinationIds = null; + private java.util.List sources = java.util.Collections.emptyList(); + private java.util.List destinationIds = java.util.Collections.emptyList(); - private EventSubscriptionsCreateCallBuilder( + private CreateCallBuilder( ) { } @@ -46,7 +48,7 @@ public class EventSubscriptions { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public EventSubscriptionsCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -58,7 +60,7 @@ public class EventSubscriptions { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventSubscriptionsCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -70,7 +72,7 @@ public class EventSubscriptions { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public EventSubscriptionsCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -82,7 +84,7 @@ public class EventSubscriptions { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventSubscriptionsCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -93,7 +95,7 @@ public class EventSubscriptions { * @param sources the value of the sources parameter as a {@link java.util.List} * @return the call builder instance */ - public EventSubscriptionsCreateCallBuilder sources(final java.util.List sources) { + public CreateCallBuilder sources(final java.util.List sources) { this.sources = Objects.requireNonNull(sources, "sources is required"); return this; } @@ -104,8 +106,8 @@ public class EventSubscriptions { * @param sources the value of the sources parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public EventSubscriptionsCreateCallBuilder sources(final Optional> sources) { - this.sources = Objects.requireNonNull(sources, "sources is required").orElse(null); + public CreateCallBuilder sources(final Optional> sources) { + this.sources = Objects.requireNonNull(sources, "sources is required").orElse(java.util.Collections.emptyList()); return this; } @@ -116,7 +118,7 @@ public class EventSubscriptions { * @param destinationIds the value of the destination_ids parameter as a {@link java.util.List} * @return the call builder instance */ - public EventSubscriptionsCreateCallBuilder destinationIds(final java.util.List destinationIds) { + public CreateCallBuilder destinationIds(final java.util.List destinationIds) { this.destinationIds = Objects.requireNonNull(destinationIds, "destinationIds is required"); return this; } @@ -128,8 +130,8 @@ public class EventSubscriptions { * @param destinationIds the value of the destination_ids parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public EventSubscriptionsCreateCallBuilder destinationIds(final Optional> destinationIds) { - this.destinationIds = Objects.requireNonNull(destinationIds, "destinationIds is required").orElse(null); + public CreateCallBuilder destinationIds(final Optional> destinationIds) { + this.destinationIds = Objects.requireNonNull(destinationIds, "destinationIds is required").orElse(java.util.Collections.emptyList()); return this; } @@ -171,21 +173,23 @@ public class EventSubscriptions { /** * Create an Event Subscription. * + * See also https://ngrok.com/docs/api#api-event-subscriptions-create. + * * @return a call builder for this API call */ - public EventSubscriptionsCreateCallBuilder create( + public CreateCallBuilder create( ) { - return new EventSubscriptionsCreateCallBuilder( + return new CreateCallBuilder( ); } /** * A builder object encapsulating state for an unsent Delete API call. */ - public class EventSubscriptionsDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private EventSubscriptionsDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -223,13 +227,15 @@ public class EventSubscriptions { /** * Delete an Event Subscription. * + * See also https://ngrok.com/docs/api#api-event-subscriptions-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public EventSubscriptionsDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new EventSubscriptionsDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -237,10 +243,10 @@ public class EventSubscriptions { /** * A builder object encapsulating state for an unsent Get API call. */ - public class EventSubscriptionsGetCallBuilder { + public class GetCallBuilder { private final String id; - private EventSubscriptionsGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -279,13 +285,15 @@ public class EventSubscriptions { /** * Get an Event Subscription by ID. * + * See also https://ngrok.com/docs/api#api-event-subscriptions-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public EventSubscriptionsGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new EventSubscriptionsGetCallBuilder( + return new GetCallBuilder( id ); } @@ -293,11 +301,11 @@ public class EventSubscriptions { /** * A builder object encapsulating state for an unsent List API call. */ - public class EventSubscriptionsListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private EventSubscriptionsListCallBuilder( + private ListCallBuilder( ) { } @@ -307,7 +315,7 @@ public class EventSubscriptions { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public EventSubscriptionsListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -318,7 +326,7 @@ public class EventSubscriptions { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventSubscriptionsListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -329,7 +337,7 @@ public class EventSubscriptions { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public EventSubscriptionsListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -340,7 +348,7 @@ public class EventSubscriptions { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventSubscriptionsListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -381,25 +389,27 @@ public class EventSubscriptions { /** * List this Account's Event Subscriptions. * + * See also https://ngrok.com/docs/api#api-event-subscriptions-list. + * * @return a call builder for this API call */ - public EventSubscriptionsListCallBuilder list( + public ListCallBuilder list( ) { - return new EventSubscriptionsListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class EventSubscriptionsUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional metadata = Optional.empty(); private Optional description = Optional.empty(); private Optional> sources = Optional.empty(); private Optional> destinationIds = Optional.empty(); - private EventSubscriptionsUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -412,7 +422,7 @@ public class EventSubscriptions { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public EventSubscriptionsUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -424,7 +434,7 @@ public class EventSubscriptions { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventSubscriptionsUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -436,7 +446,7 @@ public class EventSubscriptions { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public EventSubscriptionsUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -448,7 +458,7 @@ public class EventSubscriptions { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public EventSubscriptionsUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -459,7 +469,7 @@ public class EventSubscriptions { * @param sources the value of the sources parameter as a {@link java.util.List} * @return the call builder instance */ - public EventSubscriptionsUpdateCallBuilder sources(final java.util.List sources) { + public UpdateCallBuilder sources(final java.util.List sources) { this.sources = Optional.ofNullable(sources); return this; } @@ -470,7 +480,7 @@ public class EventSubscriptions { * @param sources the value of the sources parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public EventSubscriptionsUpdateCallBuilder sources(final Optional> sources) { + public UpdateCallBuilder sources(final Optional> sources) { this.sources = Objects.requireNonNull(sources, "sources is required"); return this; } @@ -482,7 +492,7 @@ public class EventSubscriptions { * @param destinationIds the value of the destination_ids parameter as a {@link java.util.List} * @return the call builder instance */ - public EventSubscriptionsUpdateCallBuilder destinationIds(final java.util.List destinationIds) { + public UpdateCallBuilder destinationIds(final java.util.List destinationIds) { this.destinationIds = Optional.ofNullable(destinationIds); return this; } @@ -494,7 +504,7 @@ public class EventSubscriptions { * @param destinationIds the value of the destination_ids parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public EventSubscriptionsUpdateCallBuilder destinationIds(final Optional> destinationIds) { + public UpdateCallBuilder destinationIds(final Optional> destinationIds) { this.destinationIds = Objects.requireNonNull(destinationIds, "destinationIds is required"); return this; } @@ -537,13 +547,15 @@ public class EventSubscriptions { /** * Update an Event Subscription. * + * See also https://ngrok.com/docs/api#api-event-subscriptions-update. + * * @param id Unique identifier for this Event Subscription. * @return a call builder for this API call */ - public EventSubscriptionsUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new EventSubscriptionsUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/IpPolicies.java b/src/main/java/com/ngrok/services/IpPolicies.java index e08ef05..b32c7cb 100644 --- a/src/main/java/com/ngrok/services/IpPolicies.java +++ b/src/main/java/com/ngrok/services/IpPolicies.java @@ -17,6 +17,8 @@ import java.util.stream.Stream; * action. They can be attached to endpoints via the Endpoint Configuration IP * 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. */ public class IpPolicies { private final NgrokApiClient apiClient; @@ -33,12 +35,12 @@ public class IpPolicies { /** * A builder object encapsulating state for an unsent Create API call. */ - public class IpPoliciesCreateCallBuilder { + public class CreateCallBuilder { private String description = ""; private String metadata = ""; private final String action; - private IpPoliciesCreateCallBuilder( + private CreateCallBuilder( final String action ) { this.action = Objects.requireNonNull(action, "action is required"); @@ -51,7 +53,7 @@ public class IpPolicies { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public IpPoliciesCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -63,7 +65,7 @@ public class IpPolicies { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPoliciesCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -75,7 +77,7 @@ public class IpPolicies { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public IpPoliciesCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -87,7 +89,7 @@ public class IpPolicies { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPoliciesCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -130,13 +132,15 @@ public class IpPolicies { * Create a new IP policy. It will not apply to any traffic until you associate to * a traffic source via an endpoint configuration or IP restriction. * + * See also https://ngrok.com/docs/api#api-ip-policies-create. + * * @param action the IP policy action. Supported values are allow or deny * @return a call builder for this API call */ - public IpPoliciesCreateCallBuilder create( + public CreateCallBuilder create( final String action ) { - return new IpPoliciesCreateCallBuilder( + return new CreateCallBuilder( action ); } @@ -144,10 +148,10 @@ public class IpPolicies { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class IpPoliciesDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private IpPoliciesDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -187,13 +191,15 @@ public class IpPolicies { * purposes of traffic restriction it will be treated as if the IP policy remains * but has zero rules. * + * See also https://ngrok.com/docs/api#api-ip-policies-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public IpPoliciesDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new IpPoliciesDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -201,10 +207,10 @@ public class IpPolicies { /** * A builder object encapsulating state for an unsent Get API call. */ - public class IpPoliciesGetCallBuilder { + public class GetCallBuilder { private final String id; - private IpPoliciesGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -243,13 +249,15 @@ public class IpPolicies { /** * Get detailed information about an IP policy by ID. * + * See also https://ngrok.com/docs/api#api-ip-policies-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public IpPoliciesGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new IpPoliciesGetCallBuilder( + return new GetCallBuilder( id ); } @@ -257,11 +265,11 @@ public class IpPolicies { /** * A builder object encapsulating state for an unsent List API call. */ - public class IpPoliciesListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private IpPoliciesListCallBuilder( + private ListCallBuilder( ) { } @@ -271,7 +279,7 @@ public class IpPolicies { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public IpPoliciesListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -282,7 +290,7 @@ public class IpPolicies { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPoliciesListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -293,7 +301,7 @@ public class IpPolicies { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public IpPoliciesListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -304,7 +312,7 @@ public class IpPolicies { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPoliciesListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -345,23 +353,25 @@ public class IpPolicies { /** * List all IP policies on this account * + * See also https://ngrok.com/docs/api#api-ip-policies-list. + * * @return a call builder for this API call */ - public IpPoliciesListCallBuilder list( + public ListCallBuilder list( ) { - return new IpPoliciesListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class IpPoliciesUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); - private IpPoliciesUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -374,7 +384,7 @@ public class IpPolicies { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public IpPoliciesUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -386,7 +396,7 @@ public class IpPolicies { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPoliciesUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -398,7 +408,7 @@ public class IpPolicies { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public IpPoliciesUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -410,7 +420,7 @@ public class IpPolicies { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPoliciesUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -451,13 +461,15 @@ public class IpPolicies { /** * Update attributes of an IP policy by ID * + * See also https://ngrok.com/docs/api#api-ip-policies-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public IpPoliciesUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new IpPoliciesUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/IpPolicyRules.java b/src/main/java/com/ngrok/services/IpPolicyRules.java index 915372e..bcaff20 100644 --- a/src/main/java/com/ngrok/services/IpPolicyRules.java +++ b/src/main/java/com/ngrok/services/IpPolicyRules.java @@ -14,6 +14,8 @@ import java.util.stream.Stream; /** * 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. */ public class IpPolicyRules { private final NgrokApiClient apiClient; @@ -30,13 +32,13 @@ public class IpPolicyRules { /** * A builder object encapsulating state for an unsent Create API call. */ - public class IpPolicyRulesCreateCallBuilder { + public class CreateCallBuilder { private String description = ""; private String metadata = ""; private final String cidr; private final String ipPolicyId; - private IpPolicyRulesCreateCallBuilder( + private CreateCallBuilder( final String cidr, final String ipPolicyId ) { @@ -51,7 +53,7 @@ public class IpPolicyRules { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public IpPolicyRulesCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -63,7 +65,7 @@ public class IpPolicyRules { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPolicyRulesCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -75,7 +77,7 @@ public class IpPolicyRules { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public IpPolicyRulesCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -87,7 +89,7 @@ public class IpPolicyRules { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPolicyRulesCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -130,15 +132,17 @@ public class IpPolicyRules { /** * Create a new IP policy rule attached to an IP Policy. * + * See also https://ngrok.com/docs/api#api-ip-policy-rules-create. + * * @param cidr an IP or IP range specified in CIDR notation. IPv4 and IPv6 are both supported. * @param ipPolicyId ID of the IP policy this IP policy rule will be attached to * @return a call builder for this API call */ - public IpPolicyRulesCreateCallBuilder create( + public CreateCallBuilder create( final String cidr, final String ipPolicyId ) { - return new IpPolicyRulesCreateCallBuilder( + return new CreateCallBuilder( cidr, ipPolicyId ); @@ -147,10 +151,10 @@ public class IpPolicyRules { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class IpPolicyRulesDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private IpPolicyRulesDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -188,13 +192,15 @@ public class IpPolicyRules { /** * Delete an IP policy rule. * + * See also https://ngrok.com/docs/api#api-ip-policy-rules-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public IpPolicyRulesDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new IpPolicyRulesDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -202,10 +208,10 @@ public class IpPolicyRules { /** * A builder object encapsulating state for an unsent Get API call. */ - public class IpPolicyRulesGetCallBuilder { + public class GetCallBuilder { private final String id; - private IpPolicyRulesGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -244,13 +250,15 @@ public class IpPolicyRules { /** * Get detailed information about an IP policy rule by ID. * + * See also https://ngrok.com/docs/api#api-ip-policy-rules-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public IpPolicyRulesGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new IpPolicyRulesGetCallBuilder( + return new GetCallBuilder( id ); } @@ -258,11 +266,11 @@ public class IpPolicyRules { /** * A builder object encapsulating state for an unsent List API call. */ - public class IpPolicyRulesListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private IpPolicyRulesListCallBuilder( + private ListCallBuilder( ) { } @@ -272,7 +280,7 @@ public class IpPolicyRules { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public IpPolicyRulesListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -283,7 +291,7 @@ public class IpPolicyRules { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPolicyRulesListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -294,7 +302,7 @@ public class IpPolicyRules { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public IpPolicyRulesListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -305,7 +313,7 @@ public class IpPolicyRules { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPolicyRulesListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -346,24 +354,26 @@ public class IpPolicyRules { /** * List all IP policy rules on this account * + * See also https://ngrok.com/docs/api#api-ip-policy-rules-list. + * * @return a call builder for this API call */ - public IpPolicyRulesListCallBuilder list( + public ListCallBuilder list( ) { - return new IpPolicyRulesListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class IpPolicyRulesUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); private Optional cidr = Optional.empty(); - private IpPolicyRulesUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -376,7 +386,7 @@ public class IpPolicyRules { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public IpPolicyRulesUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -388,7 +398,7 @@ public class IpPolicyRules { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPolicyRulesUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -400,7 +410,7 @@ public class IpPolicyRules { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public IpPolicyRulesUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -412,7 +422,7 @@ public class IpPolicyRules { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPolicyRulesUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -423,7 +433,7 @@ public class IpPolicyRules { * @param cidr the value of the cidr parameter as a {@link String} * @return the call builder instance */ - public IpPolicyRulesUpdateCallBuilder cidr(final String cidr) { + public UpdateCallBuilder cidr(final String cidr) { this.cidr = Optional.ofNullable(cidr); return this; } @@ -434,7 +444,7 @@ public class IpPolicyRules { * @param cidr the value of the cidr parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpPolicyRulesUpdateCallBuilder cidr(final Optional cidr) { + public UpdateCallBuilder cidr(final Optional cidr) { this.cidr = Objects.requireNonNull(cidr, "cidr is required"); return this; } @@ -476,13 +486,15 @@ public class IpPolicyRules { /** * Update attributes of an IP policy rule by ID * + * See also https://ngrok.com/docs/api#api-ip-policy-rules-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public IpPolicyRulesUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new IpPolicyRulesUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/IpRestrictions.java b/src/main/java/com/ngrok/services/IpRestrictions.java index 2fc39e8..50919e8 100644 --- a/src/main/java/com/ngrok/services/IpRestrictions.java +++ b/src/main/java/com/ngrok/services/IpRestrictions.java @@ -18,6 +18,8 @@ import java.util.stream.Stream; * restrictions can be used to enforce the source IPs that can make API * 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. */ public class IpRestrictions { private final NgrokApiClient apiClient; @@ -34,14 +36,14 @@ public class IpRestrictions { /** * A builder object encapsulating state for an unsent Create API call. */ - public class IpRestrictionsCreateCallBuilder { + public class CreateCallBuilder { private String description = ""; private String metadata = ""; private boolean enforced = false; private final String type; private final java.util.List ipPolicyIds; - private IpRestrictionsCreateCallBuilder( + private CreateCallBuilder( final String type, final java.util.List ipPolicyIds ) { @@ -55,7 +57,7 @@ public class IpRestrictions { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public IpRestrictionsCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -66,7 +68,7 @@ public class IpRestrictions { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpRestrictionsCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -78,7 +80,7 @@ public class IpRestrictions { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public IpRestrictionsCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -90,7 +92,7 @@ public class IpRestrictions { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpRestrictionsCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -102,7 +104,7 @@ public class IpRestrictions { * @param enforced the value of the enforced parameter as a {@link boolean} * @return the call builder instance */ - public IpRestrictionsCreateCallBuilder enforced(final boolean enforced) { + public CreateCallBuilder enforced(final boolean enforced) { this.enforced = Objects.requireNonNull(enforced, "enforced is required"); return this; } @@ -114,7 +116,7 @@ public class IpRestrictions { * @param enforced the value of the enforced parameter as an {@link Optional} of {@link boolean} * @return the call builder instance */ - public IpRestrictionsCreateCallBuilder enforced(final Optional enforced) { + public CreateCallBuilder enforced(final Optional enforced) { this.enforced = Objects.requireNonNull(enforced, "enforced is required").orElse(false); return this; } @@ -158,15 +160,17 @@ public class IpRestrictions { /** * Create a new IP restriction * + * See also https://ngrok.com/docs/api#api-ip-restrictions-create. + * * @param type the type of IP restriction. this defines what traffic will be restricted with the attached policies. four values are currently supported: dashboard, api, agent, and endpoints * @param ipPolicyIds the set of IP policy identifiers that are used to enforce the restriction * @return a call builder for this API call */ - public IpRestrictionsCreateCallBuilder create( + public CreateCallBuilder create( final String type, final java.util.List ipPolicyIds ) { - return new IpRestrictionsCreateCallBuilder( + return new CreateCallBuilder( type, ipPolicyIds ); @@ -175,10 +179,10 @@ public class IpRestrictions { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class IpRestrictionsDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private IpRestrictionsDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -216,13 +220,15 @@ public class IpRestrictions { /** * Delete an IP restriction * + * See also https://ngrok.com/docs/api#api-ip-restrictions-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public IpRestrictionsDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new IpRestrictionsDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -230,10 +236,10 @@ public class IpRestrictions { /** * A builder object encapsulating state for an unsent Get API call. */ - public class IpRestrictionsGetCallBuilder { + public class GetCallBuilder { private final String id; - private IpRestrictionsGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -272,13 +278,15 @@ public class IpRestrictions { /** * Get detailed information about an IP restriction * + * See also https://ngrok.com/docs/api#api-ip-restrictions-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public IpRestrictionsGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new IpRestrictionsGetCallBuilder( + return new GetCallBuilder( id ); } @@ -286,11 +294,11 @@ public class IpRestrictions { /** * A builder object encapsulating state for an unsent List API call. */ - public class IpRestrictionsListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private IpRestrictionsListCallBuilder( + private ListCallBuilder( ) { } @@ -300,7 +308,7 @@ public class IpRestrictions { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public IpRestrictionsListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -311,7 +319,7 @@ public class IpRestrictions { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpRestrictionsListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -322,7 +330,7 @@ public class IpRestrictions { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public IpRestrictionsListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -333,7 +341,7 @@ public class IpRestrictions { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpRestrictionsListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -374,25 +382,27 @@ public class IpRestrictions { /** * List all IP restrictions on this account * + * See also https://ngrok.com/docs/api#api-ip-restrictions-list. + * * @return a call builder for this API call */ - public IpRestrictionsListCallBuilder list( + public ListCallBuilder list( ) { - return new IpRestrictionsListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class IpRestrictionsUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); private Optional enforced = Optional.empty(); - private java.util.List ipPolicyIds = null; + private java.util.List ipPolicyIds = java.util.Collections.emptyList(); - private IpRestrictionsUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -404,7 +414,7 @@ public class IpRestrictions { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public IpRestrictionsUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -415,7 +425,7 @@ public class IpRestrictions { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpRestrictionsUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -427,7 +437,7 @@ public class IpRestrictions { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public IpRestrictionsUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -439,7 +449,7 @@ public class IpRestrictions { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpRestrictionsUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -451,7 +461,7 @@ public class IpRestrictions { * @param enforced the value of the enforced parameter as a {@link boolean} * @return the call builder instance */ - public IpRestrictionsUpdateCallBuilder enforced(final boolean enforced) { + public UpdateCallBuilder enforced(final boolean enforced) { this.enforced = Optional.ofNullable(enforced); return this; } @@ -463,7 +473,7 @@ public class IpRestrictions { * @param enforced the value of the enforced parameter as an {@link Optional} of {@link boolean} * @return the call builder instance */ - public IpRestrictionsUpdateCallBuilder enforced(final Optional enforced) { + public UpdateCallBuilder enforced(final Optional enforced) { this.enforced = Objects.requireNonNull(enforced, "enforced is required"); return this; } @@ -474,7 +484,7 @@ public class IpRestrictions { * @param ipPolicyIds the value of the ip_policy_ids parameter as a {@link java.util.List} * @return the call builder instance */ - public IpRestrictionsUpdateCallBuilder ipPolicyIds(final java.util.List ipPolicyIds) { + public UpdateCallBuilder ipPolicyIds(final java.util.List ipPolicyIds) { this.ipPolicyIds = Objects.requireNonNull(ipPolicyIds, "ipPolicyIds is required"); return this; } @@ -485,8 +495,8 @@ public class IpRestrictions { * @param ipPolicyIds the value of the ip_policy_ids parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public IpRestrictionsUpdateCallBuilder ipPolicyIds(final Optional> ipPolicyIds) { - this.ipPolicyIds = Objects.requireNonNull(ipPolicyIds, "ipPolicyIds is required").orElse(null); + public UpdateCallBuilder ipPolicyIds(final Optional> ipPolicyIds) { + this.ipPolicyIds = Objects.requireNonNull(ipPolicyIds, "ipPolicyIds is required").orElse(java.util.Collections.emptyList()); return this; } @@ -528,13 +538,15 @@ public class IpRestrictions { /** * Update attributes of an IP restriction by ID * + * See also https://ngrok.com/docs/api#api-ip-restrictions-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public IpRestrictionsUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new IpRestrictionsUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/IpWhitelist.java b/src/main/java/com/ngrok/services/IpWhitelist.java index 5088e25..b59db83 100644 --- a/src/main/java/com/ngrok/services/IpWhitelist.java +++ b/src/main/java/com/ngrok/services/IpWhitelist.java @@ -14,6 +14,8 @@ import java.util.stream.Stream; /** * 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. */ public class IpWhitelist { private final NgrokApiClient apiClient; @@ -30,12 +32,12 @@ public class IpWhitelist { /** * A builder object encapsulating state for an unsent Create API call. */ - public class IpWhitelistCreateCallBuilder { + public class CreateCallBuilder { private String description = ""; private String metadata = ""; private String ipNet = ""; - private IpWhitelistCreateCallBuilder( + private CreateCallBuilder( ) { } @@ -46,7 +48,7 @@ public class IpWhitelist { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public IpWhitelistCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -58,7 +60,7 @@ public class IpWhitelist { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpWhitelistCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -70,7 +72,7 @@ public class IpWhitelist { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public IpWhitelistCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -82,7 +84,7 @@ public class IpWhitelist { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpWhitelistCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -95,7 +97,7 @@ public class IpWhitelist { * @param ipNet the value of the ip_net parameter as a {@link String} * @return the call builder instance */ - public IpWhitelistCreateCallBuilder ipNet(final String ipNet) { + public CreateCallBuilder ipNet(final String ipNet) { this.ipNet = Objects.requireNonNull(ipNet, "ipNet is required"); return this; } @@ -108,7 +110,7 @@ public class IpWhitelist { * @param ipNet the value of the ip_net parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpWhitelistCreateCallBuilder ipNet(final Optional ipNet) { + public CreateCallBuilder ipNet(final Optional ipNet) { this.ipNet = Objects.requireNonNull(ipNet, "ipNet is required").orElse(""); return this; } @@ -151,21 +153,23 @@ public class IpWhitelist { * Create a new IP whitelist entry that will restrict traffic to all tunnel * endpoints on the account. * + * See also https://ngrok.com/docs/api#api-ip-whitelist-create. + * * @return a call builder for this API call */ - public IpWhitelistCreateCallBuilder create( + public CreateCallBuilder create( ) { - return new IpWhitelistCreateCallBuilder( + return new CreateCallBuilder( ); } /** * A builder object encapsulating state for an unsent Delete API call. */ - public class IpWhitelistDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private IpWhitelistDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -203,13 +207,15 @@ public class IpWhitelist { /** * Delete an IP whitelist entry. * + * See also https://ngrok.com/docs/api#api-ip-whitelist-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public IpWhitelistDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new IpWhitelistDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -217,10 +223,10 @@ public class IpWhitelist { /** * A builder object encapsulating state for an unsent Get API call. */ - public class IpWhitelistGetCallBuilder { + public class GetCallBuilder { private final String id; - private IpWhitelistGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -259,13 +265,15 @@ public class IpWhitelist { /** * Get detailed information about an IP whitelist entry by ID. * + * See also https://ngrok.com/docs/api#api-ip-whitelist-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public IpWhitelistGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new IpWhitelistGetCallBuilder( + return new GetCallBuilder( id ); } @@ -273,11 +281,11 @@ public class IpWhitelist { /** * A builder object encapsulating state for an unsent List API call. */ - public class IpWhitelistListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private IpWhitelistListCallBuilder( + private ListCallBuilder( ) { } @@ -287,7 +295,7 @@ public class IpWhitelist { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public IpWhitelistListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -298,7 +306,7 @@ public class IpWhitelist { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpWhitelistListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -309,7 +317,7 @@ public class IpWhitelist { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public IpWhitelistListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -320,7 +328,7 @@ public class IpWhitelist { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpWhitelistListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -361,23 +369,25 @@ public class IpWhitelist { /** * List all IP whitelist entries on this account * + * See also https://ngrok.com/docs/api#api-ip-whitelist-list. + * * @return a call builder for this API call */ - public IpWhitelistListCallBuilder list( + public ListCallBuilder list( ) { - return new IpWhitelistListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class IpWhitelistUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); - private IpWhitelistUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -390,7 +400,7 @@ public class IpWhitelist { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public IpWhitelistUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -402,7 +412,7 @@ public class IpWhitelist { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpWhitelistUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -414,7 +424,7 @@ public class IpWhitelist { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public IpWhitelistUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -426,7 +436,7 @@ public class IpWhitelist { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public IpWhitelistUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -467,13 +477,15 @@ public class IpWhitelist { /** * Update attributes of an IP whitelist entry by ID * + * See also https://ngrok.com/docs/api#api-ip-whitelist-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public IpWhitelistUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new IpWhitelistUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/ReservedAddrs.java b/src/main/java/com/ngrok/services/ReservedAddrs.java index 8c9ee8f..d7bfc61 100644 --- a/src/main/java/com/ngrok/services/ReservedAddrs.java +++ b/src/main/java/com/ngrok/services/ReservedAddrs.java @@ -15,6 +15,8 @@ import java.util.stream.Stream; * Reserved Addresses are TCP addresses that can be used to listen for traffic. * TCP address hostnames and ports are assigned by ngrok, they cannot be * chosen. + * + * See also https://ngrok.com/docs/api#api-reserved-addrs. */ public class ReservedAddrs { private final NgrokApiClient apiClient; @@ -31,13 +33,13 @@ public class ReservedAddrs { /** * A builder object encapsulating state for an unsent Create API call. */ - public class ReservedAddrsCreateCallBuilder { + public class CreateCallBuilder { private String description = ""; private String metadata = ""; private String region = ""; private String endpointConfigurationId = ""; - private ReservedAddrsCreateCallBuilder( + private CreateCallBuilder( ) { } @@ -47,7 +49,7 @@ public class ReservedAddrs { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public ReservedAddrsCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -58,7 +60,7 @@ public class ReservedAddrs { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedAddrsCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -70,7 +72,7 @@ public class ReservedAddrs { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public ReservedAddrsCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -82,7 +84,7 @@ public class ReservedAddrs { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedAddrsCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -94,7 +96,7 @@ public class ReservedAddrs { * @param region the value of the region parameter as a {@link String} * @return the call builder instance */ - public ReservedAddrsCreateCallBuilder region(final String region) { + public CreateCallBuilder region(final String region) { this.region = Objects.requireNonNull(region, "region is required"); return this; } @@ -106,7 +108,7 @@ public class ReservedAddrs { * @param region the value of the region parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedAddrsCreateCallBuilder region(final Optional region) { + public CreateCallBuilder region(final Optional region) { this.region = Objects.requireNonNull(region, "region is required").orElse(""); return this; } @@ -118,7 +120,7 @@ public class ReservedAddrs { * @param endpointConfigurationId the value of the endpoint_configuration_id parameter as a {@link String} * @return the call builder instance */ - public ReservedAddrsCreateCallBuilder endpointConfigurationId(final String endpointConfigurationId) { + public CreateCallBuilder endpointConfigurationId(final String endpointConfigurationId) { this.endpointConfigurationId = Objects.requireNonNull(endpointConfigurationId, "endpointConfigurationId is required"); return this; } @@ -130,7 +132,7 @@ public class ReservedAddrs { * @param endpointConfigurationId the value of the endpoint_configuration_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedAddrsCreateCallBuilder endpointConfigurationId(final Optional endpointConfigurationId) { + public CreateCallBuilder endpointConfigurationId(final Optional endpointConfigurationId) { this.endpointConfigurationId = Objects.requireNonNull(endpointConfigurationId, "endpointConfigurationId is required").orElse(""); return this; } @@ -173,21 +175,23 @@ public class ReservedAddrs { /** * Create a new reserved address. * + * See also https://ngrok.com/docs/api#api-reserved-addrs-create. + * * @return a call builder for this API call */ - public ReservedAddrsCreateCallBuilder create( + public CreateCallBuilder create( ) { - return new ReservedAddrsCreateCallBuilder( + return new CreateCallBuilder( ); } /** * A builder object encapsulating state for an unsent Delete API call. */ - public class ReservedAddrsDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private ReservedAddrsDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -225,13 +229,15 @@ public class ReservedAddrs { /** * Delete a reserved address. * + * See also https://ngrok.com/docs/api#api-reserved-addrs-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public ReservedAddrsDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new ReservedAddrsDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -239,10 +245,10 @@ public class ReservedAddrs { /** * A builder object encapsulating state for an unsent Get API call. */ - public class ReservedAddrsGetCallBuilder { + public class GetCallBuilder { private final String id; - private ReservedAddrsGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -281,13 +287,15 @@ public class ReservedAddrs { /** * Get the details of a reserved address. * + * See also https://ngrok.com/docs/api#api-reserved-addrs-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public ReservedAddrsGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new ReservedAddrsGetCallBuilder( + return new GetCallBuilder( id ); } @@ -295,11 +303,11 @@ public class ReservedAddrs { /** * A builder object encapsulating state for an unsent List API call. */ - public class ReservedAddrsListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private ReservedAddrsListCallBuilder( + private ListCallBuilder( ) { } @@ -309,7 +317,7 @@ public class ReservedAddrs { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public ReservedAddrsListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -320,7 +328,7 @@ public class ReservedAddrs { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedAddrsListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -331,7 +339,7 @@ public class ReservedAddrs { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public ReservedAddrsListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -342,7 +350,7 @@ public class ReservedAddrs { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedAddrsListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -383,24 +391,26 @@ public class ReservedAddrs { /** * List all reserved addresses on this account. * + * See also https://ngrok.com/docs/api#api-reserved-addrs-list. + * * @return a call builder for this API call */ - public ReservedAddrsListCallBuilder list( + public ListCallBuilder list( ) { - return new ReservedAddrsListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class ReservedAddrsUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); private Optional endpointConfigurationId = Optional.empty(); - private ReservedAddrsUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -412,7 +422,7 @@ public class ReservedAddrs { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public ReservedAddrsUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -423,7 +433,7 @@ public class ReservedAddrs { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedAddrsUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -435,7 +445,7 @@ public class ReservedAddrs { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public ReservedAddrsUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -447,7 +457,7 @@ public class ReservedAddrs { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedAddrsUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -459,7 +469,7 @@ public class ReservedAddrs { * @param endpointConfigurationId the value of the endpoint_configuration_id parameter as a {@link String} * @return the call builder instance */ - public ReservedAddrsUpdateCallBuilder endpointConfigurationId(final String endpointConfigurationId) { + public UpdateCallBuilder endpointConfigurationId(final String endpointConfigurationId) { this.endpointConfigurationId = Optional.ofNullable(endpointConfigurationId); return this; } @@ -471,7 +481,7 @@ public class ReservedAddrs { * @param endpointConfigurationId the value of the endpoint_configuration_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedAddrsUpdateCallBuilder endpointConfigurationId(final Optional endpointConfigurationId) { + public UpdateCallBuilder endpointConfigurationId(final Optional endpointConfigurationId) { this.endpointConfigurationId = Objects.requireNonNull(endpointConfigurationId, "endpointConfigurationId is required"); return this; } @@ -513,13 +523,15 @@ public class ReservedAddrs { /** * Update the attributes of a reserved address. * + * See also https://ngrok.com/docs/api#api-reserved-addrs-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public ReservedAddrsUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new ReservedAddrsUpdateCallBuilder( + return new UpdateCallBuilder( id ); } @@ -527,10 +539,10 @@ public class ReservedAddrs { /** * A builder object encapsulating state for an unsent DeleteEndpointConfig API call. */ - public class ReservedAddrsDeleteEndpointConfigCallBuilder { + public class DeleteEndpointConfigCallBuilder { private final String id; - private ReservedAddrsDeleteEndpointConfigCallBuilder( + private DeleteEndpointConfigCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -568,13 +580,15 @@ public class ReservedAddrs { /** * Detach the endpoint configuration attached to a reserved address. * + * See also https://ngrok.com/docs/api#api-reserved-addrs-delete-endpoint-config. + * * @param id a resource identifier * @return a call builder for this API call */ - public ReservedAddrsDeleteEndpointConfigCallBuilder deleteEndpointConfig( + public DeleteEndpointConfigCallBuilder deleteEndpointConfig( final String id ) { - return new ReservedAddrsDeleteEndpointConfigCallBuilder( + return new DeleteEndpointConfigCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/ReservedDomains.java b/src/main/java/com/ngrok/services/ReservedDomains.java index 20df945..5e24a21 100644 --- a/src/main/java/com/ngrok/services/ReservedDomains.java +++ b/src/main/java/com/ngrok/services/ReservedDomains.java @@ -16,6 +16,8 @@ import java.util.stream.Stream; * can be used to listen for http, https or tls traffic. You may use a domain * 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. */ public class ReservedDomains { private final NgrokApiClient apiClient; @@ -32,7 +34,7 @@ public class ReservedDomains { /** * A builder object encapsulating state for an unsent Create API call. */ - public class ReservedDomainsCreateCallBuilder { + public class CreateCallBuilder { private final String name; private String region = ""; private String description = ""; @@ -42,7 +44,7 @@ public class ReservedDomains { private Optional certificateId = Optional.empty(); private Optional certificateManagementPolicy = Optional.empty(); - private ReservedDomainsCreateCallBuilder( + private CreateCallBuilder( final String name ) { this.name = Objects.requireNonNull(name, "name is required"); @@ -55,7 +57,7 @@ public class ReservedDomains { * @param region the value of the region parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder region(final String region) { + public CreateCallBuilder region(final String region) { this.region = Objects.requireNonNull(region, "region is required"); return this; } @@ -67,7 +69,7 @@ public class ReservedDomains { * @param region the value of the region parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder region(final Optional region) { + public CreateCallBuilder region(final Optional region) { this.region = Objects.requireNonNull(region, "region is required").orElse(""); return this; } @@ -78,7 +80,7 @@ public class ReservedDomains { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -89,7 +91,7 @@ public class ReservedDomains { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -101,7 +103,7 @@ public class ReservedDomains { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -113,7 +115,7 @@ public class ReservedDomains { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -125,7 +127,7 @@ public class ReservedDomains { * @param httpEndpointConfigurationId the value of the http_endpoint_configuration_id parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder httpEndpointConfigurationId(final String httpEndpointConfigurationId) { + public CreateCallBuilder httpEndpointConfigurationId(final String httpEndpointConfigurationId) { this.httpEndpointConfigurationId = Optional.ofNullable(httpEndpointConfigurationId); return this; } @@ -137,7 +139,7 @@ public class ReservedDomains { * @param httpEndpointConfigurationId the value of the http_endpoint_configuration_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder httpEndpointConfigurationId(final Optional httpEndpointConfigurationId) { + public CreateCallBuilder httpEndpointConfigurationId(final Optional httpEndpointConfigurationId) { this.httpEndpointConfigurationId = Objects.requireNonNull(httpEndpointConfigurationId, "httpEndpointConfigurationId is required"); return this; } @@ -149,7 +151,7 @@ public class ReservedDomains { * @param httpsEndpointConfigurationId the value of the https_endpoint_configuration_id parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder httpsEndpointConfigurationId(final String httpsEndpointConfigurationId) { + public CreateCallBuilder httpsEndpointConfigurationId(final String httpsEndpointConfigurationId) { this.httpsEndpointConfigurationId = Optional.ofNullable(httpsEndpointConfigurationId); return this; } @@ -161,7 +163,7 @@ public class ReservedDomains { * @param httpsEndpointConfigurationId the value of the https_endpoint_configuration_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder httpsEndpointConfigurationId(final Optional httpsEndpointConfigurationId) { + public CreateCallBuilder httpsEndpointConfigurationId(final Optional httpsEndpointConfigurationId) { this.httpsEndpointConfigurationId = Objects.requireNonNull(httpsEndpointConfigurationId, "httpsEndpointConfigurationId is required"); return this; } @@ -174,7 +176,7 @@ public class ReservedDomains { * @param certificateId the value of the certificate_id parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder certificateId(final String certificateId) { + public CreateCallBuilder certificateId(final String certificateId) { this.certificateId = Optional.ofNullable(certificateId); return this; } @@ -187,7 +189,7 @@ public class ReservedDomains { * @param certificateId the value of the certificate_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder certificateId(final Optional certificateId) { + public CreateCallBuilder certificateId(final Optional certificateId) { this.certificateId = Objects.requireNonNull(certificateId, "certificateId is required"); return this; } @@ -200,7 +202,7 @@ public class ReservedDomains { * @param certificateManagementPolicy the value of the certificate_management_policy parameter as a {@link ReservedDomainCertPolicy} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder certificateManagementPolicy(final ReservedDomainCertPolicy certificateManagementPolicy) { + public CreateCallBuilder certificateManagementPolicy(final ReservedDomainCertPolicy certificateManagementPolicy) { this.certificateManagementPolicy = Optional.ofNullable(certificateManagementPolicy); return this; } @@ -213,7 +215,7 @@ public class ReservedDomains { * @param certificateManagementPolicy the value of the certificate_management_policy parameter as an {@link Optional} of {@link ReservedDomainCertPolicy} * @return the call builder instance */ - public ReservedDomainsCreateCallBuilder certificateManagementPolicy(final Optional certificateManagementPolicy) { + public CreateCallBuilder certificateManagementPolicy(final Optional certificateManagementPolicy) { this.certificateManagementPolicy = Objects.requireNonNull(certificateManagementPolicy, "certificateManagementPolicy is required"); return this; } @@ -260,13 +262,15 @@ public class ReservedDomains { /** * Create a new reserved domain. * + * See also https://ngrok.com/docs/api#api-reserved-domains-create. + * * @param name the domain name to reserve. It may be a full domain name like app.example.com. If the name does not contain a '.' it will reserve that subdomain on ngrok.io. * @return a call builder for this API call */ - public ReservedDomainsCreateCallBuilder create( + public CreateCallBuilder create( final String name ) { - return new ReservedDomainsCreateCallBuilder( + return new CreateCallBuilder( name ); } @@ -274,10 +278,10 @@ public class ReservedDomains { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class ReservedDomainsDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private ReservedDomainsDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -315,13 +319,15 @@ public class ReservedDomains { /** * Delete a reserved domain. * + * See also https://ngrok.com/docs/api#api-reserved-domains-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public ReservedDomainsDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new ReservedDomainsDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -329,10 +335,10 @@ public class ReservedDomains { /** * A builder object encapsulating state for an unsent Get API call. */ - public class ReservedDomainsGetCallBuilder { + public class GetCallBuilder { private final String id; - private ReservedDomainsGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -371,13 +377,15 @@ public class ReservedDomains { /** * Get the details of a reserved domain. * + * See also https://ngrok.com/docs/api#api-reserved-domains-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public ReservedDomainsGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new ReservedDomainsGetCallBuilder( + return new GetCallBuilder( id ); } @@ -385,11 +393,11 @@ public class ReservedDomains { /** * A builder object encapsulating state for an unsent List API call. */ - public class ReservedDomainsListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private ReservedDomainsListCallBuilder( + private ListCallBuilder( ) { } @@ -399,7 +407,7 @@ public class ReservedDomains { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -410,7 +418,7 @@ public class ReservedDomains { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -421,7 +429,7 @@ public class ReservedDomains { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -432,7 +440,7 @@ public class ReservedDomains { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -473,18 +481,20 @@ public class ReservedDomains { /** * List all reserved domains on this account. * + * See also https://ngrok.com/docs/api#api-reserved-domains-list. + * * @return a call builder for this API call */ - public ReservedDomainsListCallBuilder list( + public ListCallBuilder list( ) { - return new ReservedDomainsListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class ReservedDomainsUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); @@ -493,7 +503,7 @@ public class ReservedDomains { private Optional certificateId = Optional.empty(); private Optional certificateManagementPolicy = Optional.empty(); - private ReservedDomainsUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -505,7 +515,7 @@ public class ReservedDomains { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -516,7 +526,7 @@ public class ReservedDomains { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -528,7 +538,7 @@ public class ReservedDomains { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -540,7 +550,7 @@ public class ReservedDomains { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -552,7 +562,7 @@ public class ReservedDomains { * @param httpEndpointConfigurationId the value of the http_endpoint_configuration_id parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsUpdateCallBuilder httpEndpointConfigurationId(final String httpEndpointConfigurationId) { + public UpdateCallBuilder httpEndpointConfigurationId(final String httpEndpointConfigurationId) { this.httpEndpointConfigurationId = Optional.ofNullable(httpEndpointConfigurationId); return this; } @@ -564,7 +574,7 @@ public class ReservedDomains { * @param httpEndpointConfigurationId the value of the http_endpoint_configuration_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsUpdateCallBuilder httpEndpointConfigurationId(final Optional httpEndpointConfigurationId) { + public UpdateCallBuilder httpEndpointConfigurationId(final Optional httpEndpointConfigurationId) { this.httpEndpointConfigurationId = Objects.requireNonNull(httpEndpointConfigurationId, "httpEndpointConfigurationId is required"); return this; } @@ -576,7 +586,7 @@ public class ReservedDomains { * @param httpsEndpointConfigurationId the value of the https_endpoint_configuration_id parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsUpdateCallBuilder httpsEndpointConfigurationId(final String httpsEndpointConfigurationId) { + public UpdateCallBuilder httpsEndpointConfigurationId(final String httpsEndpointConfigurationId) { this.httpsEndpointConfigurationId = Optional.ofNullable(httpsEndpointConfigurationId); return this; } @@ -588,7 +598,7 @@ public class ReservedDomains { * @param httpsEndpointConfigurationId the value of the https_endpoint_configuration_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsUpdateCallBuilder httpsEndpointConfigurationId(final Optional httpsEndpointConfigurationId) { + public UpdateCallBuilder httpsEndpointConfigurationId(final Optional httpsEndpointConfigurationId) { this.httpsEndpointConfigurationId = Objects.requireNonNull(httpsEndpointConfigurationId, "httpsEndpointConfigurationId is required"); return this; } @@ -601,7 +611,7 @@ public class ReservedDomains { * @param certificateId the value of the certificate_id parameter as a {@link String} * @return the call builder instance */ - public ReservedDomainsUpdateCallBuilder certificateId(final String certificateId) { + public UpdateCallBuilder certificateId(final String certificateId) { this.certificateId = Optional.ofNullable(certificateId); return this; } @@ -614,7 +624,7 @@ public class ReservedDomains { * @param certificateId the value of the certificate_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public ReservedDomainsUpdateCallBuilder certificateId(final Optional certificateId) { + public UpdateCallBuilder certificateId(final Optional certificateId) { this.certificateId = Objects.requireNonNull(certificateId, "certificateId is required"); return this; } @@ -627,7 +637,7 @@ public class ReservedDomains { * @param certificateManagementPolicy the value of the certificate_management_policy parameter as a {@link ReservedDomainCertPolicy} * @return the call builder instance */ - public ReservedDomainsUpdateCallBuilder certificateManagementPolicy(final ReservedDomainCertPolicy certificateManagementPolicy) { + public UpdateCallBuilder certificateManagementPolicy(final ReservedDomainCertPolicy certificateManagementPolicy) { this.certificateManagementPolicy = Optional.ofNullable(certificateManagementPolicy); return this; } @@ -640,7 +650,7 @@ public class ReservedDomains { * @param certificateManagementPolicy the value of the certificate_management_policy parameter as an {@link Optional} of {@link ReservedDomainCertPolicy} * @return the call builder instance */ - public ReservedDomainsUpdateCallBuilder certificateManagementPolicy(final Optional certificateManagementPolicy) { + public UpdateCallBuilder certificateManagementPolicy(final Optional certificateManagementPolicy) { this.certificateManagementPolicy = Objects.requireNonNull(certificateManagementPolicy, "certificateManagementPolicy is required"); return this; } @@ -685,13 +695,15 @@ public class ReservedDomains { /** * Update the attributes of a reserved domain. * + * See also https://ngrok.com/docs/api#api-reserved-domains-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public ReservedDomainsUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new ReservedDomainsUpdateCallBuilder( + return new UpdateCallBuilder( id ); } @@ -699,10 +711,10 @@ public class ReservedDomains { /** * A builder object encapsulating state for an unsent DeleteCertificateManagementPolicy API call. */ - public class ReservedDomainsDeleteCertificateManagementPolicyCallBuilder { + public class DeleteCertificateManagementPolicyCallBuilder { private final String id; - private ReservedDomainsDeleteCertificateManagementPolicyCallBuilder( + private DeleteCertificateManagementPolicyCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -740,13 +752,15 @@ public class ReservedDomains { /** * Detach the certificate management policy attached to a reserved domain. * + * See also https://ngrok.com/docs/api#api-reserved-domains-delete-certificate-management-policy. + * * @param id a resource identifier * @return a call builder for this API call */ - public ReservedDomainsDeleteCertificateManagementPolicyCallBuilder deleteCertificateManagementPolicy( + public DeleteCertificateManagementPolicyCallBuilder deleteCertificateManagementPolicy( final String id ) { - return new ReservedDomainsDeleteCertificateManagementPolicyCallBuilder( + return new DeleteCertificateManagementPolicyCallBuilder( id ); } @@ -754,10 +768,10 @@ public class ReservedDomains { /** * A builder object encapsulating state for an unsent DeleteCertificate API call. */ - public class ReservedDomainsDeleteCertificateCallBuilder { + public class DeleteCertificateCallBuilder { private final String id; - private ReservedDomainsDeleteCertificateCallBuilder( + private DeleteCertificateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -795,13 +809,15 @@ public class ReservedDomains { /** * Detach the certificate attached to a reserved domain. * + * See also https://ngrok.com/docs/api#api-reserved-domains-delete-certificate. + * * @param id a resource identifier * @return a call builder for this API call */ - public ReservedDomainsDeleteCertificateCallBuilder deleteCertificate( + public DeleteCertificateCallBuilder deleteCertificate( final String id ) { - return new ReservedDomainsDeleteCertificateCallBuilder( + return new DeleteCertificateCallBuilder( id ); } @@ -809,10 +825,10 @@ public class ReservedDomains { /** * A builder object encapsulating state for an unsent DeleteHttpEndpointConfig API call. */ - public class ReservedDomainsDeleteHttpEndpointConfigCallBuilder { + public class DeleteHttpEndpointConfigCallBuilder { private final String id; - private ReservedDomainsDeleteHttpEndpointConfigCallBuilder( + private DeleteHttpEndpointConfigCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -850,13 +866,15 @@ public class ReservedDomains { /** * Detach the http endpoint configuration attached to a reserved domain. * + * See also https://ngrok.com/docs/api#api-reserved-domains-delete-http-endpoint-config. + * * @param id a resource identifier * @return a call builder for this API call */ - public ReservedDomainsDeleteHttpEndpointConfigCallBuilder deleteHttpEndpointConfig( + public DeleteHttpEndpointConfigCallBuilder deleteHttpEndpointConfig( final String id ) { - return new ReservedDomainsDeleteHttpEndpointConfigCallBuilder( + return new DeleteHttpEndpointConfigCallBuilder( id ); } @@ -864,10 +882,10 @@ public class ReservedDomains { /** * A builder object encapsulating state for an unsent DeleteHttpsEndpointConfig API call. */ - public class ReservedDomainsDeleteHttpsEndpointConfigCallBuilder { + public class DeleteHttpsEndpointConfigCallBuilder { private final String id; - private ReservedDomainsDeleteHttpsEndpointConfigCallBuilder( + private DeleteHttpsEndpointConfigCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -905,13 +923,15 @@ public class ReservedDomains { /** * Detach the https endpoint configuration attached to a reserved domain. * + * See also https://ngrok.com/docs/api#api-reserved-domains-delete-https-endpoint-config. + * * @param id a resource identifier * @return a call builder for this API call */ - public ReservedDomainsDeleteHttpsEndpointConfigCallBuilder deleteHttpsEndpointConfig( + public DeleteHttpsEndpointConfigCallBuilder deleteHttpsEndpointConfig( final String id ) { - return new ReservedDomainsDeleteHttpsEndpointConfigCallBuilder( + return new DeleteHttpsEndpointConfigCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/SshCertificateAuthorities.java b/src/main/java/com/ngrok/services/SshCertificateAuthorities.java index b485297..ae26f70 100644 --- a/src/main/java/com/ngrok/services/SshCertificateAuthorities.java +++ b/src/main/java/com/ngrok/services/SshCertificateAuthorities.java @@ -14,6 +14,8 @@ import java.util.stream.Stream; /** * 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. */ public class SshCertificateAuthorities { private final NgrokApiClient apiClient; @@ -30,14 +32,14 @@ public class SshCertificateAuthorities { /** * A builder object encapsulating state for an unsent Create API call. */ - public class SshCertificateAuthoritiesCreateCallBuilder { + public class CreateCallBuilder { private String description = ""; private String metadata = ""; private String privateKeyType = ""; private String ellipticCurve = ""; private long keySize = 0L; - private SshCertificateAuthoritiesCreateCallBuilder( + private CreateCallBuilder( ) { } @@ -48,7 +50,7 @@ public class SshCertificateAuthorities { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -60,7 +62,7 @@ public class SshCertificateAuthorities { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -72,7 +74,7 @@ public class SshCertificateAuthorities { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -84,7 +86,7 @@ public class SshCertificateAuthorities { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -96,7 +98,7 @@ public class SshCertificateAuthorities { * @param privateKeyType the value of the private_key_type parameter as a {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesCreateCallBuilder privateKeyType(final String privateKeyType) { + public CreateCallBuilder privateKeyType(final String privateKeyType) { this.privateKeyType = Objects.requireNonNull(privateKeyType, "privateKeyType is required"); return this; } @@ -108,7 +110,7 @@ public class SshCertificateAuthorities { * @param privateKeyType the value of the private_key_type parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesCreateCallBuilder privateKeyType(final Optional privateKeyType) { + public CreateCallBuilder privateKeyType(final Optional privateKeyType) { this.privateKeyType = Objects.requireNonNull(privateKeyType, "privateKeyType is required").orElse(""); return this; } @@ -119,7 +121,7 @@ public class SshCertificateAuthorities { * @param ellipticCurve the value of the elliptic_curve parameter as a {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesCreateCallBuilder ellipticCurve(final String ellipticCurve) { + public CreateCallBuilder ellipticCurve(final String ellipticCurve) { this.ellipticCurve = Objects.requireNonNull(ellipticCurve, "ellipticCurve is required"); return this; } @@ -130,7 +132,7 @@ public class SshCertificateAuthorities { * @param ellipticCurve the value of the elliptic_curve parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesCreateCallBuilder ellipticCurve(final Optional ellipticCurve) { + public CreateCallBuilder ellipticCurve(final Optional ellipticCurve) { this.ellipticCurve = Objects.requireNonNull(ellipticCurve, "ellipticCurve is required").orElse(""); return this; } @@ -142,7 +144,7 @@ public class SshCertificateAuthorities { * @param keySize the value of the key_size parameter as a {@link long} * @return the call builder instance */ - public SshCertificateAuthoritiesCreateCallBuilder keySize(final long keySize) { + public CreateCallBuilder keySize(final long keySize) { this.keySize = Objects.requireNonNull(keySize, "keySize is required"); return this; } @@ -154,7 +156,7 @@ public class SshCertificateAuthorities { * @param keySize the value of the key_size parameter as an {@link Optional} of {@link long} * @return the call builder instance */ - public SshCertificateAuthoritiesCreateCallBuilder keySize(final Optional keySize) { + public CreateCallBuilder keySize(final Optional keySize) { this.keySize = Objects.requireNonNull(keySize, "keySize is required").orElse(0L); return this; } @@ -198,21 +200,23 @@ public class SshCertificateAuthorities { /** * Create a new SSH Certificate Authority * + * See also https://ngrok.com/docs/api#api-ssh-certificate-authorities-create. + * * @return a call builder for this API call */ - public SshCertificateAuthoritiesCreateCallBuilder create( + public CreateCallBuilder create( ) { - return new SshCertificateAuthoritiesCreateCallBuilder( + return new CreateCallBuilder( ); } /** * A builder object encapsulating state for an unsent Delete API call. */ - public class SshCertificateAuthoritiesDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private SshCertificateAuthoritiesDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -250,13 +254,15 @@ public class SshCertificateAuthorities { /** * Delete an SSH Certificate Authority * + * See also https://ngrok.com/docs/api#api-ssh-certificate-authorities-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public SshCertificateAuthoritiesDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new SshCertificateAuthoritiesDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -264,10 +270,10 @@ public class SshCertificateAuthorities { /** * A builder object encapsulating state for an unsent Get API call. */ - public class SshCertificateAuthoritiesGetCallBuilder { + public class GetCallBuilder { private final String id; - private SshCertificateAuthoritiesGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -306,13 +312,15 @@ public class SshCertificateAuthorities { /** * Get detailed information about an SSH Certficate Authority * + * See also https://ngrok.com/docs/api#api-ssh-certificate-authorities-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public SshCertificateAuthoritiesGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new SshCertificateAuthoritiesGetCallBuilder( + return new GetCallBuilder( id ); } @@ -320,11 +328,11 @@ public class SshCertificateAuthorities { /** * A builder object encapsulating state for an unsent List API call. */ - public class SshCertificateAuthoritiesListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private SshCertificateAuthoritiesListCallBuilder( + private ListCallBuilder( ) { } @@ -334,7 +342,7 @@ public class SshCertificateAuthorities { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -345,7 +353,7 @@ public class SshCertificateAuthorities { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -356,7 +364,7 @@ public class SshCertificateAuthorities { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -367,7 +375,7 @@ public class SshCertificateAuthorities { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -408,23 +416,25 @@ public class SshCertificateAuthorities { /** * List all SSH Certificate Authorities on this account * + * See also https://ngrok.com/docs/api#api-ssh-certificate-authorities-list. + * * @return a call builder for this API call */ - public SshCertificateAuthoritiesListCallBuilder list( + public ListCallBuilder list( ) { - return new SshCertificateAuthoritiesListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class SshCertificateAuthoritiesUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); - private SshCertificateAuthoritiesUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -437,7 +447,7 @@ public class SshCertificateAuthorities { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -449,7 +459,7 @@ public class SshCertificateAuthorities { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -461,7 +471,7 @@ public class SshCertificateAuthorities { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -473,7 +483,7 @@ public class SshCertificateAuthorities { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCertificateAuthoritiesUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -514,13 +524,15 @@ public class SshCertificateAuthorities { /** * Update an SSH Certificate Authority * + * See also https://ngrok.com/docs/api#api-ssh-certificate-authorities-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public SshCertificateAuthoritiesUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new SshCertificateAuthoritiesUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/SshCredentials.java b/src/main/java/com/ngrok/services/SshCredentials.java index 0fda6df..afee199 100644 --- a/src/main/java/com/ngrok/services/SshCredentials.java +++ b/src/main/java/com/ngrok/services/SshCredentials.java @@ -14,6 +14,8 @@ import java.util.stream.Stream; /** * 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. */ public class SshCredentials { private final NgrokApiClient apiClient; @@ -30,13 +32,13 @@ public class SshCredentials { /** * A builder object encapsulating state for an unsent Create API call. */ - public class SshCredentialsCreateCallBuilder { + public class CreateCallBuilder { private String description = ""; private String metadata = ""; - private java.util.List acl = null; + private java.util.List acl = java.util.Collections.emptyList(); private final String publicKey; - private SshCredentialsCreateCallBuilder( + private CreateCallBuilder( final String publicKey ) { this.publicKey = Objects.requireNonNull(publicKey, "publicKey is required"); @@ -49,7 +51,7 @@ public class SshCredentials { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public SshCredentialsCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -61,7 +63,7 @@ public class SshCredentials { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCredentialsCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -73,7 +75,7 @@ public class SshCredentials { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public SshCredentialsCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -85,7 +87,7 @@ public class SshCredentials { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCredentialsCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -106,7 +108,7 @@ public class SshCredentials { * @param acl the value of the acl parameter as a {@link java.util.List} * @return the call builder instance */ - public SshCredentialsCreateCallBuilder acl(final java.util.List acl) { + public CreateCallBuilder acl(final java.util.List acl) { this.acl = Objects.requireNonNull(acl, "acl is required"); return this; } @@ -127,8 +129,8 @@ public class SshCredentials { * @param acl the value of the acl parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public SshCredentialsCreateCallBuilder acl(final Optional> acl) { - this.acl = Objects.requireNonNull(acl, "acl is required").orElse(null); + public CreateCallBuilder acl(final Optional> acl) { + this.acl = Objects.requireNonNull(acl, "acl is required").orElse(java.util.Collections.emptyList()); return this; } @@ -171,13 +173,15 @@ public class SshCredentials { * Create a new ssh_credential from an uploaded public SSH key. This ssh credential * can be used to start new tunnels via ngrok's SSH gateway. * + * See also https://ngrok.com/docs/api#api-ssh-credentials-create. + * * @param publicKey the PEM-encoded public key of the SSH keypair that will be used to authenticate * @return a call builder for this API call */ - public SshCredentialsCreateCallBuilder create( + public CreateCallBuilder create( final String publicKey ) { - return new SshCredentialsCreateCallBuilder( + return new CreateCallBuilder( publicKey ); } @@ -185,10 +189,10 @@ public class SshCredentials { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class SshCredentialsDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private SshCredentialsDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -226,13 +230,15 @@ public class SshCredentials { /** * Delete an ssh_credential by ID * + * See also https://ngrok.com/docs/api#api-ssh-credentials-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public SshCredentialsDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new SshCredentialsDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -240,10 +246,10 @@ public class SshCredentials { /** * A builder object encapsulating state for an unsent Get API call. */ - public class SshCredentialsGetCallBuilder { + public class GetCallBuilder { private final String id; - private SshCredentialsGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -282,13 +288,15 @@ public class SshCredentials { /** * Get detailed information about an ssh_credential * + * See also https://ngrok.com/docs/api#api-ssh-credentials-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public SshCredentialsGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new SshCredentialsGetCallBuilder( + return new GetCallBuilder( id ); } @@ -296,11 +304,11 @@ public class SshCredentials { /** * A builder object encapsulating state for an unsent List API call. */ - public class SshCredentialsListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private SshCredentialsListCallBuilder( + private ListCallBuilder( ) { } @@ -310,7 +318,7 @@ public class SshCredentials { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public SshCredentialsListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -321,7 +329,7 @@ public class SshCredentials { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCredentialsListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -332,7 +340,7 @@ public class SshCredentials { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public SshCredentialsListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -343,7 +351,7 @@ public class SshCredentials { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCredentialsListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -384,24 +392,26 @@ public class SshCredentials { /** * List all ssh credentials on this account * + * See also https://ngrok.com/docs/api#api-ssh-credentials-list. + * * @return a call builder for this API call */ - public SshCredentialsListCallBuilder list( + public ListCallBuilder list( ) { - return new SshCredentialsListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class SshCredentialsUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); private Optional> acl = Optional.empty(); - private SshCredentialsUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -414,7 +424,7 @@ public class SshCredentials { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public SshCredentialsUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -426,7 +436,7 @@ public class SshCredentials { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCredentialsUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -438,7 +448,7 @@ public class SshCredentials { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public SshCredentialsUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -450,7 +460,7 @@ public class SshCredentials { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshCredentialsUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -471,7 +481,7 @@ public class SshCredentials { * @param acl the value of the acl parameter as a {@link java.util.List} * @return the call builder instance */ - public SshCredentialsUpdateCallBuilder acl(final java.util.List acl) { + public UpdateCallBuilder acl(final java.util.List acl) { this.acl = Optional.ofNullable(acl); return this; } @@ -492,7 +502,7 @@ public class SshCredentials { * @param acl the value of the acl parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public SshCredentialsUpdateCallBuilder acl(final Optional> acl) { + public UpdateCallBuilder acl(final Optional> acl) { this.acl = Objects.requireNonNull(acl, "acl is required"); return this; } @@ -534,13 +544,15 @@ public class SshCredentials { /** * Update attributes of an ssh_credential by ID * + * See also https://ngrok.com/docs/api#api-ssh-credentials-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public SshCredentialsUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new SshCredentialsUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/SshHostCertificates.java b/src/main/java/com/ngrok/services/SshHostCertificates.java index 4516171..e6b412b 100644 --- a/src/main/java/com/ngrok/services/SshHostCertificates.java +++ b/src/main/java/com/ngrok/services/SshHostCertificates.java @@ -15,6 +15,8 @@ import java.util.stream.Stream; * SSH Host Certificates along with the corresponding private key allows an SSH * 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. */ public class SshHostCertificates { private final NgrokApiClient apiClient; @@ -31,16 +33,16 @@ public class SshHostCertificates { /** * A builder object encapsulating state for an unsent Create API call. */ - public class SshHostCertificatesCreateCallBuilder { + public class CreateCallBuilder { private final String sshCertificateAuthorityId; private final String publicKey; - private java.util.List principals = null; + private java.util.List principals = java.util.Collections.emptyList(); private java.time.OffsetDateTime validAfter = null; private java.time.OffsetDateTime validUntil = null; private String description = ""; private String metadata = ""; - private SshHostCertificatesCreateCallBuilder( + private CreateCallBuilder( final String sshCertificateAuthorityId, final String publicKey ) { @@ -57,7 +59,7 @@ public class SshHostCertificates { * @param principals the value of the principals parameter as a {@link java.util.List} * @return the call builder instance */ - public SshHostCertificatesCreateCallBuilder principals(final java.util.List principals) { + public CreateCallBuilder principals(final java.util.List principals) { this.principals = Objects.requireNonNull(principals, "principals is required"); return this; } @@ -71,8 +73,8 @@ public class SshHostCertificates { * @param principals the value of the principals parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public SshHostCertificatesCreateCallBuilder principals(final Optional> principals) { - this.principals = Objects.requireNonNull(principals, "principals is required").orElse(null); + public CreateCallBuilder principals(final Optional> principals) { + this.principals = Objects.requireNonNull(principals, "principals is required").orElse(java.util.Collections.emptyList()); return this; } @@ -83,7 +85,7 @@ public class SshHostCertificates { * @param validAfter the value of the valid_after parameter as a {@link java.time.OffsetDateTime} * @return the call builder instance */ - public SshHostCertificatesCreateCallBuilder validAfter(final java.time.OffsetDateTime validAfter) { + public CreateCallBuilder validAfter(final java.time.OffsetDateTime validAfter) { this.validAfter = Objects.requireNonNull(validAfter, "validAfter is required"); return this; } @@ -95,7 +97,7 @@ public class SshHostCertificates { * @param validAfter the value of the valid_after parameter as an {@link Optional} of {@link java.time.OffsetDateTime} * @return the call builder instance */ - public SshHostCertificatesCreateCallBuilder validAfter(final Optional validAfter) { + public CreateCallBuilder validAfter(final Optional validAfter) { this.validAfter = Objects.requireNonNull(validAfter, "validAfter is required").orElse(null); return this; } @@ -108,7 +110,7 @@ public class SshHostCertificates { * @param validUntil the value of the valid_until parameter as a {@link java.time.OffsetDateTime} * @return the call builder instance */ - public SshHostCertificatesCreateCallBuilder validUntil(final java.time.OffsetDateTime validUntil) { + public CreateCallBuilder validUntil(final java.time.OffsetDateTime validUntil) { this.validUntil = Objects.requireNonNull(validUntil, "validUntil is required"); return this; } @@ -121,7 +123,7 @@ public class SshHostCertificates { * @param validUntil the value of the valid_until parameter as an {@link Optional} of {@link java.time.OffsetDateTime} * @return the call builder instance */ - public SshHostCertificatesCreateCallBuilder validUntil(final Optional validUntil) { + public CreateCallBuilder validUntil(final Optional validUntil) { this.validUntil = Objects.requireNonNull(validUntil, "validUntil is required").orElse(null); return this; } @@ -133,7 +135,7 @@ public class SshHostCertificates { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public SshHostCertificatesCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -145,7 +147,7 @@ public class SshHostCertificates { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshHostCertificatesCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -157,7 +159,7 @@ public class SshHostCertificates { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public SshHostCertificatesCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -169,7 +171,7 @@ public class SshHostCertificates { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshHostCertificatesCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -215,15 +217,17 @@ public class SshHostCertificates { /** * Create a new SSH Host Certificate * + * See also https://ngrok.com/docs/api#api-ssh-host-certificates-create. + * * @param sshCertificateAuthorityId the ssh certificate authority that is used to sign this ssh host certificate * @param publicKey a public key in OpenSSH Authorized Keys format that this certificate signs * @return a call builder for this API call */ - public SshHostCertificatesCreateCallBuilder create( + public CreateCallBuilder create( final String sshCertificateAuthorityId, final String publicKey ) { - return new SshHostCertificatesCreateCallBuilder( + return new CreateCallBuilder( sshCertificateAuthorityId, publicKey ); @@ -232,10 +236,10 @@ public class SshHostCertificates { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class SshHostCertificatesDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private SshHostCertificatesDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -273,13 +277,15 @@ public class SshHostCertificates { /** * Delete an SSH Host Certificate * + * See also https://ngrok.com/docs/api#api-ssh-host-certificates-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public SshHostCertificatesDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new SshHostCertificatesDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -287,10 +293,10 @@ public class SshHostCertificates { /** * A builder object encapsulating state for an unsent Get API call. */ - public class SshHostCertificatesGetCallBuilder { + public class GetCallBuilder { private final String id; - private SshHostCertificatesGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -329,13 +335,15 @@ public class SshHostCertificates { /** * Get detailed information about an SSH Host Certficate * + * See also https://ngrok.com/docs/api#api-ssh-host-certificates-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public SshHostCertificatesGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new SshHostCertificatesGetCallBuilder( + return new GetCallBuilder( id ); } @@ -343,11 +351,11 @@ public class SshHostCertificates { /** * A builder object encapsulating state for an unsent List API call. */ - public class SshHostCertificatesListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private SshHostCertificatesListCallBuilder( + private ListCallBuilder( ) { } @@ -357,7 +365,7 @@ public class SshHostCertificates { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public SshHostCertificatesListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -368,7 +376,7 @@ public class SshHostCertificates { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshHostCertificatesListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -379,7 +387,7 @@ public class SshHostCertificates { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public SshHostCertificatesListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -390,7 +398,7 @@ public class SshHostCertificates { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshHostCertificatesListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -431,23 +439,25 @@ public class SshHostCertificates { /** * List all SSH Host Certificates issued on this account * + * See also https://ngrok.com/docs/api#api-ssh-host-certificates-list. + * * @return a call builder for this API call */ - public SshHostCertificatesListCallBuilder list( + public ListCallBuilder list( ) { - return new SshHostCertificatesListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class SshHostCertificatesUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); - private SshHostCertificatesUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -460,7 +470,7 @@ public class SshHostCertificates { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public SshHostCertificatesUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -472,7 +482,7 @@ public class SshHostCertificates { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshHostCertificatesUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -484,7 +494,7 @@ public class SshHostCertificates { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public SshHostCertificatesUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -496,7 +506,7 @@ public class SshHostCertificates { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshHostCertificatesUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -537,13 +547,15 @@ public class SshHostCertificates { /** * Update an SSH Host Certificate * + * See also https://ngrok.com/docs/api#api-ssh-host-certificates-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public SshHostCertificatesUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new SshHostCertificatesUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/SshUserCertificates.java b/src/main/java/com/ngrok/services/SshUserCertificates.java index ddaffb9..dccf750 100644 --- a/src/main/java/com/ngrok/services/SshUserCertificates.java +++ b/src/main/java/com/ngrok/services/SshUserCertificates.java @@ -15,6 +15,8 @@ import java.util.stream.Stream; * SSH User Certificates are presented by SSH clients when connecting to an SSH * 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. */ public class SshUserCertificates { private final NgrokApiClient apiClient; @@ -31,18 +33,18 @@ public class SshUserCertificates { /** * A builder object encapsulating state for an unsent Create API call. */ - public class SshUserCertificatesCreateCallBuilder { + public class CreateCallBuilder { private final String sshCertificateAuthorityId; private final String publicKey; - private java.util.List principals = null; - private java.util.Map criticalOptions = null; - private java.util.Map extensions = null; + private java.util.List principals = java.util.Collections.emptyList(); + private java.util.Map criticalOptions = java.util.Collections.emptyMap(); + private java.util.Map extensions = java.util.Collections.emptyMap(); private java.time.OffsetDateTime validAfter = null; private java.time.OffsetDateTime validUntil = null; private String description = ""; private String metadata = ""; - private SshUserCertificatesCreateCallBuilder( + private CreateCallBuilder( final String sshCertificateAuthorityId, final String publicKey ) { @@ -59,7 +61,7 @@ public class SshUserCertificates { * @param principals the value of the principals parameter as a {@link java.util.List} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder principals(final java.util.List principals) { + public CreateCallBuilder principals(final java.util.List principals) { this.principals = Objects.requireNonNull(principals, "principals is required"); return this; } @@ -73,8 +75,8 @@ public class SshUserCertificates { * @param principals the value of the principals parameter as an {@link Optional} of {@link java.util.List} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder principals(final Optional> principals) { - this.principals = Objects.requireNonNull(principals, "principals is required").orElse(null); + public CreateCallBuilder principals(final Optional> principals) { + this.principals = Objects.requireNonNull(principals, "principals is required").orElse(java.util.Collections.emptyList()); return this; } @@ -88,7 +90,7 @@ public class SshUserCertificates { * @param criticalOptions the value of the critical_options parameter as a {@link java.util.Map} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder criticalOptions(final java.util.Map criticalOptions) { + public CreateCallBuilder criticalOptions(final java.util.Map criticalOptions) { this.criticalOptions = Objects.requireNonNull(criticalOptions, "criticalOptions is required"); return this; } @@ -103,8 +105,8 @@ public class SshUserCertificates { * @param criticalOptions the value of the critical_options parameter as an {@link Optional} of {@link java.util.Map} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder criticalOptions(final Optional> criticalOptions) { - this.criticalOptions = Objects.requireNonNull(criticalOptions, "criticalOptions is required").orElse(null); + public CreateCallBuilder criticalOptions(final Optional> criticalOptions) { + this.criticalOptions = Objects.requireNonNull(criticalOptions, "criticalOptions is required").orElse(java.util.Collections.emptyMap()); return this; } @@ -122,7 +124,7 @@ public class SshUserCertificates { * @param extensions the value of the extensions parameter as a {@link java.util.Map} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder extensions(final java.util.Map extensions) { + public CreateCallBuilder extensions(final java.util.Map extensions) { this.extensions = Objects.requireNonNull(extensions, "extensions is required"); return this; } @@ -141,8 +143,8 @@ public class SshUserCertificates { * @param extensions the value of the extensions parameter as an {@link Optional} of {@link java.util.Map} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder extensions(final Optional> extensions) { - this.extensions = Objects.requireNonNull(extensions, "extensions is required").orElse(null); + public CreateCallBuilder extensions(final Optional> extensions) { + this.extensions = Objects.requireNonNull(extensions, "extensions is required").orElse(java.util.Collections.emptyMap()); return this; } @@ -153,7 +155,7 @@ public class SshUserCertificates { * @param validAfter the value of the valid_after parameter as a {@link java.time.OffsetDateTime} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder validAfter(final java.time.OffsetDateTime validAfter) { + public CreateCallBuilder validAfter(final java.time.OffsetDateTime validAfter) { this.validAfter = Objects.requireNonNull(validAfter, "validAfter is required"); return this; } @@ -165,7 +167,7 @@ public class SshUserCertificates { * @param validAfter the value of the valid_after parameter as an {@link Optional} of {@link java.time.OffsetDateTime} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder validAfter(final Optional validAfter) { + public CreateCallBuilder validAfter(final Optional validAfter) { this.validAfter = Objects.requireNonNull(validAfter, "validAfter is required").orElse(null); return this; } @@ -178,7 +180,7 @@ public class SshUserCertificates { * @param validUntil the value of the valid_until parameter as a {@link java.time.OffsetDateTime} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder validUntil(final java.time.OffsetDateTime validUntil) { + public CreateCallBuilder validUntil(final java.time.OffsetDateTime validUntil) { this.validUntil = Objects.requireNonNull(validUntil, "validUntil is required"); return this; } @@ -191,7 +193,7 @@ public class SshUserCertificates { * @param validUntil the value of the valid_until parameter as an {@link Optional} of {@link java.time.OffsetDateTime} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder validUntil(final Optional validUntil) { + public CreateCallBuilder validUntil(final Optional validUntil) { this.validUntil = Objects.requireNonNull(validUntil, "validUntil is required").orElse(null); return this; } @@ -203,7 +205,7 @@ public class SshUserCertificates { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -215,7 +217,7 @@ public class SshUserCertificates { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -227,7 +229,7 @@ public class SshUserCertificates { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -239,7 +241,7 @@ public class SshUserCertificates { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshUserCertificatesCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -287,15 +289,17 @@ public class SshUserCertificates { /** * Create a new SSH User Certificate * + * See also https://ngrok.com/docs/api#api-ssh-user-certificates-create. + * * @param sshCertificateAuthorityId the ssh certificate authority that is used to sign this ssh user certificate * @param publicKey a public key in OpenSSH Authorized Keys format that this certificate signs * @return a call builder for this API call */ - public SshUserCertificatesCreateCallBuilder create( + public CreateCallBuilder create( final String sshCertificateAuthorityId, final String publicKey ) { - return new SshUserCertificatesCreateCallBuilder( + return new CreateCallBuilder( sshCertificateAuthorityId, publicKey ); @@ -304,10 +308,10 @@ public class SshUserCertificates { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class SshUserCertificatesDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private SshUserCertificatesDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -345,13 +349,15 @@ public class SshUserCertificates { /** * Delete an SSH User Certificate * + * See also https://ngrok.com/docs/api#api-ssh-user-certificates-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public SshUserCertificatesDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new SshUserCertificatesDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -359,10 +365,10 @@ public class SshUserCertificates { /** * A builder object encapsulating state for an unsent Get API call. */ - public class SshUserCertificatesGetCallBuilder { + public class GetCallBuilder { private final String id; - private SshUserCertificatesGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -401,13 +407,15 @@ public class SshUserCertificates { /** * Get detailed information about an SSH User Certficate * + * See also https://ngrok.com/docs/api#api-ssh-user-certificates-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public SshUserCertificatesGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new SshUserCertificatesGetCallBuilder( + return new GetCallBuilder( id ); } @@ -415,11 +423,11 @@ public class SshUserCertificates { /** * A builder object encapsulating state for an unsent List API call. */ - public class SshUserCertificatesListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private SshUserCertificatesListCallBuilder( + private ListCallBuilder( ) { } @@ -429,7 +437,7 @@ public class SshUserCertificates { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public SshUserCertificatesListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -440,7 +448,7 @@ public class SshUserCertificates { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshUserCertificatesListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -451,7 +459,7 @@ public class SshUserCertificates { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public SshUserCertificatesListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -462,7 +470,7 @@ public class SshUserCertificates { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshUserCertificatesListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -503,23 +511,25 @@ public class SshUserCertificates { /** * List all SSH User Certificates issued on this account * + * See also https://ngrok.com/docs/api#api-ssh-user-certificates-list. + * * @return a call builder for this API call */ - public SshUserCertificatesListCallBuilder list( + public ListCallBuilder list( ) { - return new SshUserCertificatesListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class SshUserCertificatesUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); - private SshUserCertificatesUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -532,7 +542,7 @@ public class SshUserCertificates { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public SshUserCertificatesUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -544,7 +554,7 @@ public class SshUserCertificates { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshUserCertificatesUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -556,7 +566,7 @@ public class SshUserCertificates { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public SshUserCertificatesUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -568,7 +578,7 @@ public class SshUserCertificates { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public SshUserCertificatesUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -609,13 +619,15 @@ public class SshUserCertificates { /** * Update an SSH User Certificate * + * See also https://ngrok.com/docs/api#api-ssh-user-certificates-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public SshUserCertificatesUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new SshUserCertificatesUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/TlsCertificates.java b/src/main/java/com/ngrok/services/TlsCertificates.java index c298a72..c449568 100644 --- a/src/main/java/com/ngrok/services/TlsCertificates.java +++ b/src/main/java/com/ngrok/services/TlsCertificates.java @@ -17,6 +17,8 @@ import java.util.stream.Stream; * until they are attached to a Domain. TLS Certificates may also be * provisioned by ngrok automatically for domains on which you have enabled * automated certificate provisioning. + * + * See also https://ngrok.com/docs/api#api-tls-certificates. */ public class TlsCertificates { private final NgrokApiClient apiClient; @@ -33,13 +35,13 @@ public class TlsCertificates { /** * A builder object encapsulating state for an unsent Create API call. */ - public class TlsCertificatesCreateCallBuilder { + public class CreateCallBuilder { private String description = ""; private String metadata = ""; private final String certificatePem; private final String privateKeyPem; - private TlsCertificatesCreateCallBuilder( + private CreateCallBuilder( final String certificatePem, final String privateKeyPem ) { @@ -53,7 +55,7 @@ public class TlsCertificates { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public TlsCertificatesCreateCallBuilder description(final String description) { + public CreateCallBuilder description(final String description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -64,7 +66,7 @@ public class TlsCertificates { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public TlsCertificatesCreateCallBuilder description(final Optional description) { + public CreateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required").orElse(""); return this; } @@ -76,7 +78,7 @@ public class TlsCertificates { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public TlsCertificatesCreateCallBuilder metadata(final String metadata) { + public CreateCallBuilder metadata(final String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -88,7 +90,7 @@ public class TlsCertificates { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public TlsCertificatesCreateCallBuilder metadata(final Optional metadata) { + public CreateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required").orElse(""); return this; } @@ -131,15 +133,17 @@ public class TlsCertificates { /** * Upload a new TLS certificate * + * See also https://ngrok.com/docs/api#api-tls-certificates-create. + * * @param certificatePem chain of PEM-encoded certificates, leaf first. See Certificate Bundles. * @param privateKeyPem private key for the TLS certificate, PEM-encoded. See Private Keys. * @return a call builder for this API call */ - public TlsCertificatesCreateCallBuilder create( + public CreateCallBuilder create( final String certificatePem, final String privateKeyPem ) { - return new TlsCertificatesCreateCallBuilder( + return new CreateCallBuilder( certificatePem, privateKeyPem ); @@ -148,10 +152,10 @@ public class TlsCertificates { /** * A builder object encapsulating state for an unsent Delete API call. */ - public class TlsCertificatesDeleteCallBuilder { + public class DeleteCallBuilder { private final String id; - private TlsCertificatesDeleteCallBuilder( + private DeleteCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -189,13 +193,15 @@ public class TlsCertificates { /** * Delete a TLS certificate * + * See also https://ngrok.com/docs/api#api-tls-certificates-delete. + * * @param id a resource identifier * @return a call builder for this API call */ - public TlsCertificatesDeleteCallBuilder delete( + public DeleteCallBuilder delete( final String id ) { - return new TlsCertificatesDeleteCallBuilder( + return new DeleteCallBuilder( id ); } @@ -203,10 +209,10 @@ public class TlsCertificates { /** * A builder object encapsulating state for an unsent Get API call. */ - public class TlsCertificatesGetCallBuilder { + public class GetCallBuilder { private final String id; - private TlsCertificatesGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -245,13 +251,15 @@ public class TlsCertificates { /** * Get detailed information about a TLS certificate * + * See also https://ngrok.com/docs/api#api-tls-certificates-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public TlsCertificatesGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new TlsCertificatesGetCallBuilder( + return new GetCallBuilder( id ); } @@ -259,11 +267,11 @@ public class TlsCertificates { /** * A builder object encapsulating state for an unsent List API call. */ - public class TlsCertificatesListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private TlsCertificatesListCallBuilder( + private ListCallBuilder( ) { } @@ -273,7 +281,7 @@ public class TlsCertificates { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public TlsCertificatesListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -284,7 +292,7 @@ public class TlsCertificates { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public TlsCertificatesListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -295,7 +303,7 @@ public class TlsCertificates { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public TlsCertificatesListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -306,7 +314,7 @@ public class TlsCertificates { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public TlsCertificatesListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -347,23 +355,25 @@ public class TlsCertificates { /** * List all TLS certificates on this account * + * See also https://ngrok.com/docs/api#api-tls-certificates-list. + * * @return a call builder for this API call */ - public TlsCertificatesListCallBuilder list( + public ListCallBuilder list( ) { - return new TlsCertificatesListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Update API call. */ - public class TlsCertificatesUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; private Optional description = Optional.empty(); private Optional metadata = Optional.empty(); - private TlsCertificatesUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -375,7 +385,7 @@ public class TlsCertificates { * @param description the value of the description parameter as a {@link String} * @return the call builder instance */ - public TlsCertificatesUpdateCallBuilder description(final String description) { + public UpdateCallBuilder description(final String description) { this.description = Optional.ofNullable(description); return this; } @@ -386,7 +396,7 @@ public class TlsCertificates { * @param description the value of the description parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public TlsCertificatesUpdateCallBuilder description(final Optional description) { + public UpdateCallBuilder description(final Optional description) { this.description = Objects.requireNonNull(description, "description is required"); return this; } @@ -398,7 +408,7 @@ public class TlsCertificates { * @param metadata the value of the metadata parameter as a {@link String} * @return the call builder instance */ - public TlsCertificatesUpdateCallBuilder metadata(final String metadata) { + public UpdateCallBuilder metadata(final String metadata) { this.metadata = Optional.ofNullable(metadata); return this; } @@ -410,7 +420,7 @@ public class TlsCertificates { * @param metadata the value of the metadata parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public TlsCertificatesUpdateCallBuilder metadata(final Optional metadata) { + public UpdateCallBuilder metadata(final Optional metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata is required"); return this; } @@ -451,13 +461,15 @@ public class TlsCertificates { /** * Update attributes of a TLS Certificate by ID * + * See also https://ngrok.com/docs/api#api-tls-certificates-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public TlsCertificatesUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new TlsCertificatesUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/TunnelSessions.java b/src/main/java/com/ngrok/services/TunnelSessions.java index b233562..11148fa 100644 --- a/src/main/java/com/ngrok/services/TunnelSessions.java +++ b/src/main/java/com/ngrok/services/TunnelSessions.java @@ -15,6 +15,8 @@ import java.util.stream.Stream; * Tunnel Sessions represent instances of ngrok agents or SSH reverse tunnel * 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. */ public class TunnelSessions { private final NgrokApiClient apiClient; @@ -31,11 +33,11 @@ public class TunnelSessions { /** * A builder object encapsulating state for an unsent List API call. */ - public class TunnelSessionsListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private TunnelSessionsListCallBuilder( + private ListCallBuilder( ) { } @@ -45,7 +47,7 @@ public class TunnelSessions { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public TunnelSessionsListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -56,7 +58,7 @@ public class TunnelSessions { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public TunnelSessionsListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -67,7 +69,7 @@ public class TunnelSessions { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public TunnelSessionsListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -78,7 +80,7 @@ public class TunnelSessions { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public TunnelSessionsListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -119,21 +121,23 @@ public class TunnelSessions { /** * List all online tunnel sessions running on this account. * + * See also https://ngrok.com/docs/api#api-tunnel-sessions-list. + * * @return a call builder for this API call */ - public TunnelSessionsListCallBuilder list( + public ListCallBuilder list( ) { - return new TunnelSessionsListCallBuilder( + return new ListCallBuilder( ); } /** * A builder object encapsulating state for an unsent Get API call. */ - public class TunnelSessionsGetCallBuilder { + public class GetCallBuilder { private final String id; - private TunnelSessionsGetCallBuilder( + private GetCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -172,13 +176,15 @@ public class TunnelSessions { /** * Get the detailed status of a tunnel session by ID * + * See also https://ngrok.com/docs/api#api-tunnel-sessions-get. + * * @param id a resource identifier * @return a call builder for this API call */ - public TunnelSessionsGetCallBuilder get( + public GetCallBuilder get( final String id ) { - return new TunnelSessionsGetCallBuilder( + return new GetCallBuilder( id ); } @@ -186,10 +192,10 @@ public class TunnelSessions { /** * A builder object encapsulating state for an unsent Restart API call. */ - public class TunnelSessionsRestartCallBuilder { + public class RestartCallBuilder { private final String id; - private TunnelSessionsRestartCallBuilder( + private RestartCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -230,13 +236,15 @@ public class TunnelSessions { * not supported on Windows. When an agent restarts, it reconnects with a new * tunnel session ID. * + * See also https://ngrok.com/docs/api#api-tunnel-sessions-restart. + * * @param id a resource identifier * @return a call builder for this API call */ - public TunnelSessionsRestartCallBuilder restart( + public RestartCallBuilder restart( final String id ) { - return new TunnelSessionsRestartCallBuilder( + return new RestartCallBuilder( id ); } @@ -244,10 +252,10 @@ public class TunnelSessions { /** * A builder object encapsulating state for an unsent Stop API call. */ - public class TunnelSessionsStopCallBuilder { + public class StopCallBuilder { private final String id; - private TunnelSessionsStopCallBuilder( + private StopCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -286,13 +294,15 @@ public class TunnelSessions { * Issues a command instructing the ngrok agent that started this tunnel session to * exit. * + * See also https://ngrok.com/docs/api#api-tunnel-sessions-stop. + * * @param id a resource identifier * @return a call builder for this API call */ - public TunnelSessionsStopCallBuilder stop( + public StopCallBuilder stop( final String id ) { - return new TunnelSessionsStopCallBuilder( + return new StopCallBuilder( id ); } @@ -300,10 +310,10 @@ public class TunnelSessions { /** * A builder object encapsulating state for an unsent Update API call. */ - public class TunnelSessionsUpdateCallBuilder { + public class UpdateCallBuilder { private final String id; - private TunnelSessionsUpdateCallBuilder( + private UpdateCallBuilder( final String id ) { this.id = Objects.requireNonNull(id, "id is required"); @@ -352,13 +362,15 @@ public class TunnelSessions { * disabled update checks the agent is currently in process of updating the agent * has already successfully updated but has not yet been restarted * + * See also https://ngrok.com/docs/api#api-tunnel-sessions-update. + * * @param id the value of the id parameter as a {@link String} * @return a call builder for this API call */ - public TunnelSessionsUpdateCallBuilder update( + public UpdateCallBuilder update( final String id ) { - return new TunnelSessionsUpdateCallBuilder( + return new UpdateCallBuilder( id ); } diff --git a/src/main/java/com/ngrok/services/Tunnels.java b/src/main/java/com/ngrok/services/Tunnels.java index a3ced79..24b762a 100644 --- a/src/main/java/com/ngrok/services/Tunnels.java +++ b/src/main/java/com/ngrok/services/Tunnels.java @@ -14,6 +14,8 @@ import java.util.stream.Stream; /** * 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. */ public class Tunnels { private final NgrokApiClient apiClient; @@ -30,11 +32,11 @@ public class Tunnels { /** * A builder object encapsulating state for an unsent List API call. */ - public class TunnelsListCallBuilder { + public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); - private TunnelsListCallBuilder( + private ListCallBuilder( ) { } @@ -44,7 +46,7 @@ public class Tunnels { * @param beforeId the value of the before_id parameter as a {@link String} * @return the call builder instance */ - public TunnelsListCallBuilder beforeId(final String beforeId) { + public ListCallBuilder beforeId(final String beforeId) { this.beforeId = Optional.ofNullable(beforeId); return this; } @@ -55,7 +57,7 @@ public class Tunnels { * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public TunnelsListCallBuilder beforeId(final Optional beforeId) { + public ListCallBuilder beforeId(final Optional beforeId) { this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); return this; } @@ -66,7 +68,7 @@ public class Tunnels { * @param limit the value of the limit parameter as a {@link String} * @return the call builder instance */ - public TunnelsListCallBuilder limit(final String limit) { + public ListCallBuilder limit(final String limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -77,7 +79,7 @@ public class Tunnels { * @param limit the value of the limit parameter as an {@link Optional} of {@link String} * @return the call builder instance */ - public TunnelsListCallBuilder limit(final Optional limit) { + public ListCallBuilder limit(final Optional limit) { this.limit = Objects.requireNonNull(limit, "limit is required"); return this; } @@ -118,11 +120,13 @@ public class Tunnels { /** * List all online tunnels currently running on the account. * + * See also https://ngrok.com/docs/api#api-tunnels-list. + * * @return a call builder for this API call */ - public TunnelsListCallBuilder list( + public ListCallBuilder list( ) { - return new TunnelsListCallBuilder( + return new ListCallBuilder( ); } } diff --git a/src/test/java/com/ngrok/ApiKeyTestBase.java b/src/test/java/com/ngrok/ApiKeyTestBase.java index 8733ce3..2614d46 100644 --- a/src/test/java/com/ngrok/ApiKeyTestBase.java +++ b/src/test/java/com/ngrok/ApiKeyTestBase.java @@ -39,10 +39,10 @@ public abstract class ApiKeyTestBase extends TestBase { Optional.of((String) API_KEY_JSON_FIELDS.get("token")) ); - public static void assertApiKeyFields(final boolean useLiveApi, final ApiKey apiKey, final String expectedDescription, boolean shouldHaveToken) { + public static void assertApiKeyFields(final ApiKey apiKey, final String expectedDescription, boolean shouldHaveToken) { assertThat(apiKey).isNotNull(); - if (useLiveApi) { + if (USE_LIVE_API) { assertThat(apiKey.getId()).isNotBlank(); assertThat(apiKey.getUri().getHost()).isEqualTo(NgrokApiClient.DEFAULT_BASE_URI.getHost()); assertThat(apiKey.getCreatedAt()).isAfter(OffsetDateTime.now().minus(Duration.ofMinutes(20))); @@ -56,7 +56,7 @@ public abstract class ApiKeyTestBase extends TestBase { assertThat(apiKey.getMetadata()).isEqualTo(API_KEY_JSON_FIELDS.get("metadata")); if (shouldHaveToken) { - if (useLiveApi) { + if (USE_LIVE_API) { assertThat(apiKey.getToken()).isNotEmpty(); assertThat(apiKey.getToken().get()).isNotBlank(); } else { @@ -67,11 +67,11 @@ public abstract class ApiKeyTestBase extends TestBase { } } - public static void assertApiKeyFields(final boolean useLiveApi, final ApiKey apiKey) { - assertApiKeyFields(useLiveApi, apiKey, (String) API_KEY_JSON_FIELDS.get("description"), true); + public static void assertApiKeyFields(final ApiKey apiKey) { + assertApiKeyFields(apiKey, (String) API_KEY_JSON_FIELDS.get("description"), true); } - public static void assertApiKeyFieldsNoToken(final boolean useLiveApi, final ApiKey apiKey) { - assertApiKeyFields(useLiveApi, apiKey, (String) API_KEY_JSON_FIELDS.get("description"), false); + public static void assertApiKeyFieldsNoToken(final ApiKey apiKey) { + assertApiKeyFields( apiKey, (String) API_KEY_JSON_FIELDS.get("description"), false); } } diff --git a/src/test/java/com/ngrok/EventSubscriptionTestBase.java b/src/test/java/com/ngrok/EventSubscriptionTestBase.java new file mode 100644 index 0000000..b1dd3bf --- /dev/null +++ b/src/test/java/com/ngrok/EventSubscriptionTestBase.java @@ -0,0 +1,77 @@ +package com.ngrok; + +import com.ngrok.definitions.EventSource; +import com.ngrok.definitions.EventSubscription; +import com.ngrok.definitions.Ref; + +import java.net.URI; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; + +public abstract class EventSubscriptionTestBase extends TestBase { + public static final Map EVENT_SOURCE_JSON_FIELDS = Stream.of( + entry("type", "http_request_complete"), + entry("uri", URI.create("https://api.ngrok.com/event_sources/1802749824798")) + ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + public static final Map EVENT_DESTINATION_REF_JSON_FIELDS = Stream.of( + entry("id", "9876543abcdefg"), + entry("uri", URI.create("https://api.ngrok.com/event_destinations/9876543abcdefg")) + ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + public static final Map EVENT_SUBSCRIPTION_JSON_FIELDS = Stream.of( + entry("id", "abcdef123456"), + entry("uri", URI.create("https://api.ngrok.com/event_subscriptions/abcdef123456")), + entry("description", "this is a great event subscription"), + entry("metadata", "this event subscription is quite meta"), + entry("sources", Collections.singletonList(EVENT_SOURCE_JSON_FIELDS)), + entry("destinations", Collections.singletonList(EVENT_DESTINATION_REF_JSON_FIELDS)), + entry("created_at", OffsetDateTime.parse("2021-06-08T21:09:00-07:00")) + ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + public static EventSource EVENT_SOURCE = new EventSource( + (String) EVENT_SOURCE_JSON_FIELDS.get("type"), + (URI) EVENT_SOURCE_JSON_FIELDS.get("uri") + ); + + public static Ref EVENT_DESTINATION_REF = new Ref( + (String) EVENT_DESTINATION_REF_JSON_FIELDS.get("id"), + (URI) EVENT_DESTINATION_REF_JSON_FIELDS.get("uri") + ); + + public static EventSubscription EVENT_SUBSCRIPTION = new EventSubscription( + (String) EVENT_SUBSCRIPTION_JSON_FIELDS.get("id"), + (URI) EVENT_SUBSCRIPTION_JSON_FIELDS.get("uri"), + (OffsetDateTime) EVENT_SUBSCRIPTION_JSON_FIELDS.get("created_at"), + (String) EVENT_SUBSCRIPTION_JSON_FIELDS.get("metadata"), + (String) EVENT_SUBSCRIPTION_JSON_FIELDS.get("description"), + Collections.singletonList(EVENT_SOURCE), + Collections.singletonList(EVENT_DESTINATION_REF) + ); + + public static void assertEventSubscriptionFields(final boolean useLiveApi, final EventSubscription eventSubscription, final List expectedEventSources, final List expectedEventDestinations) { + assertThat(eventSubscription).isNotNull(); + + if (useLiveApi) { + assertThat(eventSubscription.getId()).isNotBlank(); + assertThat(eventSubscription.getUri().getHost()).isEqualTo(NgrokApiClient.DEFAULT_BASE_URI.getHost()); + assertThat(eventSubscription.getCreatedAt()).isAfter(OffsetDateTime.now().minus(Duration.ofMinutes(20))); + } else { + assertThat(eventSubscription.getId()).isEqualTo(EVENT_SUBSCRIPTION_JSON_FIELDS.get("id")); + assertThat(eventSubscription.getUri()).isEqualTo(EVENT_SUBSCRIPTION_JSON_FIELDS.get("uri")); + assertThat(eventSubscription.getCreatedAt()).isEqualTo(EVENT_SUBSCRIPTION_JSON_FIELDS.get("created_at")); + } + + assertThat(eventSubscription.getDescription()).isEqualTo(EVENT_SUBSCRIPTION_JSON_FIELDS.get("description")); + assertThat(eventSubscription.getMetadata()).isEqualTo(EVENT_SUBSCRIPTION_JSON_FIELDS.get("metadata")); + assertThat(eventSubscription.getSources()).isEqualTo(expectedEventSources); + assertThat(eventSubscription.getDestinations()).isEqualTo(expectedEventDestinations); + } +} diff --git a/src/test/java/com/ngrok/TestBase.java b/src/test/java/com/ngrok/TestBase.java index 43f2b49..4ac3916 100644 --- a/src/test/java/com/ngrok/TestBase.java +++ b/src/test/java/com/ngrok/TestBase.java @@ -5,11 +5,14 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.net.URI; import java.util.AbstractMap; import java.util.Map; import java.util.Optional; public abstract class TestBase { + public static final String FAKE_API_SECRET ="s3kr1t"; + public static final boolean USE_LIVE_API = Optional.ofNullable(System.getenv("TEST_NO_MOCK")) .map(Boolean::valueOf) .orElse(false); @@ -18,6 +21,14 @@ public abstract class TestBase { .registerModule(new Jdk8Module()) .registerModule(new JavaTimeModule()); + public static Ngrok ngrok(final URI mockBaseUri) { + final NgrokApiClient apiClient = DefaultNgrokApiClient + .newBuilder(USE_LIVE_API ? System.getenv("NGROK_API_KEY") : FAKE_API_SECRET) + .baseUri(USE_LIVE_API ? NgrokApiClient.DEFAULT_BASE_URI : mockBaseUri) + .build(); + return new Ngrok(apiClient); + } + public static Map.Entry entry(final K key, final V value) { return new AbstractMap.SimpleEntry<>(key, value); } @@ -25,5 +36,4 @@ public abstract class TestBase { public static String jsonStrForField(final Map fields, final String key) throws JsonProcessingException { return "\"" + key + "\":" + MAPPER.writeValueAsString(fields.get(key)); } - } diff --git a/src/test/java/com/ngrok/definitions/ApiKeyTest.java b/src/test/java/com/ngrok/definitions/ApiKeyTest.java index dd41884..7e0c0c7 100644 --- a/src/test/java/com/ngrok/definitions/ApiKeyTest.java +++ b/src/test/java/com/ngrok/definitions/ApiKeyTest.java @@ -29,8 +29,7 @@ public class ApiKeyTest extends ApiKeyTestBase { jsonStrForField(API_KEY_JSON_FIELDS, "uri"), jsonStrForField(API_KEY_JSON_FIELDS, "description"), jsonStrForField(API_KEY_JSON_FIELDS, "metadata"), - jsonStrForField(API_KEY_JSON_FIELDS, "created_at"), - "\"token\":null" + jsonStrForField(API_KEY_JSON_FIELDS, "created_at") ); } @@ -48,7 +47,7 @@ public class ApiKeyTest extends ApiKeyTestBase { "}"; final ApiKey apiKey = MAPPER.readValue(jsonStr, ApiKey.class); - assertApiKeyFields(false, apiKey); + assertApiKeyFields(apiKey); } @Test diff --git a/src/test/java/com/ngrok/services/ApiKeysTest.java b/src/test/java/com/ngrok/services/ApiKeysTest.java index ec376d8..1958118 100644 --- a/src/test/java/com/ngrok/services/ApiKeysTest.java +++ b/src/test/java/com/ngrok/services/ApiKeysTest.java @@ -3,9 +3,8 @@ package com.ngrok.services; import com.fasterxml.jackson.core.JsonProcessingException; import com.linecorp.armeria.common.HttpHeaderNames; import com.ngrok.ApiKeyTestBase; -import com.ngrok.DefaultNgrokApiClient; import com.ngrok.Ngrok; -import com.ngrok.NgrokApiClient; +import com.ngrok.TestBase; import com.ngrok.Version; import com.ngrok.definitions.ApiKey; import com.ngrok.definitions.ApiKeyList; @@ -21,18 +20,21 @@ import java.util.AbstractMap; import java.util.Arrays; import java.util.Map; import java.util.Optional; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; import java.util.stream.Stream; -import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.noContent; +import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static com.github.tomakehurst.wiremock.client.WireMock.patch; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static org.assertj.core.api.Assertions.assertThat; public class ApiKeysTest extends ApiKeyTestBase { - private static final String FAKE_API_SECRET ="s3kr1t"; - private static final Map API_KEY_CREATE = API_KEY_JSON_FIELDS.entrySet().stream() .filter(entry -> entry.getKey().equals("description") || entry.getKey().equals("metadata")) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); @@ -69,11 +71,7 @@ public class ApiKeysTest extends ApiKeyTestBase { final WireMockExtension wireMock = new WireMockExtension(); private Ngrok ngrok() { - final NgrokApiClient apiClient = DefaultNgrokApiClient - .newBuilder(USE_LIVE_API ? System.getenv("NGROK_API_KEY") : FAKE_API_SECRET) - .baseUri(USE_LIVE_API ? NgrokApiClient.DEFAULT_BASE_URI : wireMock.getBaseUri()) - .build(); - return new Ngrok(apiClient); + return TestBase.ngrok(wireMock.getBaseUri()); } @BeforeEach @@ -139,7 +137,7 @@ public class ApiKeysTest extends ApiKeyTestBase { } @Test - public void testApiKeys() throws ExecutionException, InterruptedException, TimeoutException { + public void testApiKeys() throws InterruptedException { final String id = testCreateApiKey(); try { testGetApiKey(id); @@ -155,37 +153,37 @@ public class ApiKeysTest extends ApiKeyTestBase { } } - private String testCreateApiKey() throws ExecutionException, InterruptedException, TimeoutException { + private String testCreateApiKey() throws InterruptedException { final ApiKeys apiKeys = ngrok().apiKeys(); final ApiKey apiKey = apiKeys.create() .description((String) API_KEY_CREATE.get("description")) .metadata((String) API_KEY_CREATE.get("metadata")) - .call().toCompletableFuture().get(5, TimeUnit.SECONDS); - assertApiKeyFields(USE_LIVE_API, apiKey); + .blockingCall(); + assertApiKeyFields(apiKey); return apiKey.getId(); } - private void testGetApiKey(final String id) throws ExecutionException, InterruptedException, TimeoutException { + private void testGetApiKey(final String id) throws InterruptedException { final ApiKeys apiKeys = ngrok().apiKeys(); final ApiKey apiKey = apiKeys.get(id) - .call().toCompletableFuture().get(5, TimeUnit.SECONDS); - assertApiKeyFieldsNoToken(USE_LIVE_API, apiKey); + .blockingCall(); + assertApiKeyFieldsNoToken(apiKey); } - public void testListApiKeys(final String id) throws ExecutionException, InterruptedException, TimeoutException { + public void testListApiKeys(final String id) throws InterruptedException { final ApiKeys apiKeys = ngrok().apiKeys(); final Page apiKeyListPage = apiKeys.list() .limit("10") - .call().toCompletableFuture().get(5, TimeUnit.SECONDS); + .blockingCall(); if (USE_LIVE_API) { final ApiKey apiKey = apiKeyListPage.getPage().getKeys() .stream() .filter(key -> key.getId().equals(id)) .findFirst() .orElseThrow(() -> new IllegalStateException("API key with ID " + id + " not found in list")); - assertApiKeyFieldsNoToken(true, apiKey); + assertApiKeyFieldsNoToken(apiKey); } else { - assertApiKeyFieldsNoToken(false, apiKeyListPage.getPage().getKeys().get(0)); + assertApiKeyFieldsNoToken(apiKeyListPage.getPage().getKeys().get(0)); assertThat(apiKeyListPage.getPage().getKeys().get(1).getId()).isEqualTo("asdadsda"); assertThat(apiKeyListPage.getPage().getKeys().get(1).getToken()).contains("12345"); assertThat(apiKeyListPage.getPage().getNextPageUri()).isEmpty(); @@ -193,16 +191,16 @@ public class ApiKeysTest extends ApiKeyTestBase { } } - private void testUpdateApiKey(final String id) throws ExecutionException, InterruptedException, TimeoutException { + private void testUpdateApiKey(final String id) throws InterruptedException { final ApiKeys apiKeys = ngrok().apiKeys(); final ApiKey apiKey = apiKeys.update(id) .description((String) API_KEY_UPDATE.get("description")) - .call().toCompletableFuture().get(5, TimeUnit.SECONDS); - assertApiKeyFields(USE_LIVE_API, apiKey, (String) API_KEY_UPDATE.get("description"), false); + .blockingCall(); + assertApiKeyFields(apiKey, (String) API_KEY_UPDATE.get("description"), false); } - private void testDeleteApiKey(final String id) throws ExecutionException, InterruptedException, TimeoutException { + private void testDeleteApiKey(final String id) throws InterruptedException { final ApiKeys apiKeys = ngrok().apiKeys(); - apiKeys.delete(id).call().toCompletableFuture().get(5, TimeUnit.SECONDS); + apiKeys.delete(id).blockingCall(); } } diff --git a/src/test/java/com/ngrok/services/EventSubscriptionsTest.java b/src/test/java/com/ngrok/services/EventSubscriptionsTest.java new file mode 100644 index 0000000..ab1d860 --- /dev/null +++ b/src/test/java/com/ngrok/services/EventSubscriptionsTest.java @@ -0,0 +1,301 @@ +package com.ngrok.services; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.linecorp.armeria.common.HttpHeaderNames; +import com.ngrok.EventSubscriptionTestBase; +import com.ngrok.Ngrok; +import com.ngrok.TestBase; +import com.ngrok.Version; +import com.ngrok.definitions.AwsAuth; +import com.ngrok.definitions.AwsRole; +import com.ngrok.definitions.EventDestination; +import com.ngrok.definitions.EventSourceReplace; +import com.ngrok.definitions.EventSubscription; +import com.ngrok.definitions.EventSubscriptionList; +import com.ngrok.definitions.EventTarget; +import com.ngrok.definitions.EventTargetCloudwatchLogs; +import com.ngrok.definitions.Page; +import de.mkammerer.wiremock.WireMockExtension; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.slf4j.LoggerFactory; + +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.noContent; +import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static com.github.tomakehurst.wiremock.client.WireMock.patch; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.assertj.core.api.Assertions.assertThat; + +public class EventSubscriptionsTest extends EventSubscriptionTestBase { + private static final EventDestination EVENT_DESTINATION = new EventDestination( + "abcdefg", + "Some extra metadata about this destination", + OffsetDateTime.now(), + "This is a cool destination", + "json", + EventTarget.newBuilder() + .cloudwatchLogs( + EventTargetCloudwatchLogs.newBuilder() + .auth(AwsAuth.newBuilder().role(AwsRole.newBuilder("arn:aws:iam::12345:role/my-role-name").build()).build()) + .logGroupArn("arn:aws:logs:us-east-1:12345:log-grp:my-log-grp") + .build() + ) + .build(), + URI.create("https://api.ngrok.com/event_destinations/abcdefg") + ); + + private static final Map EVENT_DESTINATION_CREATE = Stream.of( + entry("description", EVENT_DESTINATION.getDescription()), + entry("metadata", EVENT_DESTINATION.getMetadata()), + entry("format", EVENT_DESTINATION.getFormat()), + entry("target", Stream.of( + entry("cloudwatch_logs", Stream.of( + entry("auth", Stream.of( + entry("role", Stream.of( + entry("role_arn", EVENT_DESTINATION.getTarget().getCloudwatchLogs().get().getAuth().getRole().get().getRoleArn()) + ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))) + ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))), + entry("log_group_arn", EVENT_DESTINATION.getTarget().getCloudwatchLogs().get().getLogGroupArn()) + ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))) + ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))) + ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + @RegisterExtension + final WireMockExtension wireMock = new WireMockExtension(); + + @SuppressWarnings("unchecked") + private static final Map EVENT_SUBSCRIPTION_CREATE = Stream.of( + entry("description", EVENT_SUBSCRIPTION_JSON_FIELDS.get("description")), + entry("metadata", EVENT_SUBSCRIPTION_JSON_FIELDS.get("metadata")), + entry("sources", Collections.singletonList( + EventSourceReplace.newBuilder() + .type((String) ((List>) EVENT_SUBSCRIPTION_JSON_FIELDS.get("sources")).get(0).get("type")) + .build() + )), + entry("destination_ids", Collections.singletonList( + (String) ((List>) EVENT_SUBSCRIPTION_JSON_FIELDS.get("destinations")).get(0).get("id")) + ) + ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + private static final Map EVENT_SUBSCRIPTION_UPDATE = Stream.of( + entry("description", "some updated description") + ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + private static final EventSubscription UPDATED_EVENT_SUBSCRIPTION = new EventSubscription( + (String) EVENT_SUBSCRIPTION_JSON_FIELDS.get("id"), + (URI) EVENT_SUBSCRIPTION_JSON_FIELDS.get("uri"), + (OffsetDateTime) EVENT_SUBSCRIPTION_JSON_FIELDS.get("created_at"), + (String) EVENT_SUBSCRIPTION_JSON_FIELDS.get("metadata"), + (String) EVENT_SUBSCRIPTION_UPDATE.get("description"), + Collections.singletonList(EVENT_SOURCE), + Collections.singletonList(EVENT_DESTINATION_REF) + ); + + private static final EventSubscriptionList EVENT_SUBSCRIPTION_LIST = new EventSubscriptionList( + Collections.singletonList(EVENT_SUBSCRIPTION), + URI.create("https://api.ngrok.com/event_subscriptions"), + Optional.empty() + ); + + private Ngrok ngrok() { + return TestBase.ngrok(wireMock.getBaseUri()); + } + + @BeforeEach + public void stubEventSubscriptions() throws JsonProcessingException { + if (USE_LIVE_API) { + return; + } + + wireMock.resetAll(); + + wireMock.stubFor( + post(urlPathEqualTo("/event_destinations")) + .withHeader(HttpHeaderNames.AUTHORIZATION.toString(), equalTo("Bearer " + FAKE_API_SECRET)) + .withHeader(HttpHeaderNames.USER_AGENT.toString(), equalTo("ngrok-api-client-java/" + Version.CLIENT_VERSION)) + .withHeader("ngrok-version", equalTo(Version.API_VERSION)) + .withHeader(HttpHeaderNames.CONTENT_TYPE.toString(), containing("application/json")) + .withRequestBody(equalToJson(MAPPER.writeValueAsString(EVENT_DESTINATION_CREATE))) + .willReturn(ok(MAPPER.writeValueAsString(EVENT_DESTINATION)) + .withHeader(HttpHeaderNames.CONTENT_TYPE.toString(), "application/json") + ) + ); + + wireMock.stubFor( + delete(urlPathEqualTo("/event_destinations/" + EVENT_DESTINATION.getId())) + .withHeader(HttpHeaderNames.AUTHORIZATION.toString(), equalTo("Bearer " + FAKE_API_SECRET)) + .withHeader(HttpHeaderNames.USER_AGENT.toString(), equalTo("ngrok-api-client-java/" + Version.CLIENT_VERSION)) + .withHeader("ngrok-version", equalTo(Version.API_VERSION)) + .willReturn(noContent()) + ); + + wireMock.stubFor( + post(urlPathEqualTo("/event_subscriptions")) + .withHeader(HttpHeaderNames.AUTHORIZATION.toString(), equalTo("Bearer " + FAKE_API_SECRET)) + .withHeader(HttpHeaderNames.USER_AGENT.toString(), equalTo("ngrok-api-client-java/" + Version.CLIENT_VERSION)) + .withHeader("ngrok-version", equalTo(Version.API_VERSION)) + .withHeader(HttpHeaderNames.CONTENT_TYPE.toString(), containing("application/json")) + .withRequestBody(equalToJson(MAPPER.writeValueAsString(EVENT_SUBSCRIPTION_CREATE))) + .willReturn(ok(MAPPER.writeValueAsString(EVENT_SUBSCRIPTION)) + .withHeader(HttpHeaderNames.CONTENT_TYPE.toString(), "application/json") + ) + ); + + wireMock.stubFor( + get(urlPathEqualTo("/event_subscriptions/" + EVENT_SUBSCRIPTION_JSON_FIELDS.get("id"))) + .withHeader(HttpHeaderNames.AUTHORIZATION.toString(), equalTo("Bearer " + FAKE_API_SECRET)) + .withHeader(HttpHeaderNames.USER_AGENT.toString(), equalTo("ngrok-api-client-java/" + Version.CLIENT_VERSION)) + .withHeader("ngrok-version", equalTo(Version.API_VERSION)) + .willReturn(ok(MAPPER.writeValueAsString(EVENT_SUBSCRIPTION)) + .withHeader(HttpHeaderNames.CONTENT_TYPE.toString(), "application/json") + ) + ); + + wireMock.stubFor( + get(urlPathEqualTo("/event_subscriptions")) + .withQueryParam("limit", equalTo("10")) + .withHeader(HttpHeaderNames.AUTHORIZATION.toString(), equalTo("Bearer " + FAKE_API_SECRET)) + .withHeader(HttpHeaderNames.USER_AGENT.toString(), equalTo("ngrok-api-client-java/" + Version.CLIENT_VERSION)) + .withHeader("ngrok-version", equalTo(Version.API_VERSION)) + .willReturn(ok(MAPPER.writeValueAsString(EVENT_SUBSCRIPTION_LIST)) + .withHeader(HttpHeaderNames.CONTENT_TYPE.toString(), "application/json") + ) + ); + + wireMock.stubFor( + patch(urlPathEqualTo("/event_subscriptions/" + EVENT_SUBSCRIPTION_JSON_FIELDS.get("id"))) + .withHeader(HttpHeaderNames.AUTHORIZATION.toString(), equalTo("Bearer " + FAKE_API_SECRET)) + .withHeader(HttpHeaderNames.USER_AGENT.toString(), equalTo("ngrok-api-client-java/" + Version.CLIENT_VERSION)) + .withHeader("ngrok-version", equalTo(Version.API_VERSION)) + .withHeader(HttpHeaderNames.CONTENT_TYPE.toString(), containing("application/json")) + .withRequestBody(equalToJson(MAPPER.writeValueAsString(EVENT_SUBSCRIPTION_UPDATE))) + .willReturn(ok(MAPPER.writeValueAsString(UPDATED_EVENT_SUBSCRIPTION)) + .withHeader(HttpHeaderNames.CONTENT_TYPE.toString(), "application/json") + ) + ); + + wireMock.stubFor( + delete(urlPathEqualTo("/event_subscriptions/" + EVENT_SUBSCRIPTION_JSON_FIELDS.get("id"))) + .withHeader(HttpHeaderNames.AUTHORIZATION.toString(), equalTo("Bearer " + FAKE_API_SECRET)) + .withHeader(HttpHeaderNames.USER_AGENT.toString(), equalTo("ngrok-api-client-java/" + Version.CLIENT_VERSION)) + .withHeader("ngrok-version", equalTo(Version.API_VERSION)) + .willReturn(noContent()) + ); + } + + @Test + public void testEventSubscriptions() throws InterruptedException { + if (USE_LIVE_API) { + LoggerFactory.getLogger(getClass()).warn("{} cannot currently be run against the live API", getClass().getSimpleName()); + return; + } + + final String eventDestinationId = testCreateEventDestination(); + final String id = testCreateEventSubscription(); + try { + testGetEventSubscription(id); + testListEventSubscriptions(id); + testUpdateEventSubscription(id); + testDeleteEventSubscription(id); + testDeleteEventDestination(eventDestinationId); + } catch (final Exception e) { + if (USE_LIVE_API) { + // Make an attempt to clean things up + try { ngrok().eventSubscriptions().delete(id).blockingCall(); } catch (final Exception e1) {} + try { ngrok().eventDestinations().delete(eventDestinationId).blockingCall(); } catch (final Exception e1) {} + } + throw e; + } + } + + @SuppressWarnings("unchecked") + private String testCreateEventSubscription() throws InterruptedException { + final EventSubscription eventSubscription = ngrok().eventSubscriptions().create() + .description((String) EVENT_SUBSCRIPTION_CREATE.get("description")) + .metadata((String) EVENT_SUBSCRIPTION_CREATE.get("metadata")) + .sources((List) EVENT_SUBSCRIPTION_CREATE.get("sources")) + .destinationIds((List) EVENT_SUBSCRIPTION_CREATE.get("destination_ids")) + .blockingCall(); + assertEventSubscriptionFields(eventSubscription); + return eventSubscription.getId(); + } + + public static void assertEventSubscriptionFields(final EventSubscription eventSubscription, final String expectedDescription) { + assertThat(eventSubscription.getId()).isEqualTo(EVENT_SUBSCRIPTION_JSON_FIELDS.get("id")); + assertThat(eventSubscription.getDescription()).isEqualTo(expectedDescription); + assertThat(eventSubscription.getMetadata()).isEqualTo(EVENT_SUBSCRIPTION_JSON_FIELDS.get("metadata")); + assertThat(eventSubscription.getSources()).containsAll(EVENT_SUBSCRIPTION.getSources()); + assertThat(eventSubscription.getDestinations()).containsAll(EVENT_SUBSCRIPTION.getDestinations()); + } + + public static void assertEventSubscriptionFields(final EventSubscription eventSubscription) { + assertEventSubscriptionFields(eventSubscription, (String) EVENT_SUBSCRIPTION_JSON_FIELDS.get("description")); + } + + private void testGetEventSubscription(final String id) throws InterruptedException { + final EventSubscription eventSubscription = ngrok().eventSubscriptions().get(id) + .blockingCall(); + assertEventSubscriptionFields(eventSubscription); + } + + private void testListEventSubscriptions(final String id) throws InterruptedException { + final EventSubscriptions eventSubscriptions = ngrok().eventSubscriptions(); + final Page eventSubscriptionListPage = eventSubscriptions.list() + .limit("10") + .blockingCall(); + final EventSubscription eventSubscription; + if (USE_LIVE_API) { + eventSubscription = eventSubscriptionListPage.getPage().getEventSubscriptions() + .stream() + .filter(key -> key.getId().equals(id)) + .findFirst() + .orElseThrow(() -> new IllegalStateException("API key with ID " + id + " not found in list")); + } else { + eventSubscription = eventSubscriptionListPage.getPage().getEventSubscriptions().get(0); + assertThat(eventSubscriptionListPage.getPage().getNextPageUri()).isEmpty(); + assertThat(eventSubscriptionListPage.next()).isCompletedWithValue(Optional.empty()); + } + assertEventSubscriptionFields(eventSubscription); + } + + private void testUpdateEventSubscription(final String id) throws InterruptedException { + final EventSubscription eventSubscription = ngrok().eventSubscriptions().update(id) + .description((String) EVENT_SUBSCRIPTION_UPDATE.get("description")) + .blockingCall(); + assertEventSubscriptionFields(eventSubscription, (String) EVENT_SUBSCRIPTION_UPDATE.get("description")); + } + + private void testDeleteEventSubscription(final String id) throws InterruptedException { + ngrok().eventSubscriptions().delete(id).blockingCall(); + } + + private String testCreateEventDestination() throws InterruptedException { + final EventDestination dest = ngrok().eventDestinations().create() + .description(EVENT_DESTINATION.getDescription()) + .metadata(EVENT_DESTINATION.getMetadata()) + .format(EVENT_DESTINATION.getFormat()) + .target(EVENT_DESTINATION.getTarget()) + .blockingCall(); + return dest.getId(); + } + + private void testDeleteEventDestination(final String id) throws InterruptedException { + ngrok().eventDestinations().delete(id).blockingCall(); + } +}