Merge pull request #20 from ngrok/pr/generated-599e56c7a7

Update generated files
This commit is contained in:
Andrew Ryno
2025-05-27 15:10:18 -07:00
committed by GitHub
3 changed files with 101 additions and 108 deletions
+2 -2
View File
@@ -1,7 +1,8 @@
<!-- Code generated for API Clients. DO NOT EDIT. -->
## 0.11.0
* Added support for Cloud Endpoints (currently in private beta).
* Renamed `upstream_proto` to `upstream_protocol` for `endpoint` resources
* Renamed `principal_id` to `principal` for `endpoint` resources
## 0.10.0
* Renamed the Policy Module to the Traffic Policy Module on HTTP Edge Routes, TCP Edges, and TLS Edges, which allows you to configure rules that can be used to influence and control traffic to and from your upstream service. The Traffic Policy itself is now specified as either a JSON or YAML string.
@@ -20,4 +21,3 @@ ENHANCEMENTS:
* Added `owner_id` field to the `api_key`, `credential`, and `ssh_credential` resources. If supplied at credential creation, ownership will be assigned to the specified User or Bot. Only admins may specify an owner other than themselves. Defaults to the authenticated User or Bot.
* Added `failover_backend`, `http_response_backend`, and `tunnel_group_backend` resources. A Failover backend defines failover behavior within a list of referenced backends. Traffic is sent to the first backend in the list. If that backend is offline or no connection can be established, ngrok attempts to connect to the next backend in the list until one is successful.
@@ -69,18 +69,15 @@ public class Endpoint {
@JsonProperty("upstream_url")
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional<String> upstreamUrl;
@JsonProperty("upstream_proto")
@JsonProperty("upstream_protocol")
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional<String> upstreamProto;
private final Optional<String> upstreamProtocol;
@JsonProperty("url")
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional<String> url;
@JsonProperty("principal")
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional<Ref> principal;
@JsonProperty("principal_id")
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional<Ref> principalId;
@JsonProperty("traffic_policy")
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional<String> trafficPolicy;
@@ -96,6 +93,9 @@ public class Endpoint {
@JsonProperty("name")
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final Optional<String> name;
@JsonProperty("pooling_enabled")
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
private final boolean poolingEnabled;
/**
* Creates a new instance of {@link Endpoint}.
@@ -118,15 +118,15 @@ public class Endpoint {
* @param tunnel the tunnel serving requests to this endpoint, if this is an ephemeral endpoint
* @param edge the edge serving requests to this endpoint, if this is an edge endpoint
* @param upstreamUrl the local address the tunnel forwards to
* @param upstreamProto the protocol the agent uses to forward with
* @param upstreamProtocol the protocol the agent uses to forward with
* @param url the url of the endpoint
* @param principal The ID of the owner (bot or user) that owns this endpoint
* @param principalId TODO: deprecate me!
* @param trafficPolicy The traffic policy attached to this endpoint
* @param bindings the bindings associated with this endpoint
* @param tunnelSession The tunnel session of the agent for this endpoint
* @param uri URI of the clep API resource
* @param name user supplied name for the endpoint
* @param poolingEnabled whether the endpoint allows pooling
*/
@JsonCreator
public Endpoint(
@@ -148,15 +148,15 @@ public class Endpoint {
@JsonProperty("tunnel") final Optional<Ref> tunnel,
@JsonProperty("edge") final Optional<Ref> edge,
@JsonProperty("upstream_url") final Optional<String> upstreamUrl,
@JsonProperty("upstream_proto") final Optional<String> upstreamProto,
@JsonProperty("upstream_protocol") final Optional<String> upstreamProtocol,
@JsonProperty("url") final Optional<String> url,
@JsonProperty("principal") final Optional<Ref> principal,
@JsonProperty("principal_id") final Optional<Ref> principalId,
@JsonProperty("traffic_policy") final Optional<String> trafficPolicy,
@JsonProperty("bindings") final Optional<java.util.List<String>> bindings,
@JsonProperty("tunnel_session") final Optional<Ref> tunnelSession,
@JsonProperty("uri") final Optional<java.net.URI> uri,
@JsonProperty("name") final Optional<String> name
@JsonProperty("name") final Optional<String> name,
@JsonProperty("pooling_enabled") final Boolean poolingEnabled
) {
this.id = Objects.requireNonNull(id, "id is required");
this.region = region != null ? region : Optional.empty();
@@ -176,15 +176,15 @@ public class Endpoint {
this.tunnel = tunnel != null ? tunnel : Optional.empty();
this.edge = edge != null ? edge : Optional.empty();
this.upstreamUrl = upstreamUrl != null ? upstreamUrl : Optional.empty();
this.upstreamProto = upstreamProto != null ? upstreamProto : Optional.empty();
this.upstreamProtocol = upstreamProtocol != null ? upstreamProtocol : Optional.empty();
this.url = url != null ? url : Optional.empty();
this.principal = principal != null ? principal : Optional.empty();
this.principalId = principalId != null ? principalId : Optional.empty();
this.trafficPolicy = trafficPolicy != null ? trafficPolicy : Optional.empty();
this.bindings = bindings != null ? bindings : Optional.empty();
this.tunnelSession = tunnelSession != null ? tunnelSession : Optional.empty();
this.uri = uri != null ? uri : Optional.empty();
this.name = name != null ? name : Optional.empty();
this.poolingEnabled = Objects.requireNonNull(poolingEnabled, "poolingEnabled is required");
}
/**
@@ -357,8 +357,8 @@ public class Endpoint {
*
* @return the value of the property as a {@link String} wrapped in an {@link Optional}
*/
public Optional<String> getUpstreamProto() {
return this.upstreamProto;
public Optional<String> getUpstreamProtocol() {
return this.upstreamProtocol;
}
/**
@@ -379,15 +379,6 @@ public class Endpoint {
return this.principal;
}
/**
* TODO: deprecate me!
*
* @return the value of the property as a {@link Ref} wrapped in an {@link Optional}
*/
public Optional<Ref> getPrincipalId() {
return this.principalId;
}
/**
* The traffic policy attached to this endpoint
*
@@ -433,6 +424,15 @@ public class Endpoint {
return this.name;
}
/**
* whether the endpoint allows pooling
*
* @return the value of the property as a {@link boolean}
*/
public boolean getPoolingEnabled() {
return this.poolingEnabled;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
@@ -462,15 +462,15 @@ public class Endpoint {
this.tunnel.equals(other.tunnel)&&
this.edge.equals(other.edge)&&
this.upstreamUrl.equals(other.upstreamUrl)&&
this.upstreamProto.equals(other.upstreamProto)&&
this.upstreamProtocol.equals(other.upstreamProtocol)&&
this.url.equals(other.url)&&
this.principal.equals(other.principal)&&
this.principalId.equals(other.principalId)&&
this.trafficPolicy.equals(other.trafficPolicy)&&
this.bindings.equals(other.bindings)&&
this.tunnelSession.equals(other.tunnelSession)&&
this.uri.equals(other.uri)&&
this.name.equals(other.name);
this.name.equals(other.name)&&
this.poolingEnabled == other.poolingEnabled;
}
@@ -495,15 +495,15 @@ public class Endpoint {
this.tunnel,
this.edge,
this.upstreamUrl,
this.upstreamProto,
this.upstreamProtocol,
this.url,
this.principal,
this.principalId,
this.trafficPolicy,
this.bindings,
this.tunnelSession,
this.uri,
this.name
this.name,
this.poolingEnabled
);
}
@@ -528,15 +528,15 @@ public class Endpoint {
"', tunnel='" + this.tunnel.map(Object::toString).orElse("(null)") +
"', edge='" + this.edge.map(Object::toString).orElse("(null)") +
"', upstreamUrl='" + this.upstreamUrl.orElse("(null)") +
"', upstreamProto='" + this.upstreamProto.orElse("(null)") +
"', upstreamProtocol='" + this.upstreamProtocol.orElse("(null)") +
"', url='" + this.url.orElse("(null)") +
"', principal='" + this.principal.map(Object::toString).orElse("(null)") +
"', principalId='" + this.principalId.map(Object::toString).orElse("(null)") +
"', trafficPolicy='" + this.trafficPolicy.orElse("(null)") +
"', bindings='" + this.bindings.map(Object::toString).orElse("(null)") +
"', tunnelSession='" + this.tunnelSession.map(Object::toString).orElse("(null)") +
"', uri='" + this.uri.map(Object::toString).orElse("(null)") +
"', name='" + this.name.orElse("(null)") +
"', poolingEnabled='" + this.poolingEnabled +
"'}";
}
}
+68 -75
View File
@@ -36,85 +36,22 @@ public class Endpoints {
* A builder object encapsulating state for an unsent Create API call.
*/
public class CreateCallBuilder {
private Optional<String> url = Optional.empty();
private Optional<String> type = Optional.empty();
private Optional<String> trafficPolicy = Optional.empty();
private final String url;
private final String type;
private final String trafficPolicy;
private Optional<String> description = Optional.empty();
private Optional<String> metadata = Optional.empty();
private Optional<java.util.List<String>> bindings = Optional.empty();
private Optional<Boolean> poolingEnabled = Optional.empty();
private CreateCallBuilder(
final String url,
final String type,
final String trafficPolicy
) {
}
/**
* the url of the endpoint
*
* @param url the value of the url parameter as a {@link String}
* @return the call builder instance
*/
public CreateCallBuilder url(final String url) {
this.url = Optional.of(Objects.requireNonNull(url, "url is required"));
return this;
}
/**
* the url of the endpoint
*
* @param url the value of the url parameter as an {@link Optional} of {@link String}
* @return the call builder instance
*/
public CreateCallBuilder url(final Optional<String> url) {
this.url = Objects.requireNonNull(url, "url is required");
return this;
}
/**
* whether the endpoint is <code>ephemeral</code> (served directly by an
* agent-initiated tunnel) or <code>edge</code> (served by an edge) or <code>cloud
* (represents a cloud endpoint)</code>
*
* @param type the value of the type parameter as a {@link String}
* @return the call builder instance
*/
public CreateCallBuilder type(final String type) {
this.type = Optional.of(Objects.requireNonNull(type, "type is required"));
return this;
}
/**
* whether the endpoint is <code>ephemeral</code> (served directly by an
* agent-initiated tunnel) or <code>edge</code> (served by an edge) or <code>cloud
* (represents a cloud endpoint)</code>
*
* @param type the value of the type parameter as an {@link Optional} of {@link String}
* @return the call builder instance
*/
public CreateCallBuilder type(final Optional<String> type) {
this.type = Objects.requireNonNull(type, "type is required");
return this;
}
/**
* The traffic policy attached to this endpoint
*
* @param trafficPolicy the value of the traffic_policy parameter as a {@link String}
* @return the call builder instance
*/
public CreateCallBuilder trafficPolicy(final String trafficPolicy) {
this.trafficPolicy = Optional.of(Objects.requireNonNull(trafficPolicy, "trafficPolicy is required"));
return this;
}
/**
* The traffic policy attached to this endpoint
*
* @param trafficPolicy the value of the traffic_policy parameter as an {@link Optional} of {@link String}
* @return the call builder instance
*/
public CreateCallBuilder trafficPolicy(final Optional<String> trafficPolicy) {
this.trafficPolicy = Objects.requireNonNull(trafficPolicy, "trafficPolicy is required");
return this;
}
/**
@@ -183,6 +120,28 @@ public class Endpoints {
return this;
}
/**
* Sets the <code>pooling_enabled</code> parameter.
*
* @param poolingEnabled the value of the pooling_enabled parameter as a {@link boolean}
* @return the call builder instance
*/
public CreateCallBuilder poolingEnabled(final boolean poolingEnabled) {
this.poolingEnabled = Optional.of(Objects.requireNonNull(poolingEnabled, "poolingEnabled is required"));
return this;
}
/**
* Sets (or unsets) the <code>pooling_enabled</code> parameter.
*
* @param poolingEnabled the value of the pooling_enabled parameter as an {@link Optional} of {@link boolean}
* @return the call builder instance
*/
public CreateCallBuilder poolingEnabled(final Optional<Boolean> poolingEnabled) {
this.poolingEnabled = Objects.requireNonNull(poolingEnabled, "poolingEnabled is required");
return this;
}
/**
* Initiates the API call asynchronously.
*
@@ -194,12 +153,13 @@ public class Endpoints {
"/endpoints",
Stream.empty(),
Stream.of(
new AbstractMap.SimpleEntry<>("url", this.url.map(Function.identity())),
new AbstractMap.SimpleEntry<>("type", this.type.map(Function.identity())),
new AbstractMap.SimpleEntry<>("traffic_policy", this.trafficPolicy.map(Function.identity())),
new AbstractMap.SimpleEntry<>("url", Optional.of(this.url)),
new AbstractMap.SimpleEntry<>("type", Optional.of(this.type)),
new AbstractMap.SimpleEntry<>("traffic_policy", Optional.of(this.trafficPolicy)),
new AbstractMap.SimpleEntry<>("description", this.description.map(Function.identity())),
new AbstractMap.SimpleEntry<>("metadata", this.metadata.map(Function.identity())),
new AbstractMap.SimpleEntry<>("bindings", Optional.of(this.bindings).filter(bindings -> !bindings.isEmpty()).map(Function.identity()))
new AbstractMap.SimpleEntry<>("bindings", Optional.of(this.bindings).filter(bindings -> !bindings.isEmpty()).map(Function.identity())),
new AbstractMap.SimpleEntry<>("pooling_enabled", this.poolingEnabled.map(Function.identity()))
),
Optional.of(Endpoint.class)
);
@@ -225,11 +185,20 @@ public class Endpoints {
*
* See also <a href="https://ngrok.com/docs/api#api-endpoints-create">https://ngrok.com/docs/api#api-endpoints-create</a>.
*
* @param url the url of the endpoint
* @param type Type of endpoint. Only &#39;cloud&#39; is currently supported (represents a cloud endpoint). Defaults to &#39;cloud&#39; if not specified.
* @param trafficPolicy The traffic policy attached to this endpoint
* @return a call builder for this API call
*/
public CreateCallBuilder create(
final String url,
final String type,
final String trafficPolicy
) {
return new CreateCallBuilder(
url,
type,
trafficPolicy
);
}
@@ -402,6 +371,7 @@ public class Endpoints {
private Optional<String> description = Optional.empty();
private Optional<String> metadata = Optional.empty();
private Optional<java.util.List<String>> bindings = Optional.empty();
private Optional<Boolean> poolingEnabled = Optional.empty();
private UpdateCallBuilder(
final String id
@@ -519,6 +489,28 @@ public class Endpoints {
return this;
}
/**
* Sets the <code>pooling_enabled</code> parameter.
*
* @param poolingEnabled the value of the pooling_enabled parameter as a {@link boolean}
* @return the call builder instance
*/
public UpdateCallBuilder poolingEnabled(final boolean poolingEnabled) {
this.poolingEnabled = Optional.of(Objects.requireNonNull(poolingEnabled, "poolingEnabled is required"));
return this;
}
/**
* Sets (or unsets) the <code>pooling_enabled</code> parameter.
*
* @param poolingEnabled the value of the pooling_enabled parameter as an {@link Optional} of {@link boolean}
* @return the call builder instance
*/
public UpdateCallBuilder poolingEnabled(final Optional<Boolean> poolingEnabled) {
this.poolingEnabled = Objects.requireNonNull(poolingEnabled, "poolingEnabled is required");
return this;
}
/**
* Initiates the API call asynchronously.
*
@@ -534,7 +526,8 @@ public class Endpoints {
new AbstractMap.SimpleEntry<>("traffic_policy", this.trafficPolicy.map(Function.identity())),
new AbstractMap.SimpleEntry<>("description", this.description.map(Function.identity())),
new AbstractMap.SimpleEntry<>("metadata", this.metadata.map(Function.identity())),
new AbstractMap.SimpleEntry<>("bindings", Optional.of(this.bindings).filter(bindings -> !bindings.isEmpty()).map(Function.identity()))
new AbstractMap.SimpleEntry<>("bindings", Optional.of(this.bindings).filter(bindings -> !bindings.isEmpty()).map(Function.identity())),
new AbstractMap.SimpleEntry<>("pooling_enabled", this.poolingEnabled.map(Function.identity()))
),
Optional.of(Endpoint.class)
);