use of com.hazelcast.config.GcpConfig in project hazelcast by hazelcast.
the class WanBatchPublisherConfigDTO method fromJson.
@Override
@SuppressWarnings({ "checkstyle:methodlength", "checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity" })
public void fromJson(JsonObject json) {
config = new WanBatchPublisherConfig();
consumeIfExists(json, "clusterName", v -> config.setClusterName(v.asString()));
consumeIfExists(json, "publisherId", v -> config.setPublisherId(v.asString()));
consumeIfExists(json, "batchSize", v -> config.setBatchSize(v.asInt()));
consumeIfExists(json, "batchMaxDelayMillis", v -> config.setBatchMaxDelayMillis(v.asInt()));
consumeIfExists(json, "responseTimeoutMillis", v -> config.setResponseTimeoutMillis(v.asInt()));
consumeIfExists(json, "acknowledgeType", v -> config.setAcknowledgeType(WanAcknowledgeType.getById(v.asInt())));
consumeIfExists(json, "initialPublisherState", v -> config.setInitialPublisherState(WanPublisherState.getByType((byte) v.asInt())));
consumeIfExists(json, "snapshotEnabled", v -> config.setSnapshotEnabled(v.asBoolean()));
consumeIfExists(json, "idleMaxParkNs", v -> config.setIdleMaxParkNs(v.asLong()));
consumeIfExists(json, "idleMinParkNs", v -> config.setIdleMinParkNs(v.asLong()));
consumeIfExists(json, "maxConcurrentInvocations", v -> config.setMaxConcurrentInvocations(v.asInt()));
consumeIfExists(json, "discoveryPeriodSeconds", v -> config.setDiscoveryPeriodSeconds(v.asInt()));
consumeIfExists(json, "useEndpointPrivateAddress", v -> config.setUseEndpointPrivateAddress(v.asBoolean()));
consumeIfExists(json, "queueFullBehavior", v -> config.setQueueFullBehavior(WanQueueFullBehavior.getByType(v.asInt())));
consumeIfExists(json, "maxTargetEndpoints", v -> config.setMaxTargetEndpoints(v.asInt()));
consumeIfExists(json, "queueCapacity", v -> config.setQueueCapacity(v.asInt()));
consumeIfExists(json, "targetEndpoints", v -> config.setTargetEndpoints(v.asString()));
AwsConfig awsConfig = (AwsConfig) this.deserializeAliasedDiscoveryConfig(json, "aws");
if (awsConfig != null) {
config.setAwsConfig(awsConfig);
}
GcpConfig gcpConfig = (GcpConfig) this.deserializeAliasedDiscoveryConfig(json, "gcp");
if (gcpConfig != null) {
config.setGcpConfig(gcpConfig);
}
AzureConfig azureConfig = (AzureConfig) this.deserializeAliasedDiscoveryConfig(json, "azure");
if (azureConfig != null) {
config.setAzureConfig(azureConfig);
}
KubernetesConfig kubernetesConfig = (KubernetesConfig) this.deserializeAliasedDiscoveryConfig(json, "kubernetes");
if (kubernetesConfig != null) {
config.setKubernetesConfig(kubernetesConfig);
}
EurekaConfig eurekaConfig = (EurekaConfig) this.deserializeAliasedDiscoveryConfig(json, "eureka");
if (eurekaConfig != null) {
config.setEurekaConfig(eurekaConfig);
}
JsonValue discoveryJson = json.get("discovery");
if (discoveryJson != null && !discoveryJson.isNull()) {
DiscoveryConfigDTO discoveryDTO = new DiscoveryConfigDTO();
discoveryDTO.fromJson(discoveryJson.asObject());
config.setDiscoveryConfig(discoveryDTO.getConfig());
}
JsonValue syncJson = json.get("sync");
if (syncJson != null && !syncJson.isNull()) {
WanSyncConfigDTO syncDTO = new WanSyncConfigDTO();
syncDTO.fromJson(syncJson.asObject());
config.setSyncConfig(syncDTO.getConfig());
}
consumeIfExists(json, "endpoint", v -> config.setEndpoint(v.asString()));
config.setProperties(fromJsonObject((JsonObject) json.get("properties")));
}
Aggregations