mirror of
https://github.com/ngrok/ngrok-api-java.git
synced 2026-05-17 16:50:39 +00:00
Update generated files
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
/* 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 EndpointTrafficPolicy} resource.
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class EndpointTrafficPolicy {
|
||||
/**
|
||||
* Builder class for {@link EndpointTrafficPolicy}.
|
||||
*/
|
||||
public static class Builder {
|
||||
private Optional<Boolean> enabled = Optional.empty();
|
||||
private Optional<String> value = Optional.empty();
|
||||
|
||||
private Builder(
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>true</code> if the module will be applied to traffic, <code>false</code>
|
||||
* to disable. default <code>true</code> if unspecified
|
||||
*
|
||||
* @param enabled the value of the <code>enabled</code> 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>true</code> if the module will be applied to traffic, <code>false</code>
|
||||
* to disable. default <code>true</code> if unspecified
|
||||
*
|
||||
* @param enabled the value of the <code>enabled</code> parameter as a {@link boolean}, wrapped in an {@link Optional}
|
||||
* @return this builder instance
|
||||
*/
|
||||
public Builder enabled(final Optional<Boolean> enabled) {
|
||||
this.enabled = Objects.requireNonNull(enabled, "enabled is required");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* the traffic policy that should be applied to the traffic on your endpoint.
|
||||
*
|
||||
* @param value the value of the <code>value</code> parameter as a {@link String}
|
||||
* @return this builder instance
|
||||
*/
|
||||
public Builder value(final String value) {
|
||||
this.value = Optional.of(Objects.requireNonNull(value, "value is required"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* the traffic policy that should be applied to the traffic on your endpoint.
|
||||
*
|
||||
* @param value the value of the <code>value</code> parameter as a {@link String}, wrapped in an {@link Optional}
|
||||
* @return this builder instance
|
||||
*/
|
||||
public Builder value(final Optional<String> value) {
|
||||
this.value = Objects.requireNonNull(value, "value is required");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the {@link EndpointTrafficPolicy} instance.
|
||||
*
|
||||
* @return a new {@link EndpointTrafficPolicy}
|
||||
*/
|
||||
public EndpointTrafficPolicy build() {
|
||||
return new EndpointTrafficPolicy(
|
||||
this.enabled,
|
||||
this.value.orElse("")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new builder for the {@link EndpointTrafficPolicy} type.
|
||||
*
|
||||
* @return a new {@link Builder}
|
||||
*/
|
||||
public static Builder newBuilder(
|
||||
) {
|
||||
return new Builder (
|
||||
);
|
||||
}
|
||||
|
||||
@JsonProperty("enabled")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final Optional<Boolean> enabled;
|
||||
@JsonProperty("value")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final String value;
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@link EndpointTrafficPolicy}.
|
||||
*
|
||||
* @param enabled <code>true</code> if the module will be applied to traffic, <code>false</code> to disable. default <code>true</code> if unspecified
|
||||
* @param value the traffic policy that should be applied to the traffic on your endpoint.
|
||||
*/
|
||||
@JsonCreator
|
||||
private EndpointTrafficPolicy(
|
||||
@JsonProperty("enabled") final Optional<Boolean> enabled,
|
||||
@JsonProperty("value") final String value
|
||||
) {
|
||||
this.enabled = enabled != null ? enabled : Optional.empty();
|
||||
this.value = Objects.requireNonNull(value, "value is required");
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>true</code> if the module will be applied to traffic, <code>false</code>
|
||||
* to disable. default <code>true</code> if unspecified
|
||||
*
|
||||
* @return the value of the property as a {@link boolean} wrapped in an {@link Optional}
|
||||
*/
|
||||
public Optional<Boolean> getEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* the traffic policy that should be applied to the traffic on your endpoint.
|
||||
*
|
||||
* @return the value of the property as a {@link String}
|
||||
*/
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final EndpointTrafficPolicy other = (EndpointTrafficPolicy) o;
|
||||
return
|
||||
this.enabled.equals(other.enabled)&&
|
||||
this.value.equals(other.value);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(
|
||||
this.enabled,
|
||||
this.value
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EndpointTrafficPolicy{" +
|
||||
"enabled='" + this.enabled.map(Object::toString).orElse("(null)") +
|
||||
"', value='" + this.value +
|
||||
"'}";
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ public class EventTarget {
|
||||
private Optional<EventTargetKinesis> kinesis = Optional.empty();
|
||||
private Optional<EventTargetCloudwatchLogs> cloudwatchLogs = Optional.empty();
|
||||
private Optional<EventTargetDatadog> datadog = Optional.empty();
|
||||
private Optional<EventTargetAzureLogsIngestion> azureLogsIngestion = Optional.empty();
|
||||
|
||||
private Builder(
|
||||
) {
|
||||
@@ -116,6 +117,28 @@ public class EventTarget {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the azure_logs_ingestion property
|
||||
*
|
||||
* @param azureLogsIngestion the value of the <code>azure_logs_ingestion</code> parameter as a {@link EventTargetAzureLogsIngestion}
|
||||
* @return this builder instance
|
||||
*/
|
||||
public Builder azureLogsIngestion(final EventTargetAzureLogsIngestion azureLogsIngestion) {
|
||||
this.azureLogsIngestion = Optional.of(Objects.requireNonNull(azureLogsIngestion, "azureLogsIngestion is required"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the azure_logs_ingestion property
|
||||
*
|
||||
* @param azureLogsIngestion the value of the <code>azure_logs_ingestion</code> parameter as a {@link EventTargetAzureLogsIngestion}, wrapped in an {@link Optional}
|
||||
* @return this builder instance
|
||||
*/
|
||||
public Builder azureLogsIngestion(final Optional<EventTargetAzureLogsIngestion> azureLogsIngestion) {
|
||||
this.azureLogsIngestion = Objects.requireNonNull(azureLogsIngestion, "azureLogsIngestion is required");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the {@link EventTarget} instance.
|
||||
*
|
||||
@@ -126,7 +149,8 @@ public class EventTarget {
|
||||
this.firehose,
|
||||
this.kinesis,
|
||||
this.cloudwatchLogs,
|
||||
this.datadog
|
||||
this.datadog,
|
||||
this.azureLogsIngestion
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -154,6 +178,9 @@ public class EventTarget {
|
||||
@JsonProperty("datadog")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final Optional<EventTargetDatadog> datadog;
|
||||
@JsonProperty("azure_logs_ingestion")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final Optional<EventTargetAzureLogsIngestion> azureLogsIngestion;
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@link EventTarget}.
|
||||
@@ -162,18 +189,21 @@ public class EventTarget {
|
||||
* @param kinesis Configuration used to send events to Amazon Kinesis.
|
||||
* @param cloudwatchLogs Configuration used to send events to Amazon CloudWatch Logs.
|
||||
* @param datadog Configuration used to send events to Datadog.
|
||||
* @param azureLogsIngestion the value of the <code>azure_logs_ingestion</code> parameter as a {@link EventTargetAzureLogsIngestion}
|
||||
*/
|
||||
@JsonCreator
|
||||
private EventTarget(
|
||||
@JsonProperty("firehose") final Optional<EventTargetFirehose> firehose,
|
||||
@JsonProperty("kinesis") final Optional<EventTargetKinesis> kinesis,
|
||||
@JsonProperty("cloudwatch_logs") final Optional<EventTargetCloudwatchLogs> cloudwatchLogs,
|
||||
@JsonProperty("datadog") final Optional<EventTargetDatadog> datadog
|
||||
@JsonProperty("datadog") final Optional<EventTargetDatadog> datadog,
|
||||
@JsonProperty("azure_logs_ingestion") final Optional<EventTargetAzureLogsIngestion> azureLogsIngestion
|
||||
) {
|
||||
this.firehose = firehose != null ? firehose : Optional.empty();
|
||||
this.kinesis = kinesis != null ? kinesis : Optional.empty();
|
||||
this.cloudwatchLogs = cloudwatchLogs != null ? cloudwatchLogs : Optional.empty();
|
||||
this.datadog = datadog != null ? datadog : Optional.empty();
|
||||
this.azureLogsIngestion = azureLogsIngestion != null ? azureLogsIngestion : Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,6 +242,15 @@ public class EventTarget {
|
||||
return this.datadog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the value of the <code>azureLogsIngestion</code> property.
|
||||
*
|
||||
* @return the value of the property as a {@link EventTargetAzureLogsIngestion} wrapped in an {@link Optional}
|
||||
*/
|
||||
public Optional<EventTargetAzureLogsIngestion> getAzureLogsIngestion() {
|
||||
return this.azureLogsIngestion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) {
|
||||
@@ -226,7 +265,8 @@ public class EventTarget {
|
||||
this.firehose.equals(other.firehose)&&
|
||||
this.kinesis.equals(other.kinesis)&&
|
||||
this.cloudwatchLogs.equals(other.cloudwatchLogs)&&
|
||||
this.datadog.equals(other.datadog);
|
||||
this.datadog.equals(other.datadog)&&
|
||||
this.azureLogsIngestion.equals(other.azureLogsIngestion);
|
||||
|
||||
}
|
||||
|
||||
@@ -236,7 +276,8 @@ public class EventTarget {
|
||||
this.firehose,
|
||||
this.kinesis,
|
||||
this.cloudwatchLogs,
|
||||
this.datadog
|
||||
this.datadog,
|
||||
this.azureLogsIngestion
|
||||
);
|
||||
}
|
||||
|
||||
@@ -247,6 +288,7 @@ public class EventTarget {
|
||||
"', kinesis='" + this.kinesis.map(Object::toString).orElse("(null)") +
|
||||
"', cloudwatchLogs='" + this.cloudwatchLogs.map(Object::toString).orElse("(null)") +
|
||||
"', datadog='" + this.datadog.map(Object::toString).orElse("(null)") +
|
||||
"', azureLogsIngestion='" + this.azureLogsIngestion.map(Object::toString).orElse("(null)") +
|
||||
"'}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
/* 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 EventTargetAzureLogsIngestion} resource.
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class EventTargetAzureLogsIngestion {
|
||||
/**
|
||||
* Builder class for {@link EventTargetAzureLogsIngestion}.
|
||||
*/
|
||||
public static class Builder {
|
||||
private final String tenantId;
|
||||
private final String clientId;
|
||||
private final String clientSecret;
|
||||
private final String logsIngestionUri;
|
||||
private final String dataCollectionRuleId;
|
||||
private final String dataCollectionStreamName;
|
||||
|
||||
private Builder(
|
||||
final String tenantId,
|
||||
final String clientId,
|
||||
final String clientSecret,
|
||||
final String logsIngestionUri,
|
||||
final String dataCollectionRuleId,
|
||||
final String dataCollectionStreamName
|
||||
) {
|
||||
this.tenantId = Objects.requireNonNull(tenantId, "tenantId is required");
|
||||
this.clientId = Objects.requireNonNull(clientId, "clientId is required");
|
||||
this.clientSecret = Objects.requireNonNull(clientSecret, "clientSecret is required");
|
||||
this.logsIngestionUri = Objects.requireNonNull(logsIngestionUri, "logsIngestionUri is required");
|
||||
this.dataCollectionRuleId = Objects.requireNonNull(dataCollectionRuleId, "dataCollectionRuleId is required");
|
||||
this.dataCollectionStreamName = Objects.requireNonNull(dataCollectionStreamName, "dataCollectionStreamName is required");
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the {@link EventTargetAzureLogsIngestion} instance.
|
||||
*
|
||||
* @return a new {@link EventTargetAzureLogsIngestion}
|
||||
*/
|
||||
public EventTargetAzureLogsIngestion build() {
|
||||
return new EventTargetAzureLogsIngestion(
|
||||
this.tenantId,
|
||||
this.clientId,
|
||||
this.clientSecret,
|
||||
this.logsIngestionUri,
|
||||
this.dataCollectionRuleId,
|
||||
this.dataCollectionStreamName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new builder for the {@link EventTargetAzureLogsIngestion} type.
|
||||
*
|
||||
* @param tenantId Tenant ID for the Azure account
|
||||
* @param clientId Client ID for the application client
|
||||
* @param clientSecret Client Secret for the application client
|
||||
* @param logsIngestionUri Data collection endpoint logs ingestion URI
|
||||
* @param dataCollectionRuleId Data collection rule immutable ID
|
||||
* @param dataCollectionStreamName Data collection stream name to use as destination, located instide the DCR
|
||||
* @return a new {@link Builder}
|
||||
*/
|
||||
public static Builder newBuilder(
|
||||
final String tenantId,
|
||||
final String clientId,
|
||||
final String clientSecret,
|
||||
final String logsIngestionUri,
|
||||
final String dataCollectionRuleId,
|
||||
final String dataCollectionStreamName
|
||||
) {
|
||||
return new Builder (
|
||||
tenantId,
|
||||
clientId,
|
||||
clientSecret,
|
||||
logsIngestionUri,
|
||||
dataCollectionRuleId,
|
||||
dataCollectionStreamName
|
||||
);
|
||||
}
|
||||
|
||||
@JsonProperty("tenant_id")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final String tenantId;
|
||||
@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("logs_ingestion_uri")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final String logsIngestionUri;
|
||||
@JsonProperty("data_collection_rule_id")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final String dataCollectionRuleId;
|
||||
@JsonProperty("data_collection_stream_name")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final String dataCollectionStreamName;
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@link EventTargetAzureLogsIngestion}.
|
||||
*
|
||||
* @param tenantId Tenant ID for the Azure account
|
||||
* @param clientId Client ID for the application client
|
||||
* @param clientSecret Client Secret for the application client
|
||||
* @param logsIngestionUri Data collection endpoint logs ingestion URI
|
||||
* @param dataCollectionRuleId Data collection rule immutable ID
|
||||
* @param dataCollectionStreamName Data collection stream name to use as destination, located instide the DCR
|
||||
*/
|
||||
@JsonCreator
|
||||
private EventTargetAzureLogsIngestion(
|
||||
@JsonProperty("tenant_id") final String tenantId,
|
||||
@JsonProperty("client_id") final String clientId,
|
||||
@JsonProperty("client_secret") final String clientSecret,
|
||||
@JsonProperty("logs_ingestion_uri") final String logsIngestionUri,
|
||||
@JsonProperty("data_collection_rule_id") final String dataCollectionRuleId,
|
||||
@JsonProperty("data_collection_stream_name") final String dataCollectionStreamName
|
||||
) {
|
||||
this.tenantId = Objects.requireNonNull(tenantId, "tenantId is required");
|
||||
this.clientId = Objects.requireNonNull(clientId, "clientId is required");
|
||||
this.clientSecret = Objects.requireNonNull(clientSecret, "clientSecret is required");
|
||||
this.logsIngestionUri = Objects.requireNonNull(logsIngestionUri, "logsIngestionUri is required");
|
||||
this.dataCollectionRuleId = Objects.requireNonNull(dataCollectionRuleId, "dataCollectionRuleId is required");
|
||||
this.dataCollectionStreamName = Objects.requireNonNull(dataCollectionStreamName, "dataCollectionStreamName is required");
|
||||
}
|
||||
|
||||
/**
|
||||
* Tenant ID for the Azure account
|
||||
*
|
||||
* @return the value of the property as a {@link String}
|
||||
*/
|
||||
public String getTenantId() {
|
||||
return this.tenantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Client ID for the application client
|
||||
*
|
||||
* @return the value of the property as a {@link String}
|
||||
*/
|
||||
public String getClientId() {
|
||||
return this.clientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Client Secret for the application client
|
||||
*
|
||||
* @return the value of the property as a {@link String}
|
||||
*/
|
||||
public String getClientSecret() {
|
||||
return this.clientSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data collection endpoint logs ingestion URI
|
||||
*
|
||||
* @return the value of the property as a {@link String}
|
||||
*/
|
||||
public String getLogsIngestionUri() {
|
||||
return this.logsIngestionUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data collection rule immutable ID
|
||||
*
|
||||
* @return the value of the property as a {@link String}
|
||||
*/
|
||||
public String getDataCollectionRuleId() {
|
||||
return this.dataCollectionRuleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data collection stream name to use as destination, located instide the DCR
|
||||
*
|
||||
* @return the value of the property as a {@link String}
|
||||
*/
|
||||
public String getDataCollectionStreamName() {
|
||||
return this.dataCollectionStreamName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final EventTargetAzureLogsIngestion other = (EventTargetAzureLogsIngestion) o;
|
||||
return
|
||||
this.tenantId.equals(other.tenantId)&&
|
||||
this.clientId.equals(other.clientId)&&
|
||||
this.clientSecret.equals(other.clientSecret)&&
|
||||
this.logsIngestionUri.equals(other.logsIngestionUri)&&
|
||||
this.dataCollectionRuleId.equals(other.dataCollectionRuleId)&&
|
||||
this.dataCollectionStreamName.equals(other.dataCollectionStreamName);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(
|
||||
this.tenantId,
|
||||
this.clientId,
|
||||
this.clientSecret,
|
||||
this.logsIngestionUri,
|
||||
this.dataCollectionRuleId,
|
||||
this.dataCollectionStreamName
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EventTargetAzureLogsIngestion{" +
|
||||
"tenantId='" + this.tenantId +
|
||||
"', clientId='" + this.clientId +
|
||||
"', clientSecret='" + this.clientSecret +
|
||||
"', logsIngestionUri='" + this.logsIngestionUri +
|
||||
"', dataCollectionRuleId='" + this.dataCollectionRuleId +
|
||||
"', dataCollectionStreamName='" + this.dataCollectionStreamName +
|
||||
"'}";
|
||||
}
|
||||
}
|
||||
@@ -75,9 +75,9 @@ public class HttpsEdgeRoute {
|
||||
@JsonProperty("user_agent_filter")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final Optional<EndpointUserAgentFilter> userAgentFilter;
|
||||
@JsonProperty("policy")
|
||||
@JsonProperty("traffic_policy")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final Optional<EndpointPolicy> policy;
|
||||
private final Optional<EndpointTrafficPolicy> trafficPolicy;
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@link HttpsEdgeRoute}.
|
||||
@@ -102,7 +102,7 @@ public class HttpsEdgeRoute {
|
||||
* @param oidc oidc module configuration or <code>null</code>
|
||||
* @param websocketTcpConverter websocket to tcp adapter configuration or <code>null</code>
|
||||
* @param userAgentFilter the value of the <code>user_agent_filter</code> parameter as a {@link EndpointUserAgentFilter}
|
||||
* @param policy the traffic policy associated with this edge or null
|
||||
* @param trafficPolicy the traffic policy associated with this edge or null
|
||||
*/
|
||||
@JsonCreator
|
||||
public HttpsEdgeRoute(
|
||||
@@ -126,7 +126,7 @@ public class HttpsEdgeRoute {
|
||||
@JsonProperty("oidc") final Optional<EndpointOidc> oidc,
|
||||
@JsonProperty("websocket_tcp_converter") final Optional<EndpointWebsocketTcpConverter> websocketTcpConverter,
|
||||
@JsonProperty("user_agent_filter") final Optional<EndpointUserAgentFilter> userAgentFilter,
|
||||
@JsonProperty("policy") final Optional<EndpointPolicy> policy
|
||||
@JsonProperty("traffic_policy") final Optional<EndpointTrafficPolicy> trafficPolicy
|
||||
) {
|
||||
this.edgeId = Objects.requireNonNull(edgeId, "edgeId is required");
|
||||
this.id = Objects.requireNonNull(id, "id is required");
|
||||
@@ -148,7 +148,7 @@ public class HttpsEdgeRoute {
|
||||
this.oidc = oidc != null ? oidc : Optional.empty();
|
||||
this.websocketTcpConverter = websocketTcpConverter != null ? websocketTcpConverter : Optional.empty();
|
||||
this.userAgentFilter = userAgentFilter != null ? userAgentFilter : Optional.empty();
|
||||
this.policy = policy != null ? policy : Optional.empty();
|
||||
this.trafficPolicy = trafficPolicy != null ? trafficPolicy : Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -338,10 +338,10 @@ public class HttpsEdgeRoute {
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @return the value of the property as a {@link EndpointPolicy} wrapped in an {@link Optional}
|
||||
* @return the value of the property as a {@link EndpointTrafficPolicy} wrapped in an {@link Optional}
|
||||
*/
|
||||
public Optional<EndpointPolicy> getPolicy() {
|
||||
return this.policy;
|
||||
public Optional<EndpointTrafficPolicy> getTrafficPolicy() {
|
||||
return this.trafficPolicy;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -375,7 +375,7 @@ public class HttpsEdgeRoute {
|
||||
this.oidc.equals(other.oidc)&&
|
||||
this.websocketTcpConverter.equals(other.websocketTcpConverter)&&
|
||||
this.userAgentFilter.equals(other.userAgentFilter)&&
|
||||
this.policy.equals(other.policy);
|
||||
this.trafficPolicy.equals(other.trafficPolicy);
|
||||
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ public class HttpsEdgeRoute {
|
||||
this.oidc,
|
||||
this.websocketTcpConverter,
|
||||
this.userAgentFilter,
|
||||
this.policy
|
||||
this.trafficPolicy
|
||||
);
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ public class HttpsEdgeRoute {
|
||||
"', oidc='" + this.oidc.map(Object::toString).orElse("(null)") +
|
||||
"', websocketTcpConverter='" + this.websocketTcpConverter.map(Object::toString).orElse("(null)") +
|
||||
"', userAgentFilter='" + this.userAgentFilter.map(Object::toString).orElse("(null)") +
|
||||
"', policy='" + this.policy.map(Object::toString).orElse("(null)") +
|
||||
"', trafficPolicy='" + this.trafficPolicy.map(Object::toString).orElse("(null)") +
|
||||
"'}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ public class TcpEdge {
|
||||
@JsonProperty("ip_restriction")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final Optional<EndpointIpPolicy> ipRestriction;
|
||||
@JsonProperty("policy")
|
||||
@JsonProperty("traffic_policy")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final Optional<EndpointPolicy> policy;
|
||||
private final Optional<EndpointTrafficPolicy> trafficPolicy;
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@link TcpEdge}.
|
||||
@@ -54,7 +54,7 @@ public class TcpEdge {
|
||||
* @param hostports hostports served by this edge
|
||||
* @param backend edge modules
|
||||
* @param ipRestriction the value of the <code>ip_restriction</code> parameter as a {@link EndpointIpPolicy}
|
||||
* @param policy the traffic policy associated with this edge or null
|
||||
* @param trafficPolicy the traffic policy associated with this edge or null
|
||||
*/
|
||||
@JsonCreator
|
||||
public TcpEdge(
|
||||
@@ -66,7 +66,7 @@ public class TcpEdge {
|
||||
@JsonProperty("hostports") final Optional<java.util.List<String>> hostports,
|
||||
@JsonProperty("backend") final Optional<EndpointBackend> backend,
|
||||
@JsonProperty("ip_restriction") final Optional<EndpointIpPolicy> ipRestriction,
|
||||
@JsonProperty("policy") final Optional<EndpointPolicy> policy
|
||||
@JsonProperty("traffic_policy") final Optional<EndpointTrafficPolicy> trafficPolicy
|
||||
) {
|
||||
this.id = Objects.requireNonNull(id, "id is required");
|
||||
this.description = description != null ? description : Optional.empty();
|
||||
@@ -76,7 +76,7 @@ public class TcpEdge {
|
||||
this.hostports = hostports != null ? hostports : Optional.empty();
|
||||
this.backend = backend != null ? backend : Optional.empty();
|
||||
this.ipRestriction = ipRestriction != null ? ipRestriction : Optional.empty();
|
||||
this.policy = policy != null ? policy : Optional.empty();
|
||||
this.trafficPolicy = trafficPolicy != null ? trafficPolicy : Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,10 +156,10 @@ public class TcpEdge {
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @return the value of the property as a {@link EndpointPolicy} wrapped in an {@link Optional}
|
||||
* @return the value of the property as a {@link EndpointTrafficPolicy} wrapped in an {@link Optional}
|
||||
*/
|
||||
public Optional<EndpointPolicy> getPolicy() {
|
||||
return this.policy;
|
||||
public Optional<EndpointTrafficPolicy> getTrafficPolicy() {
|
||||
return this.trafficPolicy;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -181,7 +181,7 @@ public class TcpEdge {
|
||||
this.hostports.equals(other.hostports)&&
|
||||
this.backend.equals(other.backend)&&
|
||||
this.ipRestriction.equals(other.ipRestriction)&&
|
||||
this.policy.equals(other.policy);
|
||||
this.trafficPolicy.equals(other.trafficPolicy);
|
||||
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class TcpEdge {
|
||||
this.hostports,
|
||||
this.backend,
|
||||
this.ipRestriction,
|
||||
this.policy
|
||||
this.trafficPolicy
|
||||
);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ public class TcpEdge {
|
||||
"', hostports='" + this.hostports.map(Object::toString).orElse("(null)") +
|
||||
"', backend='" + this.backend.map(Object::toString).orElse("(null)") +
|
||||
"', ipRestriction='" + this.ipRestriction.map(Object::toString).orElse("(null)") +
|
||||
"', policy='" + this.policy.map(Object::toString).orElse("(null)") +
|
||||
"', trafficPolicy='" + this.trafficPolicy.map(Object::toString).orElse("(null)") +
|
||||
"'}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ public class TlsEdge {
|
||||
@JsonProperty("tls_termination")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final Optional<EndpointTlsTermination> tlsTermination;
|
||||
@JsonProperty("policy")
|
||||
@JsonProperty("traffic_policy")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
|
||||
private final Optional<EndpointPolicy> policy;
|
||||
private final Optional<EndpointTrafficPolicy> trafficPolicy;
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@link TlsEdge}.
|
||||
@@ -62,7 +62,7 @@ public class TlsEdge {
|
||||
* @param ipRestriction the value of the <code>ip_restriction</code> parameter as a {@link EndpointIpPolicy}
|
||||
* @param mutualTls the value of the <code>mutual_tls</code> parameter as a {@link EndpointMutualTls}
|
||||
* @param tlsTermination the value of the <code>tls_termination</code> parameter as a {@link EndpointTlsTermination}
|
||||
* @param policy the traffic policy associated with this edge or null
|
||||
* @param trafficPolicy the traffic policy associated with this edge or null
|
||||
*/
|
||||
@JsonCreator
|
||||
public TlsEdge(
|
||||
@@ -76,7 +76,7 @@ public class TlsEdge {
|
||||
@JsonProperty("ip_restriction") final Optional<EndpointIpPolicy> ipRestriction,
|
||||
@JsonProperty("mutual_tls") final Optional<EndpointMutualTls> mutualTls,
|
||||
@JsonProperty("tls_termination") final Optional<EndpointTlsTermination> tlsTermination,
|
||||
@JsonProperty("policy") final Optional<EndpointPolicy> policy
|
||||
@JsonProperty("traffic_policy") final Optional<EndpointTrafficPolicy> trafficPolicy
|
||||
) {
|
||||
this.id = Objects.requireNonNull(id, "id is required");
|
||||
this.description = description != null ? description : Optional.empty();
|
||||
@@ -88,7 +88,7 @@ public class TlsEdge {
|
||||
this.ipRestriction = ipRestriction != null ? ipRestriction : Optional.empty();
|
||||
this.mutualTls = mutualTls != null ? mutualTls : Optional.empty();
|
||||
this.tlsTermination = tlsTermination != null ? tlsTermination : Optional.empty();
|
||||
this.policy = policy != null ? policy : Optional.empty();
|
||||
this.trafficPolicy = trafficPolicy != null ? trafficPolicy : Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,10 +186,10 @@ public class TlsEdge {
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @return the value of the property as a {@link EndpointPolicy} wrapped in an {@link Optional}
|
||||
* @return the value of the property as a {@link EndpointTrafficPolicy} wrapped in an {@link Optional}
|
||||
*/
|
||||
public Optional<EndpointPolicy> getPolicy() {
|
||||
return this.policy;
|
||||
public Optional<EndpointTrafficPolicy> getTrafficPolicy() {
|
||||
return this.trafficPolicy;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -213,7 +213,7 @@ public class TlsEdge {
|
||||
this.ipRestriction.equals(other.ipRestriction)&&
|
||||
this.mutualTls.equals(other.mutualTls)&&
|
||||
this.tlsTermination.equals(other.tlsTermination)&&
|
||||
this.policy.equals(other.policy);
|
||||
this.trafficPolicy.equals(other.trafficPolicy);
|
||||
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ public class TlsEdge {
|
||||
this.ipRestriction,
|
||||
this.mutualTls,
|
||||
this.tlsTermination,
|
||||
this.policy
|
||||
this.trafficPolicy
|
||||
);
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ public class TlsEdge {
|
||||
"', ipRestriction='" + this.ipRestriction.map(Object::toString).orElse("(null)") +
|
||||
"', mutualTls='" + this.mutualTls.map(Object::toString).orElse("(null)") +
|
||||
"', tlsTermination='" + this.tlsTermination.map(Object::toString).orElse("(null)") +
|
||||
"', policy='" + this.policy.map(Object::toString).orElse("(null)") +
|
||||
"', trafficPolicy='" + this.trafficPolicy.map(Object::toString).orElse("(null)") +
|
||||
"'}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
/* 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 EdgeRouteTrafficPolicyModule}.
|
||||
*
|
||||
* See also <a href="https://ngrok.com/docs/api#api-edge-route-traffic-policy-module">https://ngrok.com/docs/api#api-edge-route-traffic-policy-module</a>.
|
||||
*/
|
||||
public class EdgeRouteTrafficPolicyModule {
|
||||
private final NgrokApiClient apiClient;
|
||||
|
||||
/**
|
||||
* Creates a new sub-client for EdgeRouteTrafficPolicyModule.
|
||||
*
|
||||
* @param apiClient an instance of {@link com.ngrok.NgrokApiClient}
|
||||
*/
|
||||
public EdgeRouteTrafficPolicyModule(final NgrokApiClient apiClient) {
|
||||
this.apiClient = Objects.requireNonNull(apiClient, "apiClient is required");
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder object encapsulating state for an unsent Replace API call.
|
||||
*/
|
||||
public class ReplaceCallBuilder {
|
||||
private final String edgeId;
|
||||
private final String id;
|
||||
private Optional<EndpointTrafficPolicy> module = Optional.empty();
|
||||
|
||||
private ReplaceCallBuilder(
|
||||
final String edgeId,
|
||||
final String id
|
||||
) {
|
||||
this.edgeId = Objects.requireNonNull(edgeId, "edgeId is required");
|
||||
this.id = Objects.requireNonNull(id, "id is required");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the <code>module</code> parameter.
|
||||
*
|
||||
* @param module the value of the module parameter as a {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public ReplaceCallBuilder module(final EndpointTrafficPolicy module) {
|
||||
this.module = Optional.of(Objects.requireNonNull(module, "module is required"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets (or unsets) the <code>module</code> parameter.
|
||||
*
|
||||
* @param module the value of the module parameter as an {@link Optional} of {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public ReplaceCallBuilder module(final Optional<EndpointTrafficPolicy> module) {
|
||||
this.module = Objects.requireNonNull(module, "module is required");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the API call asynchronously.
|
||||
*
|
||||
* @return a {@link CompletionStage} of {@link EndpointTrafficPolicy}
|
||||
*/
|
||||
public CompletionStage<EndpointTrafficPolicy> call() {
|
||||
return apiClient.sendRequest(
|
||||
NgrokApiClient.HttpMethod.PUT,
|
||||
"/edges/https/" + this.edgeId + "/routes/" + this.id + "/traffic_policy",
|
||||
Stream.empty(),
|
||||
Stream.of(
|
||||
new AbstractMap.SimpleEntry<>("module", this.module.map(Function.identity()))
|
||||
),
|
||||
Optional.of(EndpointTrafficPolicy.class)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the API call and blocks until it returns.
|
||||
*
|
||||
* @return {@link EndpointTrafficPolicy}
|
||||
* @throws InterruptedException if the thread was interrupted during the call
|
||||
*/
|
||||
public EndpointTrafficPolicy 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a call builder for the Replace API operation.
|
||||
*
|
||||
* See also <a href="https://ngrok.com/docs/api#api-edge-route-traffic-policy-module-replace">https://ngrok.com/docs/api#api-edge-route-traffic-policy-module-replace</a>.
|
||||
*
|
||||
* @param edgeId the value of the <code>edge_id</code> parameter as a {@link String}
|
||||
* @param id the value of the <code>id</code> parameter as a {@link String}
|
||||
* @return a call builder for this API call
|
||||
*/
|
||||
public ReplaceCallBuilder replace(
|
||||
final String edgeId,
|
||||
final String id
|
||||
) {
|
||||
return new ReplaceCallBuilder(
|
||||
edgeId,
|
||||
id
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder object encapsulating state for an unsent Get API call.
|
||||
*/
|
||||
public class GetCallBuilder {
|
||||
private final String edgeId;
|
||||
private final String id;
|
||||
|
||||
private GetCallBuilder(
|
||||
final String edgeId,
|
||||
final String id
|
||||
) {
|
||||
this.edgeId = Objects.requireNonNull(edgeId, "edgeId is required");
|
||||
this.id = Objects.requireNonNull(id, "id is required");
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the API call asynchronously.
|
||||
*
|
||||
* @return a {@link CompletionStage} of {@link EndpointTrafficPolicy}
|
||||
*/
|
||||
public CompletionStage<EndpointTrafficPolicy> call() {
|
||||
return apiClient.sendRequest(
|
||||
NgrokApiClient.HttpMethod.GET,
|
||||
"/edges/https/" + this.edgeId + "/routes/" + this.id + "/traffic_policy",
|
||||
Stream.empty(),
|
||||
Stream.empty(),
|
||||
Optional.of(EndpointTrafficPolicy.class)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the API call and blocks until it returns.
|
||||
*
|
||||
* @return {@link EndpointTrafficPolicy}
|
||||
* @throws InterruptedException if the thread was interrupted during the call
|
||||
*/
|
||||
public EndpointTrafficPolicy 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a call builder for the Get API operation.
|
||||
*
|
||||
* See also <a href="https://ngrok.com/docs/api#api-edge-route-traffic-policy-module-get">https://ngrok.com/docs/api#api-edge-route-traffic-policy-module-get</a>.
|
||||
*
|
||||
* @param edgeId unique identifier of this edge
|
||||
* @param id unique identifier of this edge route
|
||||
* @return a call builder for this API call
|
||||
*/
|
||||
public GetCallBuilder get(
|
||||
final String edgeId,
|
||||
final String id
|
||||
) {
|
||||
return new GetCallBuilder(
|
||||
edgeId,
|
||||
id
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder object encapsulating state for an unsent Delete API call.
|
||||
*/
|
||||
public class DeleteCallBuilder {
|
||||
private final String edgeId;
|
||||
private final String id;
|
||||
|
||||
private DeleteCallBuilder(
|
||||
final String edgeId,
|
||||
final String id
|
||||
) {
|
||||
this.edgeId = Objects.requireNonNull(edgeId, "edgeId is required");
|
||||
this.id = Objects.requireNonNull(id, "id is required");
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the API call asynchronously.
|
||||
*
|
||||
* @return a {@link CompletionStage} of {@link Void}
|
||||
*/
|
||||
public CompletionStage<Void> call() {
|
||||
return apiClient.sendRequest(
|
||||
NgrokApiClient.HttpMethod.DELETE,
|
||||
"/edges/https/" + this.edgeId + "/routes/" + this.id + "/traffic_policy",
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a call builder for the Delete API operation.
|
||||
*
|
||||
* See also <a href="https://ngrok.com/docs/api#api-edge-route-traffic-policy-module-delete">https://ngrok.com/docs/api#api-edge-route-traffic-policy-module-delete</a>.
|
||||
*
|
||||
* @param edgeId unique identifier of this edge
|
||||
* @param id unique identifier of this edge route
|
||||
* @return a call builder for this API call
|
||||
*/
|
||||
public DeleteCallBuilder delete(
|
||||
final String edgeId,
|
||||
final String id
|
||||
) {
|
||||
return new DeleteCallBuilder(
|
||||
edgeId,
|
||||
id
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class EdgesHttpsRoutes {
|
||||
private Optional<EndpointOidc> oidc = Optional.empty();
|
||||
private Optional<EndpointWebsocketTcpConverter> websocketTcpConverter = Optional.empty();
|
||||
private Optional<EndpointUserAgentFilter> userAgentFilter = Optional.empty();
|
||||
private Optional<EndpointPolicy> policy = Optional.empty();
|
||||
private Optional<EndpointTrafficPolicy> trafficPolicy = Optional.empty();
|
||||
|
||||
private CreateCallBuilder(
|
||||
final String edgeId,
|
||||
@@ -378,22 +378,22 @@ public class EdgesHttpsRoutes {
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @param policy the value of the policy parameter as a {@link EndpointPolicy}
|
||||
* @param trafficPolicy the value of the traffic_policy parameter as a {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public CreateCallBuilder policy(final EndpointPolicy policy) {
|
||||
this.policy = Optional.of(Objects.requireNonNull(policy, "policy is required"));
|
||||
public CreateCallBuilder trafficPolicy(final EndpointTrafficPolicy trafficPolicy) {
|
||||
this.trafficPolicy = Optional.of(Objects.requireNonNull(trafficPolicy, "trafficPolicy is required"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @param policy the value of the policy parameter as an {@link Optional} of {@link EndpointPolicy}
|
||||
* @param trafficPolicy the value of the traffic_policy parameter as an {@link Optional} of {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public CreateCallBuilder policy(final Optional<EndpointPolicy> policy) {
|
||||
this.policy = Objects.requireNonNull(policy, "policy is required");
|
||||
public CreateCallBuilder trafficPolicy(final Optional<EndpointTrafficPolicy> trafficPolicy) {
|
||||
this.trafficPolicy = Objects.requireNonNull(trafficPolicy, "trafficPolicy is required");
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ public class EdgesHttpsRoutes {
|
||||
new AbstractMap.SimpleEntry<>("oidc", this.oidc.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("websocket_tcp_converter", this.websocketTcpConverter.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("user_agent_filter", this.userAgentFilter.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("policy", this.policy.map(Function.identity()))
|
||||
new AbstractMap.SimpleEntry<>("traffic_policy", this.trafficPolicy.map(Function.identity()))
|
||||
),
|
||||
Optional.of(HttpsEdgeRoute.class)
|
||||
);
|
||||
@@ -553,7 +553,7 @@ public class EdgesHttpsRoutes {
|
||||
private Optional<EndpointOidc> oidc = Optional.empty();
|
||||
private Optional<EndpointWebsocketTcpConverter> websocketTcpConverter = Optional.empty();
|
||||
private Optional<EndpointUserAgentFilter> userAgentFilter = Optional.empty();
|
||||
private Optional<EndpointPolicy> policy = Optional.empty();
|
||||
private Optional<EndpointTrafficPolicy> trafficPolicy = Optional.empty();
|
||||
|
||||
private UpdateCallBuilder(
|
||||
final String edgeId,
|
||||
@@ -926,22 +926,22 @@ public class EdgesHttpsRoutes {
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @param policy the value of the policy parameter as a {@link EndpointPolicy}
|
||||
* @param trafficPolicy the value of the traffic_policy parameter as a {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public UpdateCallBuilder policy(final EndpointPolicy policy) {
|
||||
this.policy = Optional.of(Objects.requireNonNull(policy, "policy is required"));
|
||||
public UpdateCallBuilder trafficPolicy(final EndpointTrafficPolicy trafficPolicy) {
|
||||
this.trafficPolicy = Optional.of(Objects.requireNonNull(trafficPolicy, "trafficPolicy is required"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @param policy the value of the policy parameter as an {@link Optional} of {@link EndpointPolicy}
|
||||
* @param trafficPolicy the value of the traffic_policy parameter as an {@link Optional} of {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public UpdateCallBuilder policy(final Optional<EndpointPolicy> policy) {
|
||||
this.policy = Objects.requireNonNull(policy, "policy is required");
|
||||
public UpdateCallBuilder trafficPolicy(final Optional<EndpointTrafficPolicy> trafficPolicy) {
|
||||
this.trafficPolicy = Objects.requireNonNull(trafficPolicy, "trafficPolicy is required");
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -972,7 +972,7 @@ public class EdgesHttpsRoutes {
|
||||
new AbstractMap.SimpleEntry<>("oidc", this.oidc.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("websocket_tcp_converter", this.websocketTcpConverter.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("user_agent_filter", this.userAgentFilter.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("policy", this.policy.map(Function.identity()))
|
||||
new AbstractMap.SimpleEntry<>("traffic_policy", this.trafficPolicy.map(Function.identity()))
|
||||
),
|
||||
Optional.of(HttpsEdgeRoute.class)
|
||||
);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class EdgesTcp {
|
||||
private Optional<java.util.List<String>> hostports = Optional.empty();
|
||||
private Optional<EndpointBackendMutate> backend = Optional.empty();
|
||||
private Optional<EndpointIpPolicyMutate> ipRestriction = Optional.empty();
|
||||
private Optional<EndpointPolicy> policy = Optional.empty();
|
||||
private Optional<EndpointTrafficPolicy> trafficPolicy = Optional.empty();
|
||||
|
||||
private CreateCallBuilder(
|
||||
) {
|
||||
@@ -162,22 +162,22 @@ public class EdgesTcp {
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @param policy the value of the policy parameter as a {@link EndpointPolicy}
|
||||
* @param trafficPolicy the value of the traffic_policy parameter as a {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public CreateCallBuilder policy(final EndpointPolicy policy) {
|
||||
this.policy = Optional.of(Objects.requireNonNull(policy, "policy is required"));
|
||||
public CreateCallBuilder trafficPolicy(final EndpointTrafficPolicy trafficPolicy) {
|
||||
this.trafficPolicy = Optional.of(Objects.requireNonNull(trafficPolicy, "trafficPolicy is required"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @param policy the value of the policy parameter as an {@link Optional} of {@link EndpointPolicy}
|
||||
* @param trafficPolicy the value of the traffic_policy parameter as an {@link Optional} of {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public CreateCallBuilder policy(final Optional<EndpointPolicy> policy) {
|
||||
this.policy = Objects.requireNonNull(policy, "policy is required");
|
||||
public CreateCallBuilder trafficPolicy(final Optional<EndpointTrafficPolicy> trafficPolicy) {
|
||||
this.trafficPolicy = Objects.requireNonNull(trafficPolicy, "trafficPolicy is required");
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ public class EdgesTcp {
|
||||
new AbstractMap.SimpleEntry<>("hostports", Optional.of(this.hostports).filter(hostports -> !hostports.isEmpty()).map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("backend", this.backend.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("ip_restriction", this.ipRestriction.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("policy", this.policy.map(Function.identity()))
|
||||
new AbstractMap.SimpleEntry<>("traffic_policy", this.trafficPolicy.map(Function.identity()))
|
||||
),
|
||||
Optional.of(TcpEdge.class)
|
||||
);
|
||||
@@ -400,7 +400,7 @@ public class EdgesTcp {
|
||||
private Optional<java.util.List<String>> hostports = Optional.empty();
|
||||
private Optional<EndpointBackendMutate> backend = Optional.empty();
|
||||
private Optional<EndpointIpPolicyMutate> ipRestriction = Optional.empty();
|
||||
private Optional<EndpointPolicy> policy = Optional.empty();
|
||||
private Optional<EndpointTrafficPolicy> trafficPolicy = Optional.empty();
|
||||
|
||||
private UpdateCallBuilder(
|
||||
final String id
|
||||
@@ -525,22 +525,22 @@ public class EdgesTcp {
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @param policy the value of the policy parameter as a {@link EndpointPolicy}
|
||||
* @param trafficPolicy the value of the traffic_policy parameter as a {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public UpdateCallBuilder policy(final EndpointPolicy policy) {
|
||||
this.policy = Optional.of(Objects.requireNonNull(policy, "policy is required"));
|
||||
public UpdateCallBuilder trafficPolicy(final EndpointTrafficPolicy trafficPolicy) {
|
||||
this.trafficPolicy = Optional.of(Objects.requireNonNull(trafficPolicy, "trafficPolicy is required"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @param policy the value of the policy parameter as an {@link Optional} of {@link EndpointPolicy}
|
||||
* @param trafficPolicy the value of the traffic_policy parameter as an {@link Optional} of {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public UpdateCallBuilder policy(final Optional<EndpointPolicy> policy) {
|
||||
this.policy = Objects.requireNonNull(policy, "policy is required");
|
||||
public UpdateCallBuilder trafficPolicy(final Optional<EndpointTrafficPolicy> trafficPolicy) {
|
||||
this.trafficPolicy = Objects.requireNonNull(trafficPolicy, "trafficPolicy is required");
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ public class EdgesTcp {
|
||||
new AbstractMap.SimpleEntry<>("hostports", Optional.of(this.hostports).filter(hostports -> !hostports.isEmpty()).map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("backend", this.backend.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("ip_restriction", this.ipRestriction.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("policy", this.policy.map(Function.identity()))
|
||||
new AbstractMap.SimpleEntry<>("traffic_policy", this.trafficPolicy.map(Function.identity()))
|
||||
),
|
||||
Optional.of(TcpEdge.class)
|
||||
);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class EdgesTls {
|
||||
private Optional<EndpointIpPolicyMutate> ipRestriction = Optional.empty();
|
||||
private Optional<EndpointMutualTlsMutate> mutualTls = Optional.empty();
|
||||
private Optional<EndpointTlsTermination> tlsTermination = Optional.empty();
|
||||
private Optional<EndpointPolicy> policy = Optional.empty();
|
||||
private Optional<EndpointTrafficPolicy> trafficPolicy = Optional.empty();
|
||||
|
||||
private CreateCallBuilder(
|
||||
) {
|
||||
@@ -208,22 +208,22 @@ public class EdgesTls {
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @param policy the value of the policy parameter as a {@link EndpointPolicy}
|
||||
* @param trafficPolicy the value of the traffic_policy parameter as a {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public CreateCallBuilder policy(final EndpointPolicy policy) {
|
||||
this.policy = Optional.of(Objects.requireNonNull(policy, "policy is required"));
|
||||
public CreateCallBuilder trafficPolicy(final EndpointTrafficPolicy trafficPolicy) {
|
||||
this.trafficPolicy = Optional.of(Objects.requireNonNull(trafficPolicy, "trafficPolicy is required"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @param policy the value of the policy parameter as an {@link Optional} of {@link EndpointPolicy}
|
||||
* @param trafficPolicy the value of the traffic_policy parameter as an {@link Optional} of {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public CreateCallBuilder policy(final Optional<EndpointPolicy> policy) {
|
||||
this.policy = Objects.requireNonNull(policy, "policy is required");
|
||||
public CreateCallBuilder trafficPolicy(final Optional<EndpointTrafficPolicy> trafficPolicy) {
|
||||
this.trafficPolicy = Objects.requireNonNull(trafficPolicy, "trafficPolicy is required");
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ public class EdgesTls {
|
||||
new AbstractMap.SimpleEntry<>("ip_restriction", this.ipRestriction.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("mutual_tls", this.mutualTls.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("tls_termination", this.tlsTermination.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("policy", this.policy.map(Function.identity()))
|
||||
new AbstractMap.SimpleEntry<>("traffic_policy", this.trafficPolicy.map(Function.identity()))
|
||||
),
|
||||
Optional.of(TlsEdge.class)
|
||||
);
|
||||
@@ -450,7 +450,7 @@ public class EdgesTls {
|
||||
private Optional<EndpointIpPolicyMutate> ipRestriction = Optional.empty();
|
||||
private Optional<EndpointMutualTlsMutate> mutualTls = Optional.empty();
|
||||
private Optional<EndpointTlsTermination> tlsTermination = Optional.empty();
|
||||
private Optional<EndpointPolicy> policy = Optional.empty();
|
||||
private Optional<EndpointTrafficPolicy> trafficPolicy = Optional.empty();
|
||||
|
||||
private UpdateCallBuilder(
|
||||
final String id
|
||||
@@ -619,22 +619,22 @@ public class EdgesTls {
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @param policy the value of the policy parameter as a {@link EndpointPolicy}
|
||||
* @param trafficPolicy the value of the traffic_policy parameter as a {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public UpdateCallBuilder policy(final EndpointPolicy policy) {
|
||||
this.policy = Optional.of(Objects.requireNonNull(policy, "policy is required"));
|
||||
public UpdateCallBuilder trafficPolicy(final EndpointTrafficPolicy trafficPolicy) {
|
||||
this.trafficPolicy = Optional.of(Objects.requireNonNull(trafficPolicy, "trafficPolicy is required"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* the traffic policy associated with this edge or null
|
||||
*
|
||||
* @param policy the value of the policy parameter as an {@link Optional} of {@link EndpointPolicy}
|
||||
* @param trafficPolicy the value of the traffic_policy parameter as an {@link Optional} of {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public UpdateCallBuilder policy(final Optional<EndpointPolicy> policy) {
|
||||
this.policy = Objects.requireNonNull(policy, "policy is required");
|
||||
public UpdateCallBuilder trafficPolicy(final Optional<EndpointTrafficPolicy> trafficPolicy) {
|
||||
this.trafficPolicy = Objects.requireNonNull(trafficPolicy, "trafficPolicy is required");
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -656,7 +656,7 @@ public class EdgesTls {
|
||||
new AbstractMap.SimpleEntry<>("ip_restriction", this.ipRestriction.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("mutual_tls", this.mutualTls.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("tls_termination", this.tlsTermination.map(Function.identity())),
|
||||
new AbstractMap.SimpleEntry<>("policy", this.policy.map(Function.identity()))
|
||||
new AbstractMap.SimpleEntry<>("traffic_policy", this.trafficPolicy.map(Function.identity()))
|
||||
),
|
||||
Optional.of(TlsEdge.class)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
/* 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 TcpEdgeTrafficPolicyModule}.
|
||||
*
|
||||
* See also <a href="https://ngrok.com/docs/api#api-tcp-edge-traffic-policy-module">https://ngrok.com/docs/api#api-tcp-edge-traffic-policy-module</a>.
|
||||
*/
|
||||
public class TcpEdgeTrafficPolicyModule {
|
||||
private final NgrokApiClient apiClient;
|
||||
|
||||
/**
|
||||
* Creates a new sub-client for TcpEdgeTrafficPolicyModule.
|
||||
*
|
||||
* @param apiClient an instance of {@link com.ngrok.NgrokApiClient}
|
||||
*/
|
||||
public TcpEdgeTrafficPolicyModule(final NgrokApiClient apiClient) {
|
||||
this.apiClient = Objects.requireNonNull(apiClient, "apiClient is required");
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder object encapsulating state for an unsent Replace API call.
|
||||
*/
|
||||
public class ReplaceCallBuilder {
|
||||
private final String id;
|
||||
private Optional<EndpointTrafficPolicy> module = Optional.empty();
|
||||
|
||||
private ReplaceCallBuilder(
|
||||
final String id
|
||||
) {
|
||||
this.id = Objects.requireNonNull(id, "id is required");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the <code>module</code> parameter.
|
||||
*
|
||||
* @param module the value of the module parameter as a {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public ReplaceCallBuilder module(final EndpointTrafficPolicy module) {
|
||||
this.module = Optional.of(Objects.requireNonNull(module, "module is required"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets (or unsets) the <code>module</code> parameter.
|
||||
*
|
||||
* @param module the value of the module parameter as an {@link Optional} of {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public ReplaceCallBuilder module(final Optional<EndpointTrafficPolicy> module) {
|
||||
this.module = Objects.requireNonNull(module, "module is required");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the API call asynchronously.
|
||||
*
|
||||
* @return a {@link CompletionStage} of {@link EndpointTrafficPolicy}
|
||||
*/
|
||||
public CompletionStage<EndpointTrafficPolicy> call() {
|
||||
return apiClient.sendRequest(
|
||||
NgrokApiClient.HttpMethod.PUT,
|
||||
"/edges/tcp/" + this.id + "/traffic_policy",
|
||||
Stream.empty(),
|
||||
Stream.of(
|
||||
new AbstractMap.SimpleEntry<>("module", this.module.map(Function.identity()))
|
||||
),
|
||||
Optional.of(EndpointTrafficPolicy.class)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the API call and blocks until it returns.
|
||||
*
|
||||
* @return {@link EndpointTrafficPolicy}
|
||||
* @throws InterruptedException if the thread was interrupted during the call
|
||||
*/
|
||||
public EndpointTrafficPolicy 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a call builder for the Replace API operation.
|
||||
*
|
||||
* See also <a href="https://ngrok.com/docs/api#api-tcp-edge-traffic-policy-module-replace">https://ngrok.com/docs/api#api-tcp-edge-traffic-policy-module-replace</a>.
|
||||
*
|
||||
* @param id the value of the <code>id</code> parameter as a {@link String}
|
||||
* @return a call builder for this API call
|
||||
*/
|
||||
public ReplaceCallBuilder replace(
|
||||
final String id
|
||||
) {
|
||||
return new ReplaceCallBuilder(
|
||||
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 EndpointTrafficPolicy}
|
||||
*/
|
||||
public CompletionStage<EndpointTrafficPolicy> call() {
|
||||
return apiClient.sendRequest(
|
||||
NgrokApiClient.HttpMethod.GET,
|
||||
"/edges/tcp/" + this.id + "/traffic_policy",
|
||||
Stream.empty(),
|
||||
Stream.empty(),
|
||||
Optional.of(EndpointTrafficPolicy.class)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the API call and blocks until it returns.
|
||||
*
|
||||
* @return {@link EndpointTrafficPolicy}
|
||||
* @throws InterruptedException if the thread was interrupted during the call
|
||||
*/
|
||||
public EndpointTrafficPolicy 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a call builder for the Get API operation.
|
||||
*
|
||||
* See also <a href="https://ngrok.com/docs/api#api-tcp-edge-traffic-policy-module-get">https://ngrok.com/docs/api#api-tcp-edge-traffic-policy-module-get</a>.
|
||||
*
|
||||
* @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 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<Void> call() {
|
||||
return apiClient.sendRequest(
|
||||
NgrokApiClient.HttpMethod.DELETE,
|
||||
"/edges/tcp/" + this.id + "/traffic_policy",
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a call builder for the Delete API operation.
|
||||
*
|
||||
* See also <a href="https://ngrok.com/docs/api#api-tcp-edge-traffic-policy-module-delete">https://ngrok.com/docs/api#api-tcp-edge-traffic-policy-module-delete</a>.
|
||||
*
|
||||
* @param id a resource identifier
|
||||
* @return a call builder for this API call
|
||||
*/
|
||||
public DeleteCallBuilder delete(
|
||||
final String id
|
||||
) {
|
||||
return new DeleteCallBuilder(
|
||||
id
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
/* 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 TlsEdgeTrafficPolicyModule}.
|
||||
*
|
||||
* See also <a href="https://ngrok.com/docs/api#api-tls-edge-traffic-policy-module">https://ngrok.com/docs/api#api-tls-edge-traffic-policy-module</a>.
|
||||
*/
|
||||
public class TlsEdgeTrafficPolicyModule {
|
||||
private final NgrokApiClient apiClient;
|
||||
|
||||
/**
|
||||
* Creates a new sub-client for TlsEdgeTrafficPolicyModule.
|
||||
*
|
||||
* @param apiClient an instance of {@link com.ngrok.NgrokApiClient}
|
||||
*/
|
||||
public TlsEdgeTrafficPolicyModule(final NgrokApiClient apiClient) {
|
||||
this.apiClient = Objects.requireNonNull(apiClient, "apiClient is required");
|
||||
}
|
||||
|
||||
/**
|
||||
* A builder object encapsulating state for an unsent Replace API call.
|
||||
*/
|
||||
public class ReplaceCallBuilder {
|
||||
private final String id;
|
||||
private Optional<EndpointTrafficPolicy> module = Optional.empty();
|
||||
|
||||
private ReplaceCallBuilder(
|
||||
final String id
|
||||
) {
|
||||
this.id = Objects.requireNonNull(id, "id is required");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the <code>module</code> parameter.
|
||||
*
|
||||
* @param module the value of the module parameter as a {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public ReplaceCallBuilder module(final EndpointTrafficPolicy module) {
|
||||
this.module = Optional.of(Objects.requireNonNull(module, "module is required"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets (or unsets) the <code>module</code> parameter.
|
||||
*
|
||||
* @param module the value of the module parameter as an {@link Optional} of {@link EndpointTrafficPolicy}
|
||||
* @return the call builder instance
|
||||
*/
|
||||
public ReplaceCallBuilder module(final Optional<EndpointTrafficPolicy> module) {
|
||||
this.module = Objects.requireNonNull(module, "module is required");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the API call asynchronously.
|
||||
*
|
||||
* @return a {@link CompletionStage} of {@link EndpointTrafficPolicy}
|
||||
*/
|
||||
public CompletionStage<EndpointTrafficPolicy> call() {
|
||||
return apiClient.sendRequest(
|
||||
NgrokApiClient.HttpMethod.PUT,
|
||||
"/edges/tls/" + this.id + "/traffic_policy",
|
||||
Stream.empty(),
|
||||
Stream.of(
|
||||
new AbstractMap.SimpleEntry<>("module", this.module.map(Function.identity()))
|
||||
),
|
||||
Optional.of(EndpointTrafficPolicy.class)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the API call and blocks until it returns.
|
||||
*
|
||||
* @return {@link EndpointTrafficPolicy}
|
||||
* @throws InterruptedException if the thread was interrupted during the call
|
||||
*/
|
||||
public EndpointTrafficPolicy 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a call builder for the Replace API operation.
|
||||
*
|
||||
* See also <a href="https://ngrok.com/docs/api#api-tls-edge-traffic-policy-module-replace">https://ngrok.com/docs/api#api-tls-edge-traffic-policy-module-replace</a>.
|
||||
*
|
||||
* @param id the value of the <code>id</code> parameter as a {@link String}
|
||||
* @return a call builder for this API call
|
||||
*/
|
||||
public ReplaceCallBuilder replace(
|
||||
final String id
|
||||
) {
|
||||
return new ReplaceCallBuilder(
|
||||
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 EndpointTrafficPolicy}
|
||||
*/
|
||||
public CompletionStage<EndpointTrafficPolicy> call() {
|
||||
return apiClient.sendRequest(
|
||||
NgrokApiClient.HttpMethod.GET,
|
||||
"/edges/tls/" + this.id + "/traffic_policy",
|
||||
Stream.empty(),
|
||||
Stream.empty(),
|
||||
Optional.of(EndpointTrafficPolicy.class)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the API call and blocks until it returns.
|
||||
*
|
||||
* @return {@link EndpointTrafficPolicy}
|
||||
* @throws InterruptedException if the thread was interrupted during the call
|
||||
*/
|
||||
public EndpointTrafficPolicy 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a call builder for the Get API operation.
|
||||
*
|
||||
* See also <a href="https://ngrok.com/docs/api#api-tls-edge-traffic-policy-module-get">https://ngrok.com/docs/api#api-tls-edge-traffic-policy-module-get</a>.
|
||||
*
|
||||
* @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 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<Void> call() {
|
||||
return apiClient.sendRequest(
|
||||
NgrokApiClient.HttpMethod.DELETE,
|
||||
"/edges/tls/" + this.id + "/traffic_policy",
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a call builder for the Delete API operation.
|
||||
*
|
||||
* See also <a href="https://ngrok.com/docs/api#api-tls-edge-traffic-policy-module-delete">https://ngrok.com/docs/api#api-tls-edge-traffic-policy-module-delete</a>.
|
||||
*
|
||||
* @param id a resource identifier
|
||||
* @return a call builder for this API call
|
||||
*/
|
||||
public DeleteCallBuilder delete(
|
||||
final String id
|
||||
) {
|
||||
return new DeleteCallBuilder(
|
||||
id
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user