From e936d924a77fe0fc2efd5d3cd133f2a58d222c6e Mon Sep 17 00:00:00 2001 From: ngrok release bot Date: Tue, 16 Dec 2025 17:22:33 +0000 Subject: [PATCH] Update generated files --- CHANGELOG.md | 3 + src/main/java/com/ngrok/Ngrok.java | 11 + .../java/com/ngrok/definitions/Endpoint.java | 4 +- .../java/com/ngrok/definitions/Secret.java | 24 +- .../com/ngrok/definitions/ServiceUser.java | 143 ++++++ .../ngrok/definitions/ServiceUserList.java | 107 ++++ .../com/ngrok/services/AgentIngresses.java | 26 +- src/main/java/com/ngrok/services/ApiKeys.java | 26 +- .../services/CertificateAuthorities.java | 28 +- .../java/com/ngrok/services/Credentials.java | 26 +- .../java/com/ngrok/services/Endpoints.java | 26 +- .../com/ngrok/services/EventDestinations.java | 26 +- .../ngrok/services/EventSubscriptions.java | 26 +- .../java/com/ngrok/services/IpPolicies.java | 26 +- .../com/ngrok/services/IpPolicyRules.java | 26 +- .../com/ngrok/services/IpRestrictions.java | 26 +- .../com/ngrok/services/ReservedAddrs.java | 26 +- .../com/ngrok/services/ReservedDomains.java | 26 +- src/main/java/com/ngrok/services/Secrets.java | 81 ++- .../java/com/ngrok/services/ServiceUsers.java | 480 ++++++++++++++++++ .../services/SshCertificateAuthorities.java | 28 +- .../com/ngrok/services/SshCredentials.java | 26 +- .../ngrok/services/SshHostCertificates.java | 2 +- .../ngrok/services/SshUserCertificates.java | 2 +- .../com/ngrok/services/TlsCertificates.java | 26 +- .../com/ngrok/services/TunnelSessions.java | 26 +- src/main/java/com/ngrok/services/Vaults.java | 26 +- 27 files changed, 1269 insertions(+), 34 deletions(-) create mode 100644 src/main/java/com/ngrok/definitions/ServiceUser.java create mode 100644 src/main/java/com/ngrok/definitions/ServiceUserList.java create mode 100644 src/main/java/com/ngrok/services/ServiceUsers.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 126f937..f54ea99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ +## 0.15.0 +* Add support for CEL filtering when listing resources. + ## 0.14.0 * Change endpoint filtering query parameters to `id` and `url`. * Add support for getting secrets by vault. diff --git a/src/main/java/com/ngrok/Ngrok.java b/src/main/java/com/ngrok/Ngrok.java index 9da74c8..988e0b0 100644 --- a/src/main/java/com/ngrok/Ngrok.java +++ b/src/main/java/com/ngrok/Ngrok.java @@ -288,6 +288,17 @@ public class Ngrok { return new Secrets(this.apiClient); } + /** + * Creates a service client for ServiceUsers. + * + * See also https://ngrok.com/docs/api#api-service-users. + * + * @return a service client + */ + public ServiceUsers serviceUsers() { + return new ServiceUsers(this.apiClient); + } + /** * 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. diff --git a/src/main/java/com/ngrok/definitions/Endpoint.java b/src/main/java/com/ngrok/definitions/Endpoint.java index 6e2cf3a..15fb557 100644 --- a/src/main/java/com/ngrok/definitions/Endpoint.java +++ b/src/main/java/com/ngrok/definitions/Endpoint.java @@ -104,7 +104,7 @@ public class Endpoint { * @param region identifier of the region this endpoint belongs to * @param createdAt timestamp when the endpoint was created in RFC 3339 format * @param updatedAt timestamp when the endpoint was updated in RFC 3339 format - * @param publicUrl URL of the hostport served by this endpoint + * @param publicUrl deprecated [replaced by URL]: URL of the hostport served by this endpoint * @param proto protocol served by this endpoint. one of http, https, tcp, or tls * @param scheme the value of the scheme parameter as a {@link String} * @param hostport hostport served by this endpoint (hostname:port) -> soon to be deprecated @@ -224,7 +224,7 @@ public class Endpoint { } /** - * URL of the hostport served by this endpoint + * deprecated [replaced by URL]: URL of the hostport served by this endpoint * * @return the value of the property as a {@link java.net.URI} */ diff --git a/src/main/java/com/ngrok/definitions/Secret.java b/src/main/java/com/ngrok/definitions/Secret.java index 2708ec7..c71c358 100644 --- a/src/main/java/com/ngrok/definitions/Secret.java +++ b/src/main/java/com/ngrok/definitions/Secret.java @@ -45,6 +45,9 @@ public class Secret { @JsonProperty("vault") @JsonInclude(value = JsonInclude.Include.NON_ABSENT) private final Ref vault; + @JsonProperty("vault_name") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) + private final Optional vaultName; /** * Creates a new instance of {@link Secret}. @@ -59,6 +62,7 @@ public class Secret { * @param createdBy Reference to who created this Secret * @param lastUpdatedBy Reference to who created this Secret * @param vault Reference to the vault the secret is stored in + * @param vaultName Name of the vault the secret is stored in */ @JsonCreator public Secret( @@ -71,7 +75,8 @@ public class Secret { @JsonProperty("metadata") final Optional metadata, @JsonProperty("created_by") final Ref createdBy, @JsonProperty("last_updated_by") final Ref lastUpdatedBy, - @JsonProperty("vault") final Ref vault + @JsonProperty("vault") final Ref vault, + @JsonProperty("vault_name") final Optional vaultName ) { this.id = Objects.requireNonNull(id, "id is required"); this.uri = Objects.requireNonNull(uri, "uri is required"); @@ -83,6 +88,7 @@ public class Secret { this.createdBy = Objects.requireNonNull(createdBy, "createdBy is required"); this.lastUpdatedBy = Objects.requireNonNull(lastUpdatedBy, "lastUpdatedBy is required"); this.vault = Objects.requireNonNull(vault, "vault is required"); + this.vaultName = vaultName != null ? vaultName : Optional.empty(); } /** @@ -175,6 +181,15 @@ public class Secret { return this.vault; } + /** + * Name of the vault the secret is stored in + * + * @return the value of the property as a {@link String} wrapped in an {@link Optional} + */ + public Optional getVaultName() { + return this.vaultName; + } + @Override public boolean equals(final Object o) { if (this == o) { @@ -195,7 +210,8 @@ public class Secret { this.metadata.equals(other.metadata)&& this.createdBy.equals(other.createdBy)&& this.lastUpdatedBy.equals(other.lastUpdatedBy)&& - this.vault.equals(other.vault); + this.vault.equals(other.vault)&& + this.vaultName.equals(other.vaultName); } @@ -211,7 +227,8 @@ public class Secret { this.metadata, this.createdBy, this.lastUpdatedBy, - this.vault + this.vault, + this.vaultName ); } @@ -228,6 +245,7 @@ public class Secret { "', createdBy='" + this.createdBy + "', lastUpdatedBy='" + this.lastUpdatedBy + "', vault='" + this.vault + + "', vaultName='" + this.vaultName.orElse("(null)") + "'}"; } } diff --git a/src/main/java/com/ngrok/definitions/ServiceUser.java b/src/main/java/com/ngrok/definitions/ServiceUser.java new file mode 100644 index 0000000..5227e4f --- /dev/null +++ b/src/main/java/com/ngrok/definitions/ServiceUser.java @@ -0,0 +1,143 @@ +/* Code generated for API Clients. DO NOT EDIT. */ + +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; +import java.util.Optional; + +/** + * A class encapsulating the {@link ServiceUser} resource. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ServiceUser { + @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("name") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) + private final String name; + @JsonProperty("active") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) + private final boolean active; + @JsonProperty("created_at") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) + private final java.time.OffsetDateTime createdAt; + + /** + * Creates a new instance of {@link ServiceUser}. + * + * @param id unique API key resource identifier + * @param uri URI to the API resource of this service user + * @param name human-readable name used to identify the service + * @param active whether or not the service is active + * @param createdAt timestamp when the api key was created, RFC 3339 format + */ + @JsonCreator + public ServiceUser( + @JsonProperty("id") final String id, + @JsonProperty("uri") final java.net.URI uri, + @JsonProperty("name") final String name, + @JsonProperty("active") final Boolean active, + @JsonProperty("created_at") final java.time.OffsetDateTime createdAt + ) { + this.id = Objects.requireNonNull(id, "id is required"); + this.uri = Objects.requireNonNull(uri, "uri is required"); + this.name = Objects.requireNonNull(name, "name is required"); + this.active = Objects.requireNonNull(active, "active is required"); + this.createdAt = Objects.requireNonNull(createdAt, "createdAt is required"); + } + + /** + * unique API key resource identifier + * + * @return the value of the property as a {@link String} + */ + public String getId() { + return this.id; + } + + /** + * URI to the API resource of this service user + * + * @return the value of the property as a {@link java.net.URI} + */ + public java.net.URI getUri() { + return this.uri; + } + + /** + * human-readable name used to identify the service + * + * @return the value of the property as a {@link String} + */ + public String getName() { + return this.name; + } + + /** + * whether or not the service is active + * + * @return the value of the property as a {@link boolean} + */ + public boolean getActive() { + return this.active; + } + + /** + * timestamp when the api key was created, RFC 3339 format + * + * @return the value of the property as a {@link java.time.OffsetDateTime} + */ + public java.time.OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + final ServiceUser other = (ServiceUser) o; + return + this.id.equals(other.id)&& + this.uri.equals(other.uri)&& + this.name.equals(other.name)&& + this.active == other.active&& + this.createdAt.equals(other.createdAt); + + } + + @Override + public int hashCode() { + return Objects.hash( + this.id, + this.uri, + this.name, + this.active, + this.createdAt + ); + } + + @Override + public String toString() { + return "ServiceUser{" + + "id='" + this.id + + "', uri='" + this.uri + + "', name='" + this.name + + "', active='" + this.active + + "', createdAt='" + this.createdAt + + "'}"; + } +} diff --git a/src/main/java/com/ngrok/definitions/ServiceUserList.java b/src/main/java/com/ngrok/definitions/ServiceUserList.java new file mode 100644 index 0000000..fa25cf0 --- /dev/null +++ b/src/main/java/com/ngrok/definitions/ServiceUserList.java @@ -0,0 +1,107 @@ +/* Code generated for API Clients. DO NOT EDIT. */ + +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; +import java.util.Optional; + +/** + * A class encapsulating the {@link ServiceUserList} resource. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ServiceUserList implements Pageable { + @JsonProperty("service_users") + @JsonInclude(value = JsonInclude.Include.NON_ABSENT) + private final java.util.List serviceUsers; + @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; + + /** + * Creates a new instance of {@link ServiceUserList}. + * + * @param serviceUsers the list of all service users on this account + * @param uri URI of the service users list API resource + * @param nextPageUri URI of the next page, or null if there is no next page + */ + @JsonCreator + public ServiceUserList( + @JsonProperty("service_users") final java.util.List serviceUsers, + @JsonProperty("uri") final java.net.URI uri, + @JsonProperty("next_page_uri") final Optional nextPageUri + ) { + this.serviceUsers = serviceUsers != null ? serviceUsers : java.util.Collections.emptyList(); + this.uri = Objects.requireNonNull(uri, "uri is required"); + this.nextPageUri = nextPageUri != null ? nextPageUri : Optional.empty(); + } + + /** + * the list of all service users on this account + * + * @return the value of the property as a {@link java.util.List} of {@link ServiceUser} + */ + public java.util.List getServiceUsers() { + return this.serviceUsers; + } + + /** + * URI of the service users list API resource + * + * @return the value of the property as a {@link java.net.URI} + */ + public java.net.URI getUri() { + return this.uri; + } + + /** + * URI of the next page, or null if there is no next page + * + * @return the value of the property as a {@link java.net.URI} wrapped in an {@link Optional} + */ + public Optional getNextPageUri() { + return this.nextPageUri; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + final ServiceUserList other = (ServiceUserList) o; + return + this.serviceUsers.equals(other.serviceUsers)&& + this.uri.equals(other.uri)&& + this.nextPageUri.equals(other.nextPageUri); + + } + + @Override + public int hashCode() { + return Objects.hash( + this.serviceUsers, + this.uri, + this.nextPageUri + ); + } + + @Override + public String toString() { + return "ServiceUserList{" + + "serviceUsers='" + this.serviceUsers + + "', uri='" + this.uri + + "', nextPageUri='" + this.nextPageUri.map(Object::toString).orElse("(null)") + + "'}"; + } +} diff --git a/src/main/java/com/ngrok/services/AgentIngresses.java b/src/main/java/com/ngrok/services/AgentIngresses.java index 71721aa..41030b4 100644 --- a/src/main/java/com/ngrok/services/AgentIngresses.java +++ b/src/main/java/com/ngrok/services/AgentIngresses.java @@ -290,6 +290,7 @@ public class AgentIngresses { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -339,6 +340,28 @@ public class AgentIngresses { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -350,7 +373,8 @@ public class AgentIngresses { "/agent_ingresses", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(AgentIngressList.class) diff --git a/src/main/java/com/ngrok/services/ApiKeys.java b/src/main/java/com/ngrok/services/ApiKeys.java index 65c9ac3..737bc9c 100644 --- a/src/main/java/com/ngrok/services/ApiKeys.java +++ b/src/main/java/com/ngrok/services/ApiKeys.java @@ -290,6 +290,7 @@ public class ApiKeys { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -339,6 +340,28 @@ public class ApiKeys { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -350,7 +373,8 @@ public class ApiKeys { "/api_keys", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(ApiKeyList.class) diff --git a/src/main/java/com/ngrok/services/CertificateAuthorities.java b/src/main/java/com/ngrok/services/CertificateAuthorities.java index c831a7b..4a2d771 100644 --- a/src/main/java/com/ngrok/services/CertificateAuthorities.java +++ b/src/main/java/com/ngrok/services/CertificateAuthorities.java @@ -246,7 +246,7 @@ public class CertificateAuthorities { } /** - * Get detailed information about a certficate authority + * Get detailed information about a certificate authority * * See also https://ngrok.com/docs/api#api-certificate-authorities-get. * @@ -267,6 +267,7 @@ public class CertificateAuthorities { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -316,6 +317,28 @@ public class CertificateAuthorities { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -327,7 +350,8 @@ public class CertificateAuthorities { "/certificate_authorities", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(CertificateAuthorityList.class) diff --git a/src/main/java/com/ngrok/services/Credentials.java b/src/main/java/com/ngrok/services/Credentials.java index 8b5f6bc..ff389ba 100644 --- a/src/main/java/com/ngrok/services/Credentials.java +++ b/src/main/java/com/ngrok/services/Credentials.java @@ -341,6 +341,7 @@ public class Credentials { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -390,6 +391,28 @@ public class Credentials { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -401,7 +424,8 @@ public class Credentials { "/credentials", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(CredentialList.class) diff --git a/src/main/java/com/ngrok/services/Endpoints.java b/src/main/java/com/ngrok/services/Endpoints.java index ccb3276..829e132 100644 --- a/src/main/java/com/ngrok/services/Endpoints.java +++ b/src/main/java/com/ngrok/services/Endpoints.java @@ -210,6 +210,7 @@ public class Endpoints { private Optional limit = Optional.empty(); private Optional> id = Optional.empty(); private Optional> url = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -303,6 +304,28 @@ public class Endpoints { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -316,7 +339,8 @@ public class Endpoints { new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), new AbstractMap.SimpleEntry<>("id", Optional.of(this.id).filter(id -> !id.isEmpty()).map(Function.identity())), - new AbstractMap.SimpleEntry<>("url", Optional.of(this.url).filter(url -> !url.isEmpty()).map(Function.identity())) + new AbstractMap.SimpleEntry<>("url", Optional.of(this.url).filter(url -> !url.isEmpty()).map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(EndpointList.class) diff --git a/src/main/java/com/ngrok/services/EventDestinations.java b/src/main/java/com/ngrok/services/EventDestinations.java index 02732ba..4fcc66e 100644 --- a/src/main/java/com/ngrok/services/EventDestinations.java +++ b/src/main/java/com/ngrok/services/EventDestinations.java @@ -312,6 +312,7 @@ public class EventDestinations { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -361,6 +362,28 @@ public class EventDestinations { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -372,7 +395,8 @@ public class EventDestinations { "/event_destinations", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(EventDestinationList.class) diff --git a/src/main/java/com/ngrok/services/EventSubscriptions.java b/src/main/java/com/ngrok/services/EventSubscriptions.java index cc683f2..89e30e1 100644 --- a/src/main/java/com/ngrok/services/EventSubscriptions.java +++ b/src/main/java/com/ngrok/services/EventSubscriptions.java @@ -306,6 +306,7 @@ public class EventSubscriptions { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -355,6 +356,28 @@ public class EventSubscriptions { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -366,7 +389,8 @@ public class EventSubscriptions { "/event_subscriptions", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(EventSubscriptionList.class) diff --git a/src/main/java/com/ngrok/services/IpPolicies.java b/src/main/java/com/ngrok/services/IpPolicies.java index 59f1b83..129817b 100644 --- a/src/main/java/com/ngrok/services/IpPolicies.java +++ b/src/main/java/com/ngrok/services/IpPolicies.java @@ -263,6 +263,7 @@ public class IpPolicies { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -312,6 +313,28 @@ public class IpPolicies { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -323,7 +346,8 @@ public class IpPolicies { "/ip_policies", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(IpPolicyList.class) diff --git a/src/main/java/com/ngrok/services/IpPolicyRules.java b/src/main/java/com/ngrok/services/IpPolicyRules.java index 2b88155..2e9f8ff 100644 --- a/src/main/java/com/ngrok/services/IpPolicyRules.java +++ b/src/main/java/com/ngrok/services/IpPolicyRules.java @@ -278,6 +278,7 @@ public class IpPolicyRules { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -327,6 +328,28 @@ public class IpPolicyRules { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -338,7 +361,8 @@ public class IpPolicyRules { "/ip_policy_rules", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(IpPolicyRuleList.class) diff --git a/src/main/java/com/ngrok/services/IpRestrictions.java b/src/main/java/com/ngrok/services/IpRestrictions.java index 7108d69..fac3645 100644 --- a/src/main/java/com/ngrok/services/IpRestrictions.java +++ b/src/main/java/com/ngrok/services/IpRestrictions.java @@ -299,6 +299,7 @@ public class IpRestrictions { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -348,6 +349,28 @@ public class IpRestrictions { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -359,7 +382,8 @@ public class IpRestrictions { "/ip_restrictions", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(IpRestrictionList.class) diff --git a/src/main/java/com/ngrok/services/ReservedAddrs.java b/src/main/java/com/ngrok/services/ReservedAddrs.java index 51f7310..20787bf 100644 --- a/src/main/java/com/ngrok/services/ReservedAddrs.java +++ b/src/main/java/com/ngrok/services/ReservedAddrs.java @@ -282,6 +282,7 @@ public class ReservedAddrs { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -331,6 +332,28 @@ public class ReservedAddrs { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -342,7 +365,8 @@ public class ReservedAddrs { "/reserved_addrs", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(ReservedAddrList.class) diff --git a/src/main/java/com/ngrok/services/ReservedDomains.java b/src/main/java/com/ngrok/services/ReservedDomains.java index ad45576..09beac6 100644 --- a/src/main/java/com/ngrok/services/ReservedDomains.java +++ b/src/main/java/com/ngrok/services/ReservedDomains.java @@ -367,6 +367,7 @@ public class ReservedDomains { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -416,6 +417,28 @@ public class ReservedDomains { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -427,7 +450,8 @@ public class ReservedDomains { "/reserved_domains", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(ReservedDomainList.class) diff --git a/src/main/java/com/ngrok/services/Secrets.java b/src/main/java/com/ngrok/services/Secrets.java index c4c6579..030e71b 100644 --- a/src/main/java/com/ngrok/services/Secrets.java +++ b/src/main/java/com/ngrok/services/Secrets.java @@ -39,12 +39,11 @@ public class Secrets { private Optional value = Optional.empty(); private Optional metadata = Optional.empty(); private Optional description = Optional.empty(); - private final String vaultId; + private Optional vaultId = Optional.empty(); + private Optional vaultName = Optional.empty(); private CreateCallBuilder( - final String vaultId ) { - this.vaultId = Objects.requireNonNull(vaultId, "vaultId is required"); } /** @@ -135,6 +134,50 @@ public class Secrets { return this; } + /** + * unique identifier of the referenced vault + * + * @param vaultId the value of the vault_id parameter as a {@link String} + * @return the call builder instance + */ + public CreateCallBuilder vaultId(final String vaultId) { + this.vaultId = Optional.of(Objects.requireNonNull(vaultId, "vaultId is required")); + return this; + } + + /** + * unique identifier of the referenced vault + * + * @param vaultId the value of the vault_id parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public CreateCallBuilder vaultId(final Optional vaultId) { + this.vaultId = Objects.requireNonNull(vaultId, "vaultId is required"); + return this; + } + + /** + * name of the referenced vault + * + * @param vaultName the value of the vault_name parameter as a {@link String} + * @return the call builder instance + */ + public CreateCallBuilder vaultName(final String vaultName) { + this.vaultName = Optional.of(Objects.requireNonNull(vaultName, "vaultName is required")); + return this; + } + + /** + * name of the referenced vault + * + * @param vaultName the value of the vault_name parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public CreateCallBuilder vaultName(final Optional vaultName) { + this.vaultName = Objects.requireNonNull(vaultName, "vaultName is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -150,7 +193,8 @@ public class Secrets { new AbstractMap.SimpleEntry<>("value", this.value.map(Function.identity())), new AbstractMap.SimpleEntry<>("metadata", this.metadata.map(Function.identity())), new AbstractMap.SimpleEntry<>("description", this.description.map(Function.identity())), - new AbstractMap.SimpleEntry<>("vault_id", Optional.of(this.vaultId)) + new AbstractMap.SimpleEntry<>("vault_id", this.vaultId.map(Function.identity())), + new AbstractMap.SimpleEntry<>("vault_name", this.vaultName.map(Function.identity())) ), Optional.of(Secret.class) ); @@ -176,14 +220,11 @@ public class Secrets { * * See also https://ngrok.com/docs/api#api-secrets-create. * - * @param vaultId unique identifier of the referenced vault * @return a call builder for this API call */ public CreateCallBuilder create( - final String vaultId ) { return new CreateCallBuilder( - vaultId ); } @@ -463,6 +504,7 @@ public class Secrets { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -512,6 +554,28 @@ public class Secrets { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -523,7 +587,8 @@ public class Secrets { "/vault_secrets", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(SecretList.class) diff --git a/src/main/java/com/ngrok/services/ServiceUsers.java b/src/main/java/com/ngrok/services/ServiceUsers.java new file mode 100644 index 0000000..3176699 --- /dev/null +++ b/src/main/java/com/ngrok/services/ServiceUsers.java @@ -0,0 +1,480 @@ +/* Code generated for API Clients. DO NOT EDIT. */ + +package com.ngrok.services; + +import com.ngrok.NgrokApiClient; +import com.ngrok.definitions.*; + +import java.util.AbstractMap; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.ExecutionException; +import java.util.function.Function; +import java.util.stream.Stream; + +/** + * An API client for {@link ServiceUsers}. + * + * See also https://ngrok.com/docs/api#api-service-users. + */ +public class ServiceUsers { + private final NgrokApiClient apiClient; + + /** + * Creates a new sub-client for ServiceUsers. + * + * @param apiClient an instance of {@link com.ngrok.NgrokApiClient} + */ + public ServiceUsers(final NgrokApiClient apiClient) { + this.apiClient = Objects.requireNonNull(apiClient, "apiClient is required"); + } + + /** + * A builder object encapsulating state for an unsent Create API call. + */ + public class CreateCallBuilder { + private Optional name = Optional.empty(); + private Optional active = Optional.empty(); + + private CreateCallBuilder( + ) { + } + + /** + * human-readable name used to identify the service + * + * @param name the value of the name parameter as a {@link String} + * @return the call builder instance + */ + public CreateCallBuilder name(final String name) { + this.name = Optional.of(Objects.requireNonNull(name, "name is required")); + return this; + } + + /** + * human-readable name used to identify the service + * + * @param name the value of the name parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public CreateCallBuilder name(final Optional name) { + this.name = Objects.requireNonNull(name, "name is required"); + return this; + } + + /** + * whether or not the service is active + * + * @param active the value of the active parameter as a {@link boolean} + * @return the call builder instance + */ + public CreateCallBuilder active(final boolean active) { + this.active = Optional.of(Objects.requireNonNull(active, "active is required")); + return this; + } + + /** + * whether or not the service is active + * + * @param active the value of the active parameter as an {@link Optional} of {@link boolean} + * @return the call builder instance + */ + public CreateCallBuilder active(final Optional active) { + this.active = Objects.requireNonNull(active, "active is required"); + return this; + } + + /** + * Initiates the API call asynchronously. + * + * @return a {@link CompletionStage} of {@link ServiceUser} + */ + public CompletionStage call() { + return apiClient.sendRequest( + NgrokApiClient.HttpMethod.POST, + "/service_users", + Stream.empty(), + Stream.of( + new AbstractMap.SimpleEntry<>("name", this.name.map(Function.identity())), + new AbstractMap.SimpleEntry<>("active", this.active.map(Function.identity())) + ), + Optional.of(ServiceUser.class) + ); + } + + /** + * Initiates the API call and blocks until it returns. + * + * @return {@link ServiceUser} + * @throws InterruptedException if the thread was interrupted during the call + */ + public ServiceUser blockingCall() throws InterruptedException { + try { + return call().toCompletableFuture().get(); + } catch (final ExecutionException e) { + throw e.getCause() instanceof RuntimeException ? (RuntimeException) e.getCause() : new RuntimeException(e.getCause().getMessage(), e.getCause()); + } + } + } + + /** + * Create a new service user + * + * See also https://ngrok.com/docs/api#api-service-users-create. + * + * @return a call builder for this API call + */ + public CreateCallBuilder create( + ) { + return new CreateCallBuilder( + ); + } + + /** + * A builder object encapsulating state for an unsent Delete API call. + */ + public class DeleteCallBuilder { + private final String id; + + private DeleteCallBuilder( + final String id + ) { + this.id = Objects.requireNonNull(id, "id is required"); + } + + /** + * Initiates the API call asynchronously. + * + * @return a {@link CompletionStage} of {@link Void} + */ + public CompletionStage call() { + return apiClient.sendRequest( + NgrokApiClient.HttpMethod.DELETE, + "/service_users/" + this.id, + Stream.empty(), + Stream.empty(), + Optional.empty() + ); + } + + /** + * Initiates the API call and blocks until it returns. + * + * @throws InterruptedException if the thread was interrupted during the call + */ + public void blockingCall() throws InterruptedException { + try { + call().toCompletableFuture().get(); + } catch (final ExecutionException e) { + throw e.getCause() instanceof RuntimeException ? (RuntimeException) e.getCause() : new RuntimeException(e.getCause().getMessage(), e.getCause()); + } + } + } + + /** + * Delete a service user by ID + * + * See also https://ngrok.com/docs/api#api-service-users-delete. + * + * @param id a resource identifier + * @return a call builder for this API call + */ + public DeleteCallBuilder delete( + final String id + ) { + return new DeleteCallBuilder( + id + ); + } + + /** + * A builder object encapsulating state for an unsent Get API call. + */ + public class GetCallBuilder { + private final String id; + + private GetCallBuilder( + final String id + ) { + this.id = Objects.requireNonNull(id, "id is required"); + } + + /** + * Initiates the API call asynchronously. + * + * @return a {@link CompletionStage} of {@link ServiceUser} + */ + public CompletionStage call() { + return apiClient.sendRequest( + NgrokApiClient.HttpMethod.GET, + "/service_users/" + this.id, + Stream.empty(), + Stream.empty(), + Optional.of(ServiceUser.class) + ); + } + + /** + * Initiates the API call and blocks until it returns. + * + * @return {@link ServiceUser} + * @throws InterruptedException if the thread was interrupted during the call + */ + public ServiceUser blockingCall() throws InterruptedException { + try { + return call().toCompletableFuture().get(); + } catch (final ExecutionException e) { + throw e.getCause() instanceof RuntimeException ? (RuntimeException) e.getCause() : new RuntimeException(e.getCause().getMessage(), e.getCause()); + } + } + } + + /** + * Get the details of a Bot User by ID. + * + * See also https://ngrok.com/docs/api#api-service-users-get. + * + * @param id a resource identifier + * @return a call builder for this API call + */ + public GetCallBuilder get( + final String id + ) { + return new GetCallBuilder( + id + ); + } + + /** + * A builder object encapsulating state for an unsent List API call. + */ + public class ListCallBuilder { + private Optional beforeId = Optional.empty(); + private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); + + private ListCallBuilder( + ) { + } + + /** + * Sets the before_id parameter. + * + * @param beforeId the value of the before_id parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder beforeId(final String beforeId) { + this.beforeId = Optional.of(Objects.requireNonNull(beforeId, "beforeId is required")); + return this; + } + + /** + * Sets (or unsets) the before_id parameter. + * + * @param beforeId the value of the before_id parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder beforeId(final Optional beforeId) { + this.beforeId = Objects.requireNonNull(beforeId, "beforeId is required"); + return this; + } + + /** + * Sets the limit parameter. + * + * @param limit the value of the limit parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder limit(final String limit) { + this.limit = Optional.of(Objects.requireNonNull(limit, "limit is required")); + return this; + } + + /** + * Sets (or unsets) the limit parameter. + * + * @param limit the value of the limit parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder limit(final Optional limit) { + this.limit = Objects.requireNonNull(limit, "limit is required"); + return this; + } + + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + + /** + * Initiates the API call asynchronously. + * + * @return a {@link CompletionStage} of a {@link Page} of {@link ServiceUserList} + */ + public CompletionStage> call() { + return apiClient.sendRequest( + NgrokApiClient.HttpMethod.GET, + "/service_users", + Stream.of( + new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) + ), + Stream.empty(), + Optional.of(ServiceUserList.class) + ).thenApply(list -> new Page<>(apiClient, list)); + } + + /** + * Initiates the API call and blocks until it returns. + * + * @return a {@link Page} of {@link ServiceUserList} + * @throws InterruptedException if the thread was interrupted during the call + */ + public Page blockingCall() throws InterruptedException { + try { + return call().toCompletableFuture().get(); + } catch (final ExecutionException e) { + throw e.getCause() instanceof RuntimeException ? (RuntimeException) e.getCause() : new RuntimeException(e.getCause().getMessage(), e.getCause()); + } + } + } + + /** + * List all service users in this account. + * + * See also https://ngrok.com/docs/api#api-service-users-list. + * + * @return a call builder for this API call + */ + public ListCallBuilder list( + ) { + return new ListCallBuilder( + ); + } + + /** + * A builder object encapsulating state for an unsent Update API call. + */ + public class UpdateCallBuilder { + private final String id; + private Optional name = Optional.empty(); + private Optional active = Optional.empty(); + + private UpdateCallBuilder( + final String id + ) { + this.id = Objects.requireNonNull(id, "id is required"); + } + + /** + * human-readable name used to identify the service + * + * @param name the value of the name parameter as a {@link String} + * @return the call builder instance + */ + public UpdateCallBuilder name(final String name) { + this.name = Optional.of(Objects.requireNonNull(name, "name is required")); + return this; + } + + /** + * human-readable name used to identify the service + * + * @param name the value of the name parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public UpdateCallBuilder name(final Optional name) { + this.name = Objects.requireNonNull(name, "name is required"); + return this; + } + + /** + * whether or not the service is active + * + * @param active the value of the active parameter as a {@link boolean} + * @return the call builder instance + */ + public UpdateCallBuilder active(final boolean active) { + this.active = Optional.of(Objects.requireNonNull(active, "active is required")); + return this; + } + + /** + * whether or not the service is active + * + * @param active the value of the active parameter as an {@link Optional} of {@link boolean} + * @return the call builder instance + */ + public UpdateCallBuilder active(final Optional active) { + this.active = Objects.requireNonNull(active, "active is required"); + return this; + } + + /** + * Initiates the API call asynchronously. + * + * @return a {@link CompletionStage} of {@link ServiceUser} + */ + public CompletionStage call() { + return apiClient.sendRequest( + NgrokApiClient.HttpMethod.PATCH, + "/service_users/" + this.id, + Stream.empty(), + Stream.of( + new AbstractMap.SimpleEntry<>("name", this.name.map(Function.identity())), + new AbstractMap.SimpleEntry<>("active", this.active.map(Function.identity())) + ), + Optional.of(ServiceUser.class) + ); + } + + /** + * Initiates the API call and blocks until it returns. + * + * @return {@link ServiceUser} + * @throws InterruptedException if the thread was interrupted during the call + */ + public ServiceUser blockingCall() throws InterruptedException { + try { + return call().toCompletableFuture().get(); + } catch (final ExecutionException e) { + throw e.getCause() instanceof RuntimeException ? (RuntimeException) e.getCause() : new RuntimeException(e.getCause().getMessage(), e.getCause()); + } + } + } + + /** + * Update attributes of a service user by ID. + * + * See also https://ngrok.com/docs/api#api-service-users-update. + * + * @param id the value of the id parameter as a {@link String} + * @return a call builder for this API call + */ + public UpdateCallBuilder update( + final String id + ) { + return new UpdateCallBuilder( + id + ); + } +} diff --git a/src/main/java/com/ngrok/services/SshCertificateAuthorities.java b/src/main/java/com/ngrok/services/SshCertificateAuthorities.java index 2497b6d..5ee0878 100644 --- a/src/main/java/com/ngrok/services/SshCertificateAuthorities.java +++ b/src/main/java/com/ngrok/services/SshCertificateAuthorities.java @@ -312,7 +312,7 @@ public class SshCertificateAuthorities { } /** - * Get detailed information about an SSH Certficate Authority + * Get detailed information about an SSH Certificate Authority * * See also https://ngrok.com/docs/api#api-ssh-certificate-authorities-get. * @@ -333,6 +333,7 @@ public class SshCertificateAuthorities { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -382,6 +383,28 @@ public class SshCertificateAuthorities { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -393,7 +416,8 @@ public class SshCertificateAuthorities { "/ssh_certificate_authorities", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(SshCertificateAuthorityList.class) diff --git a/src/main/java/com/ngrok/services/SshCredentials.java b/src/main/java/com/ngrok/services/SshCredentials.java index 751a426..99d3c60 100644 --- a/src/main/java/com/ngrok/services/SshCredentials.java +++ b/src/main/java/com/ngrok/services/SshCredentials.java @@ -343,6 +343,7 @@ public class SshCredentials { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -392,6 +393,28 @@ public class SshCredentials { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -403,7 +426,8 @@ public class SshCredentials { "/ssh_credentials", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(SshCredentialList.class) diff --git a/src/main/java/com/ngrok/services/SshHostCertificates.java b/src/main/java/com/ngrok/services/SshHostCertificates.java index 6b6836c..c00a9f0 100644 --- a/src/main/java/com/ngrok/services/SshHostCertificates.java +++ b/src/main/java/com/ngrok/services/SshHostCertificates.java @@ -335,7 +335,7 @@ public class SshHostCertificates { } /** - * Get detailed information about an SSH Host Certficate + * Get detailed information about an SSH Host Certificate * * See also https://ngrok.com/docs/api#api-ssh-host-certificates-get. * diff --git a/src/main/java/com/ngrok/services/SshUserCertificates.java b/src/main/java/com/ngrok/services/SshUserCertificates.java index 686e04e..20a0a1d 100644 --- a/src/main/java/com/ngrok/services/SshUserCertificates.java +++ b/src/main/java/com/ngrok/services/SshUserCertificates.java @@ -407,7 +407,7 @@ public class SshUserCertificates { } /** - * Get detailed information about an SSH User Certficate + * Get detailed information about an SSH User Certificate * * See also https://ngrok.com/docs/api#api-ssh-user-certificates-get. * diff --git a/src/main/java/com/ngrok/services/TlsCertificates.java b/src/main/java/com/ngrok/services/TlsCertificates.java index 8cde4e2..7eacc73 100644 --- a/src/main/java/com/ngrok/services/TlsCertificates.java +++ b/src/main/java/com/ngrok/services/TlsCertificates.java @@ -272,6 +272,7 @@ public class TlsCertificates { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -321,6 +322,28 @@ public class TlsCertificates { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -332,7 +355,8 @@ public class TlsCertificates { "/tls_certificates", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(TlsCertificateList.class) diff --git a/src/main/java/com/ngrok/services/TunnelSessions.java b/src/main/java/com/ngrok/services/TunnelSessions.java index 8c7d947..21759f1 100644 --- a/src/main/java/com/ngrok/services/TunnelSessions.java +++ b/src/main/java/com/ngrok/services/TunnelSessions.java @@ -38,6 +38,7 @@ public class TunnelSessions { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -87,6 +88,28 @@ public class TunnelSessions { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -98,7 +121,8 @@ public class TunnelSessions { "/tunnel_sessions", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(TunnelSessionList.class) diff --git a/src/main/java/com/ngrok/services/Vaults.java b/src/main/java/com/ngrok/services/Vaults.java index 4925d6c..7ecabfa 100644 --- a/src/main/java/com/ngrok/services/Vaults.java +++ b/src/main/java/com/ngrok/services/Vaults.java @@ -515,6 +515,7 @@ public class Vaults { public class ListCallBuilder { private Optional beforeId = Optional.empty(); private Optional limit = Optional.empty(); + private Optional filter = Optional.empty(); private ListCallBuilder( ) { @@ -564,6 +565,28 @@ public class Vaults { return this; } + /** + * Sets the filter parameter. + * + * @param filter the value of the filter parameter as a {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final String filter) { + this.filter = Optional.of(Objects.requireNonNull(filter, "filter is required")); + return this; + } + + /** + * Sets (or unsets) the filter parameter. + * + * @param filter the value of the filter parameter as an {@link Optional} of {@link String} + * @return the call builder instance + */ + public ListCallBuilder filter(final Optional filter) { + this.filter = Objects.requireNonNull(filter, "filter is required"); + return this; + } + /** * Initiates the API call asynchronously. * @@ -575,7 +598,8 @@ public class Vaults { "/vaults", Stream.of( new AbstractMap.SimpleEntry<>("before_id", this.beforeId.map(Function.identity())), - new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())) + new AbstractMap.SimpleEntry<>("limit", this.limit.map(Function.identity())), + new AbstractMap.SimpleEntry<>("filter", this.filter.map(Function.identity())) ), Stream.empty(), Optional.of(VaultList.class)