diff --git a/managed/src/main/java/AppInit.java b/managed/src/main/java/AppInit.java index f4a2fde04439..daae0bd4f3de 100644 --- a/managed/src/main/java/AppInit.java +++ b/managed/src/main/java/AppInit.java @@ -4,19 +4,27 @@ import com.google.inject.Singleton; import com.yugabyte.yw.cloud.AWSInitializer; import com.yugabyte.yw.commissioner.TaskGarbageCollector; -import com.yugabyte.yw.common.*; +import com.yugabyte.yw.common.CertificateHelper; +import com.yugabyte.yw.common.ConfigHelper; +import com.yugabyte.yw.common.CustomerTaskManager; +import com.yugabyte.yw.common.ExtraMigrationManager; +import com.yugabyte.yw.common.ReleaseManager; +import com.yugabyte.yw.common.YamlWrapper; import com.yugabyte.yw.common.ha.PlatformReplicationManager; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.ExtraMigration; +import com.yugabyte.yw.models.InstanceType; +import com.yugabyte.yw.models.MetricConfig; +import com.yugabyte.yw.models.Provider; import io.ebean.Ebean; import io.prometheus.client.hotspot.DefaultExports; +import java.util.List; +import java.util.Map; import play.Application; import play.Configuration; import play.Environment; import play.Logger; -import java.util.List; -import java.util.Map; - /** We will use this singleton to do actions specific to the app environment, like db seed etc. */ @Singleton public class AppInit { diff --git a/managed/src/main/java/Filters.java b/managed/src/main/java/Filters.java index ad20f3df8468..78d0203aba35 100644 --- a/managed/src/main/java/Filters.java +++ b/managed/src/main/java/Filters.java @@ -1,13 +1,12 @@ // Copyright (c) YugaByte, Inc. import com.google.inject.Inject; -import play.mvc.EssentialFilter; +import java.util.ArrayList; +import java.util.List; import play.filters.cors.CORSFilter; import play.filters.csrf.CSRFFilter; import play.http.HttpFilters; - -import java.util.ArrayList; -import java.util.List; +import play.mvc.EssentialFilter; public class Filters implements HttpFilters { diff --git a/managed/src/main/java/Module.java b/managed/src/main/java/Module.java index b9bbcde986e8..f8f670ccea0c 100644 --- a/managed/src/main/java/Module.java +++ b/managed/src/main/java/Module.java @@ -4,8 +4,28 @@ import com.google.inject.Provides; import com.yugabyte.yw.cloud.AWSInitializer; import com.yugabyte.yw.cloud.aws.AWSCloudModule; -import com.yugabyte.yw.commissioner.*; -import com.yugabyte.yw.common.*; +import com.yugabyte.yw.commissioner.CallHome; +import com.yugabyte.yw.commissioner.HealthChecker; +import com.yugabyte.yw.commissioner.QueryAlerts; +import com.yugabyte.yw.commissioner.SetUniverseKey; +import com.yugabyte.yw.commissioner.TaskGarbageCollector; +import com.yugabyte.yw.common.AccessManager; +import com.yugabyte.yw.common.AlertManager; +import com.yugabyte.yw.common.ConfigHelper; +import com.yugabyte.yw.common.CustomerTaskManager; +import com.yugabyte.yw.common.ExtraMigrationManager; +import com.yugabyte.yw.common.HealthManager; +import com.yugabyte.yw.common.KubernetesManager; +import com.yugabyte.yw.common.NetworkManager; +import com.yugabyte.yw.common.NodeManager; +import com.yugabyte.yw.common.PlatformInstanceClientFactory; +import com.yugabyte.yw.common.ReleaseManager; +import com.yugabyte.yw.common.ShellProcessHandler; +import com.yugabyte.yw.common.SwamperHelper; +import com.yugabyte.yw.common.TemplateManager; +import com.yugabyte.yw.common.YamlWrapper; +import com.yugabyte.yw.common.YcqlQueryExecutor; +import com.yugabyte.yw.common.YsqlQueryExecutor; import com.yugabyte.yw.common.alerts.AlertConfigurationWriter; import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.common.config.impl.SettableRuntimeConfigFactory; diff --git a/managed/src/main/java/com/yugabyte/yw/cloud/AWSInitializer.java b/managed/src/main/java/com/yugabyte/yw/cloud/AWSInitializer.java index 0474ec07d2c1..e71ac812635f 100644 --- a/managed/src/main/java/com/yugabyte/yw/cloud/AWSInitializer.java +++ b/managed/src/main/java/com/yugabyte/yw/cloud/AWSInitializer.java @@ -10,6 +10,25 @@ package com.yugabyte.yw.cloud; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GP2_SIZE; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_PIOPS; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_SIZE; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_THROUGHPUT; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GROUP_EBS_IOPS; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GROUP_EBS_THROUGHPUT; +import static com.yugabyte.yw.cloud.PublicCloudConstants.IO1_PIOPS; +import static com.yugabyte.yw.cloud.PublicCloudConstants.IO1_SIZE; +import static com.yugabyte.yw.cloud.PublicCloudConstants.PRODUCT_FAMILY_COMPUTE_INSTANCE; +import static com.yugabyte.yw.cloud.PublicCloudConstants.PRODUCT_FAMILY_PROVISIONED_THROUGHPUT; +import static com.yugabyte.yw.cloud.PublicCloudConstants.PRODUCT_FAMILY_STORAGE; +import static com.yugabyte.yw.cloud.PublicCloudConstants.PRODUCT_FAMILY_SYSTEM_OPERATION; +import static com.yugabyte.yw.cloud.PublicCloudConstants.VOLUME_API_GENERAL_PURPOSE; +import static com.yugabyte.yw.cloud.PublicCloudConstants.VOLUME_API_NAME_GP2; +import static com.yugabyte.yw.cloud.PublicCloudConstants.VOLUME_API_NAME_GP3; +import static com.yugabyte.yw.cloud.PublicCloudConstants.VOLUME_API_NAME_IO1; +import static com.yugabyte.yw.cloud.PublicCloudConstants.VOLUME_TYPE_PROVISIONED_IOPS; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.inject.Inject; @@ -22,22 +41,18 @@ import com.yugabyte.yw.models.PriceComponent; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; -import org.apache.commons.compress.archivers.tar.TarArchiveEntry; -import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; -import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream; -import play.Environment; -import play.libs.Json; -import play.mvc.Result; - import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.UUID; - -import static com.yugabyte.yw.cloud.PublicCloudConstants.*; -import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; +import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; +import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream; +import play.Environment; +import play.libs.Json; +import play.mvc.Result; // TODO: move pricing data fetch to ybcloud. @Singleton diff --git a/managed/src/main/java/com/yugabyte/yw/cloud/AZUInitializer.java b/managed/src/main/java/com/yugabyte/yw/cloud/AZUInitializer.java index aafc4af14d08..550d514ca306 100644 --- a/managed/src/main/java/com/yugabyte/yw/cloud/AZUInitializer.java +++ b/managed/src/main/java/com/yugabyte/yw/cloud/AZUInitializer.java @@ -10,25 +10,28 @@ package com.yugabyte.yw.cloud; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; + import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Singleton; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.common.ApiResponse; import com.yugabyte.yw.forms.YWResults; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.InstanceType; import com.yugabyte.yw.models.InstanceType.InstanceTypeDetails; +import com.yugabyte.yw.models.PriceComponent; import com.yugabyte.yw.models.PriceComponent.PriceDetails; -import play.libs.Json; -import play.mvc.Result; - +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; import java.time.Instant; import java.time.format.DateTimeFormatter; import java.util.Iterator; import java.util.List; import java.util.UUID; - -import static play.mvc.Http.Status.BAD_REQUEST; -import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; +import play.libs.Json; +import play.mvc.Result; @Singleton public class AZUInitializer extends AbstractInitializer { diff --git a/managed/src/main/java/com/yugabyte/yw/cloud/AbstractInitializer.java b/managed/src/main/java/com/yugabyte/yw/cloud/AbstractInitializer.java index 02c1566690ff..a89112ee0472 100644 --- a/managed/src/main/java/com/yugabyte/yw/cloud/AbstractInitializer.java +++ b/managed/src/main/java/com/yugabyte/yw/cloud/AbstractInitializer.java @@ -14,14 +14,13 @@ import com.yugabyte.yw.common.ApiHelper; import com.yugabyte.yw.common.CloudQueryHelper; import com.yugabyte.yw.models.Provider; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.mvc.Result; - import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.mvc.Result; public abstract class AbstractInitializer { public static final Logger LOG = LoggerFactory.getLogger(AbstractInitializer.class); diff --git a/managed/src/main/java/com/yugabyte/yw/cloud/CloudAPI.java b/managed/src/main/java/com/yugabyte/yw/cloud/CloudAPI.java index c74d1b41f820..79a99ea145e6 100644 --- a/managed/src/main/java/com/yugabyte/yw/cloud/CloudAPI.java +++ b/managed/src/main/java/com/yugabyte/yw/cloud/CloudAPI.java @@ -2,13 +2,12 @@ import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.inject.Inject; -import javax.inject.Singleton; import java.util.Map; import java.util.Set; +import javax.inject.Inject; +import javax.inject.Singleton; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public interface CloudAPI { diff --git a/managed/src/main/java/com/yugabyte/yw/cloud/GCPInitializer.java b/managed/src/main/java/com/yugabyte/yw/cloud/GCPInitializer.java index ae11187f1a80..d0dd3b04891a 100644 --- a/managed/src/main/java/com/yugabyte/yw/cloud/GCPInitializer.java +++ b/managed/src/main/java/com/yugabyte/yw/cloud/GCPInitializer.java @@ -10,25 +10,28 @@ package com.yugabyte.yw.cloud; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; + import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Singleton; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.common.ApiResponse; import com.yugabyte.yw.forms.YWResults; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.InstanceType; import com.yugabyte.yw.models.InstanceType.InstanceTypeDetails; +import com.yugabyte.yw.models.PriceComponent; import com.yugabyte.yw.models.PriceComponent.PriceDetails; -import play.libs.Json; -import play.mvc.Result; - +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; import java.time.Instant; import java.time.format.DateTimeFormatter; import java.util.Iterator; import java.util.List; import java.util.UUID; - -import static play.mvc.Http.Status.BAD_REQUEST; -import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; +import play.libs.Json; +import play.mvc.Result; @Singleton public class GCPInitializer extends AbstractInitializer { diff --git a/managed/src/main/java/com/yugabyte/yw/cloud/UniverseResourceDetails.java b/managed/src/main/java/com/yugabyte/yw/cloud/UniverseResourceDetails.java index e51b6adb1ff2..d5b47aa578a7 100644 --- a/managed/src/main/java/com/yugabyte/yw/cloud/UniverseResourceDetails.java +++ b/managed/src/main/java/com/yugabyte/yw/cloud/UniverseResourceDetails.java @@ -10,6 +10,13 @@ package com.yugabyte.yw.cloud; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GP2_SIZE; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_PIOPS; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_SIZE; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_THROUGHPUT; +import static com.yugabyte.yw.cloud.PublicCloudConstants.IO1_PIOPS; +import static com.yugabyte.yw.cloud.PublicCloudConstants.IO1_SIZE; + import com.typesafe.config.Config; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; @@ -22,14 +29,11 @@ import com.yugabyte.yw.models.helpers.NodeDetails; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Collection; import java.util.HashSet; import java.util.UUID; - -import static com.yugabyte.yw.cloud.PublicCloudConstants.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @ApiModel(value = "UniverseResource", description = "Universe Resource") public class UniverseResourceDetails { diff --git a/managed/src/main/java/com/yugabyte/yw/cloud/aws/AWSCloudImpl.java b/managed/src/main/java/com/yugabyte/yw/cloud/aws/AWSCloudImpl.java index 999ba690d816..4b08d8915f25 100644 --- a/managed/src/main/java/com/yugabyte/yw/cloud/aws/AWSCloudImpl.java +++ b/managed/src/main/java/com/yugabyte/yw/cloud/aws/AWSCloudImpl.java @@ -1,16 +1,26 @@ package com.yugabyte.yw.cloud.aws; -import com.amazonaws.auth.*; +import static java.util.stream.Collectors.groupingBy; +import static java.util.stream.Collectors.mapping; +import static java.util.stream.Collectors.toSet; + +import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; import com.amazonaws.services.ec2.AmazonEC2; -import com.amazonaws.services.ec2.AmazonEC2Client; import com.amazonaws.services.ec2.AmazonEC2ClientBuilder; -import com.amazonaws.services.ec2.model.*; -import com.amazonaws.regions.Regions; +import com.amazonaws.services.ec2.model.DescribeInstanceTypeOfferingsRequest; +import com.amazonaws.services.ec2.model.DescribeInstanceTypeOfferingsResult; +import com.amazonaws.services.ec2.model.DescribeInstancesRequest; +import com.amazonaws.services.ec2.model.DryRunResult; +import com.amazonaws.services.ec2.model.Filter; +import com.amazonaws.services.ec2.model.InstanceTypeOffering; +import com.amazonaws.services.ec2.model.LocationType; import com.google.common.base.Strings; import com.yugabyte.yw.cloud.CloudAPI; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; - import java.util.List; import java.util.Map; import java.util.Set; @@ -18,8 +28,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static java.util.stream.Collectors.*; - // TODO - Better handling of UnauthorizedOperation. Ideally we should trigger alert so that // site admin knows about it class AWSCloudImpl implements CloudAPI { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/AbstractTaskBase.java b/managed/src/main/java/com/yugabyte/yw/commissioner/AbstractTaskBase.java index 35e6a84efb49..102107b7bbb2 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/AbstractTaskBase.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/AbstractTaskBase.java @@ -18,19 +18,27 @@ import com.yugabyte.yw.forms.CustomerRegisterFormData; import com.yugabyte.yw.forms.ITaskParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Alert; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.Universe.UniverseUpdater; import com.yugabyte.yw.models.helpers.KnownAlertCodes; import com.yugabyte.yw.models.helpers.NodeDetails; +import java.util.UUID; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import play.Application; import play.api.Play; import play.libs.Json; -import javax.inject.Inject; -import java.util.UUID; -import java.util.concurrent.*; - @Slf4j public abstract class AbstractTaskBase implements ITask { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/BaseTaskDependencies.java b/managed/src/main/java/com/yugabyte/yw/commissioner/BaseTaskDependencies.java index c19f0ad55fc3..8be6095e24d2 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/BaseTaskDependencies.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/BaseTaskDependencies.java @@ -17,13 +17,12 @@ import com.yugabyte.yw.common.alerts.AlertService; import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.common.services.YBClientService; +import javax.inject.Inject; +import javax.inject.Singleton; import lombok.Getter; import lombok.RequiredArgsConstructor; import play.Application; -import javax.inject.Inject; -import javax.inject.Singleton; - @Singleton @Getter @RequiredArgsConstructor(onConstructor_ = {@Inject}) diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/CallHome.java b/managed/src/main/java/com/yugabyte/yw/commissioner/CallHome.java index a45fd05dd4f9..f4306376d729 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/CallHome.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/CallHome.java @@ -6,19 +6,16 @@ import com.google.common.annotations.VisibleForTesting; import com.google.inject.Inject; import com.google.inject.Singleton; - import com.yugabyte.yw.common.CallHomeManager; import com.yugabyte.yw.models.Customer; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import play.Environment; import scala.concurrent.ExecutionContext; import scala.concurrent.duration.Duration; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; - @Singleton public class CallHome { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/Commissioner.java b/managed/src/main/java/com/yugabyte/yw/commissioner/Commissioner.java index d129244d1627..11ed63c3849e 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/Commissioner.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/Commissioner.java @@ -2,35 +2,32 @@ package com.yugabyte.yw.commissioner; +import static play.mvc.Http.Status.BAD_REQUEST; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.google.inject.Singleton; +import com.yugabyte.yw.common.YWServiceException; +import com.yugabyte.yw.forms.ITaskParams; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.TaskInfo; +import com.yugabyte.yw.models.helpers.TaskType; import java.util.Iterator; import java.util.Map; -import java.util.Optional; import java.util.Map.Entry; +import java.util.Optional; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; - -import com.yugabyte.yw.common.YWServiceException; -import com.yugabyte.yw.forms.ITaskParams; -import com.yugabyte.yw.models.CustomerTask; -import com.yugabyte.yw.models.helpers.TaskType; -import com.yugabyte.yw.models.TaskInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.util.concurrent.ThreadFactoryBuilder; -import com.google.inject.Singleton; - import play.libs.Json; -import static play.mvc.Http.Status.*; - @Singleton public class Commissioner { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/Common.java b/managed/src/main/java/com/yugabyte/yw/commissioner/Common.java index 4f9aacda41e8..316ecfa41d27 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/Common.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/Common.java @@ -3,7 +3,6 @@ package com.yugabyte.yw.commissioner; import com.yugabyte.yw.common.ConfigHelper; - import java.util.Optional; public class Common { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/HealthChecker.java b/managed/src/main/java/com/yugabyte/yw/commissioner/HealthChecker.java index e3fb57019fdc..6b16c1653cd7 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/HealthChecker.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/HealthChecker.java @@ -19,20 +19,48 @@ import com.google.inject.Singleton; import com.typesafe.config.Config; import com.yugabyte.yw.commissioner.Common.CloudType; -import com.yugabyte.yw.common.*; +import com.yugabyte.yw.common.EmailHelper; +import com.yugabyte.yw.common.HealthManager; +import com.yugabyte.yw.common.PlacementInfoUtil; +import com.yugabyte.yw.common.ShellResponse; +import com.yugabyte.yw.common.Util; import com.yugabyte.yw.common.alerts.AlertDefinitionLabelsBuilder; import com.yugabyte.yw.common.alerts.AlertService; import com.yugabyte.yw.common.alerts.SmtpData; import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.forms.CustomerRegisterFormData.AlertingData; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AccessKey; +import com.yugabyte.yw.models.Alert; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.HealthCheck; +import com.yugabyte.yw.models.HighAvailabilityConfig; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.filters.AlertFilter; import com.yugabyte.yw.models.helpers.KnownAlertCodes; import com.yugabyte.yw.models.helpers.KnownAlertLabels; import com.yugabyte.yw.models.helpers.NodeDetails; import io.prometheus.client.CollectorRegistry; import io.prometheus.client.Gauge; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import javax.mail.MessagingException; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,11 +70,6 @@ import scala.concurrent.ExecutionContext; import scala.concurrent.duration.Duration; -import javax.mail.MessagingException; -import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.atomic.AtomicBoolean; - @Singleton public class HealthChecker { public static final Logger LOG = LoggerFactory.getLogger(HealthChecker.class); diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/HealthCheckerReport.java b/managed/src/main/java/com/yugabyte/yw/commissioner/HealthCheckerReport.java index 0fd61223e511..403df23d07d2 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/HealthCheckerReport.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/HealthCheckerReport.java @@ -10,12 +10,6 @@ package com.yugabyte.yw.commissioner; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; -import java.net.InetAddress; -import java.net.UnknownHostException; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.util.DefaultIndenter; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; @@ -26,7 +20,11 @@ import com.google.inject.Singleton; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Cluster; import com.yugabyte.yw.models.Universe; - +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/ITask.java b/managed/src/main/java/com/yugabyte/yw/commissioner/ITask.java index 62412d39fdf0..6fc7aa139d6f 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/ITask.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/ITask.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.forms.ITaskParams; - import java.util.UUID; public interface ITask extends Runnable { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/QueryAlerts.java b/managed/src/main/java/com/yugabyte/yw/commissioner/QueryAlerts.java index 7b01fcc8f5ca..9095c687b909 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/QueryAlerts.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/QueryAlerts.java @@ -23,23 +23,35 @@ import com.yugabyte.yw.metrics.MetricQueryHelper; import com.yugabyte.yw.metrics.data.AlertData; import com.yugabyte.yw.metrics.data.AlertState; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Alert; +import com.yugabyte.yw.models.AlertDefinition; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.AlertLabel; +import com.yugabyte.yw.models.HighAvailabilityConfig; import com.yugabyte.yw.models.filters.AlertDefinitionFilter; import com.yugabyte.yw.models.filters.AlertDefinitionGroupFilter; import com.yugabyte.yw.models.filters.AlertFilter; import com.yugabyte.yw.models.helpers.KnownAlertCodes; import com.yugabyte.yw.models.helpers.KnownAlertLabels; import io.jsonwebtoken.lang.Collections; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import scala.concurrent.ExecutionContext; -import scala.concurrent.duration.Duration; - -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import scala.concurrent.ExecutionContext; +import scala.concurrent.duration.Duration; @Singleton @Slf4j diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/SetUniverseKey.java b/managed/src/main/java/com/yugabyte/yw/commissioner/SetUniverseKey.java index b1ac4b5387a7..487b394095cc 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/SetUniverseKey.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/SetUniverseKey.java @@ -25,7 +25,6 @@ import com.yugabyte.yw.models.Universe; import java.util.Arrays; import java.util.Base64; -import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/SubTaskGroupQueue.java b/managed/src/main/java/com/yugabyte/yw/commissioner/SubTaskGroupQueue.java index 65190dcbeb2e..2e6884b9bd48 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/SubTaskGroupQueue.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/SubTaskGroupQueue.java @@ -2,10 +2,9 @@ package com.yugabyte.yw.commissioner; +import com.yugabyte.yw.models.TaskInfo; import java.util.UUID; import java.util.concurrent.CopyOnWriteArrayList; - -import com.yugabyte.yw.models.TaskInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/TaskGarbageCollector.java b/managed/src/main/java/com/yugabyte/yw/commissioner/TaskGarbageCollector.java index 88c1d0b5bdf0..1ef46c06a2e5 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/TaskGarbageCollector.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/TaskGarbageCollector.java @@ -8,16 +8,15 @@ import com.yugabyte.yw.models.CustomerTask; import io.prometheus.client.CollectorRegistry; import io.prometheus.client.Counter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import scala.concurrent.ExecutionContext; - -import javax.inject.Inject; -import javax.inject.Singleton; import java.time.Duration; import java.util.List; import java.util.Optional; import java.util.concurrent.Callable; +import javax.inject.Inject; +import javax.inject.Singleton; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import scala.concurrent.ExecutionContext; @Singleton public class TaskGarbageCollector { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/TaskRunner.java b/managed/src/main/java/com/yugabyte/yw/commissioner/TaskRunner.java index e8d2cd20ae53..46d019ed3448 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/TaskRunner.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/TaskRunner.java @@ -8,16 +8,15 @@ import com.yugabyte.yw.models.ScheduleTask; import com.yugabyte.yw.models.TaskInfo; import com.yugabyte.yw.models.helpers.TaskType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.api.Play; - import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.api.Play; /** * This class is responsible for creating and running a task. It provides all the common diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/UserTaskDetails.java b/managed/src/main/java/com/yugabyte/yw/commissioner/UserTaskDetails.java index fcb04e966720..3bdd5113df38 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/UserTaskDetails.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/UserTaskDetails.java @@ -1,11 +1,10 @@ package com.yugabyte.yw.commissioner; import com.yugabyte.yw.models.TaskInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.ArrayList; import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** Class that encapsulates the user task details. */ public class UserTaskDetails { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/AddNodeToUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/AddNodeToUniverse.java index bf9daa607fba..4043851ce94d 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/AddNodeToUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/AddNodeToUniverse.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.commissioner.tasks; +import static com.yugabyte.yw.common.Util.areMastersUnderReplicated; + import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.Common.CloudType; import com.yugabyte.yw.commissioner.SubTaskGroupQueue; @@ -22,12 +24,16 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.NodeDetails.NodeState; -import lombok.extern.slf4j.Slf4j; - +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import javax.inject.Inject; -import java.util.*; - -import static com.yugabyte.yw.common.Util.areMastersUnderReplicated; +import lombok.extern.slf4j.Slf4j; // Allows the addition of a node into a universe. Spawns the necessary processes - tserver // and/or master and ensures the task waits for the right set of load balance primitives. diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/BackupUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/BackupUniverse.java index 3a89e8c84a1b..0216258e1a0e 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/BackupUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/BackupUniverse.java @@ -16,11 +16,10 @@ import com.yugabyte.yw.forms.BackupTableParams; import com.yugabyte.yw.models.KmsConfig; import com.yugabyte.yw.models.Universe; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.Set; import java.util.stream.Collectors; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class BackupUniverse extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CloudBootstrap.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CloudBootstrap.java index 332ddb886b6a..2b1f6b688444 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CloudBootstrap.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CloudBootstrap.java @@ -10,7 +10,11 @@ package com.yugabyte.yw.commissioner.tasks; -import com.yugabyte.yw.commissioner.*; +import com.yugabyte.yw.commissioner.BaseTaskDependencies; +import com.yugabyte.yw.commissioner.Common; +import com.yugabyte.yw.commissioner.SubTaskGroup; +import com.yugabyte.yw.commissioner.SubTaskGroupQueue; +import com.yugabyte.yw.commissioner.UserTaskDetails; import com.yugabyte.yw.commissioner.tasks.params.CloudTaskParams; import com.yugabyte.yw.commissioner.tasks.subtasks.cloud.CloudAccessKeySetup; import com.yugabyte.yw.commissioner.tasks.subtasks.cloud.CloudInitializer; @@ -19,14 +23,13 @@ import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; import io.swagger.annotations.ApiModel; -import play.libs.Json; - -import javax.inject.Inject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import javax.inject.Inject; +import play.libs.Json; public class CloudBootstrap extends CloudTaskBase { @Inject diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CloudCleanup.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CloudCleanup.java index ca01ce77453d..b44c6b18afa4 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CloudCleanup.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CloudCleanup.java @@ -18,9 +18,8 @@ import com.yugabyte.yw.commissioner.tasks.subtasks.cloud.CloudAccessKeyCleanup; import com.yugabyte.yw.commissioner.tasks.subtasks.cloud.CloudProviderCleanup; import com.yugabyte.yw.commissioner.tasks.subtasks.cloud.CloudRegionCleanup; - -import javax.inject.Inject; import java.util.List; +import javax.inject.Inject; public class CloudCleanup extends CloudTaskBase { @Inject diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CloudTaskBase.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CloudTaskBase.java index 699d23ffa17d..4d54c63862eb 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CloudTaskBase.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CloudTaskBase.java @@ -16,9 +16,8 @@ import com.yugabyte.yw.commissioner.tasks.params.CloudTaskParams; import com.yugabyte.yw.forms.ITaskParams; import com.yugabyte.yw.models.Provider; - -import javax.inject.Inject; import java.util.Map; +import javax.inject.Inject; public abstract class CloudTaskBase extends AbstractTaskBase { private Provider provider; diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateCassandraTable.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateCassandraTable.java index d4f46bfa67f5..e80124cc124b 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateCassandraTable.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateCassandraTable.java @@ -14,11 +14,10 @@ import com.yugabyte.yw.commissioner.SubTaskGroupQueue; import com.yugabyte.yw.commissioner.UserTaskDetails.SubTaskGroupType; import com.yugabyte.yw.forms.TableDefinitionTaskParams; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.Common; -import javax.inject.Inject; - @Slf4j public class CreateCassandraTable extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateKMSConfig.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateKMSConfig.java index 5d19a3cfabd5..356d0764fb7d 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateKMSConfig.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateKMSConfig.java @@ -13,9 +13,8 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.common.kms.EncryptionAtRestManager; import com.yugabyte.yw.models.KmsConfig; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class CreateKMSConfig extends KMSConfigTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateKubernetesUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateKubernetesUniverse.java index 6943b6236e46..3951701705bb 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateKubernetesUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateKubernetesUniverse.java @@ -20,14 +20,13 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.PlacementInfo; +import java.util.Set; +import java.util.UUID; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.Common; import org.yb.client.YBClient; -import javax.inject.Inject; -import java.util.Set; -import java.util.UUID; - @Slf4j public class CreateKubernetesUniverse extends KubernetesTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateUniverse.java index 03ff4427c754..fc0751728721 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/CreateUniverse.java @@ -23,14 +23,13 @@ import com.yugabyte.yw.models.NodeInstance; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; -import org.yb.Common; -import org.yb.client.YBClient; - -import javax.inject.Inject; import java.util.HashMap; import java.util.Map; import java.util.Set; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; +import org.yb.Common; +import org.yb.client.YBClient; @Slf4j public class CreateUniverse extends UniverseDefinitionTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DeleteKMSConfig.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DeleteKMSConfig.java index a793d4a39282..5dcf14ea923e 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DeleteKMSConfig.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DeleteKMSConfig.java @@ -12,9 +12,8 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.common.kms.EncryptionAtRestManager; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class DeleteKMSConfig extends KMSConfigTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DeleteNodeFromUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DeleteNodeFromUniverse.java index 1d44739bbe2b..ba1b2704ef27 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DeleteNodeFromUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DeleteNodeFromUniverse.java @@ -15,9 +15,8 @@ import com.yugabyte.yw.commissioner.UserTaskDetails; import com.yugabyte.yw.commissioner.tasks.params.NodeTaskParams; import com.yugabyte.yw.models.Universe; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class DeleteNodeFromUniverse extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DeleteTable.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DeleteTable.java index 8b8b3ce67d04..f11f32080906 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DeleteTable.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DeleteTable.java @@ -14,9 +14,8 @@ import com.yugabyte.yw.commissioner.SubTaskGroupQueue; import com.yugabyte.yw.commissioner.UserTaskDetails; import com.yugabyte.yw.commissioner.tasks.subtasks.DeleteTableFromUniverse; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class DeleteTable extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DestroyKubernetesUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DestroyKubernetesUniverse.java index 9afa9ba5574f..26c8e73537f8 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DestroyKubernetesUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DestroyKubernetesUniverse.java @@ -21,12 +21,11 @@ import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.PlacementInfo; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.Map; import java.util.Map.Entry; import java.util.UUID; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class DestroyKubernetesUniverse extends DestroyUniverse { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DestroyUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DestroyUniverse.java index 54e88bc6d88a..124ae325e06c 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DestroyUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/DestroyUniverse.java @@ -10,6 +10,9 @@ package com.yugabyte.yw.commissioner.tasks; +import static com.yugabyte.yw.models.helpers.EntityOperation.DELETE; +import static com.yugabyte.yw.models.helpers.EntityOperation.UPDATE; + import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.Common.CloudType; import com.yugabyte.yw.commissioner.SubTaskGroup; @@ -27,16 +30,12 @@ import com.yugabyte.yw.models.filters.AlertFilter; import com.yugabyte.yw.models.helpers.EntityOperation; import com.yugabyte.yw.models.helpers.KnownAlertLabels; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.stream.Collectors; - -import static com.yugabyte.yw.models.helpers.EntityOperation.DELETE; -import static com.yugabyte.yw.models.helpers.EntityOperation.UPDATE; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class DestroyUniverse extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/EditKubernetesUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/EditKubernetesUniverse.java index 05ab4bfc43d1..4ae271151a36 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/EditKubernetesUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/EditKubernetesUniverse.java @@ -23,10 +23,13 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.PlacementInfo; -import lombok.extern.slf4j.Slf4j; - +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import java.util.UUID; import javax.inject.Inject; -import java.util.*; +import lombok.extern.slf4j.Slf4j; @Slf4j public class EditKubernetesUniverse extends KubernetesTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/EditUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/EditUniverse.java index d61a49f5ff54..600e034b9142 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/EditUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/EditUniverse.java @@ -21,11 +21,18 @@ import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.UserIntent; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import java.util.stream.Collectors; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; // Tracks edit intents to the cluster and then performs the sequence of configuration changes on // this universe to go from the current set of master/tserver nodes to the final configuration. diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ImportIntoTable.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ImportIntoTable.java index 0a36a5a2e9b1..4b7c1bafeed0 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ImportIntoTable.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ImportIntoTable.java @@ -6,9 +6,8 @@ import com.yugabyte.yw.commissioner.SubTaskGroupQueue; import com.yugabyte.yw.commissioner.UserTaskDetails; import com.yugabyte.yw.forms.BulkImportParams; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class ImportIntoTable extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KMSConfigTaskBase.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KMSConfigTaskBase.java index b017da52ded8..32e473e00600 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KMSConfigTaskBase.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KMSConfigTaskBase.java @@ -15,7 +15,6 @@ import com.yugabyte.yw.commissioner.tasks.params.KMSConfigTaskParams; import com.yugabyte.yw.common.kms.EncryptionAtRestManager; import com.yugabyte.yw.forms.ITaskParams; - import javax.inject.Inject; public abstract class KMSConfigTaskBase extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KubernetesProvision.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KubernetesProvision.java index b314a017d44f..a44e6d5a477a 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KubernetesProvision.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KubernetesProvision.java @@ -16,9 +16,8 @@ import com.yugabyte.yw.commissioner.UserTaskDetails; import com.yugabyte.yw.commissioner.tasks.params.KubernetesClusterInitParams; import com.yugabyte.yw.commissioner.tasks.subtasks.KubernetesCommandExecutor; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class KubernetesProvision extends CloudTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KubernetesTaskBase.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KubernetesTaskBase.java index 835e4aa4481f..57c95e9f41b8 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KubernetesTaskBase.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KubernetesTaskBase.java @@ -16,12 +16,19 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.PlacementInfo; - -import javax.inject.Inject; -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Set; +import java.util.UUID; import java.util.function.Function; import java.util.stream.Collectors; +import javax.inject.Inject; public abstract class KubernetesTaskBase extends UniverseDefinitionTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/MultiTableBackup.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/MultiTableBackup.java index 2aa54433b917..4bbd0202bdab 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/MultiTableBackup.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/MultiTableBackup.java @@ -10,12 +10,22 @@ package com.yugabyte.yw.commissioner.tasks; +import static com.yugabyte.yw.common.Util.getUUIDRepresentation; +import static org.yb.Common.TableType; + import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.SubTaskGroupQueue; import com.yugabyte.yw.commissioner.UserTaskDetails; import com.yugabyte.yw.forms.BackupTableParams; import com.yugabyte.yw.models.Backup; import com.yugabyte.yw.models.Universe; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.GetTableSchemaResponse; import org.yb.client.ListTablesResponse; @@ -23,12 +33,6 @@ import org.yb.master.Master.ListTablesResponsePB.TableInfo; import org.yb.master.Master.RelationType; -import javax.inject.Inject; -import java.util.*; - -import static com.yugabyte.yw.common.Util.getUUIDRepresentation; -import static org.yb.Common.TableType; - @Slf4j public class MultiTableBackup extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/PauseUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/PauseUniverse.java index 279a0d3b0573..0e16b48a575a 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/PauseUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/PauseUniverse.java @@ -17,12 +17,11 @@ import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.HashSet; import java.util.Set; import java.util.UUID; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class PauseUniverse extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReadOnlyClusterCreate.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReadOnlyClusterCreate.java index 94e658c34011..a424d810af12 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReadOnlyClusterCreate.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReadOnlyClusterCreate.java @@ -21,13 +21,12 @@ import com.yugabyte.yw.models.NodeInstance; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Set; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; // Tracks the read only cluster create intent within an existing universe. @Slf4j diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReadOnlyClusterDelete.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReadOnlyClusterDelete.java index a584c658acb7..471bfca593fd 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReadOnlyClusterDelete.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReadOnlyClusterDelete.java @@ -19,10 +19,9 @@ import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Cluster; import com.yugabyte.yw.models.Universe; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.UUID; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; // Tracks a read only cluster delete intent from a universe. @Slf4j diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReleaseInstanceFromUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReleaseInstanceFromUniverse.java index e71940def8a5..c8a2e9dff1ad 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReleaseInstanceFromUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ReleaseInstanceFromUniverse.java @@ -20,12 +20,11 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.NodeDetails.NodeState; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; // Allows the removal of the instance from a universe. That node is already not part of the // universe and is in Removed state. diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/RemoveNodeFromUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/RemoveNodeFromUniverse.java index 5ca56eeecae4..451ac724f391 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/RemoveNodeFromUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/RemoveNodeFromUniverse.java @@ -23,11 +23,10 @@ import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.NodeDetails.NodeState; import com.yugabyte.yw.models.helpers.PlacementInfo; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.Arrays; import java.util.HashSet; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; // Allows the removal of a node from a universe. Ensures the task waits for the right set of // server data move primitives. And stops using the underlying instance, though YW still owns it. diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ResumeUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ResumeUniverse.java index edee347b8e59..a6d238e55c7f 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ResumeUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/ResumeUniverse.java @@ -18,12 +18,11 @@ import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.HashSet; import java.util.Set; import java.util.UUID; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class ResumeUniverse extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/SetUniverseKey.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/SetUniverseKey.java index 3367617a521f..11cc30cc9b51 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/SetUniverseKey.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/SetUniverseKey.java @@ -15,9 +15,8 @@ import com.yugabyte.yw.commissioner.SubTaskGroupQueue; import com.yugabyte.yw.commissioner.UserTaskDetails.SubTaskGroupType; import com.yugabyte.yw.forms.EncryptionAtRestKeyParams; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class SetUniverseKey extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/StartMasterOnNode.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/StartMasterOnNode.java index 00d9902dd5b5..4a571588d40c 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/StartMasterOnNode.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/StartMasterOnNode.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.commissioner.tasks; +import static com.yugabyte.yw.common.Util.areMastersUnderReplicated; + import com.google.common.collect.ImmutableList; import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.SubTaskGroupQueue; @@ -18,13 +20,10 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.NodeDetails.NodeState; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.Arrays; import java.util.HashSet; - -import static com.yugabyte.yw.common.Util.areMastersUnderReplicated; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; // Allows the addition of the master server to a node. Spawns master the process and ensures // the task waits for the right set of load balance primitives. diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/StartNodeInUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/StartNodeInUniverse.java index 5155df8f0104..aef56fb40fdb 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/StartNodeInUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/StartNodeInUniverse.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.commissioner.tasks; +import static com.yugabyte.yw.common.Util.areMastersUnderReplicated; + import com.google.common.collect.ImmutableList; import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.SubTaskGroupQueue; @@ -20,13 +22,10 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.NodeDetails.NodeState; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.Arrays; import java.util.HashSet; - -import static com.yugabyte.yw.common.Util.areMastersUnderReplicated; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; /** * Class contains the tasks to start a node in a given universe. It starts the tserver process and diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/StopNodeInUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/StopNodeInUniverse.java index 86b68c44e723..7bb8938241fb 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/StopNodeInUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/StopNodeInUniverse.java @@ -20,11 +20,10 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.NodeDetails.NodeState; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.Arrays; import java.util.HashSet; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class StopNodeInUniverse extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/SyncDBStateWithPlatform.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/SyncDBStateWithPlatform.java index f0eb59bcede7..4b413f0233d9 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/SyncDBStateWithPlatform.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/SyncDBStateWithPlatform.java @@ -4,11 +4,10 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.SubTaskGroupQueue; import com.yugabyte.yw.commissioner.UserTaskDetails; +import javax.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Inject; - public class SyncDBStateWithPlatform extends UniverseDefinitionTaskBase { public static final Logger LOG = LoggerFactory.getLogger(SyncDBStateWithPlatform.class); diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UniverseDefinitionTaskBase.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UniverseDefinitionTaskBase.java index 2cd04ecd126f..089d7ccd38bd 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UniverseDefinitionTaskBase.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UniverseDefinitionTaskBase.java @@ -9,7 +9,14 @@ import com.yugabyte.yw.commissioner.UserTaskDetails.SubTaskGroupType; import com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskType; import com.yugabyte.yw.commissioner.tasks.params.NodeTaskParams; -import com.yugabyte.yw.commissioner.tasks.subtasks.*; +import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleClusterServerCtl; +import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleConfigureServers; +import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleSetupServer; +import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleUpdateNodeInfo; +import com.yugabyte.yw.commissioner.tasks.subtasks.InstanceActions; +import com.yugabyte.yw.commissioner.tasks.subtasks.PrecheckNode; +import com.yugabyte.yw.commissioner.tasks.subtasks.WaitForMasterLeader; +import com.yugabyte.yw.commissioner.tasks.subtasks.WaitForTServerHeartBeats; import com.yugabyte.yw.common.NodeManager; import com.yugabyte.yw.common.PlacementInfoUtil; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; @@ -25,16 +32,21 @@ import com.yugabyte.yw.models.helpers.CloudSpecificInfo; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.PlacementInfo; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import play.Configuration; - -import javax.inject.Inject; -import java.time.Duration; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import play.Configuration; /** * Abstract base class for all tasks that create/edit the universe definition. These include the diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UniverseTaskBase.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UniverseTaskBase.java index 6f7afa3cbc5e..ce505462ad43 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UniverseTaskBase.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UniverseTaskBase.java @@ -11,18 +11,74 @@ import com.yugabyte.yw.commissioner.UserTaskDetails.SubTaskGroupType; import com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase.ServerType; import com.yugabyte.yw.commissioner.tasks.params.NodeTaskParams; -import com.yugabyte.yw.commissioner.tasks.subtasks.*; +import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleClusterServerCtl; +import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleDestroyServer; +import com.yugabyte.yw.commissioner.tasks.subtasks.AsyncReplicationPlatformSync; +import com.yugabyte.yw.commissioner.tasks.subtasks.BackupTable; +import com.yugabyte.yw.commissioner.tasks.subtasks.BackupUniverseKeys; +import com.yugabyte.yw.commissioner.tasks.subtasks.BulkImport; +import com.yugabyte.yw.commissioner.tasks.subtasks.ChangeMasterConfig; +import com.yugabyte.yw.commissioner.tasks.subtasks.CreateAlertDefinitions; +import com.yugabyte.yw.commissioner.tasks.subtasks.CreateTable; +import com.yugabyte.yw.commissioner.tasks.subtasks.DeleteBackup; +import com.yugabyte.yw.commissioner.tasks.subtasks.DeleteNode; +import com.yugabyte.yw.commissioner.tasks.subtasks.DeleteTableFromUniverse; +import com.yugabyte.yw.commissioner.tasks.subtasks.DestroyEncryptionAtRest; +import com.yugabyte.yw.commissioner.tasks.subtasks.DisableEncryptionAtRest; +import com.yugabyte.yw.commissioner.tasks.subtasks.EnableEncryptionAtRest; +import com.yugabyte.yw.commissioner.tasks.subtasks.LoadBalancerStateChange; +import com.yugabyte.yw.commissioner.tasks.subtasks.ManipulateDnsRecordTask; +import com.yugabyte.yw.commissioner.tasks.subtasks.ModifyBlackList; +import com.yugabyte.yw.commissioner.tasks.subtasks.PauseServer; +import com.yugabyte.yw.commissioner.tasks.subtasks.PersistResizeNode; +import com.yugabyte.yw.commissioner.tasks.subtasks.ResetUniverseVersion; +import com.yugabyte.yw.commissioner.tasks.subtasks.RestoreUniverseKeys; +import com.yugabyte.yw.commissioner.tasks.subtasks.ResumeServer; +import com.yugabyte.yw.commissioner.tasks.subtasks.SetFlagInMemory; +import com.yugabyte.yw.commissioner.tasks.subtasks.SetNodeState; +import com.yugabyte.yw.commissioner.tasks.subtasks.SwamperTargetsFileUpdate; +import com.yugabyte.yw.commissioner.tasks.subtasks.UnivSetCertificate; +import com.yugabyte.yw.commissioner.tasks.subtasks.UniverseUpdateSucceeded; +import com.yugabyte.yw.commissioner.tasks.subtasks.UpdateAndPersistGFlags; +import com.yugabyte.yw.commissioner.tasks.subtasks.UpdatePlacementInfo; +import com.yugabyte.yw.commissioner.tasks.subtasks.UpdateSoftwareVersion; +import com.yugabyte.yw.commissioner.tasks.subtasks.WaitForDataMove; +import com.yugabyte.yw.commissioner.tasks.subtasks.WaitForEncryptionKeyInMemory; +import com.yugabyte.yw.commissioner.tasks.subtasks.WaitForLeadersOnPreferredOnly; +import com.yugabyte.yw.commissioner.tasks.subtasks.WaitForLoadBalance; +import com.yugabyte.yw.commissioner.tasks.subtasks.WaitForMasterLeader; +import com.yugabyte.yw.commissioner.tasks.subtasks.WaitForServer; +import com.yugabyte.yw.commissioner.tasks.subtasks.WaitForServerReady; import com.yugabyte.yw.commissioner.tasks.subtasks.nodes.UpdateNodeProcess; import com.yugabyte.yw.common.DnsManager; import com.yugabyte.yw.common.NodeManager; import com.yugabyte.yw.common.ShellResponse; import com.yugabyte.yw.common.services.YBClientService; -import com.yugabyte.yw.forms.*; +import com.yugabyte.yw.forms.BackupTableParams; +import com.yugabyte.yw.forms.BulkImportParams; +import com.yugabyte.yw.forms.ITaskParams; +import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; +import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.forms.UniverseTaskParams.EncryptionAtRestConfig.OpType; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Backup; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.NodeInstance; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.Universe.UniverseUpdater; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.TableDetails; +import java.time.Duration; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.UUID; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.yb.Common; @@ -31,11 +87,6 @@ import play.api.Play; import play.libs.Json; -import javax.inject.Inject; -import java.time.Duration; -import java.util.*; -import java.util.Map.Entry; - @Slf4j public abstract class UniverseTaskBase extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpdateDiskSize.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpdateDiskSize.java index e84c2c8271f1..5e62795af5b6 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpdateDiskSize.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpdateDiskSize.java @@ -18,10 +18,9 @@ import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Cluster; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.Set; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class UpdateDiskSize extends UniverseDefinitionTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpgradeKubernetesUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpgradeKubernetesUniverse.java index e61012e5ce8c..575e0f4dcb69 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpgradeKubernetesUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpgradeKubernetesUniverse.java @@ -22,10 +22,9 @@ import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.PlacementInfo; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.UUID; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class UpgradeKubernetesUniverse extends KubernetesTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpgradeUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpgradeUniverse.java index 52969073d2e1..3b543dea391d 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpgradeUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpgradeUniverse.java @@ -10,36 +10,55 @@ package com.yugabyte.yw.commissioner.tasks; +import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.Stopping; +import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.ToggleTls; +import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.UpdateCert; +import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.UpdateGFlags; +import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.UpgradeSoftware; + +import com.google.common.collect.ImmutableList; +import com.typesafe.config.Config; import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.commissioner.SubTaskGroup; import com.yugabyte.yw.commissioner.SubTaskGroupQueue; import com.yugabyte.yw.commissioner.UserTaskDetails.SubTaskGroupType; -import com.yugabyte.yw.commissioner.tasks.subtasks.*; +import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleConfigureServers; +import com.yugabyte.yw.commissioner.tasks.subtasks.ChangeInstanceType; +import com.yugabyte.yw.commissioner.tasks.subtasks.CreateRootVolumes; +import com.yugabyte.yw.commissioner.tasks.subtasks.ReplaceRootVolume; +import com.yugabyte.yw.commissioner.tasks.subtasks.UniverseSetTlsParams; +import com.yugabyte.yw.commissioner.tasks.subtasks.UpdateNodeDetails; import com.yugabyte.yw.common.CertificateHelper; -import com.yugabyte.yw.common.NodeManager; import com.yugabyte.yw.common.PlacementInfoUtil; -import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.UserIntent; import com.yugabyte.yw.forms.UpgradeParams; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.CertificateInfo; +import com.yugabyte.yw.models.InstanceType; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.helpers.DeviceInfo; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.PlacementInfo; -import com.yugabyte.yw.models.helpers.DeviceInfo; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.google.common.collect.ImmutableList; import play.api.Play; -import com.typesafe.config.Config; - -import javax.inject.Inject; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.*; @Slf4j public class UpgradeUniverse extends UniverseDefinitionTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/CloudTaskParams.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/CloudTaskParams.java index be3427fb5f69..e30ee5e56c86 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/CloudTaskParams.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/CloudTaskParams.java @@ -3,7 +3,6 @@ package com.yugabyte.yw.commissioner.tasks.params; import com.yugabyte.yw.forms.AbstractTaskParams; - import java.util.UUID; public class CloudTaskParams extends AbstractTaskParams { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/KMSConfigTaskParams.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/KMSConfigTaskParams.java index 8ecd1ffa2bac..cd0e8a2ae075 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/KMSConfigTaskParams.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/KMSConfigTaskParams.java @@ -2,8 +2,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.kms.util.KeyProvider; -import com.yugabyte.yw.models.KmsConfig; import com.yugabyte.yw.forms.AbstractTaskParams; +import com.yugabyte.yw.models.KmsConfig; import java.util.UUID; public class KMSConfigTaskParams extends AbstractTaskParams { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/NodeTaskParams.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/NodeTaskParams.java index f9188ec33cbf..74e0e6dff346 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/NodeTaskParams.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/NodeTaskParams.java @@ -2,15 +2,14 @@ package com.yugabyte.yw.commissioner.tasks.params; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.models.AvailabilityZone; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; public class NodeTaskParams extends UniverseDefinitionTaskParams { // The AZ in which the node should be. This can be used to find the region. diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/ServerSubTaskParams.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/ServerSubTaskParams.java index 56e548b92ad9..bb8de949b91a 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/ServerSubTaskParams.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/params/ServerSubTaskParams.java @@ -1,7 +1,6 @@ package com.yugabyte.yw.commissioner.tasks.params; import com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase.ServerType; - import com.yugabyte.yw.forms.UniverseTaskParams; public class ServerSubTaskParams extends UniverseTaskParams { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleClusterServerCtl.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleClusterServerCtl.java index 49e44daefbfa..1e4c6272fd02 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleClusterServerCtl.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleClusterServerCtl.java @@ -14,9 +14,8 @@ import com.yugabyte.yw.commissioner.tasks.params.NodeTaskParams; import com.yugabyte.yw.common.NodeManager; import com.yugabyte.yw.common.ShellResponse; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class AnsibleClusterServerCtl extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleConfigureServers.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleConfigureServers.java index c61284252867..5096a245ab1c 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleConfigureServers.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleConfigureServers.java @@ -27,11 +27,14 @@ import com.yugabyte.yw.models.helpers.KnownAlertCodes; import com.yugabyte.yw.models.helpers.KnownAlertLabels; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class AnsibleConfigureServers extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleDestroyServer.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleDestroyServer.java index 5dd2be4e1ddf..10a886531fc8 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleDestroyServer.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleDestroyServer.java @@ -21,9 +21,8 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.Universe.UniverseUpdater; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class AnsibleDestroyServer extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleSetupServer.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleSetupServer.java index e5a334b25899..9f241e3761f4 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleSetupServer.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleSetupServer.java @@ -17,10 +17,9 @@ import com.yugabyte.yw.common.ShellResponse; import com.yugabyte.yw.models.AccessKey; import com.yugabyte.yw.models.Provider; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.List; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class AnsibleSetupServer extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleUpdateNodeInfo.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleUpdateNodeInfo.java index ff4bd4b7f66a..91b5b348cb63 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleUpdateNodeInfo.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AnsibleUpdateNodeInfo.java @@ -20,13 +20,12 @@ import com.yugabyte.yw.models.Universe.UniverseUpdater; import com.yugabyte.yw.models.helpers.CloudSpecificInfo; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; -import play.libs.Json; - -import javax.inject.Inject; import java.lang.reflect.Field; import java.util.Iterator; import java.util.Map.Entry; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; +import play.libs.Json; @Slf4j public class AnsibleUpdateNodeInfo extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AsyncReplicationPlatformSync.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AsyncReplicationPlatformSync.java index d3bc50455dae..a0ff4ed56112 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AsyncReplicationPlatformSync.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/AsyncReplicationPlatformSync.java @@ -8,6 +8,11 @@ import com.yugabyte.yw.forms.ITaskParams; import com.yugabyte.yw.models.AsyncReplicationRelationship; import com.yugabyte.yw.models.Universe; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import javax.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yb.cdc.CdcConsumer; @@ -15,12 +20,6 @@ import org.yb.master.Master; import play.api.Play; -import javax.inject.Inject; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - public class AsyncReplicationPlatformSync extends UniverseDefinitionTaskBase { public static final Logger LOG = LoggerFactory.getLogger(AsyncReplicationPlatformSync.class); diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/BackupTable.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/BackupTable.java index 4e7a14bc7257..6203c655d07d 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/BackupTable.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/BackupTable.java @@ -17,13 +17,11 @@ import com.yugabyte.yw.forms.BackupTableParams; import com.yugabyte.yw.models.Backup; import com.yugabyte.yw.models.Universe; -import lombok.extern.slf4j.Slf4j; -import play.libs.Json; - -import javax.inject.Inject; - import java.util.List; import java.util.Map; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; +import play.libs.Json; @Slf4j public class BackupTable extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/BackupUniverseKeys.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/BackupUniverseKeys.java index f468cb8ff084..a6d210752c90 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/BackupUniverseKeys.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/BackupUniverseKeys.java @@ -14,9 +14,8 @@ import com.yugabyte.yw.common.kms.EncryptionAtRestManager; import com.yugabyte.yw.forms.BackupTableParams; import com.yugabyte.yw.models.Universe; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class BackupUniverseKeys extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/BulkImport.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/BulkImport.java index 1d003bde4d2b..fe2de6cd5922 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/BulkImport.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/BulkImport.java @@ -13,7 +13,6 @@ import com.yugabyte.yw.commissioner.AbstractTaskBase; import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.forms.BulkImportParams; - import javax.inject.Inject; public class BulkImport extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ChangeInstanceType.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ChangeInstanceType.java index 130bf4cb4896..900562594176 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ChangeInstanceType.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ChangeInstanceType.java @@ -7,14 +7,10 @@ import com.yugabyte.yw.commissioner.tasks.params.NodeTaskParams; import com.yugabyte.yw.common.NodeManager; import com.yugabyte.yw.common.ShellResponse; - import com.yugabyte.yw.models.Universe; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; -import java.util.UUID; - public class ChangeInstanceType extends NodeTaskBase { public static final Logger LOG = LoggerFactory.getLogger(PauseServer.class); diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ChangeMasterConfig.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ChangeMasterConfig.java index bb02dec0d08a..5bd1481d6594 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ChangeMasterConfig.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ChangeMasterConfig.java @@ -15,12 +15,11 @@ import com.yugabyte.yw.commissioner.tasks.params.NodeTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.ChangeConfigResponse; import org.yb.client.YBClient; -import javax.inject.Inject; - @Slf4j public class ChangeMasterConfig extends AbstractTaskBase { @Inject diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreateAlertDefinitions.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreateAlertDefinitions.java index 39cf0c5595b3..3b398e214b61 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreateAlertDefinitions.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreateAlertDefinitions.java @@ -9,11 +9,10 @@ import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.filters.AlertDefinitionGroupFilter; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.List; import java.util.stream.Collectors; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class CreateAlertDefinitions extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreatePrometheusSwamperConfig.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreatePrometheusSwamperConfig.java index 31e5a5877693..bc13a40ff69f 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreatePrometheusSwamperConfig.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreatePrometheusSwamperConfig.java @@ -12,9 +12,8 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.SubTaskGroupQueue; import com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class CreatePrometheusSwamperConfig extends UniverseDefinitionTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreateRootVolumes.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreateRootVolumes.java index c847c415a0b2..705f2eb904a4 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreateRootVolumes.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreateRootVolumes.java @@ -4,13 +4,12 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.common.NodeManager; import com.yugabyte.yw.common.ShellResponse; -import play.libs.Json; - -import javax.inject.Inject; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.CopyOnWriteArrayList; +import javax.inject.Inject; +import play.libs.Json; public class CreateRootVolumes extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreateTable.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreateTable.java index 4f9dba7b156f..3fd56d1ee37e 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreateTable.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/CreateTable.java @@ -18,18 +18,16 @@ import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.TableDetails; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.net.InetSocketAddress; +import java.util.List; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.yb.Common.TableType; import org.yb.client.YBClient; import org.yb.client.YBTable; -import javax.inject.Inject; -import java.net.InetSocketAddress; -import java.util.List; - @Slf4j public class CreateTable extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteBackup.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteBackup.java index 73db6b8f94ea..069d2c9438a8 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteBackup.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteBackup.java @@ -18,12 +18,11 @@ import com.yugabyte.yw.forms.AbstractTaskParams; import com.yugabyte.yw.forms.BackupTableParams; import com.yugabyte.yw.models.Backup; -import lombok.extern.slf4j.Slf4j; -import play.libs.Json; - -import javax.inject.Inject; import java.util.List; import java.util.UUID; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; +import play.libs.Json; @Slf4j public class DeleteBackup extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteClusterFromUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteClusterFromUniverse.java index 791d9bdb3625..b96e24f93c11 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteClusterFromUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteClusterFromUniverse.java @@ -15,10 +15,9 @@ import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.UUID; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class DeleteClusterFromUniverse extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteNode.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteNode.java index 16f4d33c6535..a42c29b0ea8c 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteNode.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteNode.java @@ -10,6 +10,10 @@ package com.yugabyte.yw.commissioner.tasks.subtasks; +import static com.yugabyte.yw.common.PlacementInfoUtil.isNodeRemovable; +import static com.yugabyte.yw.common.PlacementInfoUtil.removeNodeByName; +import static com.yugabyte.yw.common.PlacementInfoUtil.updatePlacementInfo; + import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.common.NodeManager; @@ -18,12 +22,9 @@ import com.yugabyte.yw.models.NodeInstance; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.Set; - -import static com.yugabyte.yw.common.PlacementInfoUtil.*; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class DeleteNode extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteTableFromUniverse.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteTableFromUniverse.java index d153861c8e15..1c23ac740a0f 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteTableFromUniverse.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DeleteTableFromUniverse.java @@ -14,11 +14,10 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.forms.TableTaskParams; import com.yugabyte.yw.models.Universe; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.YBClient; -import javax.inject.Inject; - @Slf4j public class DeleteTableFromUniverse extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DestroyEncryptionAtRest.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DestroyEncryptionAtRest.java index 017b3652eb5a..f258c747f5b5 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DestroyEncryptionAtRest.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DestroyEncryptionAtRest.java @@ -16,10 +16,9 @@ import com.yugabyte.yw.forms.EncryptionAtRestKeyParams; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Universe; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.UUID; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class DestroyEncryptionAtRest extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DisableEncryptionAtRest.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DisableEncryptionAtRest.java index 48b897d34df3..17175ae50c52 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DisableEncryptionAtRest.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/DisableEncryptionAtRest.java @@ -13,11 +13,10 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.forms.EncryptionAtRestKeyParams; import com.yugabyte.yw.models.Universe; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.YBClient; -import javax.inject.Inject; - @Slf4j public class DisableEncryptionAtRest extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/EnableEncryptionAtRest.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/EnableEncryptionAtRest.java index 01159c42422d..d0971eed41a7 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/EnableEncryptionAtRest.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/EnableEncryptionAtRest.java @@ -17,15 +17,14 @@ import com.yugabyte.yw.common.kms.util.EncryptionAtRestUtil; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.models.Universe; -import lombok.extern.slf4j.Slf4j; -import org.yb.client.YBClient; -import org.yb.util.Pair; - -import javax.inject.Inject; import java.util.Arrays; import java.util.Base64; import java.util.List; import java.util.stream.Collectors; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; +import org.yb.client.YBClient; +import org.yb.util.Pair; @Slf4j public class EnableEncryptionAtRest extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/InstanceActions.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/InstanceActions.java index c719d40f9ab3..fbe7883e68ea 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/InstanceActions.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/InstanceActions.java @@ -14,9 +14,8 @@ import com.yugabyte.yw.commissioner.tasks.params.NodeTaskParams; import com.yugabyte.yw.common.NodeManager; import com.yugabyte.yw.common.ShellResponse; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class InstanceActions extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesCheckNumPod.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesCheckNumPod.java index e399caa98e7f..f06bacfe1c55 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesCheckNumPod.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesCheckNumPod.java @@ -19,7 +19,6 @@ import com.yugabyte.yw.common.ShellResponse; import com.yugabyte.yw.forms.AbstractTaskParams; import com.yugabyte.yw.models.Provider; - import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesCommandExecutor.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesCommandExecutor.java index c0ab808cbfd7..4d66cdb66dbc 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesCommandExecutor.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesCommandExecutor.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.commissioner.tasks.subtasks; +import static com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ExposingServiceState; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -25,24 +27,31 @@ import com.yugabyte.yw.common.ShellResponse; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseTaskParams; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.InstanceType; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.PlacementInfo; -import lombok.extern.slf4j.Slf4j; -import org.yaml.snakeyaml.Yaml; -import play.libs.Json; - import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; import java.util.Map.Entry; +import java.util.Set; +import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; - -import static com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ExposingServiceState; +import lombok.extern.slf4j.Slf4j; +import org.yaml.snakeyaml.Yaml; +import play.libs.Json; @Slf4j public class KubernetesCommandExecutor extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesWaitForPod.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesWaitForPod.java index 2a6cf29d0c98..571d4cf3b7ef 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesWaitForPod.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/KubernetesWaitForPod.java @@ -19,13 +19,12 @@ import com.yugabyte.yw.common.ShellResponse; import com.yugabyte.yw.forms.AbstractTaskParams; import com.yugabyte.yw.models.Provider; -import play.libs.Json; - import java.util.ArrayList; import java.util.Iterator; import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; +import play.libs.Json; public class KubernetesWaitForPod extends AbstractTaskBase { public enum CommandType { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/LoadBalancerStateChange.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/LoadBalancerStateChange.java index 7a2495c9bd84..2bef91890e99 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/LoadBalancerStateChange.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/LoadBalancerStateChange.java @@ -14,12 +14,11 @@ import com.yugabyte.yw.commissioner.tasks.UniverseTaskBase; import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.ChangeLoadBalancerStateResponse; import org.yb.client.YBClient; -import javax.inject.Inject; - // This class runs the task that helps modify the load balancer state maintained // on the master leader. @Slf4j diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ManipulateDnsRecordTask.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ManipulateDnsRecordTask.java index a2c64c59eea6..c2eec222dc6f 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ManipulateDnsRecordTask.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ManipulateDnsRecordTask.java @@ -18,11 +18,10 @@ import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - import java.util.List; import java.util.UUID; import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; @Slf4j public class ManipulateDnsRecordTask extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ModifyBlackList.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ModifyBlackList.java index 1441b301353d..7187c3b8a162 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ModifyBlackList.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ModifyBlackList.java @@ -15,16 +15,15 @@ import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.Common.HostPortPB; import org.yb.client.ModifyMasterClusterConfigBlacklist; import org.yb.client.YBClient; -import javax.inject.Inject; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - // This class runs the task that helps modify the existing list of blacklisted servers maintained // on the master leader. @Slf4j diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/NodeTaskBase.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/NodeTaskBase.java index 8b5c837c1186..8fb34b71b498 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/NodeTaskBase.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/NodeTaskBase.java @@ -17,9 +17,8 @@ import com.yugabyte.yw.common.NodeManager; import com.yugabyte.yw.models.Universe.UniverseUpdater; import com.yugabyte.yw.models.helpers.NodeDetails; -import play.libs.Json; - import javax.inject.Inject; +import play.libs.Json; public abstract class NodeTaskBase extends UniverseDefinitionTaskBase { private final NodeManager nodeManager; diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/PauseServer.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/PauseServer.java index 6954caf5dcdf..3089034827a7 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/PauseServer.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/PauseServer.java @@ -16,9 +16,8 @@ import com.yugabyte.yw.common.ShellResponse; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class PauseServer extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/PersistResizeNode.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/PersistResizeNode.java index 7f29824bd4a3..a2c725f82b6a 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/PersistResizeNode.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/PersistResizeNode.java @@ -3,19 +3,16 @@ package com.yugabyte.yw.commissioner.tasks.subtasks; import com.google.inject.Inject; -import java.util.UUID; - import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.tasks.UniverseTaskBase; -import com.yugabyte.yw.forms.UniverseTaskParams; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; -import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.UserIntent; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Cluster; +import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.UserIntent; +import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.Universe.UniverseUpdater; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class PersistResizeNode extends UniverseTaskBase { public static final Logger LOG = LoggerFactory.getLogger(PersistResizeNode.class); diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/PrecheckNode.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/PrecheckNode.java index ef3e9e010050..34751bae91af 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/PrecheckNode.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/PrecheckNode.java @@ -14,9 +14,8 @@ import com.yugabyte.yw.commissioner.tasks.UniverseTaskBase; import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.NodeInstance; - -import javax.inject.Inject; import java.util.Map; +import javax.inject.Inject; public class PrecheckNode extends UniverseTaskBase { @Inject diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/RemoveUniverseEntry.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/RemoveUniverseEntry.java index a103f9b34ba8..b92846339b65 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/RemoveUniverseEntry.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/RemoveUniverseEntry.java @@ -15,7 +15,6 @@ import com.yugabyte.yw.commissioner.tasks.UniverseTaskBase; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Universe; - import javax.inject.Inject; public class RemoveUniverseEntry extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ReplaceRootVolume.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ReplaceRootVolume.java index 4c94684deb57..9e303d1d23ec 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ReplaceRootVolume.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ReplaceRootVolume.java @@ -4,11 +4,10 @@ import com.yugabyte.yw.commissioner.tasks.params.NodeTaskParams; import com.yugabyte.yw.common.NodeManager; import com.yugabyte.yw.common.ShellResponse; - -import javax.inject.Inject; import java.util.List; import java.util.Map; import java.util.UUID; +import javax.inject.Inject; public class ReplaceRootVolume extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ResetUniverseVersion.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ResetUniverseVersion.java index fc933fe55033..ef8186aa72b9 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ResetUniverseVersion.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ResetUniverseVersion.java @@ -1,25 +1,13 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.commissioner.tasks.subtasks; -import com.google.common.collect.Sets; import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase; -import com.yugabyte.yw.common.services.YBClientService; import com.yugabyte.yw.forms.ITaskParams; -import com.yugabyte.yw.models.AsyncReplicationRelationship; import com.yugabyte.yw.models.Universe; +import javax.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.yb.cdc.CdcConsumer; -import org.yb.client.YBClient; -import org.yb.master.Master; -import play.api.Play; - -import javax.inject.Inject; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.UUID; public class ResetUniverseVersion extends UniverseDefinitionTaskBase { public static final Logger LOG = LoggerFactory.getLogger(ResetUniverseVersion.class); diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/RestoreUniverseKeys.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/RestoreUniverseKeys.java index 72b1bd8e810b..b93862cc08e0 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/RestoreUniverseKeys.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/RestoreUniverseKeys.java @@ -20,17 +20,16 @@ import com.yugabyte.yw.forms.BackupTableParams; import com.yugabyte.yw.models.KmsHistory; import com.yugabyte.yw.models.Universe; -import lombok.extern.slf4j.Slf4j; -import org.yb.client.YBClient; -import org.yb.util.Pair; - -import javax.inject.Inject; import java.util.Arrays; import java.util.Base64; import java.util.List; import java.util.UUID; import java.util.function.Consumer; import java.util.stream.Collectors; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; +import org.yb.client.YBClient; +import org.yb.util.Pair; @Slf4j public class RestoreUniverseKeys extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ResumeServer.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ResumeServer.java index 704c3c21f8ce..9e316a811388 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ResumeServer.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ResumeServer.java @@ -16,9 +16,8 @@ import com.yugabyte.yw.common.ShellResponse; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class ResumeServer extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ServerSubTaskBase.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ServerSubTaskBase.java index 46f07ea80e57..9b2ffcbe37af 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ServerSubTaskBase.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/ServerSubTaskBase.java @@ -17,11 +17,10 @@ import com.yugabyte.yw.commissioner.tasks.params.ServerSubTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.YBClient; -import javax.inject.Inject; - @Slf4j public abstract class ServerSubTaskBase extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SetFlagInMemory.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SetFlagInMemory.java index 00492b000426..8180c193f213 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SetFlagInMemory.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SetFlagInMemory.java @@ -15,12 +15,11 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase.ServerType; import com.yugabyte.yw.commissioner.tasks.params.ServerSubTaskParams; -import lombok.extern.slf4j.Slf4j; -import org.yb.client.YBClient; - -import javax.inject.Inject; import java.util.Map; import java.util.Map.Entry; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; +import org.yb.client.YBClient; @Slf4j public class SetFlagInMemory extends ServerSubTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SetNodeState.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SetNodeState.java index 02498ab702d5..466674cab9a6 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SetNodeState.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SetNodeState.java @@ -14,9 +14,8 @@ import com.yugabyte.yw.commissioner.tasks.params.NodeTaskParams; import com.yugabyte.yw.common.NodeManager; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class SetNodeState extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SwamperTargetsFileUpdate.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SwamperTargetsFileUpdate.java index 005c3182fd76..9b57a17e60ea 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SwamperTargetsFileUpdate.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/SwamperTargetsFileUpdate.java @@ -14,9 +14,8 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.common.SwamperHelper; import com.yugabyte.yw.forms.AbstractTaskParams; -import lombok.extern.slf4j.Slf4j; - import java.util.UUID; +import lombok.extern.slf4j.Slf4j; @Slf4j public class SwamperTargetsFileUpdate extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UnivSetCertificate.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UnivSetCertificate.java index cf27430ea3c7..0db74a7c0b74 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UnivSetCertificate.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UnivSetCertificate.java @@ -16,10 +16,9 @@ import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.Universe.UniverseUpdater; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.UUID; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class UnivSetCertificate extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UniverseSetTlsParams.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UniverseSetTlsParams.java index 389e019e5628..ce709caeb275 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UniverseSetTlsParams.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UniverseSetTlsParams.java @@ -8,10 +8,9 @@ import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.UUID; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class UniverseSetTlsParams extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UniverseUpdateSucceeded.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UniverseUpdateSucceeded.java index df54ddb988a8..d74ca482e884 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UniverseUpdateSucceeded.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UniverseUpdateSucceeded.java @@ -16,9 +16,8 @@ import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.Universe.UniverseUpdater; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class UniverseUpdateSucceeded extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdateAndPersistGFlags.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdateAndPersistGFlags.java index 41d60785f18c..7d06a46abd23 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdateAndPersistGFlags.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdateAndPersistGFlags.java @@ -18,10 +18,9 @@ import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.Universe.UniverseUpdater; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.Map; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class UpdateAndPersistGFlags extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdateNodeDetails.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdateNodeDetails.java index c476c2a27cf7..5bc05fd6a9d3 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdateNodeDetails.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdateNodeDetails.java @@ -7,7 +7,6 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.Universe.UniverseUpdater; import com.yugabyte.yw.models.helpers.NodeDetails; - import javax.inject.Inject; public class UpdateNodeDetails extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdatePlacementInfo.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdatePlacementInfo.java index 7f5c00efa6e1..af3a0d552e60 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdatePlacementInfo.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdatePlacementInfo.java @@ -25,6 +25,10 @@ import com.yugabyte.yw.models.helpers.PlacementInfo.PlacementAZ; import com.yugabyte.yw.models.helpers.PlacementInfo.PlacementCloud; import com.yugabyte.yw.models.helpers.PlacementInfo.PlacementRegion; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.Common; import org.yb.client.AbstractModifyMasterClusterConfig; @@ -32,11 +36,6 @@ import org.yb.client.YBClient; import org.yb.master.Master; -import javax.inject.Inject; -import java.util.List; -import java.util.Set; -import java.util.UUID; - @Slf4j public class UpdatePlacementInfo extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdateSoftwareVersion.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdateSoftwareVersion.java index c26a7ceed358..015146f6aa7c 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdateSoftwareVersion.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/UpdateSoftwareVersion.java @@ -17,9 +17,8 @@ import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.Universe.UniverseUpdater; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class UpdateSoftwareVersion extends UniverseTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForDataMove.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForDataMove.java index d23cc660c38e..0ffae9469fa6 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForDataMove.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForDataMove.java @@ -14,12 +14,11 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.GetLoadMovePercentResponse; import org.yb.client.YBClient; -import javax.inject.Inject; - @Slf4j public class WaitForDataMove extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForEncryptionKeyInMemory.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForEncryptionKeyInMemory.java index c009e6f39d06..eed7ff95c6c2 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForEncryptionKeyInMemory.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForEncryptionKeyInMemory.java @@ -16,11 +16,10 @@ import com.yugabyte.yw.common.kms.util.EncryptionAtRestUtil; import com.yugabyte.yw.models.KmsHistory; import com.yugabyte.yw.models.Universe; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.YBClient; -import javax.inject.Inject; - @Slf4j public class WaitForEncryptionKeyInMemory extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForLeadersOnPreferredOnly.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForLeadersOnPreferredOnly.java index 51fea4efa123..814d507325d8 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForLeadersOnPreferredOnly.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForLeadersOnPreferredOnly.java @@ -14,11 +14,10 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.YBClient; -import javax.inject.Inject; - @Slf4j public class WaitForLeadersOnPreferredOnly extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForLoadBalance.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForLoadBalance.java index 5502fa2efac2..7d16068fe22f 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForLoadBalance.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForLoadBalance.java @@ -14,12 +14,11 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; +import java.util.concurrent.TimeUnit; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.YBClient; -import javax.inject.Inject; -import java.util.concurrent.TimeUnit; - @Slf4j public class WaitForLoadBalance extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForMasterLeader.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForMasterLeader.java index 0976b6a0645e..e171d1746a36 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForMasterLeader.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForMasterLeader.java @@ -14,11 +14,10 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.YBClient; -import javax.inject.Inject; - @Slf4j public class WaitForMasterLeader extends AbstractTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForServer.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForServer.java index 06a7adc00fbb..2db33c8d1d3a 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForServer.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForServer.java @@ -13,11 +13,10 @@ import com.google.common.net.HostAndPort; import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.tasks.params.ServerSubTaskParams; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.YBClient; -import javax.inject.Inject; - @Slf4j public class WaitForServer extends ServerSubTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForServerReady.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForServerReady.java index 15bf1384f55a..8bdc3e1fbfa7 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForServerReady.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForServerReady.java @@ -15,12 +15,11 @@ import com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase.ServerType; import com.yugabyte.yw.commissioner.tasks.params.ServerSubTaskParams; import com.yugabyte.yw.forms.UpgradeParams; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.IsServerReadyResponse; import org.yb.client.YBClient; -import javax.inject.Inject; - @Slf4j public class WaitForServerReady extends ServerSubTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForTServerHeartBeats.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForTServerHeartBeats.java index 23f9a4ca67cd..371ba114f397 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForTServerHeartBeats.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/WaitForTServerHeartBeats.java @@ -14,11 +14,10 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.models.Universe; +import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import org.yb.client.YBClient; -import javax.inject.Inject; - // Helper class to wait for a minimum number of tservers to heartbeat to the // master leader. Currently the minimum is the same as the replication factor, // so that next set of tasks like creating a table will not lack tserver resources. diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/CheckMasterLeader.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/CheckMasterLeader.java index 8386b4a1a9f8..3d956b452d0f 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/CheckMasterLeader.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/CheckMasterLeader.java @@ -12,9 +12,8 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.SubTaskGroupQueue; import com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class CheckMasterLeader extends UniverseDefinitionTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/CheckMasters.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/CheckMasters.java index 4c7cf8c6026c..754d8b4f4370 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/CheckMasters.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/CheckMasters.java @@ -13,11 +13,10 @@ import com.yugabyte.yw.commissioner.SubTaskGroupQueue; import com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.time.Duration; import java.util.Set; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class CheckMasters extends UniverseDefinitionTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/CheckTServers.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/CheckTServers.java index 1196e3eb7082..b0624146563d 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/CheckTServers.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/CheckTServers.java @@ -13,10 +13,9 @@ import com.yugabyte.yw.commissioner.SubTaskGroupQueue; import com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - -import javax.inject.Inject; import java.util.Set; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class CheckTServers extends UniverseDefinitionTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/WaitForTServerHBs.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/WaitForTServerHBs.java index 6d4001924c00..65a9e8877313 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/WaitForTServerHBs.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/check/WaitForTServerHBs.java @@ -12,9 +12,8 @@ import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.SubTaskGroupQueue; import com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class WaitForTServerHBs extends UniverseDefinitionTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudAccessKeyCleanup.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudAccessKeyCleanup.java index cff0f17e89da..2bbda5995d45 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudAccessKeyCleanup.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudAccessKeyCleanup.java @@ -15,9 +15,8 @@ import com.yugabyte.yw.commissioner.tasks.params.CloudTaskParams; import com.yugabyte.yw.common.AccessManager; import com.yugabyte.yw.models.Region; -import play.api.Play; - import javax.inject.Inject; +import play.api.Play; public class CloudAccessKeyCleanup extends CloudTaskBase { @Inject diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudAccessKeySetup.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudAccessKeySetup.java index 7624a51b0afa..ee765f766c74 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudAccessKeySetup.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudAccessKeySetup.java @@ -17,9 +17,8 @@ import com.yugabyte.yw.common.AccessManager; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Region; -import play.api.Play; - import javax.inject.Inject; +import play.api.Play; public class CloudAccessKeySetup extends CloudTaskBase { @Inject diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudInitializer.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudInitializer.java index c7b7d22d451a..425e13483fcd 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudInitializer.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudInitializer.java @@ -11,17 +11,16 @@ package com.yugabyte.yw.commissioner.tasks.subtasks.cloud; import com.yugabyte.yw.cloud.AWSInitializer; +import com.yugabyte.yw.cloud.AZUInitializer; import com.yugabyte.yw.cloud.AbstractInitializer; import com.yugabyte.yw.cloud.GCPInitializer; -import com.yugabyte.yw.cloud.AZUInitializer; import com.yugabyte.yw.commissioner.BaseTaskDependencies; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.commissioner.tasks.CloudTaskBase; import com.yugabyte.yw.commissioner.tasks.params.CloudTaskParams; import com.yugabyte.yw.models.Provider; -import play.api.Play; - import javax.inject.Inject; +import play.api.Play; public class CloudInitializer extends CloudTaskBase { @Inject diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudProviderCleanup.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudProviderCleanup.java index 18d7d9816eeb..c51637acb098 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudProviderCleanup.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudProviderCleanup.java @@ -15,9 +15,8 @@ import com.yugabyte.yw.models.AccessKey; import com.yugabyte.yw.models.PriceComponent; import com.yugabyte.yw.models.Provider; - -import javax.inject.Inject; import java.util.List; +import javax.inject.Inject; public class CloudProviderCleanup extends CloudTaskBase { @Inject diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudRegionCleanup.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudRegionCleanup.java index 8dc05e08c156..bf974988ed06 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudRegionCleanup.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudRegionCleanup.java @@ -16,9 +16,8 @@ import com.yugabyte.yw.commissioner.tasks.params.CloudTaskParams; import com.yugabyte.yw.common.NetworkManager; import com.yugabyte.yw.models.Region; -import play.api.Play; - import javax.inject.Inject; +import play.api.Play; public class CloudRegionCleanup extends CloudTaskBase { @Inject diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudRegionSetup.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudRegionSetup.java index 3a5ccdf8af8e..3b40b0e50bb3 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudRegionSetup.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudRegionSetup.java @@ -21,13 +21,12 @@ import com.yugabyte.yw.models.AvailabilityZone; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; -import play.api.Play; -import play.libs.Json; - -import javax.inject.Inject; import java.util.ArrayList; import java.util.List; import java.util.Map; +import javax.inject.Inject; +import play.api.Play; +import play.libs.Json; public class CloudRegionSetup extends CloudTaskBase { @Inject diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudSetup.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudSetup.java index 8862fdd5d16a..33a92da31e8f 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudSetup.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/cloud/CloudSetup.java @@ -15,9 +15,8 @@ import com.yugabyte.yw.commissioner.tasks.CloudTaskBase; import com.yugabyte.yw.commissioner.tasks.params.CloudTaskParams; import com.yugabyte.yw.common.NetworkManager; -import play.api.Play; - import javax.inject.Inject; +import play.api.Play; public class CloudSetup extends CloudTaskBase { @Inject diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/nodes/UpdateNodeProcess.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/nodes/UpdateNodeProcess.java index eb2b8b9b1e2c..43f0d3ee9a1c 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/nodes/UpdateNodeProcess.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/subtasks/nodes/UpdateNodeProcess.java @@ -18,9 +18,8 @@ import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import lombok.extern.slf4j.Slf4j; - import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; @Slf4j public class UpdateNodeProcess extends NodeTaskBase { diff --git a/managed/src/main/java/com/yugabyte/yw/common/AccessManager.java b/managed/src/main/java/com/yugabyte/yw/common/AccessManager.java index 43c8eed0db83..c5d5ffc18b1b 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/AccessManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/AccessManager.java @@ -2,28 +2,25 @@ package com.yugabyte.yw.common; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.google.inject.Inject; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.models.AccessKey; -import com.yugabyte.yw.models.Region; import com.yugabyte.yw.models.Provider; - -import org.pac4j.oidc.client.KeycloakOidcClient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.inject.Singleton; +import com.yugabyte.yw.models.Region; import java.io.File; import java.io.IOException; import java.nio.file.Files; +import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.PosixFilePermission; import java.nio.file.attribute.PosixFilePermissions; -import java.nio.file.NoSuchFileException; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -31,8 +28,9 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; - -import static play.mvc.Http.Status.*; +import javax.inject.Singleton; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Singleton public class AccessManager extends DevopsBase { diff --git a/managed/src/main/java/com/yugabyte/yw/common/AlertDefinitionTemplate.java b/managed/src/main/java/com/yugabyte/yw/common/AlertDefinitionTemplate.java index f20ba9802cdb..fea473cdfbff 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/AlertDefinitionTemplate.java +++ b/managed/src/main/java/com/yugabyte/yw/common/AlertDefinitionTemplate.java @@ -6,10 +6,9 @@ import com.yugabyte.yw.models.AlertDefinitionGroup; import com.yugabyte.yw.models.AlertDefinitionGroupThreshold; import com.yugabyte.yw.models.common.Unit; -import lombok.Getter; - import java.util.EnumSet; import java.util.Map; +import lombok.Getter; @Getter public enum AlertDefinitionTemplate { diff --git a/managed/src/main/java/com/yugabyte/yw/common/AlertManager.java b/managed/src/main/java/com/yugabyte/yw/common/AlertManager.java index 968b532290e1..c89786d5b9ef 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/AlertManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/AlertManager.java @@ -10,17 +10,34 @@ package com.yugabyte.yw.common; -import com.yugabyte.yw.common.alerts.*; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.common.alerts.AlertDefinitionGroupService; +import com.yugabyte.yw.common.alerts.AlertDefinitionLabelsBuilder; +import com.yugabyte.yw.common.alerts.AlertNotificationReport; +import com.yugabyte.yw.common.alerts.AlertReceiverEmailParams; +import com.yugabyte.yw.common.alerts.AlertReceiverInterface; +import com.yugabyte.yw.common.alerts.AlertReceiverManager; +import com.yugabyte.yw.common.alerts.AlertRouteService; +import com.yugabyte.yw.common.alerts.AlertService; +import com.yugabyte.yw.common.alerts.AlertUtils; +import com.yugabyte.yw.common.alerts.YWValidateException; +import com.yugabyte.yw.models.Alert; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.AlertLabel; +import com.yugabyte.yw.models.AlertReceiver; +import com.yugabyte.yw.models.AlertRoute; +import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.filters.AlertFilter; import com.yugabyte.yw.models.helpers.KnownAlertCodes; import com.yugabyte.yw.models.helpers.KnownAlertLabels; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections.CollectionUtils; - +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.UUID; import javax.inject.Inject; import javax.inject.Singleton; -import java.util.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; @Singleton @Slf4j diff --git a/managed/src/main/java/com/yugabyte/yw/common/ApiHelper.java b/managed/src/main/java/com/yugabyte/yw/common/ApiHelper.java index c67d8958470a..6500d212e53a 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/ApiHelper.java +++ b/managed/src/main/java/com/yugabyte/yw/common/ApiHelper.java @@ -8,12 +8,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.inject.Inject; import com.google.inject.Singleton; -import play.libs.Json; -import play.libs.ws.WSClient; -import play.libs.ws.WSRequest; -import play.libs.ws.WSResponse; -import play.mvc.Http; - import java.net.HttpURLConnection; import java.net.URL; import java.util.HashMap; @@ -22,6 +16,11 @@ import java.util.UUID; import java.util.concurrent.CompletionStage; import java.util.concurrent.ExecutionException; +import play.libs.Json; +import play.libs.ws.WSClient; +import play.libs.ws.WSRequest; +import play.libs.ws.WSResponse; +import play.mvc.Http; /** Helper class API specific stuff */ @Singleton diff --git a/managed/src/main/java/com/yugabyte/yw/common/CallHomeManager.java b/managed/src/main/java/com/yugabyte/yw/common/CallHomeManager.java index a8e22ed75fa7..7f2960621dbd 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/CallHomeManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/CallHomeManager.java @@ -7,16 +7,24 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.annotations.VisibleForTesting; import com.yugabyte.yw.forms.UniverseResp; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; +import java.time.Clock; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import javax.inject.Inject; import org.asynchttpclient.util.Base64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.libs.Json; -import javax.inject.Inject; -import java.time.Clock; -import java.util.*; - public class CallHomeManager { // Used to get software version from yugaware_property table in DB ConfigHelper configHelper; diff --git a/managed/src/main/java/com/yugabyte/yw/common/CertificateHelper.java b/managed/src/main/java/com/yugabyte/yw/common/CertificateHelper.java index 3d3f3b8aba47..bfe22328342a 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/CertificateHelper.java +++ b/managed/src/main/java/com/yugabyte/yw/common/CertificateHelper.java @@ -5,8 +5,6 @@ import static play.mvc.Http.Status.BAD_REQUEST; import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.forms.CertificateParams; import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleConfigureServers; import com.yugabyte.yw.commissioner.tasks.subtasks.UniverseSetTlsParams; diff --git a/managed/src/main/java/com/yugabyte/yw/common/CloudQueryHelper.java b/managed/src/main/java/com/yugabyte/yw/common/CloudQueryHelper.java index d759c8b4a320..37a14e723088 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/CloudQueryHelper.java +++ b/managed/src/main/java/com/yugabyte/yw/common/CloudQueryHelper.java @@ -10,22 +10,21 @@ package com.yugabyte.yw.common; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.google.common.collect.ImmutableList; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.libs.Json; - -import javax.inject.Singleton; import java.util.ArrayList; import java.util.List; import java.util.UUID; - -import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; +import javax.inject.Singleton; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; @Singleton public class CloudQueryHelper extends DevopsBase { diff --git a/managed/src/main/java/com/yugabyte/yw/common/ConfigHelper.java b/managed/src/main/java/com/yugabyte/yw/common/ConfigHelper.java index c3d9684bdc21..9f0a974f0ed6 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/ConfigHelper.java +++ b/managed/src/main/java/com/yugabyte/yw/common/ConfigHelper.java @@ -2,27 +2,25 @@ package com.yugabyte.yw.common; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.fasterxml.jackson.databind.JsonNode; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableMap; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.models.YugawareProperty; -import org.yaml.snakeyaml.Yaml; -import org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor; -import play.Application; -import play.libs.Json; - -import javax.inject.Singleton; import java.io.InputStream; import java.util.Collections; -import java.util.Map; import java.util.HashMap; +import java.util.Map; import java.util.UUID; +import javax.inject.Singleton; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.math.NumberUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor; +import play.Application; +import play.libs.Json; @Singleton public class ConfigHelper { diff --git a/managed/src/main/java/com/yugabyte/yw/common/CustomerTaskManager.java b/managed/src/main/java/com/yugabyte/yw/common/CustomerTaskManager.java index 01c04a758912..1544431e3f0c 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/CustomerTaskManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/CustomerTaskManager.java @@ -2,14 +2,14 @@ package com.yugabyte.yw.common; -import io.ebean.Ebean; +import static com.yugabyte.yw.models.CustomerTask.TargetType; + import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.models.CustomerTask; import com.yugabyte.yw.models.TaskInfo; import com.yugabyte.yw.models.Universe; -import static com.yugabyte.yw.models.CustomerTask.TargetType; +import io.ebean.Ebean; import javax.inject.Singleton; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/managed/src/main/java/com/yugabyte/yw/common/DevopsBase.java b/managed/src/main/java/com/yugabyte/yw/common/DevopsBase.java index 005d8934c16d..a67f2b816691 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/DevopsBase.java +++ b/managed/src/main/java/com/yugabyte/yw/common/DevopsBase.java @@ -15,16 +15,15 @@ import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.libs.Json; - import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; public abstract class DevopsBase { public static final String YBCLOUD_SCRIPT = "bin/ybcloud.sh"; diff --git a/managed/src/main/java/com/yugabyte/yw/common/EmailHelper.java b/managed/src/main/java/com/yugabyte/yw/common/EmailHelper.java index 7f5b28f2e535..ec40d86848fa 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/EmailHelper.java +++ b/managed/src/main/java/com/yugabyte/yw/common/EmailHelper.java @@ -2,13 +2,20 @@ package com.yugabyte.yw.common; +import com.google.common.annotations.VisibleForTesting; +import com.google.inject.Singleton; +import com.typesafe.config.Config; +import com.yugabyte.yw.common.alerts.SmtpData; +import com.yugabyte.yw.common.config.RuntimeConfigFactory; +import com.yugabyte.yw.forms.CustomerRegisterFormData; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Properties; import java.util.UUID; -import java.util.Map.Entry; - import javax.inject.Inject; import javax.mail.Authenticator; import javax.mail.Message; @@ -22,20 +29,9 @@ import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; - -import com.typesafe.config.Config; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import com.google.common.annotations.VisibleForTesting; -import com.google.inject.Singleton; -import com.yugabyte.yw.common.alerts.SmtpData; -import com.yugabyte.yw.common.config.RuntimeConfigFactory; -import com.yugabyte.yw.forms.CustomerRegisterFormData; -import com.yugabyte.yw.models.Customer; -import com.yugabyte.yw.models.CustomerConfig; - import play.libs.Json; @Singleton diff --git a/managed/src/main/java/com/yugabyte/yw/common/ExtraMigrationManager.java b/managed/src/main/java/com/yugabyte/yw/common/ExtraMigrationManager.java index 55d0e01e601d..8cfa5f564633 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/ExtraMigrationManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/ExtraMigrationManager.java @@ -2,6 +2,8 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.commissioner.Common.CloudType.onprem; + import com.google.inject.Inject; import com.google.inject.Singleton; import com.yugabyte.yw.models.AccessKey; @@ -9,8 +11,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static com.yugabyte.yw.commissioner.Common.CloudType.onprem; - /* * This is a manager to hold injected resources needed for extra migrations. */ diff --git a/managed/src/main/java/com/yugabyte/yw/common/HealthManager.java b/managed/src/main/java/com/yugabyte/yw/common/HealthManager.java index c32df3281ad8..a09f384cb3ab 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/HealthManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/HealthManager.java @@ -2,18 +2,14 @@ package com.yugabyte.yw.common; -import com.yugabyte.yw.models.Provider; - import com.google.inject.Singleton; - +import com.yugabyte.yw.models.Provider; import java.util.ArrayList; import java.util.HashMap; -import java.util.Map; import java.util.List; - +import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import play.libs.Json; @Singleton diff --git a/managed/src/main/java/com/yugabyte/yw/common/KubernetesManager.java b/managed/src/main/java/com/yugabyte/yw/common/KubernetesManager.java index 42d281723e4a..eb46f46323c3 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/KubernetesManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/KubernetesManager.java @@ -5,17 +5,14 @@ import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableList; import com.google.inject.Inject; -import com.yugabyte.yw.common.Util; import com.yugabyte.yw.models.Provider; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.inject.Singleton; - import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; +import javax.inject.Singleton; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Singleton public class KubernetesManager { diff --git a/managed/src/main/java/com/yugabyte/yw/common/NetworkManager.java b/managed/src/main/java/com/yugabyte/yw/common/NetworkManager.java index 1ebd051fbb93..91cff08962cd 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/NetworkManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/NetworkManager.java @@ -2,17 +2,16 @@ package com.yugabyte.yw.common; -import com.fasterxml.jackson.databind.JsonNode; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; -import javax.inject.Singleton; +import com.fasterxml.jackson.databind.JsonNode; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.UUID; - -import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; +import javax.inject.Singleton; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Singleton public class NetworkManager extends DevopsBase { diff --git a/managed/src/main/java/com/yugabyte/yw/common/NodeManager.java b/managed/src/main/java/com/yugabyte/yw/common/NodeManager.java index 338e2dc6dd31..d0b7ebcc4565 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/NodeManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/NodeManager.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase.ServerType; + import com.google.common.collect.ImmutableList; import com.google.inject.Inject; import com.google.inject.Singleton; @@ -17,7 +19,16 @@ import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.commissioner.tasks.UpgradeUniverse; import com.yugabyte.yw.commissioner.tasks.params.NodeTaskParams; -import com.yugabyte.yw.commissioner.tasks.subtasks.*; +import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleClusterServerCtl; +import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleConfigureServers; +import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleDestroyServer; +import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleSetupServer; +import com.yugabyte.yw.commissioner.tasks.subtasks.ChangeInstanceType; +import com.yugabyte.yw.commissioner.tasks.subtasks.CreateRootVolumes; +import com.yugabyte.yw.commissioner.tasks.subtasks.InstanceActions; +import com.yugabyte.yw.commissioner.tasks.subtasks.PauseServer; +import com.yugabyte.yw.commissioner.tasks.subtasks.ReplaceRootVolume; +import com.yugabyte.yw.commissioner.tasks.subtasks.ResumeServer; import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.forms.CertificateParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; @@ -30,11 +41,6 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.DeviceInfo; import com.yugabyte.yw.models.helpers.NodeDetails; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import play.libs.Json; - import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -45,8 +51,9 @@ import java.util.Map; import java.util.Optional; import java.util.UUID; - -import static com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase.ServerType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; @Singleton public class NodeManager extends DevopsBase { diff --git a/managed/src/main/java/com/yugabyte/yw/common/NodeUniverseManager.java b/managed/src/main/java/com/yugabyte/yw/common/NodeUniverseManager.java index 7b92125b1b9b..8906691defd6 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/NodeUniverseManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/NodeUniverseManager.java @@ -8,9 +8,10 @@ import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; - -import javax.xml.soap.Node; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; @Singleton public class NodeUniverseManager extends DevopsBase { diff --git a/managed/src/main/java/com/yugabyte/yw/common/PlacementInfoUtil.java b/managed/src/main/java/com/yugabyte/yw/common/PlacementInfoUtil.java index d1a822c775bd..eb2529063237 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/PlacementInfoUtil.java +++ b/managed/src/main/java/com/yugabyte/yw/common/PlacementInfoUtil.java @@ -2,6 +2,13 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.common.Util.toBeAddedAzUuidToNumNodes; +import static com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ClusterType.ASYNC; +import static com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ClusterType.PRIMARY; +import static java.util.stream.Collectors.groupingBy; +import static java.util.stream.Collectors.toCollection; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.annotations.VisibleForTesting; @@ -17,7 +24,11 @@ import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ClusterType; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.UserIntent; import com.yugabyte.yw.metrics.MetricQueryHelper; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.NodeInstance; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.CloudSpecificInfo; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.NodeDetails.NodeState; @@ -25,23 +36,28 @@ import com.yugabyte.yw.models.helpers.PlacementInfo.PlacementAZ; import com.yugabyte.yw.models.helpers.PlacementInfo.PlacementCloud; import com.yugabyte.yw.models.helpers.PlacementInfo.PlacementRegion; -import org.joda.time.DateTime; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.libs.Json; - -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Queue; +import java.util.Set; +import java.util.UUID; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; - -import static com.yugabyte.yw.common.Util.toBeAddedAzUuidToNumNodes; -import static com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ClusterType.ASYNC; -import static com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ClusterType.PRIMARY; -import static java.util.stream.Collectors.groupingBy; -import static java.util.stream.Collectors.toCollection; -import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; +import org.joda.time.DateTime; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; public class PlacementInfoUtil { public static final Logger LOG = LoggerFactory.getLogger(PlacementInfoUtil.class); diff --git a/managed/src/main/java/com/yugabyte/yw/common/PlatformInstanceClient.java b/managed/src/main/java/com/yugabyte/yw/common/PlatformInstanceClient.java index febdda25f7eb..05ef599cfc6b 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/PlatformInstanceClient.java +++ b/managed/src/main/java/com/yugabyte/yw/common/PlatformInstanceClient.java @@ -11,6 +11,8 @@ package com.yugabyte.yw.common; +import static scala.compat.java8.JFunction.func; + import akka.stream.javadsl.FileIO; import akka.stream.javadsl.Source; import akka.util.ByteString; @@ -20,6 +22,10 @@ import com.yugabyte.yw.controllers.HAAuthenticator; import com.yugabyte.yw.controllers.ReverseInternalHAController; import com.yugabyte.yw.models.HighAvailabilityConfig; +import java.io.File; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.libs.Json; @@ -27,13 +33,6 @@ import play.mvc.Http; import v1.RoutesPrefix; -import java.io.File; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import static scala.compat.java8.JFunction.func; - public class PlatformInstanceClient { private static final Logger LOG = LoggerFactory.getLogger(PlatformInstanceClient.class); diff --git a/managed/src/main/java/com/yugabyte/yw/common/ShellProcessHandler.java b/managed/src/main/java/com/yugabyte/yw/common/ShellProcessHandler.java index cc31d5fa4f2e..f4c59ad27588 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/ShellProcessHandler.java +++ b/managed/src/main/java/com/yugabyte/yw/common/ShellProcessHandler.java @@ -19,7 +19,6 @@ import java.io.InputStreamReader; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; @@ -27,7 +26,6 @@ import javax.inject.Singleton; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.yugabyte.yw.common.Util; @Singleton public class ShellProcessHandler { diff --git a/managed/src/main/java/com/yugabyte/yw/common/ShellResponse.java b/managed/src/main/java/com/yugabyte/yw/common/ShellResponse.java index bc9ec5f243fd..864b5a13781f 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/ShellResponse.java +++ b/managed/src/main/java/com/yugabyte/yw/common/ShellResponse.java @@ -1,7 +1,6 @@ package com.yugabyte.yw.common; import java.util.List; - import org.apache.commons.lang3.StringUtils; public class ShellResponse { diff --git a/managed/src/main/java/com/yugabyte/yw/common/SslHelper.java b/managed/src/main/java/com/yugabyte/yw/common/SslHelper.java index 86827acab0f7..714a33e32d2b 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/SslHelper.java +++ b/managed/src/main/java/com/yugabyte/yw/common/SslHelper.java @@ -2,20 +2,16 @@ package com.yugabyte.yw.common; -import com.datastax.driver.core.SSLOptions; import com.datastax.driver.core.JdkSSLOptions; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - +import com.datastax.driver.core.SSLOptions; import java.io.FileInputStream; - +import java.security.KeyStore; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; -import java.security.KeyStore; - import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SslHelper { diff --git a/managed/src/main/java/com/yugabyte/yw/common/SwamperHelper.java b/managed/src/main/java/com/yugabyte/yw/common/SwamperHelper.java index c39048de7514..5fa4c74611d2 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/SwamperHelper.java +++ b/managed/src/main/java/com/yugabyte/yw/common/SwamperHelper.java @@ -10,6 +10,9 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.common.Util.writeFile; +import static com.yugabyte.yw.common.Util.writeJsonFile; + import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.annotations.VisibleForTesting; @@ -19,6 +22,19 @@ import com.yugabyte.yw.models.AlertDefinitionGroup; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.UUID; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import javax.inject.Inject; +import javax.inject.Singleton; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; @@ -28,19 +44,6 @@ import play.Environment; import play.libs.Json; -import javax.inject.Inject; -import javax.inject.Singleton; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.*; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -import static com.yugabyte.yw.common.Util.writeFile; -import static com.yugabyte.yw.common.Util.writeJsonFile; - @Singleton public class SwamperHelper { public static final Logger LOG = LoggerFactory.getLogger(SwamperHelper.class); diff --git a/managed/src/main/java/com/yugabyte/yw/common/TableManager.java b/managed/src/main/java/com/yugabyte/yw/common/TableManager.java index 3c6dd91d1d01..5c8bf1c14c20 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/TableManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/TableManager.java @@ -2,6 +2,10 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.common.TableManager.CommandSubType.BACKUP; +import static com.yugabyte.yw.common.TableManager.CommandSubType.BULK_IMPORT; +import static com.yugabyte.yw.common.TableManager.CommandSubType.DELETE; + import com.google.inject.Inject; import com.google.inject.Singleton; import com.yugabyte.yw.common.kms.util.EncryptionAtRestUtil; @@ -10,19 +14,21 @@ import com.yugabyte.yw.forms.TableManagerParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Cluster; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AccessKey; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.PlacementInfo; -import org.yb.Common.TableType; -import play.libs.Json; - import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; - -import static com.yugabyte.yw.common.TableManager.CommandSubType.*; +import org.yb.Common.TableType; +import play.libs.Json; @Singleton public class TableManager extends DevopsBase { diff --git a/managed/src/main/java/com/yugabyte/yw/common/TemplateManager.java b/managed/src/main/java/com/yugabyte/yw/common/TemplateManager.java index 0edd500c4612..975f04f82964 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/TemplateManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/TemplateManager.java @@ -2,20 +2,17 @@ package com.yugabyte.yw.common; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; + import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; import com.google.inject.Singleton; -import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.models.AccessKey; -import play.libs.Json; - import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.UUID; -import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; - @Singleton public class TemplateManager extends DevopsBase { private static final String COMMAND_TYPE = "instance"; diff --git a/managed/src/main/java/com/yugabyte/yw/common/Util.java b/managed/src/main/java/com/yugabyte/yw/common/Util.java index b9fc385bb099..a88bed674abf 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/Util.java +++ b/managed/src/main/java/com/yugabyte/yw/common/Util.java @@ -1,6 +1,10 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.common; +import static com.yugabyte.yw.common.PlacementInfoUtil.getNumMasters; +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; @@ -12,10 +16,6 @@ import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.libs.Json; - import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; @@ -29,15 +29,22 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.StreamSupport; - -import static com.yugabyte.yw.common.PlacementInfoUtil.getNumMasters; -import static play.mvc.Http.Status.BAD_REQUEST; -import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; public class Util { public static final Logger LOG = LoggerFactory.getLogger(Util.class); diff --git a/managed/src/main/java/com/yugabyte/yw/common/ValidatingFormFactory.java b/managed/src/main/java/com/yugabyte/yw/common/ValidatingFormFactory.java index 9f3b8f7709c1..527a6daf9e46 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/ValidatingFormFactory.java +++ b/managed/src/main/java/com/yugabyte/yw/common/ValidatingFormFactory.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.common; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; import com.google.inject.Singleton; @@ -17,8 +19,6 @@ import play.data.FormFactory; import play.libs.Json; -import static play.mvc.Http.Status.BAD_REQUEST; - @Singleton public class ValidatingFormFactory { private final FormFactory formFactory; diff --git a/managed/src/main/java/com/yugabyte/yw/common/YWErrorHandler.java b/managed/src/main/java/com/yugabyte/yw/common/YWErrorHandler.java index 5131fd615df5..067e388bf753 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/YWErrorHandler.java +++ b/managed/src/main/java/com/yugabyte/yw/common/YWErrorHandler.java @@ -14,6 +14,9 @@ import com.google.inject.Inject; import com.google.inject.Singleton; import com.typesafe.config.Config; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import javax.inject.Provider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.Environment; @@ -23,10 +26,6 @@ import play.mvc.Http; import play.mvc.Result; -import javax.inject.Provider; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionStage; - @Singleton public final class YWErrorHandler extends DefaultHttpErrorHandler { public static final Logger LOG = LoggerFactory.getLogger(YWErrorHandler.class); diff --git a/managed/src/main/java/com/yugabyte/yw/common/YamlWrapper.java b/managed/src/main/java/com/yugabyte/yw/common/YamlWrapper.java index a3e6ed642be8..ae20dcdc7eed 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/YamlWrapper.java +++ b/managed/src/main/java/com/yugabyte/yw/common/YamlWrapper.java @@ -1,7 +1,7 @@ package com.yugabyte.yw.common; // Copyright (c) YugaByte, Inc. -import com.google.inject.Singleton; import com.google.inject.Inject; +import com.google.inject.Singleton; import java.io.InputStream; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor; diff --git a/managed/src/main/java/com/yugabyte/yw/common/YcqlQueryExecutor.java b/managed/src/main/java/com/yugabyte/yw/common/YcqlQueryExecutor.java index 2a4d59809d99..8059306e5d0b 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/YcqlQueryExecutor.java +++ b/managed/src/main/java/com/yugabyte/yw/common/YcqlQueryExecutor.java @@ -1,5 +1,8 @@ package com.yugabyte.yw.common; +import static play.libs.Json.newObject; +import static play.libs.Json.toJson; + import com.datastax.driver.core.Cluster; import com.datastax.driver.core.ColumnDefinitions; import com.datastax.driver.core.ResultSet; @@ -22,8 +25,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.mvc.Http; -import static play.libs.Json.newObject; -import static play.libs.Json.toJson; @Singleton public class YcqlQueryExecutor { diff --git a/managed/src/main/java/com/yugabyte/yw/common/YsqlQueryExecutor.java b/managed/src/main/java/com/yugabyte/yw/common/YsqlQueryExecutor.java index f8612f21ff52..72ed38950edd 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/YsqlQueryExecutor.java +++ b/managed/src/main/java/com/yugabyte/yw/common/YsqlQueryExecutor.java @@ -1,5 +1,8 @@ package com.yugabyte.yw.common; +import static play.libs.Json.newObject; +import static play.libs.Json.toJson; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.inject.Singleton; @@ -21,8 +24,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.mvc.Http; -import static play.libs.Json.newObject; -import static play.libs.Json.toJson; @Singleton public class YsqlQueryExecutor { diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertConfigurationWriter.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertConfigurationWriter.java index 416c3906a372..c1af0d1a2af6 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertConfigurationWriter.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertConfigurationWriter.java @@ -18,19 +18,18 @@ import com.yugabyte.yw.models.AlertDefinition; import com.yugabyte.yw.models.AlertDefinitionGroup; import com.yugabyte.yw.models.filters.AlertDefinitionFilter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import scala.concurrent.ExecutionContext; -import scala.concurrent.duration.Duration; - -import javax.inject.Inject; -import javax.inject.Singleton; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; +import javax.inject.Inject; +import javax.inject.Singleton; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import scala.concurrent.ExecutionContext; +import scala.concurrent.duration.Duration; @Singleton public class AlertConfigurationWriter { diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertDefinitionGroupService.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertDefinitionGroupService.java index 793a407dd923..7cdd5dcb2e79 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertDefinitionGroupService.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertDefinitionGroupService.java @@ -9,10 +9,23 @@ */ package com.yugabyte.yw.common.alerts; +import static com.yugabyte.yw.models.AlertDefinitionGroup.createQueryByFilter; +import static com.yugabyte.yw.models.helpers.CommonUtils.nowWithoutMillis; +import static com.yugabyte.yw.models.helpers.CommonUtils.performPagedQuery; +import static com.yugabyte.yw.models.helpers.EntityOperation.CREATE; +import static com.yugabyte.yw.models.helpers.EntityOperation.UPDATE; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.yugabyte.yw.common.AlertDefinitionTemplate; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.common.config.RuntimeConfigFactory; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AlertDefinition; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.AlertDefinitionGroupTarget; +import com.yugabyte.yw.models.AlertDefinitionGroupThreshold; +import com.yugabyte.yw.models.AlertRoute; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.filters.AlertDefinitionFilter; import com.yugabyte.yw.models.filters.AlertDefinitionGroupFilter; import com.yugabyte.yw.models.helpers.EntityOperation; @@ -20,25 +33,23 @@ import com.yugabyte.yw.models.paging.AlertDefinitionGroupPagedResponse; import io.ebean.Query; import io.ebean.annotation.Transactional; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.MapUtils; -import org.apache.commons.lang3.StringUtils; - -import javax.inject.Inject; -import javax.inject.Singleton; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; - -import static com.yugabyte.yw.models.AlertDefinitionGroup.createQueryByFilter; -import static com.yugabyte.yw.models.helpers.CommonUtils.nowWithoutMillis; -import static com.yugabyte.yw.models.helpers.CommonUtils.performPagedQuery; -import static com.yugabyte.yw.models.helpers.EntityOperation.CREATE; -import static com.yugabyte.yw.models.helpers.EntityOperation.UPDATE; -import static play.mvc.Http.Status.BAD_REQUEST; +import javax.inject.Inject; +import javax.inject.Singleton; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang3.StringUtils; @Singleton @Slf4j diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertDefinitionLabelsBuilder.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertDefinitionLabelsBuilder.java index a59ade2f9016..256f075c842e 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertDefinitionLabelsBuilder.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertDefinitionLabelsBuilder.java @@ -9,9 +9,12 @@ */ package com.yugabyte.yw.common.alerts; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AlertDefinitionLabel; +import com.yugabyte.yw.models.AlertLabel; +import com.yugabyte.yw.models.AlertReceiver; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.KnownAlertLabels; - import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertDefinitionService.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertDefinitionService.java index 5607999c6faa..15e33b6f1a82 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertDefinitionService.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertDefinitionService.java @@ -9,27 +9,30 @@ */ package com.yugabyte.yw.common.alerts; +import static com.yugabyte.yw.models.AlertDefinition.createQueryByFilter; +import static com.yugabyte.yw.models.helpers.EntityOperation.CREATE; +import static com.yugabyte.yw.models.helpers.EntityOperation.UPDATE; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.models.AlertDefinition; import com.yugabyte.yw.models.filters.AlertDefinitionFilter; import com.yugabyte.yw.models.filters.AlertFilter; import com.yugabyte.yw.models.helpers.EntityOperation; import io.ebean.annotation.Transactional; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; - -import javax.inject.Inject; -import javax.inject.Singleton; -import java.util.*; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; - -import static com.yugabyte.yw.models.AlertDefinition.createQueryByFilter; -import static com.yugabyte.yw.models.helpers.EntityOperation.CREATE; -import static com.yugabyte.yw.models.helpers.EntityOperation.UPDATE; -import static play.mvc.Http.Status.BAD_REQUEST; +import javax.inject.Inject; +import javax.inject.Singleton; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; @Singleton @Slf4j diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertNotificationReport.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertNotificationReport.java index 1a69f89e692d..0f9d81fe2794 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertNotificationReport.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertNotificationReport.java @@ -9,11 +9,10 @@ */ package com.yugabyte.yw.common.alerts; -import lombok.ToString; - import java.util.HashMap; import java.util.Map; import java.util.UUID; +import lombok.ToString; @ToString public class AlertNotificationReport { diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverEmailParams.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverEmailParams.java index 8a8cab70de85..8c961dacdd28 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverEmailParams.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverEmailParams.java @@ -2,15 +2,12 @@ package com.yugabyte.yw.common.alerts; -import java.util.List; - -import org.apache.commons.validator.routines.EmailValidator; - import com.fasterxml.jackson.annotation.JsonTypeName; import com.yugabyte.yw.common.EmailHelper; - +import java.util.List; import lombok.EqualsAndHashCode; import lombok.ToString; +import org.apache.commons.validator.routines.EmailValidator; @EqualsAndHashCode(callSuper = false) @ToString diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverManager.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverManager.java index 91657b8dd674..4da5d1979b5a 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverManager.java @@ -2,13 +2,12 @@ package com.yugabyte.yw.common.alerts; -import java.util.EnumMap; -import java.util.Optional; - import com.google.inject.Inject; import com.google.inject.Singleton; import com.yugabyte.yw.common.alerts.impl.AlertReceiverEmail; import com.yugabyte.yw.models.AlertReceiver.TargetType; +import java.util.EnumMap; +import java.util.Optional; @Singleton public class AlertReceiverManager { diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverParams.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverParams.java index b3000767f33d..7e6ea10c0e7f 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverParams.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverParams.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; - import lombok.EqualsAndHashCode; import lombok.ToString; diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverSlackParams.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverSlackParams.java index 8fbef7737480..f78de388dba6 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverSlackParams.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertReceiverSlackParams.java @@ -2,13 +2,11 @@ package com.yugabyte.yw.common.alerts; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.validator.routines.UrlValidator; - import com.fasterxml.jackson.annotation.JsonTypeName; - import lombok.EqualsAndHashCode; import lombok.ToString; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.validator.routines.UrlValidator; @EqualsAndHashCode(callSuper = false) @ToString diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertRouteService.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertRouteService.java index 4f03a0bc584e..603ab8f6b712 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertRouteService.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertRouteService.java @@ -9,26 +9,23 @@ */ package com.yugabyte.yw.common.alerts; -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.apache.commons.collections.CollectionUtils; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.models.AlertDefinitionGroup; import com.yugabyte.yw.models.AlertReceiver; import com.yugabyte.yw.models.AlertRoute; import com.yugabyte.yw.models.filters.AlertDefinitionGroupFilter; - import io.ebean.annotation.Transactional; +import java.util.Collections; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.inject.Inject; +import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; -import static play.mvc.Http.Status.BAD_REQUEST; -import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; +import org.apache.commons.collections.CollectionUtils; @Singleton @Slf4j diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertRuleTemplateSubstitutor.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertRuleTemplateSubstitutor.java index 628f095f53ef..b809ce58bd9e 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertRuleTemplateSubstitutor.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertRuleTemplateSubstitutor.java @@ -14,11 +14,10 @@ import com.yugabyte.yw.models.AlertDefinitionGroup; import com.yugabyte.yw.models.AlertDefinitionGroupThreshold; import com.yugabyte.yw.models.AlertDefinitionLabel; -import lombok.RequiredArgsConstructor; - import java.text.DecimalFormat; import java.util.UUID; import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; public class AlertRuleTemplateSubstitutor extends PlaceholderSubstitutor { diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertService.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertService.java index 2e529867ae2c..c47f2ed45355 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertService.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertService.java @@ -9,6 +9,13 @@ */ package com.yugabyte.yw.common.alerts; +import static com.yugabyte.yw.models.Alert.createQueryByFilter; +import static com.yugabyte.yw.models.helpers.CommonUtils.nowWithoutMillis; +import static com.yugabyte.yw.models.helpers.CommonUtils.performPagedQuery; +import static com.yugabyte.yw.models.helpers.EntityOperation.CREATE; +import static com.yugabyte.yw.models.helpers.EntityOperation.UPDATE; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.models.Alert; import com.yugabyte.yw.models.filters.AlertFilter; @@ -18,24 +25,16 @@ import com.yugabyte.yw.models.paging.AlertPagedResponse; import io.ebean.Query; import io.ebean.annotation.Transactional; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; - -import javax.inject.Singleton; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.function.Consumer; import java.util.stream.Collectors; - -import static com.yugabyte.yw.models.Alert.createQueryByFilter; -import static com.yugabyte.yw.models.helpers.CommonUtils.nowWithoutMillis; -import static com.yugabyte.yw.models.helpers.CommonUtils.performPagedQuery; -import static com.yugabyte.yw.models.helpers.EntityOperation.CREATE; -import static com.yugabyte.yw.models.helpers.EntityOperation.UPDATE; -import static play.mvc.Http.Status.BAD_REQUEST; +import javax.inject.Singleton; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; @Singleton @Slf4j diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertUtils.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertUtils.java index c1442159b538..25cd109d2786 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertUtils.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/AlertUtils.java @@ -8,12 +8,11 @@ import com.yugabyte.yw.models.AlertReceiver; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.helpers.KnownAlertLabels; +import java.lang.reflect.InvocationTargetException; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.reflect.InvocationTargetException; - public class AlertUtils { public static final Logger LOG = LoggerFactory.getLogger(AlertUtils.class); diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/SmtpData.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/SmtpData.java index 9223f2a070db..f5258a848f14 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/SmtpData.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/SmtpData.java @@ -2,9 +2,9 @@ package com.yugabyte.yw.common.alerts; -import java.util.Objects; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; @ApiModel(value = "Smtp Data", description = "Customers SMTP data.") public class SmtpData { diff --git a/managed/src/main/java/com/yugabyte/yw/common/alerts/impl/AlertReceiverEmail.java b/managed/src/main/java/com/yugabyte/yw/common/alerts/impl/AlertReceiverEmail.java index 367da5aec75d..4a72fae7f963 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/alerts/impl/AlertReceiverEmail.java +++ b/managed/src/main/java/com/yugabyte/yw/common/alerts/impl/AlertReceiverEmail.java @@ -2,13 +2,6 @@ package com.yugabyte.yw.common.alerts.impl; -import java.util.Collections; -import java.util.List; - -import javax.mail.MessagingException; - -import org.apache.commons.collections.CollectionUtils; - import com.google.inject.Inject; import com.google.inject.Singleton; import com.yugabyte.yw.common.EmailHelper; @@ -20,8 +13,11 @@ import com.yugabyte.yw.models.Alert; import com.yugabyte.yw.models.AlertReceiver; import com.yugabyte.yw.models.Customer; - +import java.util.Collections; +import java.util.List; +import javax.mail.MessagingException; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; @Slf4j @Singleton diff --git a/managed/src/main/java/com/yugabyte/yw/common/audit/AuditService.java b/managed/src/main/java/com/yugabyte/yw/common/audit/AuditService.java index a12e1e6f72d6..da113acace79 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/audit/AuditService.java +++ b/managed/src/main/java/com/yugabyte/yw/common/audit/AuditService.java @@ -19,14 +19,13 @@ import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; import com.yugabyte.yw.models.Audit; import com.yugabyte.yw.models.Users; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.mvc.Http; - -import javax.inject.Singleton; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; +import javax.inject.Singleton; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.mvc.Http; @Singleton public class AuditService { diff --git a/managed/src/main/java/com/yugabyte/yw/common/config/impl/DelegatingConfig.java b/managed/src/main/java/com/yugabyte/yw/common/config/impl/DelegatingConfig.java index f5ec69895768..fac708d4858b 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/config/impl/DelegatingConfig.java +++ b/managed/src/main/java/com/yugabyte/yw/common/config/impl/DelegatingConfig.java @@ -10,8 +10,14 @@ package com.yugabyte.yw.common.config.impl; -import com.typesafe.config.*; - +import com.typesafe.config.Config; +import com.typesafe.config.ConfigList; +import com.typesafe.config.ConfigMemorySize; +import com.typesafe.config.ConfigMergeable; +import com.typesafe.config.ConfigObject; +import com.typesafe.config.ConfigOrigin; +import com.typesafe.config.ConfigResolveOptions; +import com.typesafe.config.ConfigValue; import java.time.Duration; import java.time.Period; import java.time.temporal.TemporalAmount; diff --git a/managed/src/main/java/com/yugabyte/yw/common/config/impl/RuntimeConfig.java b/managed/src/main/java/com/yugabyte/yw/common/config/impl/RuntimeConfig.java index ca1d60c4cf96..ad0169503faa 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/config/impl/RuntimeConfig.java +++ b/managed/src/main/java/com/yugabyte/yw/common/config/impl/RuntimeConfig.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.common.config.impl; +import static com.yugabyte.yw.models.ScopedRuntimeConfig.GLOBAL_SCOPE_UUID; + import com.typesafe.config.Config; import com.typesafe.config.ConfigValueFactory; import com.yugabyte.yw.models.Customer; @@ -20,8 +22,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static com.yugabyte.yw.models.ScopedRuntimeConfig.GLOBAL_SCOPE_UUID; - /** * This class implements most (but not all) methods of com.typesafe.config.Config In addition this * also provides for mutating the config using `setValue(path, value)` method. Any mutations will be diff --git a/managed/src/main/java/com/yugabyte/yw/common/config/impl/SettableRuntimeConfigFactory.java b/managed/src/main/java/com/yugabyte/yw/common/config/impl/SettableRuntimeConfigFactory.java index 9aacf12c0b8e..5f7d32dcce89 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/config/impl/SettableRuntimeConfigFactory.java +++ b/managed/src/main/java/com/yugabyte/yw/common/config/impl/SettableRuntimeConfigFactory.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.common.config.impl; +import static com.yugabyte.yw.models.ScopedRuntimeConfig.GLOBAL_SCOPE_UUID; + import com.google.common.annotations.VisibleForTesting; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; @@ -19,15 +21,12 @@ import com.yugabyte.yw.models.RuntimeConfigEntry; import com.yugabyte.yw.models.Universe; import io.ebean.Model; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.inject.Inject; -import javax.inject.Singleton; import java.util.Map; import java.util.UUID; - -import static com.yugabyte.yw.models.ScopedRuntimeConfig.GLOBAL_SCOPE_UUID; +import javax.inject.Inject; +import javax.inject.Singleton; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** Factory to create RuntimeConfig for various scopes */ @Singleton diff --git a/managed/src/main/java/com/yugabyte/yw/common/ha/PlatformReplicationHelper.java b/managed/src/main/java/com/yugabyte/yw/common/ha/PlatformReplicationHelper.java index b976fa1825ce..fa86c550f48f 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/ha/PlatformReplicationHelper.java +++ b/managed/src/main/java/com/yugabyte/yw/common/ha/PlatformReplicationHelper.java @@ -15,22 +15,18 @@ import com.google.common.annotations.VisibleForTesting; import com.google.inject.Inject; import com.google.inject.Singleton; -import com.yugabyte.yw.common.*; +import com.yugabyte.yw.common.ApiHelper; +import com.yugabyte.yw.common.PlatformInstanceClient; +import com.yugabyte.yw.common.PlatformInstanceClientFactory; +import com.yugabyte.yw.common.ShellProcessHandler; +import com.yugabyte.yw.common.ShellResponse; +import com.yugabyte.yw.common.Util; import com.yugabyte.yw.common.config.impl.RuntimeConfig; import com.yugabyte.yw.common.config.impl.SettableRuntimeConfigFactory; import com.yugabyte.yw.common.ha.PlatformReplicationManager.PlatformBackupParams; import com.yugabyte.yw.models.HighAvailabilityConfig; import com.yugabyte.yw.models.PlatformInstance; import io.ebean.Model; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.VelocityEngine; -import org.apache.velocity.runtime.RuntimeConstants; -import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.libs.Json; - import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; @@ -43,6 +39,14 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.apache.velocity.Template; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.VelocityEngine; +import org.apache.velocity.runtime.RuntimeConstants; +import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; @Singleton public class PlatformReplicationHelper { diff --git a/managed/src/main/java/com/yugabyte/yw/common/ha/PlatformReplicationManager.java b/managed/src/main/java/com/yugabyte/yw/common/ha/PlatformReplicationManager.java index 6d0108ba4792..144fe62854c2 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/ha/PlatformReplicationManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/ha/PlatformReplicationManager.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.common.ha; +import static com.yugabyte.yw.common.ha.PlatformReplicationHelper.REPLICATION_FREQUENCY_KEY; + import akka.actor.ActorSystem; import akka.actor.Cancellable; import com.fasterxml.jackson.databind.JsonNode; @@ -22,11 +24,6 @@ import com.yugabyte.yw.common.Util; import com.yugabyte.yw.models.HighAvailabilityConfig; import com.yugabyte.yw.models.PlatformInstance; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.libs.Json; -import scala.concurrent.ExecutionContext; - import java.io.File; import java.io.IOException; import java.net.MalformedURLException; @@ -34,12 +31,20 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.time.Duration; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import java.util.stream.StreamSupport; - -import static com.yugabyte.yw.common.ha.PlatformReplicationHelper.REPLICATION_FREQUENCY_KEY; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; +import scala.concurrent.ExecutionContext; @Singleton public class PlatformReplicationManager { diff --git a/managed/src/main/java/com/yugabyte/yw/common/kms/EncryptionAtRestManager.java b/managed/src/main/java/com/yugabyte/yw/common/kms/EncryptionAtRestManager.java index 832932654290..0d342bd2f555 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/kms/EncryptionAtRestManager.java +++ b/managed/src/main/java/com/yugabyte/yw/common/kms/EncryptionAtRestManager.java @@ -22,16 +22,18 @@ import com.yugabyte.yw.common.kms.util.EncryptionAtRestUtil.BackupEntry; import com.yugabyte.yw.common.kms.util.KeyProvider; import com.yugabyte.yw.forms.UniverseTaskParams.EncryptionAtRestConfig; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.KmsConfig; import java.io.File; import java.lang.reflect.Constructor; import java.nio.file.Files; -import java.util.*; +import java.util.List; +import java.util.Objects; +import java.util.UUID; import java.util.function.Consumer; +import java.util.stream.Collectors; import javax.inject.Singleton; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.stream.Collectors; import play.libs.Json; @Singleton diff --git a/managed/src/main/java/com/yugabyte/yw/common/kms/services/AwsEARService.java b/managed/src/main/java/com/yugabyte/yw/common/kms/services/AwsEARService.java index 1d61ad85fe66..a6e2755751db 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/kms/services/AwsEARService.java +++ b/managed/src/main/java/com/yugabyte/yw/common/kms/services/AwsEARService.java @@ -17,7 +17,6 @@ import com.yugabyte.yw.common.kms.util.EncryptionAtRestUtil; import com.yugabyte.yw.common.kms.util.KeyProvider; import com.yugabyte.yw.forms.UniverseTaskParams.EncryptionAtRestConfig; - import java.util.UUID; /** diff --git a/managed/src/main/java/com/yugabyte/yw/common/kms/services/EncryptionAtRestService.java b/managed/src/main/java/com/yugabyte/yw/common/kms/services/EncryptionAtRestService.java index 28da54f96b88..3a7c5cbc5553 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/kms/services/EncryptionAtRestService.java +++ b/managed/src/main/java/com/yugabyte/yw/common/kms/services/EncryptionAtRestService.java @@ -12,16 +12,16 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.kms.algorithms.SupportedAlgorithmInterface; -import com.yugabyte.yw.forms.UniverseTaskParams.EncryptionAtRestConfig; import com.yugabyte.yw.common.kms.util.EncryptionAtRestUtil; import com.yugabyte.yw.common.kms.util.EncryptionAtRestUtil.BackupEntry; import com.yugabyte.yw.common.kms.util.KeyProvider; +import com.yugabyte.yw.forms.UniverseTaskParams.EncryptionAtRestConfig; import com.yugabyte.yw.models.KmsConfig; import com.yugabyte.yw.models.KmsHistory; import com.yugabyte.yw.models.KmsHistoryId; import com.yugabyte.yw.models.Universe; -import java.util.Arrays; import java.util.ArrayList; +import java.util.Arrays; import java.util.Base64; import java.util.List; import java.util.UUID; diff --git a/managed/src/main/java/com/yugabyte/yw/common/kms/services/SmartKeyEARService.java b/managed/src/main/java/com/yugabyte/yw/common/kms/services/SmartKeyEARService.java index f88bfce55795..295e96b42449 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/kms/services/SmartKeyEARService.java +++ b/managed/src/main/java/com/yugabyte/yw/common/kms/services/SmartKeyEARService.java @@ -20,9 +20,7 @@ import com.yugabyte.yw.common.kms.util.EncryptionAtRestUtil; import com.yugabyte.yw.common.kms.util.KeyProvider; import com.yugabyte.yw.forms.UniverseTaskParams.EncryptionAtRestConfig; -import java.util.Arrays; import java.util.Base64; -import java.util.List; import java.util.Map; import java.util.UUID; import play.api.Play; diff --git a/managed/src/main/java/com/yugabyte/yw/common/kms/util/AwsEARServiceUtil.java b/managed/src/main/java/com/yugabyte/yw/common/kms/util/AwsEARServiceUtil.java index 41ad94431c49..0f6d0d5b4147 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/kms/util/AwsEARServiceUtil.java +++ b/managed/src/main/java/com/yugabyte/yw/common/kms/util/AwsEARServiceUtil.java @@ -18,7 +18,6 @@ import com.amazonaws.services.identitymanagement.model.GetRoleRequest; import com.amazonaws.services.identitymanagement.model.GetRoleResult; import com.amazonaws.services.identitymanagement.model.Role; -import com.amazonaws.services.identitymanagement.model.User; import com.amazonaws.services.kms.AWSKMS; import com.amazonaws.services.kms.AWSKMSClientBuilder; import com.amazonaws.services.kms.model.AliasListEntry; @@ -36,22 +35,14 @@ import com.amazonaws.services.kms.model.UpdateAliasRequest; import com.amazonaws.services.securitytoken.AWSSecurityTokenService; import com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClientBuilder; -import com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClient; import com.amazonaws.services.securitytoken.model.GetCallerIdentityRequest; import com.amazonaws.services.securitytoken.model.GetCallerIdentityResult; -import io.ebean.annotation.EnumValue; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; -import com.yugabyte.yw.commissioner.Common.CloudType; -import com.yugabyte.yw.models.KmsConfig; -import com.yugabyte.yw.models.Provider; -import com.yugabyte.yw.models.Region; +import io.ebean.annotation.EnumValue; import java.nio.ByteBuffer; -import java.util.Map; -import java.util.Properties; import java.util.UUID; - import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/managed/src/main/java/com/yugabyte/yw/common/kms/util/EncryptionAtRestUtil.java b/managed/src/main/java/com/yugabyte/yw/common/kms/util/EncryptionAtRestUtil.java index ba4eda68798b..2e34b995e943 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/kms/util/EncryptionAtRestUtil.java +++ b/managed/src/main/java/com/yugabyte/yw/common/kms/util/EncryptionAtRestUtil.java @@ -10,8 +10,11 @@ package com.yugabyte.yw.common.kms.util; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.Util; import com.yugabyte.yw.common.YWServiceException; @@ -21,19 +24,19 @@ import com.yugabyte.yw.models.KmsHistory; import com.yugabyte.yw.models.KmsHistoryId; import com.yugabyte.yw.models.Universe; -import com.fasterxml.jackson.databind.node.ArrayNode; - import java.io.File; import java.lang.reflect.Constructor; -import java.util.*; - +import java.util.Arrays; +import java.util.Base64; +import java.util.List; +import java.util.Set; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.crypto.encrypt.Encryptors; import org.springframework.security.crypto.encrypt.TextEncryptor; import play.api.Play; import play.libs.Json; -import static play.mvc.Http.Status.BAD_REQUEST; public class EncryptionAtRestUtil { protected static final Logger LOG = LoggerFactory.getLogger(EncryptionAtRestUtil.class); diff --git a/managed/src/main/java/com/yugabyte/yw/common/kms/util/KeyProvider.java b/managed/src/main/java/com/yugabyte/yw/common/kms/util/KeyProvider.java index 69699733b437..7723d2045778 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/kms/util/KeyProvider.java +++ b/managed/src/main/java/com/yugabyte/yw/common/kms/util/KeyProvider.java @@ -10,9 +10,11 @@ package com.yugabyte.yw.common.kms.util; -import io.ebean.annotation.EnumValue; import com.yugabyte.yw.common.kms.algorithms.SupportedAlgorithmInterface; -import com.yugabyte.yw.common.kms.services.*; +import com.yugabyte.yw.common.kms.services.AwsEARService; +import com.yugabyte.yw.common.kms.services.EncryptionAtRestService; +import com.yugabyte.yw.common.kms.services.SmartKeyEARService; +import io.ebean.annotation.EnumValue; /** * A list of third party encryption key providers that YB currently supports and the corresponding diff --git a/managed/src/main/java/com/yugabyte/yw/common/password/PasswordComplexityValidator.java b/managed/src/main/java/com/yugabyte/yw/common/password/PasswordComplexityValidator.java index 3a635f386d43..74c17e168b08 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/password/PasswordComplexityValidator.java +++ b/managed/src/main/java/com/yugabyte/yw/common/password/PasswordComplexityValidator.java @@ -11,10 +11,9 @@ package com.yugabyte.yw.common.password; import com.yugabyte.yw.forms.PasswordPolicyFormData; -import play.data.validation.ValidationError; - import java.util.function.Function; import java.util.function.Predicate; +import play.data.validation.ValidationError; class PasswordComplexityValidator implements PasswordValidator { private final Function characterNumberExtractor; diff --git a/managed/src/main/java/com/yugabyte/yw/common/password/PasswordPolicyService.java b/managed/src/main/java/com/yugabyte/yw/common/password/PasswordPolicyService.java index e0f9c7a6ce92..51730ad72722 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/password/PasswordPolicyService.java +++ b/managed/src/main/java/com/yugabyte/yw/common/password/PasswordPolicyService.java @@ -10,23 +10,22 @@ package com.yugabyte.yw.common.password; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.typesafe.config.Config; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.forms.PasswordPolicyFormData; import com.yugabyte.yw.models.CustomerConfig; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; -import play.data.validation.ValidationError; - -import javax.inject.Inject; -import javax.inject.Singleton; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.UUID; import java.util.stream.Collectors; - -import static play.mvc.Http.Status.BAD_REQUEST; +import javax.inject.Inject; +import javax.inject.Singleton; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; +import play.data.validation.ValidationError; @Singleton public class PasswordPolicyService { diff --git a/managed/src/main/java/com/yugabyte/yw/common/services/LocalYBClientService.java b/managed/src/main/java/com/yugabyte/yw/common/services/LocalYBClientService.java index e2a11ae56157..37dea9d34601 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/services/LocalYBClientService.java +++ b/managed/src/main/java/com/yugabyte/yw/common/services/LocalYBClientService.java @@ -3,11 +3,9 @@ package com.yugabyte.yw.common.services; import javax.inject.Singleton; - -import org.yb.client.YBClient; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.yb.client.YBClient; @Singleton public class LocalYBClientService implements YBClientService { diff --git a/managed/src/main/java/com/yugabyte/yw/common/swagger/YWModelConverter.java b/managed/src/main/java/com/yugabyte/yw/common/swagger/YWModelConverter.java index b0b722c2f82e..e093d8278969 100644 --- a/managed/src/main/java/com/yugabyte/yw/common/swagger/YWModelConverter.java +++ b/managed/src/main/java/com/yugabyte/yw/common/swagger/YWModelConverter.java @@ -8,13 +8,12 @@ import io.swagger.converter.ModelConverters; import io.swagger.models.Model; import io.swagger.models.properties.Property; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.Arrays; import java.util.Iterator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Singleton public class YWModelConverter implements ModelConverter { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/AbstractPlatformController.java b/managed/src/main/java/com/yugabyte/yw/controllers/AbstractPlatformController.java index d28a72424742..1f2e7e9a2928 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/AbstractPlatformController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/AbstractPlatformController.java @@ -9,17 +9,23 @@ */ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.controllers.TokenAuthenticator.API_TOKEN_HEADER; + import com.google.common.annotations.VisibleForTesting; import com.google.inject.Inject; import com.yugabyte.yw.common.ValidatingFormFactory; import com.yugabyte.yw.common.audit.AuditService; import com.yugabyte.yw.models.Users; -import io.swagger.annotations.*; +import io.swagger.annotations.ApiKeyAuthDefinition; +import io.swagger.annotations.Contact; +import io.swagger.annotations.ExternalDocs; +import io.swagger.annotations.Info; +import io.swagger.annotations.License; +import io.swagger.annotations.SecurityDefinition; +import io.swagger.annotations.SwaggerDefinition; import play.mvc.Controller; import play.mvc.Http; -import static com.yugabyte.yw.controllers.TokenAuthenticator.API_TOKEN_HEADER; - /** * This class contains dependencies, which can be used by most of the Platform controllers. An * example of such a functionality is the request audit. diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/AccessKeyController.java b/managed/src/main/java/com/yugabyte/yw/controllers/AccessKeyController.java index 83b3f7be628e..d50b7635ae80 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/AccessKeyController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/AccessKeyController.java @@ -2,34 +2,35 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.commissioner.Common.CloudType.onprem; +import static com.yugabyte.yw.forms.YWResults.YWSuccess.withMessage; + import com.google.inject.Inject; import com.yugabyte.yw.common.AccessManager; import com.yugabyte.yw.common.TemplateManager; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.forms.AccessKeyFormData; import com.yugabyte.yw.forms.YWResults; +import com.yugabyte.yw.forms.YWResults.YWSuccess; import com.yugabyte.yw.models.AccessKey; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; -import com.yugabyte.yw.forms.YWResults.YWSuccess; -import io.swagger.annotations.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.data.Form; -import play.libs.Json; -import play.mvc.Http; -import play.mvc.Result; - +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.UUID; - -import static com.yugabyte.yw.commissioner.Common.CloudType.onprem; -import static com.yugabyte.yw.forms.YWResults.YWSuccess.withMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.data.Form; +import play.libs.Json; +import play.mvc.Http; +import play.mvc.Result; @Api(value = "AccessKey", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class AccessKeyController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/AlertController.java b/managed/src/main/java/com/yugabyte/yw/controllers/AlertController.java index 1c76aaf43b24..809b91fdabe9 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/AlertController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/AlertController.java @@ -20,7 +20,11 @@ import com.google.inject.Inject; import com.yugabyte.yw.common.AlertDefinitionTemplate; import com.yugabyte.yw.common.YWServiceException; -import com.yugabyte.yw.common.alerts.*; +import com.yugabyte.yw.common.alerts.AlertDefinitionGroupService; +import com.yugabyte.yw.common.alerts.AlertRouteService; +import com.yugabyte.yw.common.alerts.AlertService; +import com.yugabyte.yw.common.alerts.AlertUtils; +import com.yugabyte.yw.common.alerts.YWValidateException; import com.yugabyte.yw.forms.AlertReceiverFormData; import com.yugabyte.yw.forms.AlertRouteFormData; import com.yugabyte.yw.forms.YWResults; @@ -29,7 +33,11 @@ import com.yugabyte.yw.forms.filters.AlertDefinitionTemplateApiFilter; import com.yugabyte.yw.forms.paging.AlertDefinitionGroupPagedApiQuery; import com.yugabyte.yw.forms.paging.AlertPagedApiQuery; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Alert; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.AlertReceiver; +import com.yugabyte.yw.models.AlertRoute; +import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.filters.AlertDefinitionGroupFilter; import com.yugabyte.yw.models.filters.AlertDefinitionTemplateFilter; import com.yugabyte.yw.models.filters.AlertFilter; @@ -37,15 +45,18 @@ import com.yugabyte.yw.models.paging.AlertDefinitionGroupPagedResponse; import com.yugabyte.yw.models.paging.AlertPagedQuery; import com.yugabyte.yw.models.paging.AlertPagedResponse; -import io.swagger.annotations.*; -import lombok.extern.slf4j.Slf4j; -import play.libs.Json; -import play.mvc.Result; - +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; import java.util.Arrays; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; +import play.libs.Json; +import play.mvc.Result; @Slf4j @Api(value = "Alert", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/ApiDiscoveryController.java b/managed/src/main/java/com/yugabyte/yw/controllers/ApiDiscoveryController.java index 8847fb4451c5..15430afb88bb 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/ApiDiscoveryController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/ApiDiscoveryController.java @@ -2,18 +2,14 @@ package com.yugabyte.yw.controllers; -import java.util.List; - +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.inject.Inject; import com.google.inject.Provider; - +import java.util.List; +import play.libs.Json; import play.mvc.Result; import play.routing.Router; -import play.routing.Router.RouteDocumentation; -import play.libs.Json; - -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; public class ApiDiscoveryController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/AuditController.java b/managed/src/main/java/com/yugabyte/yw/controllers/AuditController.java index d6ae32fbba50..0e8396683505 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/AuditController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/AuditController.java @@ -6,16 +6,14 @@ import com.yugabyte.yw.models.Audit; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Users; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.Authorization; -import play.mvc.Result; - import java.util.List; import java.util.UUID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.mvc.Result; @Api(value = "Audit", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class AuditController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/AvailabilityZoneController.java b/managed/src/main/java/com/yugabyte/yw/controllers/AvailabilityZoneController.java index 9d55ba3e8c0f..2fbd09660e5c 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/AvailabilityZoneController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/AvailabilityZoneController.java @@ -7,18 +7,21 @@ import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.AvailabilityZone; import com.yugabyte.yw.models.Region; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.Form; import play.libs.Json; import play.mvc.Result; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - @Api( value = "AvailabilityZone", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/BackupsController.java b/managed/src/main/java/com/yugabyte/yw/controllers/BackupsController.java index 24a4b54ea243..93dc6f540355 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/BackupsController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/BackupsController.java @@ -10,28 +10,32 @@ import com.yugabyte.yw.common.Util; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.forms.BackupTableParams; -import com.yugabyte.yw.forms.YWResults.YWError; import com.yugabyte.yw.forms.YWResults; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.forms.YWResults.YWError; +import com.yugabyte.yw.models.Backup; import com.yugabyte.yw.models.Backup.BackupState; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.TaskInfo; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; import com.yugabyte.yw.models.helpers.CommonUtils; import com.yugabyte.yw.models.helpers.TaskType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.Authorization; -import play.data.Form; -import play.libs.Json; -import play.mvc.Result; - import java.util.ArrayList; import java.util.List; import java.util.UUID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.data.Form; +import play.libs.Json; +import play.mvc.Result; @Api(value = "Backups", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class BackupsController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/CertificateController.java b/managed/src/main/java/com/yugabyte/yw/controllers/CertificateController.java index af63ec19208f..9a93ea8c60aa 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/CertificateController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/CertificateController.java @@ -9,21 +9,25 @@ import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.forms.CertificateParams; import com.yugabyte.yw.forms.ClientCertParams; -import com.yugabyte.yw.forms.YWResults.YWError; import com.yugabyte.yw.forms.YWResults; +import com.yugabyte.yw.forms.YWResults.YWError; import com.yugabyte.yw.models.CertificateInfo; import com.yugabyte.yw.models.Customer; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.Authorization; +import java.util.Date; +import java.util.List; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.Form; import play.libs.Json; import play.mvc.Result; -import java.util.Date; -import java.util.List; -import java.util.UUID; - @Api( value = "Certificate Info", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/CloudProviderApiController.java b/managed/src/main/java/com/yugabyte/yw/controllers/CloudProviderApiController.java index f5a24bcb015b..2a05b243b202 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/CloudProviderApiController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/CloudProviderApiController.java @@ -19,11 +19,14 @@ import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; -import io.swagger.annotations.*; -import play.mvc.Result; - +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; import java.io.IOException; import java.util.UUID; +import play.mvc.Result; @Api(value = "Provider1", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class CloudProviderApiController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/CloudProviderController.java b/managed/src/main/java/com/yugabyte/yw/controllers/CloudProviderController.java index 309c2ace4690..13322ce68edd 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/CloudProviderController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/CloudProviderController.java @@ -17,15 +17,18 @@ import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Provider; -import io.swagger.annotations.*; -import play.libs.Json; -import play.mvc.Result; - +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; +import play.libs.Json; +import play.mvc.Result; @Api(value = "Provider", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class CloudProviderController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/CustomerConfigController.java b/managed/src/main/java/com/yugabyte/yw/controllers/CustomerConfigController.java index aa888db8e64f..df552e0c8fd1 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/CustomerConfigController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/CustomerConfigController.java @@ -10,14 +10,17 @@ import com.yugabyte.yw.models.CustomerConfig; import com.yugabyte.yw.models.helpers.CommonUtils; import com.yugabyte.yw.models.helpers.CustomerConfigValidator; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.libs.Json; import play.mvc.Result; -import java.util.UUID; - @Api( value = "Customer Config", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/CustomerController.java b/managed/src/main/java/com/yugabyte/yw/controllers/CustomerController.java index c0000bde5255..0c3e4a9cb579 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/CustomerController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/CustomerController.java @@ -24,31 +24,44 @@ import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.commissioner.Common.CloudType; import com.yugabyte.yw.common.AlertDefinitionTemplate; -import com.yugabyte.yw.common.alerts.AlertDefinitionGroupService; import com.yugabyte.yw.common.CloudQueryHelper; import com.yugabyte.yw.common.PlacementInfoUtil; import com.yugabyte.yw.common.YWServiceException; +import com.yugabyte.yw.common.alerts.AlertDefinitionGroupService; import com.yugabyte.yw.common.alerts.AlertService; import com.yugabyte.yw.forms.AlertingFormData; -import com.yugabyte.yw.forms.FeatureUpdateFormData; import com.yugabyte.yw.forms.CustomerDetailsData; +import com.yugabyte.yw.forms.FeatureUpdateFormData; import com.yugabyte.yw.forms.MetricQueryParams; import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.metrics.MetricQueryHelper; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; import com.yugabyte.yw.models.filters.AlertDefinitionGroupFilter; import com.yugabyte.yw.models.helpers.CommonUtils; import com.yugabyte.yw.models.helpers.NodeDetails; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.Form; import play.libs.Json; import play.mvc.Result; -import com.yugabyte.yw.forms.YWResults; - -import java.util.*; -import java.util.stream.Collectors; @Api(value = "Customer", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class CustomerController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/CustomerTaskController.java b/managed/src/main/java/com/yugabyte/yw/controllers/CustomerTaskController.java index 2036d54ae47a..54c729e4d916 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/CustomerTaskController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/CustomerTaskController.java @@ -2,29 +2,38 @@ package com.yugabyte.yw.controllers; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.inject.Inject; import com.yugabyte.yw.commissioner.Commissioner; import com.yugabyte.yw.common.ApiResponse; import com.yugabyte.yw.common.config.RuntimeConfigFactory; -import com.yugabyte.yw.forms.*; +import com.yugabyte.yw.forms.CustomerTaskFormData; +import com.yugabyte.yw.forms.SubTaskFormData; +import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; +import com.yugabyte.yw.forms.UniverseResp; +import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.CustomerTask; import com.yugabyte.yw.models.TaskInfo; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.TaskType; -import io.swagger.annotations.*; import io.ebean.Query; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.libs.Json; import play.mvc.Result; -import java.util.*; - @Api( value = "Customer Task", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/EncryptionAtRestController.java b/managed/src/main/java/com/yugabyte/yw/controllers/EncryptionAtRestController.java index d8fea8d1e293..4b818647c53b 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/EncryptionAtRestController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/EncryptionAtRestController.java @@ -23,18 +23,31 @@ import com.yugabyte.yw.common.kms.util.EncryptionAtRestUtil; import com.yugabyte.yw.common.kms.util.KeyProvider; import com.yugabyte.yw.forms.YWResults; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.KmsConfig; +import com.yugabyte.yw.models.KmsHistory; +import com.yugabyte.yw.models.KmsHistoryId; import com.yugabyte.yw.models.helpers.CommonUtils; import com.yugabyte.yw.models.helpers.TaskType; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; +import java.util.Base64; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import java.util.function.Function; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.libs.Json; import play.mvc.Result; -import io.swagger.annotations.*; - -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; @Api( value = "Encryption At Rest", diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/HAAuthenticator.java b/managed/src/main/java/com/yugabyte/yw/controllers/HAAuthenticator.java index 6f4eeed92d1e..52618504dca8 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/HAAuthenticator.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/HAAuthenticator.java @@ -11,15 +11,13 @@ package com.yugabyte.yw.controllers; import com.yugabyte.yw.models.HighAvailabilityConfig; - +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; import play.mvc.Action; import play.mvc.Http; import play.mvc.Result; import play.mvc.Results; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionStage; - public class HAAuthenticator extends Action.Simple { public static final String HA_CLUSTER_KEY_TOKEN_HEADER = "HA-AUTH-TOKEN"; diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/HAController.java b/managed/src/main/java/com/yugabyte/yw/controllers/HAController.java index 763a8eca3eb6..6b531e216a3b 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/HAController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/HAController.java @@ -18,6 +18,8 @@ import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.HighAvailabilityConfig; import com.yugabyte.yw.models.PlatformInstance; +import java.util.Optional; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.Form; @@ -25,9 +27,6 @@ import play.mvc.Result; import play.mvc.Results; -import java.util.Optional; -import java.util.UUID; - public class HAController extends AuthenticatedController { public static final Logger LOG = LoggerFactory.getLogger(HAController.class); diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/ImportController.java b/managed/src/main/java/com/yugabyte/yw/controllers/ImportController.java index bd2edd143305..fe791b7efb9c 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/ImportController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/ImportController.java @@ -14,7 +14,6 @@ package com.yugabyte.yw.controllers; -import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.inject.Inject; @@ -29,20 +28,25 @@ import com.yugabyte.yw.common.ApiResponse; import com.yugabyte.yw.common.ConfigHelper; import com.yugabyte.yw.common.Util; -import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.common.ValidatingFormFactory; +import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.common.services.YBClientService; import com.yugabyte.yw.forms.ImportUniverseFormData; -import com.yugabyte.yw.forms.ImportUniverseResponseData; import com.yugabyte.yw.forms.ImportUniverseFormData.State; +import com.yugabyte.yw.forms.ImportUniverseResponseData; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Capability; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Cluster; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ImportedState; import com.yugabyte.yw.forms.UniverseTaskParams; import com.yugabyte.yw.forms.YWResults; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.InstanceType; import com.yugabyte.yw.models.InstanceType.InstanceTypeDetails; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.Universe.UniverseUpdater; import com.yugabyte.yw.models.helpers.CloudSpecificInfo; import com.yugabyte.yw.models.helpers.NodeDetails; @@ -53,22 +57,25 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.Authorization; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ThreadFactory; import lombok.extern.slf4j.Slf4j; import org.yb.client.ListTabletServersResponse; import org.yb.client.YBClient; import org.yb.util.ServerInfo; import play.data.Form; -import play.data.FormFactory; import play.libs.Json; import play.mvc.Http; import play.mvc.Result; -import java.util.*; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.ThreadFactory; - @Api(value = "Import", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) @Slf4j public class ImportController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/InstanceTypeController.java b/managed/src/main/java/com/yugabyte/yw/controllers/InstanceTypeController.java index 90075f4b90de..c460f58885c0 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/InstanceTypeController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/InstanceTypeController.java @@ -2,6 +2,13 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.commissioner.Common.CloudType.onprem; +import static java.util.function.Function.identity; +import static java.util.stream.Collectors.groupingBy; +import static java.util.stream.Collectors.mapping; +import static java.util.stream.Collectors.toMap; +import static java.util.stream.Collectors.toSet; + import com.google.inject.Inject; import com.typesafe.config.Config; import com.yugabyte.yw.cloud.CloudAPI; @@ -14,26 +21,25 @@ import com.yugabyte.yw.models.InstanceType; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.Authorization; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import play.data.Form; import play.libs.Json; import play.mvc.Result; -import java.util.*; -import java.util.stream.Collectors; - -import static com.yugabyte.yw.commissioner.Common.CloudType.onprem; -import static java.util.function.Function.identity; -import static java.util.stream.Collectors.*; - @Api( value = "Instance Type", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/InternalHAController.java b/managed/src/main/java/com/yugabyte/yw/controllers/InternalHAController.java index 16e1655a0412..03ba3d157daa 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/InternalHAController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/InternalHAController.java @@ -19,6 +19,12 @@ import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.HighAvailabilityConfig; import com.yugabyte.yw.models.PlatformInstance; +import java.io.File; +import java.net.URL; +import java.util.Date; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.libs.Files; @@ -27,13 +33,6 @@ import play.mvc.Result; import play.mvc.With; -import java.io.File; -import java.net.URL; -import java.util.Date; -import java.util.Map; -import java.util.Optional; -import java.util.Set; - @With(HAAuthenticator.class) public class InternalHAController extends Controller { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/MetaMasterController.java b/managed/src/main/java/com/yugabyte/yw/controllers/MetaMasterController.java index 3b457191c87b..5881a1c0124c 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/MetaMasterController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/MetaMasterController.java @@ -2,6 +2,8 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ExposingServiceState; + import com.google.inject.Inject; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase.ServerType; @@ -17,20 +19,20 @@ import com.yugabyte.yw.models.helpers.CloudSpecificInfo; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.PlacementInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.Authorization; -import play.mvc.Controller; -import play.mvc.Result; - -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.UUID; import java.util.stream.Collectors; - -import static com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ExposingServiceState; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.mvc.Controller; +import play.mvc.Result; @Api(value = "Metamaster", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class MetaMasterController extends Controller { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/MetricsController.java b/managed/src/main/java/com/yugabyte/yw/controllers/MetricsController.java index fc9b520ca84c..2502badc0262 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/MetricsController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/MetricsController.java @@ -3,21 +3,18 @@ package com.yugabyte.yw.controllers; import com.yugabyte.yw.common.YWServiceException; - -import play.mvc.Result; -import play.mvc.Controller; -import play.mvc.Results; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - +import io.prometheus.client.CollectorRegistry; import io.prometheus.client.exporter.common.TextFormat; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.Authorization; -import io.prometheus.client.CollectorRegistry; import java.io.ByteArrayOutputStream; import java.io.OutputStreamWriter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.mvc.Controller; +import play.mvc.Result; +import play.mvc.Results; @Api(value = "Metrics", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class MetricsController extends Controller { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/NodeInstanceController.java b/managed/src/main/java/com/yugabyte/yw/controllers/NodeInstanceController.java index 4d178ee65636..c6a9c5c196b0 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/NodeInstanceController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/NodeInstanceController.java @@ -12,9 +12,23 @@ import com.yugabyte.yw.forms.NodeInstanceFormData; import com.yugabyte.yw.forms.NodeInstanceFormData.NodeInstanceData; import com.yugabyte.yw.forms.YWResults; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.CertificateInfo; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.NodeInstance; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.AllowedActionsHelper; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.Form; @@ -22,11 +36,6 @@ import play.mvc.Result; import play.mvc.Results; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - @Api( value = "Node Instances", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/PlatformHttpActionAdapter.java b/managed/src/main/java/com/yugabyte/yw/controllers/PlatformHttpActionAdapter.java index 52eb6b03bfed..0bc0a8bc1e56 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/PlatformHttpActionAdapter.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/PlatformHttpActionAdapter.java @@ -1,12 +1,13 @@ package com.yugabyte.yw.controllers; +import static play.mvc.Results.forbidden; +import static play.mvc.Results.unauthorized; + import org.pac4j.core.context.HttpConstants; import org.pac4j.play.PlayWebContext; import org.pac4j.play.http.DefaultHttpActionAdapter; import play.mvc.Result; -import static play.mvc.Results.*; - public class PlatformHttpActionAdapter extends DefaultHttpActionAdapter { @Override diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/PlatformInstanceController.java b/managed/src/main/java/com/yugabyte/yw/controllers/PlatformInstanceController.java index d2a8989298d1..2434608c1517 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/PlatformInstanceController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/PlatformInstanceController.java @@ -19,17 +19,16 @@ import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.HighAvailabilityConfig; import com.yugabyte.yw.models.PlatformInstance; +import java.io.File; +import java.net.URL; +import java.util.Optional; +import java.util.UUID; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.Form; import play.mvc.Result; -import java.io.File; -import java.net.URL; -import java.util.Optional; -import java.util.UUID; - public class PlatformInstanceController extends AuthenticatedController { public static final Logger LOG = LoggerFactory.getLogger(PlatformInstanceController.class); diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/PlatformReplicationController.java b/managed/src/main/java/com/yugabyte/yw/controllers/PlatformReplicationController.java index 101fc1e590f6..1aa65ebabb85 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/PlatformReplicationController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/PlatformReplicationController.java @@ -18,12 +18,6 @@ import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.HighAvailabilityConfig; import com.yugabyte.yw.models.PlatformInstance; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.data.Form; -import play.mvc.Result; - import java.io.File; import java.net.URL; import java.time.Duration; @@ -32,6 +26,11 @@ import java.util.Optional; import java.util.UUID; import java.util.stream.Collectors; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.data.Form; +import play.mvc.Result; public class PlatformReplicationController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/RegionController.java b/managed/src/main/java/com/yugabyte/yw/controllers/RegionController.java index 43c74eaea14c..1c3b2a8678de 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/RegionController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/RegionController.java @@ -16,18 +16,22 @@ import com.yugabyte.yw.models.AvailabilityZone; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.Authorization; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.Form; import play.libs.Json; import play.mvc.Result; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; - @Api(value = "Region", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class RegionController extends AuthenticatedController { @Inject ConfigHelper configHelper; diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/ReleaseController.java b/managed/src/main/java/com/yugabyte/yw/controllers/ReleaseController.java index 8abce2a81900..0bc445ae9617 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/ReleaseController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/ReleaseController.java @@ -10,17 +10,20 @@ import com.yugabyte.yw.forms.ReleaseFormData; import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.Customer; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.Form; import play.libs.Json; import play.mvc.Result; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - @Api(value = "Release", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class ReleaseController extends AuthenticatedController { public static final Logger LOG = LoggerFactory.getLogger(ReleaseController.class); diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/RuntimeConfController.java b/managed/src/main/java/com/yugabyte/yw/controllers/RuntimeConfController.java index 70cc73b2b853..57018b0be025 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/RuntimeConfController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/RuntimeConfController.java @@ -25,14 +25,21 @@ import com.yugabyte.yw.models.RuntimeConfigEntry; import com.yugabyte.yw.models.Universe; import io.ebean.Model; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.mvc.Result; -import java.util.*; -import java.util.stream.Collectors; - @Api( value = "RuntimeConfig", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/ScheduleController.java b/managed/src/main/java/com/yugabyte/yw/controllers/ScheduleController.java index 814cf9226949..0155cc1b4882 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/ScheduleController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/ScheduleController.java @@ -6,17 +6,15 @@ import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Schedule; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.Authorization; -import play.libs.Json; -import play.mvc.Result; - import java.util.List; import java.util.UUID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; +import play.mvc.Result; @Api(value = "Schedule", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class ScheduleController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/SessionController.java b/managed/src/main/java/com/yugabyte/yw/controllers/SessionController.java index 9de499d78d62..164c18be4220 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/SessionController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/SessionController.java @@ -14,13 +14,21 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.ConfigHelper.ConfigType.Security; +import static com.yugabyte.yw.models.Users.Role; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableMap; import com.google.inject.Inject; -import com.yugabyte.yw.common.*; +import com.yugabyte.yw.common.AlertDefinitionTemplate; +import com.yugabyte.yw.common.ApiHelper; +import com.yugabyte.yw.common.ApiResponse; +import com.yugabyte.yw.common.ConfigHelper; +import com.yugabyte.yw.common.ValidatingFormFactory; +import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.common.alerts.AlertDefinitionGroupService; import com.yugabyte.yw.common.alerts.AlertRouteService; import com.yugabyte.yw.common.config.RuntimeConfigFactory; @@ -29,11 +37,29 @@ import com.yugabyte.yw.forms.CustomerRegisterFormData; import com.yugabyte.yw.forms.SetSecurityFormData; import com.yugabyte.yw.forms.YWResults; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.time.Duration; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import javax.persistence.PersistenceException; import org.apache.commons.io.input.ReversedLinesFileReader; import org.pac4j.core.profile.CommonProfile; import org.pac4j.core.profile.ProfileManager; @@ -50,26 +76,11 @@ import play.libs.ws.StandaloneWSResponse; import play.libs.ws.WSClient; import play.libs.ws.WSRequest; -import play.mvc.*; - -import javax.persistence.PersistenceException; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.time.Duration; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionStage; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -import static com.yugabyte.yw.common.ConfigHelper.ConfigType.Security; -import static com.yugabyte.yw.models.Users.Role; +import play.mvc.Controller; +import play.mvc.Http; +import play.mvc.Result; +import play.mvc.Results; +import play.mvc.With; @Api(value = "Session") public class SessionController extends Controller { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/TablesController.java b/managed/src/main/java/com/yugabyte/yw/controllers/TablesController.java index 94045654f9b0..67d1ea066cff 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/TablesController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/TablesController.java @@ -2,6 +2,11 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.commissioner.Common.CloudType.aws; +import static com.yugabyte.yw.common.Util.getUUIDRepresentation; +import static com.yugabyte.yw.forms.TableDefinitionTaskParams.createFromResponse; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; + import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.annotations.VisibleForTesting; @@ -18,11 +23,31 @@ import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.metrics.MetricQueryHelper; import com.yugabyte.yw.metrics.MetricQueryResponse; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Backup; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Schedule; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.ColumnDetails; import com.yugabyte.yw.models.helpers.TableDetails; import com.yugabyte.yw.models.helpers.TaskType; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.Authorization; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import lombok.Builder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,14 +60,6 @@ import play.data.Form; import play.libs.Json; import play.mvc.Result; -import play.mvc.Results; - -import java.util.*; - -import static com.yugabyte.yw.commissioner.Common.CloudType.aws; -import static com.yugabyte.yw.common.Util.getUUIDRepresentation; -import static com.yugabyte.yw.forms.TableDefinitionTaskParams.createFromResponse; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; @Api(value = "Tables", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class TablesController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/TabletServerController.java b/managed/src/main/java/com/yugabyte/yw/controllers/TabletServerController.java index 695ce74ec3a8..1f89ed158a00 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/TabletServerController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/TabletServerController.java @@ -9,13 +9,14 @@ import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Universe; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.mvc.Result; -import java.util.UUID; - @Api( value = "Tablet Server", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/TokenAuthenticator.java b/managed/src/main/java/com/yugabyte/yw/controllers/TokenAuthenticator.java index 0d89f3bd402f..0ee31e661f97 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/TokenAuthenticator.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/TokenAuthenticator.java @@ -2,11 +2,18 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.models.Users.Role; + import com.google.inject.Inject; import com.yugabyte.yw.common.ConfigHelper; import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Users; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.pac4j.core.profile.CommonProfile; import org.pac4j.core.profile.ProfileManager; import org.pac4j.play.PlayWebContext; @@ -16,14 +23,6 @@ import play.mvc.Result; import play.mvc.Results; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionStage; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static com.yugabyte.yw.models.Users.Role; - public class TokenAuthenticator extends Action.Simple { public static final String COOKIE_AUTH_TOKEN = "authToken"; public static final String AUTH_TOKEN_HEADER = "X-AUTH-TOKEN"; diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseActionsController.java b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseActionsController.java index 3587913df067..91ef60e7be06 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseActionsController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseActionsController.java @@ -10,24 +10,27 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.forms.YWResults.YWSuccess.empty; + import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.inject.Inject; import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.controllers.handlers.UniverseActionsHandler; -import com.yugabyte.yw.forms.*; +import com.yugabyte.yw.forms.AlertConfigFormData; +import com.yugabyte.yw.forms.EncryptionAtRestKeyParams; +import com.yugabyte.yw.forms.ToggleTlsParams; +import com.yugabyte.yw.forms.UniverseResp; +import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Universe; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.Authorization; +import java.util.UUID; import lombok.extern.slf4j.Slf4j; import play.libs.Json; import play.mvc.Result; -import java.util.UUID; - -import static com.yugabyte.yw.forms.YWResults.YWSuccess.empty; - @Api( value = "Universe Actions", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseClustersController.java b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseClustersController.java index dba4a5578b5f..cf0d6470bca8 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseClustersController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseClustersController.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.controllers.UniverseControllerRequestBinder.bindFormDataToTaskParams; + import com.google.inject.Inject; import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.controllers.handlers.UniverseCRUDHandler; @@ -20,11 +22,8 @@ import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Universe; -import play.mvc.Result; - import java.util.UUID; - -import static com.yugabyte.yw.controllers.UniverseControllerRequestBinder.bindFormDataToTaskParams; +import play.mvc.Result; public class UniverseClustersController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseController.java b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseController.java index b4bb320267f7..b35e61837690 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseController.java @@ -5,16 +5,18 @@ import com.google.inject.Inject; import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.controllers.handlers.UniverseCRUDHandler; -import com.yugabyte.yw.forms.*; +import com.yugabyte.yw.forms.UniverseResp; +import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Universe; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.mvc.Result; -import java.util.UUID; - @Api(value = "Universe", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class UniverseController extends AuthenticatedController { private static final Logger LOG = LoggerFactory.getLogger(UniverseController.class); diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseControllerRequestBinder.java b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseControllerRequestBinder.java index 7d0a66eeb13e..70895af77b4f 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseControllerRequestBinder.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseControllerRequestBinder.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.controllers; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -17,17 +19,14 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.libs.Json; -import play.mvc.Http; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - -import static play.mvc.Http.Status.BAD_REQUEST; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; +import play.mvc.Http; /** * This code needs to be fixed (ideally purged) as it is doing lot of raw json manipulation. As a diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseInfoController.java b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseInfoController.java index bb46a780fca4..f64132b0139b 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseInfoController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseInfoController.java @@ -25,12 +25,6 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.Authorization; -import lombok.extern.slf4j.Slf4j; -import play.libs.Json; -import play.libs.concurrent.HttpExecutionContext; -import play.mvc.Result; -import play.mvc.Results; - import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -39,6 +33,11 @@ import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; +import lombok.extern.slf4j.Slf4j; +import play.libs.Json; +import play.libs.concurrent.HttpExecutionContext; +import play.mvc.Result; +import play.mvc.Results; @Api( value = "UniverseInfo", diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseUiOnlyController.java b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseUiOnlyController.java index ff7485ae8d42..7b5cb78476c8 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseUiOnlyController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseUiOnlyController.java @@ -2,24 +2,30 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.controllers.UniverseControllerRequestBinder.bindFormDataToTaskParams; + import com.google.inject.Inject; -import com.yugabyte.yw.cloud.UniverseResourceDetails; import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.controllers.handlers.UniverseCRUDHandler; import com.yugabyte.yw.controllers.handlers.UniverseInfoHandler; -import com.yugabyte.yw.forms.*; +import com.yugabyte.yw.forms.DiskIncreaseFormData; +import com.yugabyte.yw.forms.UniverseConfigureTaskParams; +import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; +import com.yugabyte.yw.forms.UniverseResp; +import com.yugabyte.yw.forms.UpgradeParams; +import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Universe; -import io.swagger.annotations.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.mvc.Result; - +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import java.util.Collections; import java.util.Optional; import java.util.UUID; - -import static com.yugabyte.yw.controllers.UniverseControllerRequestBinder.bindFormDataToTaskParams; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.mvc.Result; @Deprecated @Api(hidden = true) diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseYbDbAdminController.java b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseYbDbAdminController.java index 3f443fec5123..f329b530ac84 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/UniverseYbDbAdminController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/UniverseYbDbAdminController.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.forms.YWResults.YWSuccess.withMessage; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.annotations.VisibleForTesting; import com.google.inject.Inject; @@ -24,16 +26,13 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.Authorization; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.Form; import play.libs.Json; import play.mvc.Result; -import java.util.UUID; - -import static com.yugabyte.yw.forms.YWResults.YWSuccess.withMessage; - @Api( value = "Universe YB Database", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/UsersController.java b/managed/src/main/java/com/yugabyte/yw/controllers/UsersController.java index 3b305fe4c310..e23f5485d2ab 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/UsersController.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/UsersController.java @@ -2,6 +2,8 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.models.Users.Role; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.inject.Inject; @@ -12,6 +14,15 @@ import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Users; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Authorization; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.Environment; @@ -19,14 +30,6 @@ import play.libs.Json; import play.mvc.Result; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.UUID; -import io.swagger.annotations.*; - -import static com.yugabyte.yw.models.Users.Role; - @Api(value = "Users", authorizations = @Authorization(AbstractPlatformController.API_KEY_AUTH)) public class UsersController extends AuthenticatedController { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/handlers/CloudProviderHandler.java b/managed/src/main/java/com/yugabyte/yw/controllers/handlers/CloudProviderHandler.java index ab55ef780d33..867bd419e1f2 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/handlers/CloudProviderHandler.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/handlers/CloudProviderHandler.java @@ -10,6 +10,12 @@ package com.yugabyte.yw.controllers.handlers; +import static com.yugabyte.yw.commissioner.Common.CloudType.kubernetes; +import static com.yugabyte.yw.common.ConfigHelper.ConfigType.DockerInstanceTypeMetadata; +import static com.yugabyte.yw.common.ConfigHelper.ConfigType.DockerRegionMetadata; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.HashMultimap; @@ -22,28 +28,38 @@ import com.yugabyte.yw.commissioner.Commissioner; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.commissioner.tasks.CloudBootstrap; -import com.yugabyte.yw.common.*; +import com.yugabyte.yw.common.AccessManager; +import com.yugabyte.yw.common.CloudQueryHelper; +import com.yugabyte.yw.common.ConfigHelper; +import com.yugabyte.yw.common.DnsManager; +import com.yugabyte.yw.common.KubernetesManager; +import com.yugabyte.yw.common.ShellResponse; +import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.forms.EditProviderRequest; import com.yugabyte.yw.forms.KubernetesProviderFormData; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AccessKey; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.InstanceType; +import com.yugabyte.yw.models.NodeInstance; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; import com.yugabyte.yw.models.helpers.TaskType; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import javax.persistence.PersistenceException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.Configuration; import play.Environment; import play.libs.Json; -import javax.persistence.PersistenceException; -import java.io.File; -import java.io.IOException; -import java.util.*; - -import static com.yugabyte.yw.commissioner.Common.CloudType.kubernetes; -import static com.yugabyte.yw.common.ConfigHelper.ConfigType.DockerInstanceTypeMetadata; -import static com.yugabyte.yw.common.ConfigHelper.ConfigType.DockerRegionMetadata; -import static play.mvc.Http.Status.BAD_REQUEST; -import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; - public class CloudProviderHandler { private static final Logger LOG = LoggerFactory.getLogger(CloudProviderHandler.class); private static final JsonNode KUBERNETES_CLOUD_INSTANCE_TYPE = diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseActionsHandler.java b/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseActionsHandler.java index 7ee837d90cbd..fba8b3e35e5e 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseActionsHandler.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseActionsHandler.java @@ -20,22 +20,26 @@ import com.yugabyte.yw.common.Util; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.common.config.RuntimeConfigFactory; -import com.yugabyte.yw.forms.*; +import com.yugabyte.yw.forms.AlertConfigFormData; +import com.yugabyte.yw.forms.EncryptionAtRestKeyParams; +import com.yugabyte.yw.forms.ToggleTlsParams; +import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; +import com.yugabyte.yw.forms.UpgradeParams; +import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.CertificateInfo; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.CustomerTask; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.TaskType; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.Form; import play.mvc.Http; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - public class UniverseActionsHandler { private static final Logger LOG = LoggerFactory.getLogger(UniverseActionsHandler.class); diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseCRUDHandler.java b/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseCRUDHandler.java index cb59244b384b..ca95d28b46c2 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseCRUDHandler.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseCRUDHandler.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.controllers.handlers; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableMap; import com.google.inject.Inject; @@ -24,19 +26,33 @@ import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.common.kms.EncryptionAtRestManager; -import com.yugabyte.yw.forms.*; +import com.yugabyte.yw.forms.DiskIncreaseFormData; +import com.yugabyte.yw.forms.UniverseConfigureTaskParams; +import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Cluster; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.forms.UniverseResp; +import com.yugabyte.yw.forms.UpgradeParams; +import com.yugabyte.yw.models.AccessKey; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.CertificateInfo; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.TaskInfo; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.TaskType; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.mvc.Http; -import java.util.*; - -import static play.mvc.Http.Status.BAD_REQUEST; - public class UniverseCRUDHandler { private static final Logger LOG = LoggerFactory.getLogger(UniverseCRUDHandler.class); diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseInfoHandler.java b/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseInfoHandler.java index 6c7fd2db8d77..e7203d59037b 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseInfoHandler.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseInfoHandler.java @@ -10,6 +10,10 @@ package com.yugabyte.yw.controllers.handlers; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; +import static play.mvc.Http.Status.NOT_FOUND; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.net.HostAndPort; import com.google.inject.Inject; @@ -24,15 +28,10 @@ import com.yugabyte.yw.metrics.MetricQueryHelper; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.HealthCheck; -import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.HealthCheck.Details; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.queries.QueryHelper; -import lombok.extern.slf4j.Slf4j; -import org.yb.client.YBClient; -import play.libs.Json; -import play.mvc.Http; - import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; @@ -40,8 +39,9 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; - -import static play.mvc.Http.Status.*; +import lombok.extern.slf4j.Slf4j; +import org.yb.client.YBClient; +import play.mvc.Http; @Slf4j public class UniverseInfoHandler { diff --git a/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseYbDbAdminHandler.java b/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseYbDbAdminHandler.java index f51c28a7d260..f8ee9d71883b 100644 --- a/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseYbDbAdminHandler.java +++ b/managed/src/main/java/com/yugabyte/yw/controllers/handlers/UniverseYbDbAdminHandler.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.controllers.handlers; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.annotations.VisibleForTesting; import com.google.inject.Inject; @@ -22,18 +24,15 @@ import com.yugabyte.yw.forms.RunQueryFormData; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Universe; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Optional; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.mvc.Controller; import play.mvc.Http; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Optional; - -import static play.mvc.Http.Status.BAD_REQUEST; - public class UniverseYbDbAdminHandler { @VisibleForTesting public static final String RUN_QUERY_ISNT_ALLOWED = diff --git a/managed/src/main/java/com/yugabyte/yw/forms/AccessKeyFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/AccessKeyFormData.java index 426b11a69b98..d943dfe90e27 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/AccessKeyFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/AccessKeyFormData.java @@ -3,9 +3,8 @@ package com.yugabyte.yw.forms; import com.yugabyte.yw.common.AccessManager; -import play.data.validation.Constraints; - import java.util.UUID; +import play.data.validation.Constraints; public class AccessKeyFormData { @Constraints.Required() public String keyCode; diff --git a/managed/src/main/java/com/yugabyte/yw/forms/AlertDefinitionFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/AlertDefinitionFormData.java index ccdd956906ee..6b80b155bed1 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/AlertDefinitionFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/AlertDefinitionFormData.java @@ -11,9 +11,8 @@ package com.yugabyte.yw.forms; import com.yugabyte.yw.common.AlertDefinitionTemplate; -import play.data.validation.Constraints; - import java.util.UUID; +import play.data.validation.Constraints; /** This class will be used by the API and UI Form Elements to validate constraints are met. */ public class AlertDefinitionFormData { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/AlertReceiverFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/AlertReceiverFormData.java index c92bda6b6c52..36a8d58c172e 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/AlertReceiverFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/AlertReceiverFormData.java @@ -2,10 +2,8 @@ package com.yugabyte.yw.forms; -import java.util.UUID; - import com.yugabyte.yw.common.alerts.AlertReceiverParams; - +import java.util.UUID; import play.data.validation.Constraints; public class AlertReceiverFormData { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/AlertRouteFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/AlertRouteFormData.java index 9b50ed04db80..a15964e66773 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/AlertRouteFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/AlertRouteFormData.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.UUID; - import play.data.validation.Constraints; public class AlertRouteFormData { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/AlertingFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/AlertingFormData.java index d9f07c383d28..feff3eff57b3 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/AlertingFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/AlertingFormData.java @@ -2,12 +2,11 @@ package com.yugabyte.yw.forms; -import play.data.validation.Constraints; -import java.util.Map; +import com.yugabyte.yw.common.alerts.SmtpData; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - -import com.yugabyte.yw.common.alerts.SmtpData; +import java.util.Map; +import play.data.validation.Constraints; /** This class will be used by the API and UI Form Elements to validate constraints are met */ @ApiModel(value = "Alerts", description = "Alerts associated with customers") diff --git a/managed/src/main/java/com/yugabyte/yw/forms/AvailabilityZoneFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/AvailabilityZoneFormData.java index c4ee5017870b..70b20d9d3be7 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/AvailabilityZoneFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/AvailabilityZoneFormData.java @@ -2,11 +2,10 @@ package com.yugabyte.yw.forms; -import play.data.validation.Constraints; - -import java.util.List; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import play.data.validation.Constraints; /** * This class will be used by the API and UI Form Elements to validate constraints for diff --git a/managed/src/main/java/com/yugabyte/yw/forms/BackupTableParams.java b/managed/src/main/java/com/yugabyte/yw/forms/BackupTableParams.java index 8cb72ccea6fb..0cc0fee80934 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/BackupTableParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/BackupTableParams.java @@ -6,13 +6,12 @@ import com.yugabyte.yw.models.Backup; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.yb.Common.TableType; -import play.data.validation.Constraints; - import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.UUID; +import org.yb.Common.TableType; +import play.data.validation.Constraints; @ApiModel(value = "Backup table params", description = "Backup table params") public class BackupTableParams extends TableManagerParams { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/BulkImportParams.java b/managed/src/main/java/com/yugabyte/yw/forms/BulkImportParams.java index 58f8836897d3..cf1ddb16b794 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/BulkImportParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/BulkImportParams.java @@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - import play.data.validation.Constraints; @ApiModel(value = "Bulk import params", description = "Bulk import params") diff --git a/managed/src/main/java/com/yugabyte/yw/forms/CertificateParams.java b/managed/src/main/java/com/yugabyte/yw/forms/CertificateParams.java index fd1e4591f560..f629cdab3d36 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/CertificateParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/CertificateParams.java @@ -2,10 +2,8 @@ package com.yugabyte.yw.forms; -import play.data.validation.Constraints; -import java.util.Date; - import com.yugabyte.yw.models.CertificateInfo; +import play.data.validation.Constraints; /** * This class will be used by the API and UI Form Elements to validate constraints for the custom diff --git a/managed/src/main/java/com/yugabyte/yw/forms/ClientCertParams.java b/managed/src/main/java/com/yugabyte/yw/forms/ClientCertParams.java index dc777e6f91f9..32824b94065e 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/ClientCertParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/ClientCertParams.java @@ -4,8 +4,6 @@ import play.data.validation.Constraints; -import java.util.Date; - /** * This class will be used by the API and UI Form Elements to validate constraints for the custom * certificate Data. diff --git a/managed/src/main/java/com/yugabyte/yw/forms/CloudProviderFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/CloudProviderFormData.java index 8ec7665a077e..59f861782488 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/CloudProviderFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/CloudProviderFormData.java @@ -5,10 +5,9 @@ import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.yugabyte.yw.commissioner.Common; -import play.data.validation.Constraints; - import java.util.HashMap; import java.util.Map; +import play.data.validation.Constraints; /** * This class will be used by the API and UI Form Elements to validate constraints for CloudProvider diff --git a/managed/src/main/java/com/yugabyte/yw/forms/CustomerDetailsData.java b/managed/src/main/java/com/yugabyte/yw/forms/CustomerDetailsData.java index b553396f6335..9bce1a518538 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/CustomerDetailsData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/CustomerDetailsData.java @@ -2,14 +2,16 @@ package com.yugabyte.yw.forms; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; + import com.fasterxml.jackson.databind.JsonNode; -import com.yugabyte.yw.forms.AlertingFormData.AlertingData; import com.yugabyte.yw.common.alerts.SmtpData; +import com.yugabyte.yw.forms.AlertingFormData.AlertingData; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.*; - -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import java.util.Date; +import java.util.List; +import java.util.UUID; /** This class will be used by Customer details API. */ @ApiModel(value = "Customer Detail", description = "Customers features and Universe UUID.") diff --git a/managed/src/main/java/com/yugabyte/yw/forms/CustomerRegisterFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/CustomerRegisterFormData.java index 23fc2f63b9f8..7fc457ecc952 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/CustomerRegisterFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/CustomerRegisterFormData.java @@ -2,10 +2,9 @@ package com.yugabyte.yw.forms; -import play.data.validation.Constraints; -import java.util.Map; - import com.yugabyte.yw.common.alerts.SmtpData; +import java.util.Map; +import play.data.validation.Constraints; /** This class will be used by the API and UI Form Elements to validate constraints are met */ public class CustomerRegisterFormData { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/CustomerTaskFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/CustomerTaskFormData.java index 02873b514b9e..464d36fbf6ff 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/CustomerTaskFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/CustomerTaskFormData.java @@ -2,10 +2,10 @@ package com.yugabyte.yw.forms; -import java.util.Date; -import java.util.UUID; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.Date; +import java.util.UUID; @ApiModel(value = "Customer Task Data", description = "Customer Task data") public class CustomerTaskFormData { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/DatabaseSecurityFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/DatabaseSecurityFormData.java index dd5094c0183e..267a0a72cc9b 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/DatabaseSecurityFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/DatabaseSecurityFormData.java @@ -2,12 +2,12 @@ package com.yugabyte.yw.forms; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.yugabyte.yw.common.Util; import com.yugabyte.yw.common.YWServiceException; import org.apache.commons.lang3.StringUtils; -import static play.mvc.Http.Status.BAD_REQUEST; - public class DatabaseSecurityFormData { public String ycqlAdminUsername; diff --git a/managed/src/main/java/com/yugabyte/yw/forms/DatabaseUserFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/DatabaseUserFormData.java index 3915222da05f..53abd930672a 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/DatabaseUserFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/DatabaseUserFormData.java @@ -2,13 +2,13 @@ package com.yugabyte.yw.forms; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.yugabyte.yw.common.Util; import com.yugabyte.yw.common.YWServiceException; import org.apache.commons.lang3.StringUtils; import play.data.validation.Constraints; -import static play.mvc.Http.Status.BAD_REQUEST; - public class DatabaseUserFormData { public String ycqlAdminUsername; diff --git a/managed/src/main/java/com/yugabyte/yw/forms/DiskIncreaseFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/DiskIncreaseFormData.java index e8630018b29a..5494d3f29a78 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/DiskIncreaseFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/DiskIncreaseFormData.java @@ -1,8 +1,7 @@ package com.yugabyte.yw.forms; -import java.util.UUID; - import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.UUID; import play.data.validation.Constraints; @JsonDeserialize(converter = DiskIncreaseFormData.Converter.class) diff --git a/managed/src/main/java/com/yugabyte/yw/forms/EncryptionAtRestKeyParams.java b/managed/src/main/java/com/yugabyte/yw/forms/EncryptionAtRestKeyParams.java index 7d00a756bb68..8ce32cb2a51e 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/EncryptionAtRestKeyParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/EncryptionAtRestKeyParams.java @@ -11,15 +11,14 @@ package com.yugabyte.yw.forms; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.core.JsonProcessingException; import com.yugabyte.yw.common.YWServiceException; +import java.util.UUID; import play.libs.Json; import play.mvc.Http; -import java.util.UUID; - -import static play.mvc.Http.Status.BAD_REQUEST; - public class EncryptionAtRestKeyParams extends UniverseTaskParams { public static EncryptionAtRestKeyParams bindFromFormData( diff --git a/managed/src/main/java/com/yugabyte/yw/forms/ImportUniverseFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/ImportUniverseFormData.java index 1f6f5df62ea1..e2e3912ab134 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/ImportUniverseFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/ImportUniverseFormData.java @@ -2,10 +2,8 @@ package com.yugabyte.yw.forms; -import java.util.UUID; - import com.yugabyte.yw.commissioner.Common.CloudType; - +import java.util.UUID; import play.data.validation.Constraints; public class ImportUniverseFormData { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/ImportUniverseResponseData.java b/managed/src/main/java/com/yugabyte/yw/forms/ImportUniverseResponseData.java index 0c5e2a8b7777..e9fe752c6c52 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/ImportUniverseResponseData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/ImportUniverseResponseData.java @@ -1,13 +1,12 @@ package com.yugabyte.yw.forms; +import com.yugabyte.yw.forms.ImportUniverseFormData.State; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; -import com.yugabyte.yw.forms.ImportUniverseFormData.State; - public class ImportUniverseResponseData { public State state; diff --git a/managed/src/main/java/com/yugabyte/yw/forms/KubernetesProviderFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/KubernetesProviderFormData.java index 75fef4369d47..0b5099eb9097 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/KubernetesProviderFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/KubernetesProviderFormData.java @@ -2,11 +2,10 @@ package com.yugabyte.yw.forms; -import play.data.validation.Constraints; - import java.util.ArrayList; -import java.util.Map; import java.util.List; +import java.util.Map; +import play.data.validation.Constraints; public class KubernetesProviderFormData extends CloudProviderFormData { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/MetricQueryParams.java b/managed/src/main/java/com/yugabyte/yw/forms/MetricQueryParams.java index 38573eda4cf1..66f7a27ebf95 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/MetricQueryParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/MetricQueryParams.java @@ -2,12 +2,10 @@ package com.yugabyte.yw.forms; -import play.data.validation.Constraints; - -import java.util.List; - import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import play.data.validation.Constraints; @ApiModel(value = "Metrics", description = "Metrics details") public class MetricQueryParams { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/MultiTableBackupRequestParams.java b/managed/src/main/java/com/yugabyte/yw/forms/MultiTableBackupRequestParams.java index a98ed606326f..a4341cfed56f 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/MultiTableBackupRequestParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/MultiTableBackupRequestParams.java @@ -1,10 +1,11 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.forms; -import com.yugabyte.yw.forms.BackupTableParams; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; /** This class will be used by Table controller createMultiTableBackup API. */ @ApiModel(value = "Multi table backup request params", description = "Backup table params") diff --git a/managed/src/main/java/com/yugabyte/yw/forms/NodeDetailsResp.java b/managed/src/main/java/com/yugabyte/yw/forms/NodeDetailsResp.java index 76d2e0bd2996..4a44243c350d 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/NodeDetailsResp.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/NodeDetailsResp.java @@ -17,7 +17,6 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.AllowedActionsHelper; import com.yugabyte.yw.models.helpers.NodeDetails; - import java.util.Set; public class NodeDetailsResp { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/NodeInstanceFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/NodeInstanceFormData.java index d44445f9c6cc..d01a5f341eca 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/NodeInstanceFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/NodeInstanceFormData.java @@ -4,12 +4,8 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - -import play.data.validation.Constraints; - import java.util.List; - -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import play.data.validation.Constraints; /** This class will be used by the API validate constraints for NodeInstance data. */ public class NodeInstanceFormData { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/OnPremFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/OnPremFormData.java index f31fe7cff676..aa8e50790657 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/OnPremFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/OnPremFormData.java @@ -2,12 +2,11 @@ package com.yugabyte.yw.forms; -import java.util.ArrayList; -import java.util.UUID; -import java.util.List; - import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.models.InstanceType; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import play.data.validation.Constraints; /** This class describes the fields we need to setup an on-prem deployment. */ diff --git a/managed/src/main/java/com/yugabyte/yw/forms/RunQueryFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/RunQueryFormData.java index e6c628c98b46..bcb70f40693f 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/RunQueryFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/RunQueryFormData.java @@ -2,11 +2,11 @@ package com.yugabyte.yw.forms; +import static org.yb.Common.TableType.PGSQL_TABLE_TYPE; + import org.yb.Common.TableType; import play.data.validation.Constraints; -import static org.yb.Common.TableType.PGSQL_TABLE_TYPE; - public class RunQueryFormData { @Constraints.Required() public String query; diff --git a/managed/src/main/java/com/yugabyte/yw/forms/RuntimeConfigFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/RuntimeConfigFormData.java index ed6bb8eba63c..66256659826f 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/RuntimeConfigFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/RuntimeConfigFormData.java @@ -10,6 +10,8 @@ package com.yugabyte.yw.forms; +import static com.yugabyte.yw.models.ScopedRuntimeConfig.GLOBAL_SCOPE_UUID; + import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.common.config.impl.RuntimeConfig; import com.yugabyte.yw.common.config.impl.SettableRuntimeConfigFactory; @@ -18,15 +20,12 @@ import com.yugabyte.yw.models.Universe; import io.ebean.Model; import io.ebean.annotation.EnumValue; -import play.mvc.Http; - +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import java.util.UUID; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import static com.yugabyte.yw.models.ScopedRuntimeConfig.GLOBAL_SCOPE_UUID; +import play.mvc.Http; @ApiModel(value = "Runtime config data", description = "Runtime config data") public class RuntimeConfigFormData { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/TableDefinitionTaskParams.java b/managed/src/main/java/com/yugabyte/yw/forms/TableDefinitionTaskParams.java index 742a2245f3ca..368e60cc6766 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/TableDefinitionTaskParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/TableDefinitionTaskParams.java @@ -4,11 +4,10 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.TableDetails; +import java.util.UUID; import org.yb.Common; import org.yb.client.GetTableSchemaResponse; -import java.util.UUID; - public class TableDefinitionTaskParams extends TableTaskParams { public Common.TableType tableType = null; public TableDetails tableDetails = null; diff --git a/managed/src/main/java/com/yugabyte/yw/forms/TableManagerParams.java b/managed/src/main/java/com/yugabyte/yw/forms/TableManagerParams.java index d7bf134cc5d5..0b50576e5453 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/TableManagerParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/TableManagerParams.java @@ -2,7 +2,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - import java.util.UUID; @ApiModel(value = "Table params", description = "Table params") diff --git a/managed/src/main/java/com/yugabyte/yw/forms/ToggleTlsParams.java b/managed/src/main/java/com/yugabyte/yw/forms/ToggleTlsParams.java index 977d034e3ed6..ff10334ce9d2 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/ToggleTlsParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/ToggleTlsParams.java @@ -6,11 +6,10 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.models.CertificateInfo; +import java.util.UUID; import play.data.validation.Constraints; import play.mvc.Http; -import java.util.UUID; - /** Class to capture request params for toggle_tls API */ public class ToggleTlsParams { public UpgradeParams.UpgradeOption upgradeOption = UpgradeParams.UpgradeOption.ROLLING_UPGRADE; diff --git a/managed/src/main/java/com/yugabyte/yw/forms/UniverseDefinitionTaskParams.java b/managed/src/main/java/com/yugabyte/yw/forms/UniverseDefinitionTaskParams.java index c1c12f3e5617..9aac35c165ae 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/UniverseDefinitionTaskParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/UniverseDefinitionTaskParams.java @@ -2,6 +2,8 @@ package com.yugabyte.yw.forms; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; @@ -21,14 +23,19 @@ import com.yugabyte.yw.models.helpers.DeviceInfo; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.PlacementInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import play.data.validation.Constraints; -import java.util.*; -import java.util.stream.Collectors; - -import static play.mvc.Http.Status.BAD_REQUEST; - /** * This class captures the user intent for creation of the universe. Note some nuances in the way * the intent is specified. diff --git a/managed/src/main/java/com/yugabyte/yw/forms/UniverseDefinitionTaskParamsResp.java b/managed/src/main/java/com/yugabyte/yw/forms/UniverseDefinitionTaskParamsResp.java index f871b0b51347..46a38f9dec7e 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/UniverseDefinitionTaskParamsResp.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/UniverseDefinitionTaskParamsResp.java @@ -14,7 +14,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonUnwrapped; import com.yugabyte.yw.models.Universe; - import java.util.Set; import java.util.stream.Collectors; diff --git a/managed/src/main/java/com/yugabyte/yw/forms/UniverseResp.java b/managed/src/main/java/com/yugabyte/yw/forms/UniverseResp.java index f7001afd1196..ed5453c2cd31 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/UniverseResp.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/UniverseResp.java @@ -11,24 +11,22 @@ package com.yugabyte.yw.forms; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.typesafe.config.Config; import com.yugabyte.yw.cloud.UniverseResourceDetails; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.common.CertificateHelper; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.Yaml; import play.Play; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - @JsonInclude(JsonInclude.Include.NON_NULL) @ApiModel(description = "Universe Resp") public class UniverseResp { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/UniverseTaskParams.java b/managed/src/main/java/com/yugabyte/yw/forms/UniverseTaskParams.java index ccc05c399284..407051e9ceb2 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/UniverseTaskParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/UniverseTaskParams.java @@ -8,16 +8,15 @@ import com.yugabyte.yw.models.AsyncReplicationRelationship; import com.yugabyte.yw.models.helpers.DeviceInfo; import com.yugabyte.yw.models.helpers.NodeDetails; +import io.ebean.annotation.EnumValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.ebean.annotation.EnumValue; -import play.data.validation.Constraints; - import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; +import play.data.validation.Constraints; @ApiModel(value = "Universe task", description = "Universe task") public class UniverseTaskParams extends AbstractTaskParams { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/UpgradeParams.java b/managed/src/main/java/com/yugabyte/yw/forms/UpgradeParams.java index 24f151edc9bd..7cbfadd386cf 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/UpgradeParams.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/UpgradeParams.java @@ -1,13 +1,11 @@ package com.yugabyte.yw.forms; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - import com.fasterxml.jackson.annotation.JsonProperty; - import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.yugabyte.yw.commissioner.tasks.UpgradeUniverse; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; import play.data.validation.Constraints; @JsonDeserialize(converter = UpgradeParams.Converter.class) diff --git a/managed/src/main/java/com/yugabyte/yw/forms/UserRegisterFormData.java b/managed/src/main/java/com/yugabyte/yw/forms/UserRegisterFormData.java index 6a4207bcd08d..56f3b25707c7 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/UserRegisterFormData.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/UserRegisterFormData.java @@ -2,12 +2,12 @@ package com.yugabyte.yw.forms; -import play.data.validation.Constraints; -import java.util.Map; - import static com.yugabyte.yw.models.Users.Role; + import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.Map; +import play.data.validation.Constraints; /** This class will be used by the API and UI Form Elements to validate constraints are met */ @ApiModel(value = "User Register", description = "User registration data") diff --git a/managed/src/main/java/com/yugabyte/yw/forms/YWResults.java b/managed/src/main/java/com/yugabyte/yw/forms/YWResults.java index 3495b371af39..55fa361ffa59 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/YWResults.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/YWResults.java @@ -10,22 +10,19 @@ package com.yugabyte.yw.forms; +import static play.mvc.Results.ok; + import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.JsonNode; import com.google.common.annotations.VisibleForTesting; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import java.util.UUID; import play.libs.Json; import play.mvc.Result; import play.mvc.Results; -import java.util.List; -import java.util.UUID; - -import static play.mvc.Results.ok; - public class YWResults { /** diff --git a/managed/src/main/java/com/yugabyte/yw/forms/YugabyteConstraints.java b/managed/src/main/java/com/yugabyte/yw/forms/YugabyteConstraints.java index cdc089e0278f..1fbf4af83280 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/YugabyteConstraints.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/YugabyteConstraints.java @@ -10,21 +10,24 @@ package com.yugabyte.yw.forms; -import play.data.validation.Constraints; -import play.libs.F; +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.CONSTRUCTOR; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE_USE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static play.libs.F.Tuple; -import javax.validation.Constraint; -import javax.validation.ConstraintValidator; -import javax.validation.Payload; import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.net.MalformedURLException; import java.net.URL; - -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.ElementType.TYPE_USE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static play.libs.F.Tuple; +import javax.validation.Constraint; +import javax.validation.ConstraintValidator; +import javax.validation.Payload; +import play.data.validation.Constraints; +import play.libs.F; public class YugabyteConstraints extends Constraints { @Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE}) diff --git a/managed/src/main/java/com/yugabyte/yw/forms/filters/AlertApiFilter.java b/managed/src/main/java/com/yugabyte/yw/forms/filters/AlertApiFilter.java index 1a73eab06e53..0823efee615a 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/filters/AlertApiFilter.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/filters/AlertApiFilter.java @@ -12,13 +12,12 @@ import com.yugabyte.yw.models.Alert; import com.yugabyte.yw.models.AlertDefinitionGroup; import com.yugabyte.yw.models.filters.AlertFilter; +import java.util.Set; +import java.util.UUID; import lombok.Data; import lombok.NoArgsConstructor; import org.apache.commons.collections.CollectionUtils; -import java.util.Set; -import java.util.UUID; - @Data @NoArgsConstructor public class AlertApiFilter { diff --git a/managed/src/main/java/com/yugabyte/yw/forms/filters/AlertDefinitionGroupApiFilter.java b/managed/src/main/java/com/yugabyte/yw/forms/filters/AlertDefinitionGroupApiFilter.java index 2af87fc72e53..0226dae449cd 100644 --- a/managed/src/main/java/com/yugabyte/yw/forms/filters/AlertDefinitionGroupApiFilter.java +++ b/managed/src/main/java/com/yugabyte/yw/forms/filters/AlertDefinitionGroupApiFilter.java @@ -12,13 +12,12 @@ import com.yugabyte.yw.common.AlertDefinitionTemplate; import com.yugabyte.yw.models.AlertDefinitionGroup; import com.yugabyte.yw.models.filters.AlertDefinitionGroupFilter; +import java.util.Set; +import java.util.UUID; import lombok.Data; import lombok.NoArgsConstructor; import org.apache.commons.collections.CollectionUtils; -import java.util.Set; -import java.util.UUID; - @Data @NoArgsConstructor public class AlertDefinitionGroupApiFilter { diff --git a/managed/src/main/java/com/yugabyte/yw/metrics/MetricGraphData.java b/managed/src/main/java/com/yugabyte/yw/metrics/MetricGraphData.java index 167cd49d91c6..caf6a49497fd 100644 --- a/managed/src/main/java/com/yugabyte/yw/metrics/MetricGraphData.java +++ b/managed/src/main/java/com/yugabyte/yw/metrics/MetricGraphData.java @@ -3,8 +3,8 @@ package com.yugabyte.yw.metrics; import com.fasterxml.jackson.databind.node.ArrayNode; -import play.libs.Json; import java.util.Map; +import play.libs.Json; public class MetricGraphData { public String name; diff --git a/managed/src/main/java/com/yugabyte/yw/metrics/MetricQueryExecutor.java b/managed/src/main/java/com/yugabyte/yw/metrics/MetricQueryExecutor.java index e5c3f4ba76e7..012b4b505ce2 100644 --- a/managed/src/main/java/com/yugabyte/yw/metrics/MetricQueryExecutor.java +++ b/managed/src/main/java/com/yugabyte/yw/metrics/MetricQueryExecutor.java @@ -6,15 +6,14 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.ApiHelper; import com.yugabyte.yw.models.MetricConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.libs.Json; - -import java.util.HashMap; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.Callable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; public class MetricQueryExecutor implements Callable { public static final Logger LOG = LoggerFactory.getLogger(MetricQueryExecutor.class); diff --git a/managed/src/main/java/com/yugabyte/yw/metrics/MetricQueryHelper.java b/managed/src/main/java/com/yugabyte/yw/metrics/MetricQueryHelper.java index 0c5ef394a0ef..77d2869bb705 100644 --- a/managed/src/main/java/com/yugabyte/yw/metrics/MetricQueryHelper.java +++ b/managed/src/main/java/com/yugabyte/yw/metrics/MetricQueryHelper.java @@ -1,6 +1,8 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.metrics; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -8,21 +10,28 @@ import com.google.inject.Singleton; import com.yugabyte.yw.common.ApiHelper; import com.yugabyte.yw.common.YWServiceException; -import org.apache.commons.lang3.StringUtils; import com.yugabyte.yw.metrics.data.AlertData; import com.yugabyte.yw.metrics.data.AlertsResponse; import com.yugabyte.yw.metrics.data.ResponseStatus; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import org.apache.commons.lang3.StringUtils; import org.joda.time.DateTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.libs.Json; -import java.io.IOException; -import java.util.*; -import java.util.concurrent.*; - -import static play.mvc.Http.Status.BAD_REQUEST; - @Singleton public class MetricQueryHelper { diff --git a/managed/src/main/java/com/yugabyte/yw/metrics/MetricQueryResponse.java b/managed/src/main/java/com/yugabyte/yw/metrics/MetricQueryResponse.java index 43ad75a91936..1c817f2c4bff 100644 --- a/managed/src/main/java/com/yugabyte/yw/metrics/MetricQueryResponse.java +++ b/managed/src/main/java/com/yugabyte/yw/metrics/MetricQueryResponse.java @@ -1,26 +1,20 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.metrics; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.yugabyte.yw.models.MetricConfig; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; - +import org.apache.commons.lang3.tuple.ImmutablePair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; - -import com.yugabyte.yw.models.MetricConfig; - -import play.libs.Json; - -import org.apache.commons.lang3.tuple.ImmutablePair; - public class MetricQueryResponse { public static final Logger LOG = LoggerFactory.getLogger(MetricQueryResponse.class); diff --git a/managed/src/main/java/com/yugabyte/yw/metrics/YBMetricQueryComponent.java b/managed/src/main/java/com/yugabyte/yw/metrics/YBMetricQueryComponent.java index d4f7a4ecd1f5..1cf15ebd17fe 100644 --- a/managed/src/main/java/com/yugabyte/yw/metrics/YBMetricQueryComponent.java +++ b/managed/src/main/java/com/yugabyte/yw/metrics/YBMetricQueryComponent.java @@ -13,16 +13,25 @@ import com.yugabyte.yw.common.services.YBClientService; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; +import java.net.InetSocketAddress; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.NavigableMap; +import java.util.Optional; +import java.util.TreeMap; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yb.client.ListTabletServersResponse; import org.yb.client.YBClient; import org.yb.util.ServerInfo; -import java.net.InetSocketAddress; -import java.util.*; -import java.util.Map.Entry; - @Singleton public class YBMetricQueryComponent { public static final Logger LOG = LoggerFactory.getLogger(YBMetricQueryComponent.class); diff --git a/managed/src/main/java/com/yugabyte/yw/metrics/data/AlertData.java b/managed/src/main/java/com/yugabyte/yw/metrics/data/AlertData.java index 66c0938edabd..4ebc20ada5b0 100644 --- a/managed/src/main/java/com/yugabyte/yw/metrics/data/AlertData.java +++ b/managed/src/main/java/com/yugabyte/yw/metrics/data/AlertData.java @@ -10,13 +10,12 @@ package com.yugabyte.yw.metrics.data; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.time.ZonedDateTime; +import java.util.Map; import lombok.Builder; import lombok.Value; import lombok.extern.jackson.Jacksonized; -import java.time.ZonedDateTime; -import java.util.Map; - @Value @Jacksonized @Builder diff --git a/managed/src/main/java/com/yugabyte/yw/metrics/data/AlertsData.java b/managed/src/main/java/com/yugabyte/yw/metrics/data/AlertsData.java index 7a036fe2d98e..2833f65879a7 100644 --- a/managed/src/main/java/com/yugabyte/yw/metrics/data/AlertsData.java +++ b/managed/src/main/java/com/yugabyte/yw/metrics/data/AlertsData.java @@ -10,12 +10,11 @@ package com.yugabyte.yw.metrics.data; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.util.List; import lombok.Builder; import lombok.Value; import lombok.extern.jackson.Jacksonized; -import java.util.List; - @Value @Jacksonized @Builder diff --git a/managed/src/main/java/com/yugabyte/yw/metrics/data/PrometheusResponse.java b/managed/src/main/java/com/yugabyte/yw/metrics/data/PrometheusResponse.java index 46d86cee0a58..03ee7af553a1 100644 --- a/managed/src/main/java/com/yugabyte/yw/metrics/data/PrometheusResponse.java +++ b/managed/src/main/java/com/yugabyte/yw/metrics/data/PrometheusResponse.java @@ -10,11 +10,10 @@ package com.yugabyte.yw.metrics.data; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.util.List; import lombok.Getter; import lombok.experimental.SuperBuilder; -import java.util.List; - @Getter @SuperBuilder @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/managed/src/main/java/com/yugabyte/yw/models/AccessKey.java b/managed/src/main/java/com/yugabyte/yw/models/AccessKey.java index 2fba23f81e0c..a6e12aa387fc 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AccessKey.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AccessKey.java @@ -2,26 +2,22 @@ package com.yugabyte.yw.models; -import play.mvc.Http; -import play.mvc.Result; -import io.ebean.*; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; + +import com.fasterxml.jackson.annotation.JsonBackReference; +import com.yugabyte.yw.common.YWServiceException; +import io.ebean.Finder; +import io.ebean.Model; import io.ebean.annotation.DbJson; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.annotation.JsonBackReference; -import com.fasterxml.jackson.databind.JsonNode; -import com.yugabyte.yw.common.YWServiceException; - -import play.data.validation.Constraints; - +import java.util.List; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; -import java.util.List; -import java.util.UUID; - -import static play.mvc.Http.Status.*; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE; +import play.data.validation.Constraints; @Entity @ApiModel( diff --git a/managed/src/main/java/com/yugabyte/yw/models/AccessKeyId.java b/managed/src/main/java/com/yugabyte/yw/models/AccessKeyId.java index a4bfde8a02bc..2f658f5496cb 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AccessKeyId.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AccessKeyId.java @@ -1,10 +1,10 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.models; -import javax.persistence.Embeddable; -import javax.persistence.Entity; import java.io.Serializable; import java.util.UUID; +import javax.persistence.Embeddable; +import javax.persistence.Entity; @Entity @Embeddable diff --git a/managed/src/main/java/com/yugabyte/yw/models/Alert.java b/managed/src/main/java/com/yugabyte/yw/models/Alert.java index 0a1002b1aee2..c4c12d1e5eca 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/Alert.java +++ b/managed/src/main/java/com/yugabyte/yw/models/Alert.java @@ -2,6 +2,13 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.models.helpers.CommonUtils.appendInClause; +import static com.yugabyte.yw.models.helpers.CommonUtils.appendNotInClause; +import static com.yugabyte.yw.models.helpers.CommonUtils.nowWithoutMillis; +import static com.yugabyte.yw.models.helpers.CommonUtils.setUniqueListValue; +import static com.yugabyte.yw.models.helpers.CommonUtils.setUniqueListValues; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; + import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.annotations.VisibleForTesting; @@ -15,20 +22,21 @@ import io.ebean.Model; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import javax.persistence.*; import java.util.Comparator; import java.util.Date; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; - -import static com.yugabyte.yw.models.helpers.CommonUtils.*; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; @Entity @Data diff --git a/managed/src/main/java/com/yugabyte/yw/models/AlertDefinition.java b/managed/src/main/java/com/yugabyte/yw/models/AlertDefinition.java index c9c5a942f2fc..4c3d65969a46 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AlertDefinition.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AlertDefinition.java @@ -10,6 +10,10 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.models.helpers.CommonUtils.appendInClause; +import static com.yugabyte.yw.models.helpers.CommonUtils.setUniqueListValue; +import static com.yugabyte.yw.models.helpers.CommonUtils.setUniqueListValues; + import com.fasterxml.jackson.annotation.JsonIgnore; import com.yugabyte.yw.models.filters.AlertDefinitionFilter; import com.yugabyte.yw.models.helpers.KnownAlertCodes; @@ -17,17 +21,23 @@ import io.ebean.ExpressionList; import io.ebean.Finder; import io.ebean.Model; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Version; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import play.data.validation.Constraints; -import javax.persistence.*; -import java.util.*; -import java.util.stream.Collectors; - -import static com.yugabyte.yw.models.helpers.CommonUtils.*; - @Entity @Data @Accessors(chain = true) diff --git a/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionGroup.java b/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionGroup.java index d618c0f6cc86..24ad41550d6f 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionGroup.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionGroup.java @@ -10,6 +10,9 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.models.helpers.CommonUtils.appendInClause; +import static com.yugabyte.yw.models.helpers.CommonUtils.nowWithoutMillis; + import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.yugabyte.yw.common.AlertDefinitionTemplate; @@ -20,19 +23,19 @@ import io.ebean.Finder; import io.ebean.Model; import io.ebean.annotation.DbJson; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import play.data.validation.Constraints; - -import javax.persistence.*; import java.util.Date; import java.util.Map; import java.util.Objects; import java.util.UUID; - -import static com.yugabyte.yw.models.helpers.CommonUtils.appendInClause; -import static com.yugabyte.yw.models.helpers.CommonUtils.nowWithoutMillis; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import play.data.validation.Constraints; @Entity @Data diff --git a/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionGroupTarget.java b/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionGroupTarget.java index 6c8f1f48cd34..dac93f74738d 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionGroupTarget.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionGroupTarget.java @@ -10,13 +10,12 @@ package com.yugabyte.yw.models; +import java.util.Set; +import java.util.UUID; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; -import java.util.Set; -import java.util.UUID; - @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) diff --git a/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionLabel.java b/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionLabel.java index 231e73d2dd36..ef42b0cf1ebd 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionLabel.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionLabel.java @@ -14,13 +14,16 @@ import com.yugabyte.yw.models.helpers.KnownAlertLabels; import com.yugabyte.yw.models.helpers.UniqueKeyListValue; import io.ebean.Model; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.ManyToOne; +import javax.persistence.MapsId; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import javax.persistence.*; -import java.util.Objects; - @Entity @Data @EqualsAndHashCode(exclude = "definition", callSuper = false) diff --git a/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionLabelKey.java b/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionLabelKey.java index 9677a2347db2..f39bd2ed8a23 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionLabelKey.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AlertDefinitionLabelKey.java @@ -12,12 +12,11 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import io.ebean.Model; +import java.util.UUID; +import javax.persistence.Embeddable; import lombok.Data; import lombok.EqualsAndHashCode; -import javax.persistence.Embeddable; -import java.util.UUID; - @Embeddable @Data @EqualsAndHashCode(callSuper = false) diff --git a/managed/src/main/java/com/yugabyte/yw/models/AlertLabel.java b/managed/src/main/java/com/yugabyte/yw/models/AlertLabel.java index fce68b15f32f..bd3f5ae8ee49 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AlertLabel.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AlertLabel.java @@ -13,13 +13,16 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.yugabyte.yw.models.helpers.UniqueKeyListValue; import io.ebean.Model; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.ManyToOne; +import javax.persistence.MapsId; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import javax.persistence.*; -import java.util.Objects; - @Entity @Data @EqualsAndHashCode(callSuper = false) diff --git a/managed/src/main/java/com/yugabyte/yw/models/AlertLabelKey.java b/managed/src/main/java/com/yugabyte/yw/models/AlertLabelKey.java index 64854ee0beff..20ec20d210ba 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AlertLabelKey.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AlertLabelKey.java @@ -12,12 +12,11 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import io.ebean.Model; +import java.util.UUID; +import javax.persistence.Embeddable; import lombok.Data; import lombok.EqualsAndHashCode; -import javax.persistence.Embeddable; -import java.util.UUID; - @Embeddable @Data @EqualsAndHashCode(callSuper = false) diff --git a/managed/src/main/java/com/yugabyte/yw/models/AlertReceiver.java b/managed/src/main/java/com/yugabyte/yw/models/AlertReceiver.java index 904372a35816..382f98edb9e1 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AlertReceiver.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AlertReceiver.java @@ -5,18 +5,6 @@ import static com.yugabyte.yw.models.helpers.CommonUtils.appendInClause; import static play.mvc.Http.Status.BAD_REQUEST; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.UUID; -import java.util.stream.Collectors; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.ManyToMany; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; @@ -26,12 +14,21 @@ import com.yugabyte.yw.common.alerts.AlertReceiverEmailParams; import com.yugabyte.yw.common.alerts.AlertReceiverParams; import com.yugabyte.yw.common.alerts.AlertReceiverSlackParams; - import io.ebean.ExpressionList; import io.ebean.Finder; import io.ebean.Model; import io.ebean.annotation.DbJson; import io.ebean.annotation.EnumValue; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.ManyToMany; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; diff --git a/managed/src/main/java/com/yugabyte/yw/models/AlertRoute.java b/managed/src/main/java/com/yugabyte/yw/models/AlertRoute.java index 898d133f22d7..6feba64abb23 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AlertRoute.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AlertRoute.java @@ -2,13 +2,17 @@ package com.yugabyte.yw.models; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.ebean.ExpressionList; +import io.ebean.Finder; +import io.ebean.Model; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -16,12 +20,6 @@ import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.ebean.ExpressionList; -import io.ebean.Finder; -import io.ebean.Model; import lombok.AccessLevel; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/managed/src/main/java/com/yugabyte/yw/models/AsyncReplicationRelationship.java b/managed/src/main/java/com/yugabyte/yw/models/AsyncReplicationRelationship.java index 6f191599d023..b311a7c94490 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AsyncReplicationRelationship.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AsyncReplicationRelationship.java @@ -3,15 +3,20 @@ import com.fasterxml.jackson.databind.JsonNode; import io.ebean.Finder; import io.ebean.Model; +import java.util.List; +import java.util.UUID; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.UniqueConstraint; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.validation.Constraints; import play.libs.Json; -import javax.persistence.*; -import java.util.List; -import java.util.UUID; - @Table( uniqueConstraints = @UniqueConstraint( diff --git a/managed/src/main/java/com/yugabyte/yw/models/Audit.java b/managed/src/main/java/com/yugabyte/yw/models/Audit.java index a2d986d9b233..8096399d2ce4 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/Audit.java +++ b/managed/src/main/java/com/yugabyte/yw/models/Audit.java @@ -2,6 +2,9 @@ package com.yugabyte.yw.models; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.common.YWServiceException; import io.ebean.Finder; @@ -10,20 +13,19 @@ import io.ebean.annotation.DbJson; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.data.validation.Constraints; -import play.mvc.Http; - -import javax.persistence.*; import java.util.Date; import java.util.List; import java.util.UUID; import java.util.function.Consumer; - -import static io.swagger.annotations.ApiModelProperty.AccessMode.*; -import static play.mvc.Http.Status.BAD_REQUEST; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.data.validation.Constraints; @ApiModel(description = "Audit for audit logging of the requests and responses.") @Entity diff --git a/managed/src/main/java/com/yugabyte/yw/models/AvailabilityZone.java b/managed/src/main/java/com/yugabyte/yw/models/AvailabilityZone.java index a6bcd79ebbbc..aa618760d810 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/AvailabilityZone.java +++ b/managed/src/main/java/com/yugabyte/yw/models/AvailabilityZone.java @@ -1,26 +1,35 @@ // Copyright (c) Yugabyte, Inc. package com.yugabyte.yw.models; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; + import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonIgnore; import com.yugabyte.yw.common.YWServiceException; -import io.ebean.*; +import io.ebean.Ebean; +import io.ebean.Finder; +import io.ebean.Model; +import io.ebean.Query; +import io.ebean.RawSql; +import io.ebean.RawSqlBuilder; import io.ebean.annotation.DbJson; -import play.data.validation.Constraints; - +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.ManyToOne; -import java.util.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.fasterxml.jackson.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import static play.mvc.Http.Status.*; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import play.data.validation.Constraints; @Entity @ApiModel(description = "Availability Zone of regions.") diff --git a/managed/src/main/java/com/yugabyte/yw/models/Backup.java b/managed/src/main/java/com/yugabyte/yw/models/Backup.java index 2758ba4db4f8..cc14085da1ae 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/Backup.java +++ b/managed/src/main/java/com/yugabyte/yw/models/Backup.java @@ -2,11 +2,15 @@ package com.yugabyte.yw.models; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE; +import static java.lang.Math.abs; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.forms.BackupTableParams; import com.yugabyte.yw.models.helpers.TaskType; - import io.ebean.Finder; import io.ebean.Model; import io.ebean.annotation.CreatedTimestamp; @@ -15,21 +19,21 @@ import io.ebean.annotation.UpdatedTimestamp; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; - -import static java.lang.Math.abs; - -import static io.swagger.annotations.ApiModelProperty.AccessMode.*; -import static play.mvc.Http.Status.BAD_REQUEST; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @ApiModel(description = "Backup with a status, expiry and backup configs") @Entity diff --git a/managed/src/main/java/com/yugabyte/yw/models/CertificateInfo.java b/managed/src/main/java/com/yugabyte/yw/models/CertificateInfo.java index 200ff3488bb6..74fa8cc76a4a 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/CertificateInfo.java +++ b/managed/src/main/java/com/yugabyte/yw/models/CertificateInfo.java @@ -2,42 +2,38 @@ package com.yugabyte.yw.models; -import com.yugabyte.yw.common.Util; -import com.yugabyte.yw.forms.CertificateParams; -import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; - -import io.ebean.*; -import io.ebean.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fasterxml.jackson.annotation.JsonFormat; +import com.yugabyte.yw.common.Util; import com.yugabyte.yw.common.YWServiceException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.libs.Json; -import play.data.validation.Constraints; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Enumerated; -import javax.persistence.EnumType; -import javax.persistence.Id; - +import com.yugabyte.yw.forms.CertificateParams; +import io.ebean.Finder; +import io.ebean.Model; +import io.ebean.annotation.DbJson; +import io.ebean.annotation.EnumValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.UUID; import java.util.Set; -import java.util.stream.Collectors; - -import static play.mvc.Http.Status.*; -import static io.swagger.annotations.ApiModelProperty.AccessMode.*; +import java.util.UUID; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.data.validation.Constraints; +import play.libs.Json; @ApiModel(description = "Certificate used by the universe to send sensitive information") @Entity diff --git a/managed/src/main/java/com/yugabyte/yw/models/Customer.java b/managed/src/main/java/com/yugabyte/yw/models/Customer.java index a7423b0c2281..bc01a9a25531 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/Customer.java +++ b/managed/src/main/java/com/yugabyte/yw/models/Customer.java @@ -2,30 +2,36 @@ package com.yugabyte.yw.models; -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.JsonNode; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import static com.yugabyte.yw.models.helpers.CommonUtils.deepMerge; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static play.mvc.Http.Status.BAD_REQUEST; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.JsonNode; import com.google.common.base.Joiner; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Cluster; import io.ebean.Finder; import io.ebean.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.validation.Constraints; import play.libs.Json; -import javax.persistence.*; -import java.util.*; -import java.util.stream.Collectors; - -import static com.yugabyte.yw.models.helpers.CommonUtils.deepMerge; -import static play.mvc.Http.Status.BAD_REQUEST; - -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; - @Entity @ApiModel(description = "Customers features and Universe UUID.") public class Customer extends Model { diff --git a/managed/src/main/java/com/yugabyte/yw/models/CustomerConfig.java b/managed/src/main/java/com/yugabyte/yw/models/CustomerConfig.java index d1dfbc1eace9..2e55a9c8961c 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/CustomerConfig.java +++ b/managed/src/main/java/com/yugabyte/yw/models/CustomerConfig.java @@ -2,34 +2,37 @@ package com.yugabyte.yw.models; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.CallHomeManager.CollectionLevel; -import com.yugabyte.yw.models.helpers.CommonUtils; +import com.yugabyte.yw.common.Util; import com.yugabyte.yw.common.YWServiceException; +import com.yugabyte.yw.models.helpers.CommonUtils; import io.ebean.Finder; import io.ebean.Model; import io.ebean.annotation.DbJson; import io.ebean.annotation.EnumValue; import io.ebean.annotation.JsonIgnore; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import play.data.validation.Constraints; -import play.libs.Json; - +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; -import java.util.*; - -import com.yugabyte.yw.common.Util; -import static play.mvc.Http.Status.*; - -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.data.validation.Constraints; +import play.libs.Json; @Entity @ApiModel(value = "Customer Config", description = "Customers Configuration") diff --git a/managed/src/main/java/com/yugabyte/yw/models/CustomerTask.java b/managed/src/main/java/com/yugabyte/yw/models/CustomerTask.java index f3291df11b68..a8cc6d603722 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/CustomerTask.java +++ b/managed/src/main/java/com/yugabyte/yw/models/CustomerTask.java @@ -2,6 +2,9 @@ package com.yugabyte.yw.models; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.annotation.JsonFormat; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; @@ -12,11 +15,6 @@ import io.ebean.annotation.Transactional; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.data.validation.Constraints; - -import javax.persistence.*; import java.lang.reflect.Field; import java.time.Duration; import java.time.Instant; @@ -25,9 +23,14 @@ import java.util.List; import java.util.UUID; import java.util.stream.Collectors; - -import static play.mvc.Http.Status.BAD_REQUEST; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.data.validation.Constraints; @Entity @ApiModel(description = "Customers Task Information.") diff --git a/managed/src/main/java/com/yugabyte/yw/models/ExtraMigration.java b/managed/src/main/java/com/yugabyte/yw/models/ExtraMigration.java index 3ff2175a21d4..e2d43305e1a8 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/ExtraMigration.java +++ b/managed/src/main/java/com/yugabyte/yw/models/ExtraMigration.java @@ -3,21 +3,15 @@ package com.yugabyte.yw.models; import com.yugabyte.yw.common.ExtraMigrationManager; -import com.yugabyte.yw.models.AccessKey; - -import java.lang.reflect.Method; -import java.lang.ReflectiveOperationException; +import io.ebean.Finder; +import io.ebean.Model; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.ebean.*; -import io.ebean.annotation.*; - @Entity public class ExtraMigration extends Model { ExtraMigrationManager extraMigrationManager; diff --git a/managed/src/main/java/com/yugabyte/yw/models/HealthCheck.java b/managed/src/main/java/com/yugabyte/yw/models/HealthCheck.java index 0513a52ab2fd..00d39207d653 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/HealthCheck.java +++ b/managed/src/main/java/com/yugabyte/yw/models/HealthCheck.java @@ -2,24 +2,20 @@ package com.yugabyte.yw.models; +import com.fasterxml.jackson.annotation.JsonAlias; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.ebean.Finder; +import io.ebean.Model; +import io.ebean.annotation.DbJson; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.UUID; - import javax.persistence.Column; -import javax.persistence.Entity; import javax.persistence.EmbeddedId; - +import javax.persistence.Entity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import io.ebean.*; -import io.ebean.annotation.DbJson; - -import com.fasterxml.jackson.annotation.JsonAlias; -import com.fasterxml.jackson.annotation.JsonFormat; - import play.data.validation.Constraints; import play.libs.Json; diff --git a/managed/src/main/java/com/yugabyte/yw/models/HealthCheckKey.java b/managed/src/main/java/com/yugabyte/yw/models/HealthCheckKey.java index 2f7417fffcc2..a9518c6ebf4c 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/HealthCheckKey.java +++ b/managed/src/main/java/com/yugabyte/yw/models/HealthCheckKey.java @@ -2,12 +2,11 @@ package com.yugabyte.yw.models; +import java.io.Serializable; import java.util.Date; import java.util.UUID; - -import java.io.Serializable; -import javax.persistence.Entity; import javax.persistence.Embeddable; +import javax.persistence.Entity; @Entity @Embeddable diff --git a/managed/src/main/java/com/yugabyte/yw/models/HighAvailabilityConfig.java b/managed/src/main/java/com/yugabyte/yw/models/HighAvailabilityConfig.java index a9820a6f5901..77aed5a927f5 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/HighAvailabilityConfig.java +++ b/managed/src/main/java/com/yugabyte/yw/models/HighAvailabilityConfig.java @@ -10,20 +10,31 @@ package com.yugabyte.yw.models; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.annotation.JsonGetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.yugabyte.yw.common.YWServiceException; import io.ebean.Finder; import io.ebean.Model; -import play.data.validation.Constraints; - +import java.util.ArrayList; +import java.util.Base64; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Collectors; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; -import javax.persistence.*; -import java.util.*; -import java.util.stream.Collectors; -import static play.mvc.Http.Status.BAD_REQUEST; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import play.data.validation.Constraints; @Entity @JsonPropertyOrder({"uuid", "cluster_key", "instances"}) diff --git a/managed/src/main/java/com/yugabyte/yw/models/InstanceType.java b/managed/src/main/java/com/yugabyte/yw/models/InstanceType.java index 63f1484e2812..ede31aa6fc99 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/InstanceType.java +++ b/managed/src/main/java/com/yugabyte/yw/models/InstanceType.java @@ -1,12 +1,15 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.models; -import com.fasterxml.jackson.annotation.JsonBackReference; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableList; import com.typesafe.config.Config; -import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.cloud.PublicCloudConstants; +import com.yugabyte.yw.common.YWServiceException; import io.ebean.Ebean; import io.ebean.Finder; import io.ebean.Model; @@ -14,21 +17,20 @@ import io.ebean.annotation.EnumValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.data.validation.Constraints; -import play.libs.Json; - -import javax.persistence.*; import java.util.LinkedList; import java.util.List; import java.util.UUID; import java.util.function.Predicate; import java.util.stream.Collectors; - -import static play.mvc.Http.Status.BAD_REQUEST; -import static io.swagger.annotations.ApiModelProperty.AccessMode.*; +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.data.validation.Constraints; +import play.libs.Json; @ApiModel(description = "Instance type model which holds the information about the instance.") @Entity diff --git a/managed/src/main/java/com/yugabyte/yw/models/InstanceTypeKey.java b/managed/src/main/java/com/yugabyte/yw/models/InstanceTypeKey.java index d2647f361ec9..1971701d1d88 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/InstanceTypeKey.java +++ b/managed/src/main/java/com/yugabyte/yw/models/InstanceTypeKey.java @@ -2,9 +2,9 @@ package com.yugabyte.yw.models; -import javax.persistence.Embeddable; import java.io.Serializable; import java.util.UUID; +import javax.persistence.Embeddable; @Embeddable public class InstanceTypeKey implements Serializable { diff --git a/managed/src/main/java/com/yugabyte/yw/models/KmsConfig.java b/managed/src/main/java/com/yugabyte/yw/models/KmsConfig.java index 68cf3fb97135..562d31544719 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/KmsConfig.java +++ b/managed/src/main/java/com/yugabyte/yw/models/KmsConfig.java @@ -10,27 +10,25 @@ package com.yugabyte.yw.models; -import io.ebean.*; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.yugabyte.yw.common.kms.util.KeyProvider; +import io.ebean.Finder; +import io.ebean.Model; import io.ebean.annotation.DbJson; import io.ebean.annotation.JsonIgnore; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.yugabyte.yw.common.kms.EncryptionAtRestManager; -import com.yugabyte.yw.common.kms.util.KeyProvider; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.api.Play; -import play.data.validation.Constraints; -import play.libs.Json; - +import java.util.List; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; -import java.util.List; -import java.util.UUID; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.data.validation.Constraints; @Entity @ApiModel(description = "KMS config.") diff --git a/managed/src/main/java/com/yugabyte/yw/models/KmsHistory.java b/managed/src/main/java/com/yugabyte/yw/models/KmsHistory.java index efa0263945a1..bb283b828aca 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/KmsHistory.java +++ b/managed/src/main/java/com/yugabyte/yw/models/KmsHistory.java @@ -10,27 +10,28 @@ package com.yugabyte.yw.models; -import io.ebean.*; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; + +import io.ebean.Ebean; +import io.ebean.Finder; +import io.ebean.Model; +import io.ebean.SqlUpdate; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.data.validation.Constraints; -import play.libs.Json; - -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Column; -import javax.persistence.Entity; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.UUID; - +import javax.persistence.Column; import javax.persistence.EmbeddedId; - -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import javax.persistence.Entity; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.data.validation.Constraints; +import play.libs.Json; @Entity // @IdClass(KmsHistoryId.class) diff --git a/managed/src/main/java/com/yugabyte/yw/models/KmsHistoryId.java b/managed/src/main/java/com/yugabyte/yw/models/KmsHistoryId.java index 624b4ecb6a70..cc25c808bcb7 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/KmsHistoryId.java +++ b/managed/src/main/java/com/yugabyte/yw/models/KmsHistoryId.java @@ -11,7 +11,6 @@ package com.yugabyte.yw.models; import io.ebean.annotation.EnumValue; -import com.fasterxml.jackson.databind.JsonNode; import java.io.Serializable; import java.util.UUID; import javax.persistence.Column; diff --git a/managed/src/main/java/com/yugabyte/yw/models/MetricConfig.java b/managed/src/main/java/com/yugabyte/yw/models/MetricConfig.java index 5258409c8355..021d04aa3338 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/MetricConfig.java +++ b/managed/src/main/java/com/yugabyte/yw/models/MetricConfig.java @@ -2,25 +2,25 @@ package com.yugabyte.yw.models; -import io.ebean.*; -import io.ebean.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE; import com.fasterxml.jackson.databind.JsonNode; -import play.libs.Json; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Transient; +import io.ebean.Finder; +import io.ebean.Model; +import io.ebean.annotation.DbJson; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Pattern; import java.util.stream.Collectors; - -import static io.swagger.annotations.ApiModelProperty.AccessMode.*; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Transient; +import play.libs.Json; @ApiModel(description = "Metric config") @Entity diff --git a/managed/src/main/java/com/yugabyte/yw/models/NodeInstance.java b/managed/src/main/java/com/yugabyte/yw/models/NodeInstance.java index 002c00064a9b..c8ec5d55d844 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/NodeInstance.java +++ b/managed/src/main/java/com/yugabyte/yw/models/NodeInstance.java @@ -1,28 +1,32 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.models; -import io.ebean.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import com.yugabyte.yw.forms.NodeInstanceFormData.NodeInstanceData; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static play.mvc.Http.Status.BAD_REQUEST; import com.yugabyte.yw.common.YWServiceException; +import com.yugabyte.yw.forms.NodeInstanceFormData.NodeInstanceData; +import io.ebean.Ebean; +import io.ebean.ExpressionList; +import io.ebean.Finder; +import io.ebean.Model; +import io.ebean.Query; +import io.ebean.RawSql; +import io.ebean.RawSqlBuilder; +import io.ebean.SqlUpdate; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.UUID; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import play.libs.Json; -import static play.mvc.Http.Status.BAD_REQUEST; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; @Entity @ApiModel(description = "Node instance attched to provider and zones") diff --git a/managed/src/main/java/com/yugabyte/yw/models/PlatformInstance.java b/managed/src/main/java/com/yugabyte/yw/models/PlatformInstance.java index 90115b65cd24..30c237739dee 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/PlatformInstance.java +++ b/managed/src/main/java/com/yugabyte/yw/models/PlatformInstance.java @@ -15,21 +15,29 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.ObjectCodec; -import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import io.ebean.Finder; import io.ebean.Model; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.data.validation.Constraints; - -import javax.persistence.*; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Optional; import java.util.UUID; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.data.validation.Constraints; @Entity @JsonPropertyOrder({"uuid", "config_uuid", "address", "is_leader", "is_local", "last_backup"}) diff --git a/managed/src/main/java/com/yugabyte/yw/models/PriceComponent.java b/managed/src/main/java/com/yugabyte/yw/models/PriceComponent.java index 26cdb9660267..cb35ba3c954d 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/PriceComponent.java +++ b/managed/src/main/java/com/yugabyte/yw/models/PriceComponent.java @@ -3,15 +3,18 @@ import io.ebean.Finder; import io.ebean.Model; +import java.util.List; +import java.util.UUID; +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.validation.Constraints; import play.libs.Json; -import javax.persistence.*; -import java.util.List; -import java.util.UUID; - @Entity public class PriceComponent extends Model { public static final Logger LOG = LoggerFactory.getLogger(PriceComponent.class); diff --git a/managed/src/main/java/com/yugabyte/yw/models/PriceComponentKey.java b/managed/src/main/java/com/yugabyte/yw/models/PriceComponentKey.java index abcdd620b36d..c2079af9e0e0 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/PriceComponentKey.java +++ b/managed/src/main/java/com/yugabyte/yw/models/PriceComponentKey.java @@ -1,10 +1,10 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.models; -import javax.persistence.Embeddable; -import javax.persistence.Entity; import java.io.Serializable; import java.util.UUID; +import javax.persistence.Embeddable; +import javax.persistence.Entity; @Entity @Embeddable diff --git a/managed/src/main/java/com/yugabyte/yw/models/Provider.java b/managed/src/main/java/com/yugabyte/yw/models/Provider.java index 656083d259ea..94b971ca4286 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/Provider.java +++ b/managed/src/main/java/com/yugabyte/yw/models/Provider.java @@ -1,6 +1,12 @@ // Copyright (c) Yugabyte, Inc. package com.yugabyte.yw.models; +import static com.yugabyte.yw.models.helpers.CommonUtils.DEFAULT_YB_HOME_DIR; +import static com.yugabyte.yw.models.helpers.CommonUtils.maskConfigNew; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonManagedReference; import com.fasterxml.jackson.annotation.JsonProperty; @@ -13,19 +19,24 @@ import io.ebean.Model; import io.ebean.annotation.DbJson; import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.UniqueConstraint; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import play.data.validation.Constraints; -import javax.persistence.*; -import java.util.*; - -import static com.yugabyte.yw.models.helpers.CommonUtils.DEFAULT_YB_HOME_DIR; -import static com.yugabyte.yw.models.helpers.CommonUtils.maskConfigNew; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE; -import static play.mvc.Http.Status.BAD_REQUEST; - @Table(uniqueConstraints = @UniqueConstraint(columnNames = {"customer_uuid", "name", "code"})) @Entity public class Provider extends Model { diff --git a/managed/src/main/java/com/yugabyte/yw/models/Region.java b/managed/src/main/java/com/yugabyte/yw/models/Region.java index d101f3283fbd..d22e5a54b2e6 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/Region.java +++ b/managed/src/main/java/com/yugabyte/yw/models/Region.java @@ -1,28 +1,43 @@ // Copyright (c) Yugabyte, Inc. package com.yugabyte.yw.models; -import com.fasterxml.jackson.annotation.*; +import static com.yugabyte.yw.models.helpers.CommonUtils.maskConfigNew; +import static io.ebean.Ebean.beginTransaction; +import static io.ebean.Ebean.commitTransaction; +import static io.ebean.Ebean.endTransaction; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE; +import static play.mvc.Http.Status.BAD_REQUEST; + +import com.fasterxml.jackson.annotation.JsonBackReference; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonManagedReference; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.common.YWServiceException; +import io.ebean.Ebean; +import io.ebean.Finder; +import io.ebean.Model; import io.ebean.Query; -import io.ebean.*; +import io.ebean.RawSql; +import io.ebean.RawSqlBuilder; +import io.ebean.SqlUpdate; import io.ebean.annotation.DbJson; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import play.data.validation.Constraints; -import play.libs.Json; - -import javax.persistence.*; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; - -import static com.yugabyte.yw.models.helpers.CommonUtils.maskConfigNew; -import static io.ebean.Ebean.*; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE; -import static play.mvc.Http.Status.BAD_REQUEST; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import play.data.validation.Constraints; +import play.libs.Json; @Entity @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/managed/src/main/java/com/yugabyte/yw/models/RuntimeConfigEntry.java b/managed/src/main/java/com/yugabyte/yw/models/RuntimeConfigEntry.java index b1a6a43bbd48..2a1e77183357 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/RuntimeConfigEntry.java +++ b/managed/src/main/java/com/yugabyte/yw/models/RuntimeConfigEntry.java @@ -1,23 +1,21 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.models.ScopedRuntimeConfig.GLOBAL_SCOPE_UUID; +import static play.mvc.Http.Status.NOT_FOUND; + import com.yugabyte.yw.common.YWServiceException; import io.ebean.Finder; import io.ebean.Model; import io.ebean.annotation.Transactional; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; - import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; - -import static com.yugabyte.yw.models.ScopedRuntimeConfig.GLOBAL_SCOPE_UUID; -import static play.mvc.Http.Status.NOT_FOUND; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Entity public class RuntimeConfigEntry extends Model { diff --git a/managed/src/main/java/com/yugabyte/yw/models/RuntimeConfigEntryKey.java b/managed/src/main/java/com/yugabyte/yw/models/RuntimeConfigEntryKey.java index bc6cb37ea05d..6f49942abbf9 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/RuntimeConfigEntryKey.java +++ b/managed/src/main/java/com/yugabyte/yw/models/RuntimeConfigEntryKey.java @@ -1,10 +1,10 @@ package com.yugabyte.yw.models; -import javax.persistence.Embeddable; -import javax.persistence.Entity; import java.io.Serializable; import java.util.Objects; import java.util.UUID; +import javax.persistence.Embeddable; +import javax.persistence.Entity; @Entity @Embeddable diff --git a/managed/src/main/java/com/yugabyte/yw/models/Schedule.java b/managed/src/main/java/com/yugabyte/yw/models/Schedule.java index 6f5b6092d0a4..fcbe2247160f 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/Schedule.java +++ b/managed/src/main/java/com/yugabyte/yw/models/Schedule.java @@ -2,36 +2,32 @@ package com.yugabyte.yw.models; -import io.ebean.*; -import io.ebean.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.JsonNode; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE; +import static play.mvc.Http.Status.BAD_REQUEST; -import com.yugabyte.yw.models.helpers.TaskType; +import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.forms.ITaskParams; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.libs.Json; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; - +import com.yugabyte.yw.models.helpers.TaskType; +import io.ebean.Finder; +import io.ebean.Model; +import io.ebean.annotation.DbJson; +import io.ebean.annotation.EnumValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.text.SimpleDateFormat; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; - -import static io.swagger.annotations.ApiModelProperty.AccessMode.*; -import static play.mvc.Http.Status.BAD_REQUEST; - -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; @Entity @ApiModel(description = "Scheduled backup") diff --git a/managed/src/main/java/com/yugabyte/yw/models/ScheduleTask.java b/managed/src/main/java/com/yugabyte/yw/models/ScheduleTask.java index e57a3930dad8..194cdc9eee0d 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/ScheduleTask.java +++ b/managed/src/main/java/com/yugabyte/yw/models/ScheduleTask.java @@ -2,25 +2,17 @@ package com.yugabyte.yw.models; -import io.ebean.*; -import io.ebean.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.JsonNode; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.libs.Json; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; - -import java.text.SimpleDateFormat; +import io.ebean.Finder; +import io.ebean.Model; import java.util.Date; import java.util.List; import java.util.UUID; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Entity public class ScheduleTask extends Model { diff --git a/managed/src/main/java/com/yugabyte/yw/models/ScopedRuntimeConfig.java b/managed/src/main/java/com/yugabyte/yw/models/ScopedRuntimeConfig.java index cbd41e91b96e..a7cdf3fdbee3 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/ScopedRuntimeConfig.java +++ b/managed/src/main/java/com/yugabyte/yw/models/ScopedRuntimeConfig.java @@ -3,12 +3,11 @@ import com.google.common.annotations.VisibleForTesting; import io.ebean.Finder; import io.ebean.Model; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - +import java.util.UUID; import javax.persistence.Entity; import javax.persistence.Id; -import java.util.UUID; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This bean is a parent for ConfigEntries bean. Intent is to identify the scope of the child diff --git a/managed/src/main/java/com/yugabyte/yw/models/TaskInfo.java b/managed/src/main/java/com/yugabyte/yw/models/TaskInfo.java index 21e3678ae0a1..76fe85516c05 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/TaskInfo.java +++ b/managed/src/main/java/com/yugabyte/yw/models/TaskInfo.java @@ -2,6 +2,10 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.commissioner.UserTaskDetails.createSubTask; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.commissioner.UserTaskDetails; @@ -19,15 +23,18 @@ import io.ebean.annotation.UpdatedTimestamp; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; import play.data.validation.Constraints; -import javax.persistence.*; -import java.util.*; - -import static com.yugabyte.yw.commissioner.UserTaskDetails.createSubTask; -import static play.mvc.Http.Status.BAD_REQUEST; -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; - @Entity @ApiModel(description = "Task Information.") public class TaskInfo extends Model { diff --git a/managed/src/main/java/com/yugabyte/yw/models/Universe.java b/managed/src/main/java/com/yugabyte/yw/models/Universe.java index a72abc318c60..80d101e6eca9 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/Universe.java +++ b/managed/src/main/java/com/yugabyte/yw/models/Universe.java @@ -2,6 +2,8 @@ package com.yugabyte.yw.models; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.JsonNode; @@ -16,8 +18,31 @@ import com.yugabyte.yw.models.helpers.CommonUtils; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.PlacementInfo; -import io.ebean.*; +import io.ebean.Ebean; +import io.ebean.ExpressionList; +import io.ebean.Finder; +import io.ebean.Model; +import io.ebean.SqlUpdate; import io.ebean.annotation.DbJson; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.ConcurrentModificationException; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.UniqueConstraint; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yb.client.YBClient; @@ -25,12 +50,6 @@ import play.data.validation.Constraints; import play.libs.Json; -import javax.persistence.*; -import java.util.*; -import java.util.stream.Collectors; - -import static play.mvc.Http.Status.BAD_REQUEST; - @Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name", "customer_id"})) @Entity public class Universe extends Model { diff --git a/managed/src/main/java/com/yugabyte/yw/models/Users.java b/managed/src/main/java/com/yugabyte/yw/models/Users.java index 2598cc7067cf..562e295b9547 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/Users.java +++ b/managed/src/main/java/com/yugabyte/yw/models/Users.java @@ -2,37 +2,34 @@ package com.yugabyte.yw.models; +import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; +import static play.mvc.Http.Status.BAD_REQUEST; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.yugabyte.yw.common.YWServiceException; +import io.ebean.Finder; +import io.ebean.Model; +import io.ebean.annotation.EnumValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.util.Date; -import java.util.UUID; import java.util.List; +import java.util.UUID; import java.util.stream.Collectors; - import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.Enumerated; import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.persistence.Id; - import org.joda.time.DateTime; import org.mindrot.jbcrypt.BCrypt; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import io.ebean.*; -import io.ebean.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.yugabyte.yw.common.YWServiceException; - import play.data.validation.Constraints; import play.libs.Json; -import static play.mvc.Http.Status.BAD_REQUEST; - -import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY; @Entity @ApiModel(description = "Users associated customers.") diff --git a/managed/src/main/java/com/yugabyte/yw/models/YugawareProperty.java b/managed/src/main/java/com/yugabyte/yw/models/YugawareProperty.java index c15ec11a08a3..7ba0fc5fb406 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/YugawareProperty.java +++ b/managed/src/main/java/com/yugabyte/yw/models/YugawareProperty.java @@ -2,17 +2,15 @@ package com.yugabyte.yw.models; +import com.fasterxml.jackson.databind.JsonNode; +import io.ebean.Finder; +import io.ebean.Model; +import io.ebean.annotation.EnumValue; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; - -import com.fasterxml.jackson.databind.JsonNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import io.ebean.*; -import io.ebean.annotation.*; - import play.data.validation.Constraints; /** diff --git a/managed/src/main/java/com/yugabyte/yw/models/filters/AlertDefinitionFilter.java b/managed/src/main/java/com/yugabyte/yw/models/filters/AlertDefinitionFilter.java index 6c00ac17349f..0776ba0a6864 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/filters/AlertDefinitionFilter.java +++ b/managed/src/main/java/com/yugabyte/yw/models/filters/AlertDefinitionFilter.java @@ -11,12 +11,13 @@ import com.yugabyte.yw.models.AlertDefinitionLabel; import com.yugabyte.yw.models.helpers.KnownAlertLabels; -import lombok.*; - import java.util.Collection; import java.util.HashSet; import java.util.Set; import java.util.UUID; +import lombok.Builder; +import lombok.NonNull; +import lombok.Value; @Value @Builder diff --git a/managed/src/main/java/com/yugabyte/yw/models/filters/AlertDefinitionGroupFilter.java b/managed/src/main/java/com/yugabyte/yw/models/filters/AlertDefinitionGroupFilter.java index c60b087eb28c..93ffaaa72958 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/filters/AlertDefinitionGroupFilter.java +++ b/managed/src/main/java/com/yugabyte/yw/models/filters/AlertDefinitionGroupFilter.java @@ -11,12 +11,13 @@ import com.yugabyte.yw.common.AlertDefinitionTemplate; import com.yugabyte.yw.models.AlertDefinitionGroup; -import lombok.*; - import java.util.Collection; import java.util.HashSet; import java.util.Set; import java.util.UUID; +import lombok.Builder; +import lombok.NonNull; +import lombok.Value; @Value @Builder diff --git a/managed/src/main/java/com/yugabyte/yw/models/filters/AlertDefinitionTemplateFilter.java b/managed/src/main/java/com/yugabyte/yw/models/filters/AlertDefinitionTemplateFilter.java index cfd986929fdb..f169607aea62 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/filters/AlertDefinitionTemplateFilter.java +++ b/managed/src/main/java/com/yugabyte/yw/models/filters/AlertDefinitionTemplateFilter.java @@ -12,7 +12,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.yugabyte.yw.common.AlertDefinitionTemplate; import com.yugabyte.yw.models.AlertDefinitionGroup; -import lombok.*; +import lombok.Builder; +import lombok.Value; @Value @Builder diff --git a/managed/src/main/java/com/yugabyte/yw/models/filters/AlertFilter.java b/managed/src/main/java/com/yugabyte/yw/models/filters/AlertFilter.java index 1d7b52a95c44..a784523bf13c 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/filters/AlertFilter.java +++ b/managed/src/main/java/com/yugabyte/yw/models/filters/AlertFilter.java @@ -14,9 +14,15 @@ import com.yugabyte.yw.models.AlertLabel; import com.yugabyte.yw.models.helpers.KnownAlertCodes; import com.yugabyte.yw.models.helpers.KnownAlertLabels; -import lombok.*; - -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; +import lombok.Builder; +import lombok.NonNull; +import lombok.Value; @Value @Builder diff --git a/managed/src/main/java/com/yugabyte/yw/models/helpers/AllowedActionsHelper.java b/managed/src/main/java/com/yugabyte/yw/models/helpers/AllowedActionsHelper.java index 01dd76718157..adc11e0653f3 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/helpers/AllowedActionsHelper.java +++ b/managed/src/main/java/com/yugabyte/yw/models/helpers/AllowedActionsHelper.java @@ -10,22 +10,21 @@ package com.yugabyte.yw.models.helpers; +import static com.yugabyte.yw.common.NodeActionType.START_MASTER; +import static com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ClusterType.PRIMARY; +import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.Live; + import com.yugabyte.yw.common.NodeActionType; import com.yugabyte.yw.common.Util; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.models.Universe; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.mvc.Http; - import java.util.Arrays; import java.util.Set; import java.util.stream.Collectors; - -import static com.yugabyte.yw.common.NodeActionType.START_MASTER; -import static com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ClusterType.PRIMARY; -import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.Live; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.mvc.Http; public class AllowedActionsHelper { private static final Logger LOG = LoggerFactory.getLogger(AllowedActionsHelper.class); diff --git a/managed/src/main/java/com/yugabyte/yw/models/helpers/ColumnDetails.java b/managed/src/main/java/com/yugabyte/yw/models/helpers/ColumnDetails.java index dde55410c59a..681a2347a86b 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/helpers/ColumnDetails.java +++ b/managed/src/main/java/com/yugabyte/yw/models/helpers/ColumnDetails.java @@ -3,12 +3,11 @@ package com.yugabyte.yw.models.helpers; import com.google.common.collect.ImmutableSet; -import org.yb.ColumnSchema; -import org.yb.Type; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - import java.util.Set; +import org.yb.ColumnSchema; +import org.yb.Type; @ApiModel(value = "Column details", description = "Column details") public class ColumnDetails { diff --git a/managed/src/main/java/com/yugabyte/yw/models/helpers/CommonUtils.java b/managed/src/main/java/com/yugabyte/yw/models/helpers/CommonUtils.java index 997de7e421d1..cba9162f2ec3 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/helpers/CommonUtils.java +++ b/managed/src/main/java/com/yugabyte/yw/models/helpers/CommonUtils.java @@ -2,6 +2,8 @@ package com.yugabyte.yw.models.helpers; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.Iterables; @@ -14,19 +16,23 @@ import io.ebean.Query; import io.ebean.common.BeanList; import io.jsonwebtoken.lang.Collections; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import play.libs.Json; - import java.time.Instant; import java.time.temporal.ChronoUnit; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.function.BiFunction; import java.util.function.Predicate; - -import static play.mvc.Http.Status.BAD_REQUEST; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import play.libs.Json; @Slf4j public class CommonUtils { diff --git a/managed/src/main/java/com/yugabyte/yw/models/helpers/CustomerConfigValidator.java b/managed/src/main/java/com/yugabyte/yw/models/helpers/CustomerConfigValidator.java index ae6b8faecb4f..2035c856e84d 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/helpers/CustomerConfigValidator.java +++ b/managed/src/main/java/com/yugabyte/yw/models/helpers/CustomerConfigValidator.java @@ -2,6 +2,9 @@ package com.yugabyte.yw.models.helpers; +import static com.yugabyte.yw.models.CustomerConfig.ConfigType.PASSWORD_POLICY; +import static com.yugabyte.yw.models.CustomerConfig.ConfigType.STORAGE; + import com.amazonaws.SdkClientException; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.BasicAWSCredentials; @@ -36,8 +39,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.validator.routines.UrlValidator; import play.libs.Json; -import static com.yugabyte.yw.models.CustomerConfig.ConfigType.PASSWORD_POLICY; -import static com.yugabyte.yw.models.CustomerConfig.ConfigType.STORAGE; @Singleton public class CustomerConfigValidator { diff --git a/managed/src/main/java/com/yugabyte/yw/models/helpers/DeviceInfo.java b/managed/src/main/java/com/yugabyte/yw/models/helpers/DeviceInfo.java index 41a9a3ff72b5..9478471c982d 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/helpers/DeviceInfo.java +++ b/managed/src/main/java/com/yugabyte/yw/models/helpers/DeviceInfo.java @@ -2,13 +2,13 @@ package com.yugabyte.yw.models.helpers; +import static play.mvc.Http.Status.BAD_REQUEST; + import com.yugabyte.yw.cloud.PublicCloudConstants; import com.yugabyte.yw.common.YWServiceException; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import static play.mvc.Http.Status.BAD_REQUEST; - @ApiModel(value = "Device info", description = "Device information") public class DeviceInfo { diff --git a/managed/src/main/java/com/yugabyte/yw/models/helpers/NodeDetails.java b/managed/src/main/java/com/yugabyte/yw/models/helpers/NodeDetails.java index 77f5e9f39b8b..a94fc7ca3e50 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/helpers/NodeDetails.java +++ b/managed/src/main/java/com/yugabyte/yw/models/helpers/NodeDetails.java @@ -2,18 +2,23 @@ package com.yugabyte.yw.models.helpers; +import static com.yugabyte.yw.common.NodeActionType.ADD; +import static com.yugabyte.yw.common.NodeActionType.DELETE; +import static com.yugabyte.yw.common.NodeActionType.QUERY; +import static com.yugabyte.yw.common.NodeActionType.RELEASE; +import static com.yugabyte.yw.common.NodeActionType.REMOVE; +import static com.yugabyte.yw.common.NodeActionType.START; +import static com.yugabyte.yw.common.NodeActionType.STOP; + import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.google.common.collect.ImmutableSet; import com.yugabyte.yw.common.NodeActionType; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - import java.util.Set; import java.util.UUID; -import static com.yugabyte.yw.common.NodeActionType.*; - /** Represents all the details of a cloud node that are of interest. */ @JsonIgnoreProperties(ignoreUnknown = true) @ApiModel(value = "Node details", description = "Node details") diff --git a/managed/src/main/java/com/yugabyte/yw/models/helpers/TableDetails.java b/managed/src/main/java/com/yugabyte/yw/models/helpers/TableDetails.java index 341accc7c941..9a0ea317b0dc 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/helpers/TableDetails.java +++ b/managed/src/main/java/com/yugabyte/yw/models/helpers/TableDetails.java @@ -2,17 +2,16 @@ package com.yugabyte.yw.models.helpers; -import org.yb.ColumnSchema; -import org.yb.Schema; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; +import org.yb.ColumnSchema; +import org.yb.Schema; @ApiModel(value = "Table details", description = "Table details") public class TableDetails { diff --git a/managed/src/main/java/com/yugabyte/yw/models/paging/PagedResponse.java b/managed/src/main/java/com/yugabyte/yw/models/paging/PagedResponse.java index 84b93bed9d07..a9eac49c09dc 100644 --- a/managed/src/main/java/com/yugabyte/yw/models/paging/PagedResponse.java +++ b/managed/src/main/java/com/yugabyte/yw/models/paging/PagedResponse.java @@ -2,9 +2,8 @@ package com.yugabyte.yw.models.paging; -import lombok.Data; - import java.util.List; +import lombok.Data; @Data public class PagedResponse { diff --git a/managed/src/main/java/com/yugabyte/yw/queries/LiveQueryExecutor.java b/managed/src/main/java/com/yugabyte/yw/queries/LiveQueryExecutor.java index f9f5fe1d2114..346c51a0124a 100644 --- a/managed/src/main/java/com/yugabyte/yw/queries/LiveQueryExecutor.java +++ b/managed/src/main/java/com/yugabyte/yw/queries/LiveQueryExecutor.java @@ -9,16 +9,13 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.ApiHelper; import com.yugabyte.yw.forms.LiveQueriesParams; -import com.yugabyte.yw.models.MetricConfig; +import java.util.UUID; +import java.util.concurrent.Callable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import play.Configuration; import play.api.Play; import play.libs.Json; -import java.util.*; -import java.util.concurrent.Callable; - public class LiveQueryExecutor implements Callable { public static final Logger LOG = LoggerFactory.getLogger(LiveQueryExecutor.class); diff --git a/managed/src/main/java/com/yugabyte/yw/queries/QueryHelper.java b/managed/src/main/java/com/yugabyte/yw/queries/QueryHelper.java index d77716018f90..b9fe5b70cf6e 100644 --- a/managed/src/main/java/com/yugabyte/yw/queries/QueryHelper.java +++ b/managed/src/main/java/com/yugabyte/yw/queries/QueryHelper.java @@ -4,24 +4,15 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; - import com.google.inject.Inject; import com.google.inject.Singleton; import com.yugabyte.yw.common.YsqlQueryExecutor; import com.yugabyte.yw.forms.RunQueryFormData; import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; -import org.joda.time.DateTime; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.Configuration; -import play.libs.Json; - -import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; -import java.util.Arrays; -import java.util.ArrayList; import java.util.Map; import java.util.Set; import java.util.concurrent.Callable; @@ -29,6 +20,9 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; @Singleton public class QueryHelper { diff --git a/managed/src/main/java/com/yugabyte/yw/queries/SlowQueryExecutor.java b/managed/src/main/java/com/yugabyte/yw/queries/SlowQueryExecutor.java index c2a7ac14c0b6..c2e0f1080ebd 100644 --- a/managed/src/main/java/com/yugabyte/yw/queries/SlowQueryExecutor.java +++ b/managed/src/main/java/com/yugabyte/yw/queries/SlowQueryExecutor.java @@ -2,34 +2,30 @@ package com.yugabyte.yw.queries; -import com.fasterxml.jackson.core.JsonProcessingException; +import static play.libs.Json.toJson; + import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.ApiHelper; -import com.yugabyte.yw.forms.RunQueryFormData; -import com.yugabyte.yw.forms.SlowQueriesParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; -import com.yugabyte.yw.models.MetricConfig; import com.yugabyte.yw.models.Universe; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.Callable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import play.Configuration; import play.api.Play; import play.libs.Json; -import javax.inject.Singleton; -import java.sql.*; -import java.util.*; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -import static play.libs.Json.newObject; -import static play.libs.Json.toJson; - public class SlowQueryExecutor implements Callable { public static final Logger LOG = LoggerFactory.getLogger(LiveQueryExecutor.class); diff --git a/managed/src/main/java/com/yugabyte/yw/scheduler/Scheduler.java b/managed/src/main/java/com/yugabyte/yw/scheduler/Scheduler.java index 7577a2d3c616..394cc63e6dc6 100644 --- a/managed/src/main/java/com/yugabyte/yw/scheduler/Scheduler.java +++ b/managed/src/main/java/com/yugabyte/yw/scheduler/Scheduler.java @@ -11,7 +11,7 @@ package com.yugabyte.yw.scheduler; -import com.google.common.annotations.VisibleForTesting; +import static com.cronutils.model.CronType.UNIX; import akka.actor.ActorSystem; import com.cronutils.model.Cron; @@ -19,20 +19,21 @@ import com.cronutils.model.time.ExecutionTime; import com.cronutils.parser.CronParser; import com.fasterxml.jackson.databind.JsonNode; +import com.google.common.annotations.VisibleForTesting; import com.google.inject.Inject; import com.google.inject.Singleton; import com.yugabyte.yw.commissioner.Commissioner; -import com.yugabyte.yw.commissioner.tasks.subtasks.DeleteBackup; import com.yugabyte.yw.commissioner.tasks.MultiTableBackup; +import com.yugabyte.yw.commissioner.tasks.subtasks.DeleteBackup; import com.yugabyte.yw.forms.BackupTableParams; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Backup; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.HighAvailabilityConfig; +import com.yugabyte.yw.models.Schedule; +import com.yugabyte.yw.models.ScheduleTask; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.TaskType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import play.libs.Json; -import scala.concurrent.ExecutionContext; -import scala.concurrent.duration.Duration; - import java.time.Instant; import java.time.ZoneId; import java.time.ZonedDateTime; @@ -42,8 +43,11 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; - -import static com.cronutils.model.CronType.UNIX; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import play.libs.Json; +import scala.concurrent.ExecutionContext; +import scala.concurrent.duration.Duration; @Singleton public class Scheduler { diff --git a/managed/src/main/java/controllers/UIController.java b/managed/src/main/java/controllers/UIController.java index b8d72627510e..3414ce3b16b8 100644 --- a/managed/src/main/java/controllers/UIController.java +++ b/managed/src/main/java/controllers/UIController.java @@ -2,12 +2,11 @@ package controllers; +import javax.inject.Inject; import play.api.mvc.AnyContent; import play.mvc.Controller; import play.mvc.Result; -import javax.inject.Inject; - public class UIController extends Controller { @Inject Assets assets; diff --git a/managed/src/main/java/db/migration/default/common/R__Insert_Alert_Definition_Clock_Skew.scala b/managed/src/main/java/db/migration/default/common/R__Insert_Alert_Definition_Clock_Skew.scala index f15f934e057a..5aaeb407b0c8 100644 --- a/managed/src/main/java/db/migration/default/common/R__Insert_Alert_Definition_Clock_Skew.scala +++ b/managed/src/main/java/db/migration/default/common/R__Insert_Alert_Definition_Clock_Skew.scala @@ -1,6 +1,7 @@ // Copyright (c) YugaByte, Inc. import java.sql.Connection + import org.flywaydb.core.api.migration.jdbc.JdbcMigration class R__Insert_Alert_Definition_Clock_Skew extends JdbcMigration { diff --git a/managed/src/main/java/db/migration/default/common/R__Recreate_Provision_Script_Extra_Migrations.scala b/managed/src/main/java/db/migration/default/common/R__Recreate_Provision_Script_Extra_Migrations.scala index 0afaacb7f2aa..c6df7c58e9b5 100644 --- a/managed/src/main/java/db/migration/default/common/R__Recreate_Provision_Script_Extra_Migrations.scala +++ b/managed/src/main/java/db/migration/default/common/R__Recreate_Provision_Script_Extra_Migrations.scala @@ -3,8 +3,6 @@ package db.migration.default.common import java.sql.Connection -import java.util.UUID -import play.api.libs.json._ import org.flywaydb.core.api.migration.jdbc.JdbcMigration diff --git a/managed/src/main/java/db/migration/default/common/R__Redact_Secrets_From_Audit.scala b/managed/src/main/java/db/migration/default/common/R__Redact_Secrets_From_Audit.scala index c9dbf78ac952..e40e07dc4c8c 100644 --- a/managed/src/main/java/db/migration/default/common/R__Redact_Secrets_From_Audit.scala +++ b/managed/src/main/java/db/migration/default/common/R__Redact_Secrets_From_Audit.scala @@ -1,15 +1,13 @@ // Copyright (c) YugaByte, Inc. package db.migration.default.common -import com.sangupta.murmur.Murmur3 +import java.sql.Connection + import com.yugabyte.yw.common.audit.AuditService import org.apache.commons.lang3.StringUtils import org.flywaydb.core.api.migration.MigrationChecksumProvider - -import java.sql.Connection import org.flywaydb.core.api.migration.jdbc.JdbcMigration -import java.util.Objects import scala.util.hashing.MurmurHash3 class R__Redact_Secrets_From_Audit extends JdbcMigration with MigrationChecksumProvider { diff --git a/managed/src/main/java/db/migration/default/common/V16__PlacementUtil_UUID_Update.scala b/managed/src/main/java/db/migration/default/common/V16__PlacementUtil_UUID_Update.scala index 171e8c85566b..a093474daab8 100644 --- a/managed/src/main/java/db/migration/default/common/V16__PlacementUtil_UUID_Update.scala +++ b/managed/src/main/java/db/migration/default/common/V16__PlacementUtil_UUID_Update.scala @@ -3,9 +3,9 @@ package db.migration.default.common import java.sql.Connection -import play.api.libs.json._ import org.flywaydb.core.api.migration.jdbc.JdbcMigration +import play.api.libs.json._ class V16__PlacementUtil_UUID_Update extends JdbcMigration { diff --git a/managed/src/main/java/db/migration/default/common/V26__Universe_Details_EBS_Type_Update.scala b/managed/src/main/java/db/migration/default/common/V26__Universe_Details_EBS_Type_Update.scala index 66a58f80ad45..8fafb3e005a7 100644 --- a/managed/src/main/java/db/migration/default/common/V26__Universe_Details_EBS_Type_Update.scala +++ b/managed/src/main/java/db/migration/default/common/V26__Universe_Details_EBS_Type_Update.scala @@ -3,9 +3,9 @@ package db.migration.default.common import java.sql.Connection -import play.api.libs.json._ import org.flywaydb.core.api.migration.jdbc.JdbcMigration +import play.api.libs.json._ class V26__Universe_Details_EBS_Type_UUID_Update extends JdbcMigration { diff --git a/managed/src/main/java/db/migration/default/common/V37__Universe_Details_EncryptionAtRestConfig_Update.scala b/managed/src/main/java/db/migration/default/common/V37__Universe_Details_EncryptionAtRestConfig_Update.scala index af5e59622737..ea077ed3b468 100644 --- a/managed/src/main/java/db/migration/default/common/V37__Universe_Details_EncryptionAtRestConfig_Update.scala +++ b/managed/src/main/java/db/migration/default/common/V37__Universe_Details_EncryptionAtRestConfig_Update.scala @@ -2,17 +2,14 @@ package db.migration.default.common -import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.databind.node.ObjectNode -import com.yugabyte.yw.common.kms.util.AwsEARServiceUtil -import com.yugabyte.yw.common.kms.util.EncryptionAtRestUtil -import com.yugabyte.yw.common.kms.util.KeyProvider -import com.yugabyte.yw.models.Universe import java.sql.Connection import java.util.UUID -import play.api.libs.json._ +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.node.ObjectNode +import com.yugabyte.yw.common.kms.util.{AwsEARServiceUtil, EncryptionAtRestUtil, KeyProvider} import org.flywaydb.core.api.migration.jdbc.JdbcMigration +import play.api.libs.json._ class V37__Universe_Details_EncryptionAtRestConfig_Update extends JdbcMigration { /** diff --git a/managed/src/main/java/db/migration/default/common/V43__Customer_Config_BackupLocation_Update.scala b/managed/src/main/java/db/migration/default/common/V43__Customer_Config_BackupLocation_Update.scala index ade15644cd10..ea9046c4dbda 100644 --- a/managed/src/main/java/db/migration/default/common/V43__Customer_Config_BackupLocation_Update.scala +++ b/managed/src/main/java/db/migration/default/common/V43__Customer_Config_BackupLocation_Update.scala @@ -3,9 +3,9 @@ package db.migration.default.common import java.sql.Connection -import play.api.libs.json._ import org.flywaydb.core.api.migration.jdbc.JdbcMigration +import play.api.libs.json._ class V43__Customer_Config_BackupLocation_Update extends JdbcMigration { override def migrate(connection: Connection): Unit = { diff --git a/managed/src/main/java/db/migration/default/common/V44__Update_Task_Info.scala b/managed/src/main/java/db/migration/default/common/V44__Update_Task_Info.scala index de439b76921a..030258cb9d08 100644 --- a/managed/src/main/java/db/migration/default/common/V44__Update_Task_Info.scala +++ b/managed/src/main/java/db/migration/default/common/V44__Update_Task_Info.scala @@ -3,9 +3,9 @@ package db.migration.default.common import java.sql.Connection -import play.api.libs.json._ import org.flywaydb.core.api.migration.jdbc.JdbcMigration +import play.api.libs.json._ class V44__Update_Task_Info extends JdbcMigration { override def migrate(connection: Connection): Unit = { diff --git a/managed/src/main/java/db/migration/default/common/V45__AccessKey_SshPort_Update.scala b/managed/src/main/java/db/migration/default/common/V45__AccessKey_SshPort_Update.scala index 1718c1127aa7..3acb4e3e8302 100644 --- a/managed/src/main/java/db/migration/default/common/V45__AccessKey_SshPort_Update.scala +++ b/managed/src/main/java/db/migration/default/common/V45__AccessKey_SshPort_Update.scala @@ -3,9 +3,9 @@ package db.migration.default.common import java.sql.Connection -import play.api.libs.json._ import org.flywaydb.core.api.migration.jdbc.JdbcMigration +import play.api.libs.json._ class V45__AccessKey_SshPort_Update extends JdbcMigration { override def migrate(connection: Connection): Unit = { diff --git a/managed/src/main/java/db/migration/default/common/V46__Onprem_SshPort_Update.scala b/managed/src/main/java/db/migration/default/common/V46__Onprem_SshPort_Update.scala index 37954ebce286..fbbc2fd59d6c 100644 --- a/managed/src/main/java/db/migration/default/common/V46__Onprem_SshPort_Update.scala +++ b/managed/src/main/java/db/migration/default/common/V46__Onprem_SshPort_Update.scala @@ -3,9 +3,9 @@ package db.migration.default.common import java.sql.Connection -import play.api.libs.json._ import org.flywaydb.core.api.migration.jdbc.JdbcMigration +import play.api.libs.json._ class V46__AccessKey_SshPort_Update extends JdbcMigration { override def migrate(connection: Connection): Unit = { diff --git a/managed/src/main/java/db/migration/default/common/V49__Update_Universe_Details_Json.scala b/managed/src/main/java/db/migration/default/common/V49__Update_Universe_Details_Json.scala index 65366c754eca..a76a2dfc0b48 100644 --- a/managed/src/main/java/db/migration/default/common/V49__Update_Universe_Details_Json.scala +++ b/managed/src/main/java/db/migration/default/common/V49__Update_Universe_Details_Json.scala @@ -3,9 +3,9 @@ package db.migration.default.common import java.sql.Connection -import play.api.libs.json._ import org.flywaydb.core.api.migration.jdbc.JdbcMigration +import play.api.libs.json._ class V49__Update_Universe_Details_Json extends JdbcMigration { override def migrate(connection: Connection): Unit = { diff --git a/managed/src/main/java/db/migration/default/common/V52__Update_Access_Key_Create_Extra_Migrations.scala b/managed/src/main/java/db/migration/default/common/V52__Update_Access_Key_Create_Extra_Migrations.scala index 4cf51bb2a36f..1441c9bb39e0 100644 --- a/managed/src/main/java/db/migration/default/common/V52__Update_Access_Key_Create_Extra_Migrations.scala +++ b/managed/src/main/java/db/migration/default/common/V52__Update_Access_Key_Create_Extra_Migrations.scala @@ -3,10 +3,9 @@ package db.migration.default.common import java.sql.Connection -import java.util.UUID -import play.api.libs.json._ import org.flywaydb.core.api.migration.jdbc.JdbcMigration +import play.api.libs.json._ class V52__Update_Access_Key_Create_Extra_Migrations extends JdbcMigration { diff --git a/managed/src/main/java/db/migration/default/common/V62__Insert_Alert_Definition_Clock_Skew.scala b/managed/src/main/java/db/migration/default/common/V62__Insert_Alert_Definition_Clock_Skew.scala index d419b4fbc375..4767688baee5 100644 --- a/managed/src/main/java/db/migration/default/common/V62__Insert_Alert_Definition_Clock_Skew.scala +++ b/managed/src/main/java/db/migration/default/common/V62__Insert_Alert_Definition_Clock_Skew.scala @@ -4,8 +4,10 @@ package db.migration.default.common import java.sql.Connection import java.util.UUID -import play.api.libs.json._ + import org.flywaydb.core.api.migration.jdbc.JdbcMigration +import play.api.libs.json._ + import scala.util.control.Breaks._ class V62__Insert_Alert_Definition_Clock_Skew extends JdbcMigration { diff --git a/managed/src/main/java/db/migration/default/common/V67__Update_Access_Key_Aws_Hosted_Zone.scala b/managed/src/main/java/db/migration/default/common/V67__Update_Access_Key_Aws_Hosted_Zone.scala index b7bc998c75de..65fdd7b4e6d7 100644 --- a/managed/src/main/java/db/migration/default/common/V67__Update_Access_Key_Aws_Hosted_Zone.scala +++ b/managed/src/main/java/db/migration/default/common/V67__Update_Access_Key_Aws_Hosted_Zone.scala @@ -3,9 +3,9 @@ package db.migration.default.common import java.sql.Connection -import java.util.UUID -import play.api.libs.json._ + import org.flywaydb.core.api.migration.jdbc.JdbcMigration +import play.api.libs.json._ class V67__Update_Access_Key_Aws_Hosted_Zone extends JdbcMigration { diff --git a/managed/src/main/java/db/migration/default/common/V68__Create_New_Alert_Definitions_Extra_Migration.scala b/managed/src/main/java/db/migration/default/common/V68__Create_New_Alert_Definitions_Extra_Migration.scala index 27d6cb0d26f6..1acca4fb48f8 100644 --- a/managed/src/main/java/db/migration/default/common/V68__Create_New_Alert_Definitions_Extra_Migration.scala +++ b/managed/src/main/java/db/migration/default/common/V68__Create_New_Alert_Definitions_Extra_Migration.scala @@ -2,6 +2,7 @@ package db.migration.default.common import java.sql.Connection + import org.flywaydb.core.api.migration.jdbc.JdbcMigration class V68__Create_New_Alert_Definitions_Extra_Migration extends JdbcMigration { diff --git a/managed/src/main/resources/swagger.json b/managed/src/main/resources/swagger.json index df31abb67a4b..afc9923ed16f 100644 --- a/managed/src/main/resources/swagger.json +++ b/managed/src/main/resources/swagger.json @@ -16,74 +16,74 @@ "host" : "localhost", "basePath" : "/", "tags" : [ { - "name" : "Release" - }, { - "name" : "Certificate Info" + "name" : "Node Instances" }, { - "name" : "Users" + "name" : "Instance Type" }, { - "name" : "Schedule" + "name" : "Encryption At Rest" }, { - "name" : "Customer" + "name" : "Session" }, { - "name" : "Provider" + "name" : "Customer Task" }, { "name" : "Provider1" }, { - "name" : "Universe Actions" + "name" : "Provider" }, { - "name" : "Encryption At Rest" + "name" : "Import" }, { - "name" : "Alert" + "name" : "Universe YB Database" }, { - "name" : "Audit" + "name" : "Metamaster" }, { - "name" : "AccessKey" + "name" : "Schedule" }, { - "name" : "Metamaster" + "name" : "AvailabilityZone" }, { - "name" : "Backups" + "name" : "Tables" }, { - "name" : "Session" + "name" : "Alert" }, { - "name" : "Region" + "name" : "Customer Config" }, { - "name" : "Node Instances" + "name" : "RuntimeConfig" }, { - "name" : "UniverseInfo" + "name" : "Universe Actions" }, { - "name" : "Tables" + "name" : "Audit" }, { - "name" : "Metrics" + "name" : "Universe" }, { "name" : "Tablet Server" }, { - "name" : "Universe YB Database" + "name" : "AccessKey" }, { - "name" : "RuntimeConfig" + "name" : "Release" }, { - "name" : "Customer Config" + "name" : "Region" }, { - "name" : "Instance Type" + "name" : "Backups" }, { - "name" : "Universe" + "name" : "Certificate Info" }, { - "name" : "Import" + "name" : "UniverseInfo" }, { - "name" : "AvailabilityZone" + "name" : "Customer" }, { - "name" : "Customer Task" + "name" : "Users" + }, { + "name" : "Metrics" } ], "schemes" : [ "http", "https" ], "consumes" : [ "application/json" ], "produces" : [ "application/json" ], "paths" : { - "/api/v1/customers/{cUUID}/releases" : { + "/api/v1/customers/{cUUID}/zones/{azUUID}/nodes/list" : { "get" : { - "tags" : [ "Release" ], - "summary" : "Get list of releases", + "tags" : [ "Node Instances" ], + "summary" : "List of node instances by zone", "description" : "", - "operationId" : "getReleases", + "operationId" : "listByZone", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -91,19 +91,19 @@ "type" : "string", "format" : "uuid" }, { - "name" : "includeMetadata", - "in" : "query", - "required" : false, - "type" : "boolean", - "default" : false + "name" : "azUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" + "type" : "array", + "items" : { + "$ref" : "#/definitions/NodeInstance" } } } @@ -111,12 +111,14 @@ "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "post" : { - "tags" : [ "Release" ], - "summary" : "Create release", + } + }, + "/api/v1/customers/{cUUID}/providers/{pUUID}/nodes/list" : { + "get" : { + "tags" : [ "Node Instances" ], + "summary" : "List of node instances by provider", "description" : "", - "operationId" : "createRelease", + "operationId" : "listByProvider", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -124,44 +126,55 @@ "type" : "string", "format" : "uuid" }, { - "in" : "body", - "name" : "Release", - "description" : "Release data to be created", + "name" : "pUUID", + "in" : "path", "required" : true, - "schema" : { - "$ref" : "#/definitions/ReleaseFormData" - } + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "type" : "array", + "items" : { + "$ref" : "#/definitions/NodeInstance" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "put" : { - "tags" : [ "Release" ], - "summary" : "Refresh release", + } + }, + "/api/v1/customers/{cUUID}/providers/{pUUID}/instances/{instanceIP}" : { + "delete" : { + "tags" : [ "Node Instances" ], + "summary" : "Delete node instance by IP", "description" : "", - "operationId" : "refresh", + "operationId" : "deleteInstance", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "pUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "instanceIP", + "in" : "path", + "required" : true, + "type" : "string" } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/YWSuccess" - } + "default" : { + "description" : "successful operation" } }, "security" : [ { @@ -169,12 +182,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/releases/{name}" : { + "/api/v1/customers/{cUUID}/universes/{universeUUID}/nodes/{nodeName}" : { "put" : { - "tags" : [ "Release" ], - "summary" : "Update release", + "tags" : [ "Node Instances" ], + "summary" : "Update node actions", "description" : "", - "operationId" : "updateRelease", + "operationId" : "nodeAction", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -182,24 +195,30 @@ "type" : "string", "format" : "uuid" }, { - "name" : "name", + "name" : "universeUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "nodeName", "in" : "path", "required" : true, "type" : "string" }, { "in" : "body", - "name" : "Release", - "description" : "Release data to be updated", + "name" : "Node action", + "description" : "Node action data to be updated", "required" : true, "schema" : { - "type" : "object" + "$ref" : "#/definitions/NodeActionFormData" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Release data" + "$ref" : "#/definitions/YWTask" } } }, @@ -208,12 +227,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/certificates/{name}" : { + "/api/v1/customers/{cUUID}/nodes/{nodeUUID}/list" : { "get" : { - "tags" : [ "Certificate Info" ], - "summary" : "get certificate UUID", + "tags" : [ "Node Instances" ], + "summary" : "Get node instance by UUID", "description" : "", - "operationId" : "getCertificate", + "operationId" : "getNodeInstance", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -221,17 +240,17 @@ "type" : "string", "format" : "uuid" }, { - "name" : "name", + "name" : "nodeUUID", "in" : "path", "required" : true, - "type" : "string" + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "string", - "format" : "uuid" + "$ref" : "#/definitions/NodeInstance" } } }, @@ -240,12 +259,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/certificates/{rUUID}" : { + "/api/v1/customers/{cUUID}/zones/{azUUID}/nodes" : { "post" : { - "tags" : [ "Certificate Info" ], - "summary" : "post certificate info", + "tags" : [ "Node Instances" ], + "summary" : "Create node instance", "description" : "", - "operationId" : "getClientCert", + "operationId" : "createNodeInstance", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -253,55 +272,52 @@ "type" : "string", "format" : "uuid" }, { - "name" : "rUUID", + "name" : "azUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { "in" : "body", - "name" : "certificate", - "description" : "post certificate info", + "name" : "Node instance", + "description" : "Node instance data to be created", "required" : true, "schema" : { - "$ref" : "#/definitions/ClientCertParams" + "$ref" : "#/definitions/NodeInstanceFormData" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/CertificateDetails" + "type" : "object", + "additionalProperties" : { + "$ref" : "#/definitions/NodeInstance" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "delete" : { - "tags" : [ "Certificate Info" ], - "summary" : "delete certificate", + } + }, + "/api/v1/metadata/ebs_types" : { + "get" : { + "tags" : [ "Instance Type" ], + "summary" : "get EBS types", "description" : "", - "operationId" : "deleteCertificate", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "rUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - } ], + "operationId" : "getEBSTypes", + "parameters" : [ ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "IO1", "GP2", "GP3", "Scratch", "Persistent", "StandardSSD_LRS", "Premium_LRS", "UltraSSD_LRS" ] + } } } }, @@ -310,66 +326,46 @@ } ] } }, - "/api/v1/customers/{cUUID}/certificates" : { + "/api/v1/metadata/gcp_types" : { "get" : { - "tags" : [ "Certificate Info" ], - "summary" : "list Certificates for a specific customer", + "tags" : [ "Instance Type" ], + "summary" : "get GCP types", "description" : "", - "operationId" : "getListOfCertificate", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - } ], + "operationId" : "getGCPTypes", + "parameters" : [ ], "responses" : { "200" : { "description" : "successful operation", "schema" : { "type" : "array", "items" : { - "$ref" : "#/definitions/CertificateInfo" + "type" : "string", + "enum" : [ "IO1", "GP2", "GP3", "Scratch", "Persistent", "StandardSSD_LRS", "Premium_LRS", "UltraSSD_LRS" ] } } - }, - "500" : { - "description" : "If there was a server or database issue when listing the regions", - "schema" : { - "$ref" : "#/definitions/Generic error response from Yugawware Platform API" - } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "post" : { - "tags" : [ "Certificate Info" ], - "summary" : "restore Backups", + } + }, + "/api/v1/metadata/azu_types" : { + "get" : { + "tags" : [ "Instance Type" ], + "summary" : "get AZU types", "description" : "", - "operationId" : "upload", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "in" : "body", - "name" : "certificate", - "description" : "certificate params of the backup to be restored", - "required" : true, - "schema" : { - "$ref" : "#/definitions/CertificateParams" - } - } ], + "operationId" : "getAZUTypes", + "parameters" : [ ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "string", - "format" : "uuid" + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "IO1", "GP2", "GP3", "Scratch", "Persistent", "StandardSSD_LRS", "Premium_LRS", "UltraSSD_LRS" ] + } } } }, @@ -378,12 +374,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/certificates/{rUUID}/download" : { + "/api/v1/customers/{cUUID}/providers/{pUUID}/instance_types/{code}" : { "get" : { - "tags" : [ "Certificate Info" ], - "summary" : "get root certificate", + "tags" : [ "Instance Type" ], + "summary" : "get instance type through instance type code.", "description" : "", - "operationId" : "getRootCert", + "operationId" : "instanceTypeDetail", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -391,31 +387,34 @@ "type" : "string", "format" : "uuid" }, { - "name" : "rUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "code", + "in" : "path", + "required" : true, + "type" : "string" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/JsonNode" + "$ref" : "#/definitions/InstanceType" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/certificates/{rUUID}/update_empty_cert" : { - "post" : { - "tags" : [ "Certificate Info" ], - "summary" : "update empty certs", + }, + "delete" : { + "tags" : [ "Instance Type" ], + "summary" : "delete", "description" : "", - "operationId" : "updateEmptyCustomCert", + "operationId" : "deleteInstanceType", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -423,17 +422,22 @@ "type" : "string", "format" : "uuid" }, { - "name" : "rUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "code", + "in" : "path", + "required" : true, + "type" : "string" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/CertificateInfo" + "$ref" : "#/definitions/YWSuccess" } } }, @@ -442,12 +446,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/users/{uUUID}" : { + "/api/v1/customers/{cUUID}/providers/{pUUID}/instance_types" : { "get" : { - "tags" : [ "Users" ], - "summary" : "User detail by UUID", + "tags" : [ "Instance Type" ], + "summary" : "list Instance Types for specific provider.", "description" : "", - "operationId" : "usersDetail", + "operationId" : "listOfInstanceType", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -455,17 +459,36 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "zone", + "in" : "query", + "required" : false, + "type" : "array", + "items" : { + "type" : "string" + }, + "collectionFormat" : "multi", + "default" : "java.util.Collections.emptyList()" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Users" + "type" : "array", + "items" : { + "$ref" : "#/definitions/YWResults" + } + } + }, + "500" : { + "description" : "If there was a server or database issue when listing the backups", + "schema" : { + "$ref" : "#/definitions/Generic error response from Yugawware Platform API" } } }, @@ -473,11 +496,11 @@ "apiKeyAuth" : [ ] } ] }, - "put" : { - "tags" : [ "Users" ], - "summary" : "Change role of user by UUID", + "post" : { + "tags" : [ "Instance Type" ], + "summary" : "create Instance type", "description" : "", - "operationId" : "changeRole", + "operationId" : "createInstanceType", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -485,34 +508,39 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { - "name" : "role", - "in" : "query", - "required" : false, - "type" : "string" + "in" : "body", + "name" : "instance type", + "description" : "instance type data of the instance to be stored", + "required" : true, + "schema" : { + "$ref" : "#/definitions/InstanceType" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "$ref" : "#/definitions/InstanceType" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "delete" : { - "tags" : [ "Users" ], - "summary" : "Delete customer", + } + }, + "/api/v1/customers/{cUUID}/universes/{uniUUID}/kms" : { + "get" : { + "tags" : [ "Encryption At Rest" ], + "summary" : "Get key ref History", "description" : "", - "operationId" : "deleteUsers", + "operationId" : "getKeyRefHistory", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -520,7 +548,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", @@ -530,35 +558,42 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "type" : "array", + "items" : { + "type" : "object" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/users" : { - "get" : { - "tags" : [ "Users" ], - "summary" : "List of Users", + }, + "post" : { + "tags" : [ "Encryption At Rest" ], + "summary" : "Retrive KMS key", "description" : "", - "operationId" : "ListOfUsers", + "operationId" : "retrieveKey", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Users" + "type" : "object", + "additionalProperties" : { + "type" : "object" } } } @@ -567,11 +602,11 @@ "apiKeyAuth" : [ ] } ] }, - "post" : { - "tags" : [ "Users" ], - "summary" : "Create User", + "delete" : { + "tags" : [ "Encryption At Rest" ], + "summary" : "Remove key ref History", "description" : "", - "operationId" : "createUsers", + "operationId" : "removeKeyRefHistory", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -579,19 +614,17 @@ "type" : "string", "format" : "uuid" }, { - "in" : "body", - "name" : "User", - "description" : "Users data to be created", + "name" : "uniUUID", + "in" : "path", "required" : true, - "schema" : { - "$ref" : "#/definitions/User Register" - } + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Users" + "$ref" : "#/definitions/YWSuccess" } } }, @@ -600,38 +633,27 @@ } ] } }, - "/api/v1/customers/{cUUID}/users/{uUUID}/change_password" : { - "put" : { - "tags" : [ "Users" ], - "summary" : "Chnage password of User", + "/api/v1/customers/{cUUID}/kms_configs" : { + "get" : { + "tags" : [ "Encryption At Rest" ], + "summary" : "List KMS config", "description" : "", - "operationId" : "changePassword", + "operationId" : "listKMSConfigs", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "uUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "in" : "body", - "name" : "Users", - "description" : "Users data to be updated", - "required" : true, - "schema" : { - "$ref" : "#/definitions/User Register" - } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "type" : "array", + "items" : { + "type" : "object" + } } } }, @@ -640,12 +662,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/schedules/{sUUID}" : { - "delete" : { - "tags" : [ "Schedule" ], - "summary" : "delete", + "/api/v1/customers/{cUUID}/kms_configs/{configUUID}" : { + "get" : { + "tags" : [ "Encryption At Rest" ], + "summary" : "KMS config detail by config UUID", "description" : "", - "operationId" : "deleteSchedule", + "operationId" : "getKMSConfig", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -653,7 +675,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "sUUID", + "name" : "configUUID", "in" : "path", "required" : true, "type" : "string", @@ -663,36 +685,40 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWResults" + "type" : "object", + "additionalProperties" : { + "type" : "object" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/schedules" : { - "get" : { - "tags" : [ "Schedule" ], - "summary" : "list", + }, + "delete" : { + "tags" : [ "Encryption At Rest" ], + "summary" : "Delete KMS config", "description" : "", - "operationId" : "listOfSchedule", + "operationId" : "deleteKMSConfig", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "configUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Schedule" - } + "$ref" : "#/definitions/YWTask" } } }, @@ -701,35 +727,37 @@ } ] } }, - "/api/v1/customers/{cUUID}/metrics" : { + "/api/v1/customers/{cUUID}/kms_configs/{kmsProvider}" : { "post" : { - "tags" : [ "Customer" ], - "summary" : "Add metrics of customer by UUID", + "tags" : [ "Encryption At Rest" ], + "summary" : "Create KMS config", "description" : "", - "operationId" : "metrics", + "operationId" : "createKMSConfig", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "kmsProvider", + "in" : "path", + "required" : true, + "type" : "string" }, { "in" : "body", - "name" : "Metrics", - "description" : "Metrics to be added", + "name" : "KMS Config", + "description" : "KMS Config to be created", "required" : true, "schema" : { - "$ref" : "#/definitions/Metrics" + "type" : "object" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" - } + "$ref" : "#/definitions/YWTask" } } }, @@ -738,332 +766,268 @@ } ] } }, - "/api/v1/customers/{cUUID}" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/kms/key_ref" : { "get" : { - "tags" : [ "Customer" ], - "summary" : "Get customer by UUID", + "tags" : [ "Encryption At Rest" ], + "summary" : "Get key ref", "description" : "", - "operationId" : "CustomerDetail", + "operationId" : "getCurrentKeyRef", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/Customer Detail" - } - } - }, - "security" : [ { - "apiKeyAuth" : [ ] - } ] - }, - "put" : { - "tags" : [ "Customer" ], - "summary" : "Update customer by UUID", - "description" : "", - "operationId" : "UpdateCustomer", - "parameters" : [ { - "name" : "cUUID", + }, { + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "in" : "body", - "name" : "Customer", - "description" : "Customer data to be updated", - "required" : true, - "schema" : { - "$ref" : "#/definitions/Alerts" - } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Customer" + "type" : "object", + "additionalProperties" : { + "type" : "object" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "delete" : { - "tags" : [ "Customer" ], - "summary" : "Delete customer by UUID", - "description" : "", - "operationId" : "deleteCustomer", + } + }, + "/universes/{uniUUID}/proxy/{proxyUrl}" : { + "get" : { + "tags" : [ "Session" ], + "operationId" : "proxyRequest", "parameters" : [ { - "name" : "cUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "proxyUrl", + "in" : "path", + "required" : true, + "type" : "string" } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/YWSuccess" - } + "default" : { + "description" : "successful operation" } - }, - "security" : [ { - "apiKeyAuth" : [ ] - } ] + } } }, - "/api/v1/customers" : { + "/api/v1/logout" : { "get" : { - "tags" : [ "Customer" ], - "summary" : "List customer", - "description" : "", - "operationId" : "ListOfCustomers", + "tags" : [ "Session" ], + "operationId" : "logout", "parameters" : [ ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Customer" - } - } + "default" : { + "description" : "successful operation" } - }, - "security" : [ { - "apiKeyAuth" : [ ] - } ] + } } }, - "/api/v1/customers/{cUUID}/features" : { - "put" : { - "tags" : [ "Customer" ], - "summary" : "Upsert features of customer by UUID", + "/api/v1/login" : { + "post" : { + "tags" : [ "Session" ], + "summary" : "login", "description" : "", - "operationId" : "upsertFeatures", + "operationId" : "login", "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { "in" : "body", - "name" : "Feature", - "description" : "Feature to be upserted", + "name" : "loginFormData", + "description" : "login form data", "required" : true, "schema" : { - "$ref" : "#/definitions/FeatureUpdateFormData" + "$ref" : "#/definitions/CustomerLoginFormData" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" - } + "type" : "object" } } - }, - "security" : [ { - "apiKeyAuth" : [ ] - } ] + } } }, - "/api/v1/customers/{cUUID}/host_info" : { + "/api/v1/insecure_login" : { "get" : { - "tags" : [ "Customer" ], - "summary" : "Get host info by customer UUID", + "tags" : [ "Session" ], + "summary" : "insecureLogin", "description" : "", - "operationId" : "getHostInfo", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - } ], + "operationId" : "insecure_login", + "parameters" : [ ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" - } + "type" : "object" } } - }, - "security" : [ { - "apiKeyAuth" : [ ] - } ] + } } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/initialize" : { + "/api/v1/platform_config" : { "get" : { - "tags" : [ "Provider" ], - "summary" : "refreshPricing", - "description" : "Refresh Provider pricing info", - "operationId" : "initialize", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "pUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - } ], + "tags" : [ "Session" ], + "operationId" : "getPlatformConfig", + "parameters" : [ ], "responses" : { "default" : { "description" : "successful operation" } - }, - "security" : [ { - "apiKeyAuth" : [ ] - } ] + } } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/bootstrap" : { - "post" : { - "tags" : [ "Provider" ], - "operationId" : "bootstrap", + "/api/v1/third_party_login" : { + "get" : { + "tags" : [ "Session" ], + "operationId" : "thirdPartyLogin", + "parameters" : [ ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/customers/{cUUID}/security" : { + "put" : { + "tags" : [ "Session" ], + "operationId" : "set_security", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "pUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" } ], "responses" : { "default" : { "description" : "successful operation" } - }, - "security" : [ { - "apiKeyAuth" : [ ] - } ] + } } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/edit" : { + "/api/v1/customers/{cUUID}/api_token" : { "put" : { - "tags" : [ "Provider" ], - "summary" : "editProvider", + "tags" : [ "Session" ], + "summary" : "apiToken", "description" : "", - "operationId" : "editProvider", + "operationId" : "api_token", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "pUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "in" : "body", - "name" : "EditProviderFormData", - "description" : "edit provider form data", - "required" : true, - "schema" : { - "$ref" : "#/definitions/EditProviderRequest" - } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Provider" + "type" : "object" } } - }, - "security" : [ { - "apiKeyAuth" : [ ] - } ] + } } }, - "/api/v1/customers/{cUUID}/providers/kubernetes" : { - "post" : { - "tags" : [ "Provider" ], - "operationId" : "createKubernetes", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - } ], + "/api/v1/customer_count" : { + "get" : { + "tags" : [ "Session" ], + "operationId" : "customerCount", + "parameters" : [ ], "responses" : { "default" : { "description" : "successful operation" } - }, - "security" : [ { - "apiKeyAuth" : [ ] - } ] + } } }, - "/api/v1/customers/{cUUID}/providers/suggested_kubernetes_config" : { + "/api/v1/app_version" : { "get" : { - "tags" : [ "Provider" ], - "summary" : "getSuggestedKubernetesConfigs", - "description" : " Performs discovery of region, zones, pull secret, storageClass when running inside a Kubernetes cluster. Returns the discovered information as a JSON, which is similar to the one which is passed to the createKubernetes method.", - "operationId" : "getSuggestedKubernetesConfigs", + "tags" : [ "Session" ], + "operationId" : "appVersion", + "parameters" : [ ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/logs/{maxLines}" : { + "get" : { + "tags" : [ "Session" ], + "operationId" : "getLogs", "parameters" : [ { - "name" : "cUUID", + "name" : "maxLines", "in" : "path", "required" : true, - "type" : "string", - "format" : "uuid" + "type" : "integer", + "format" : "int32" } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/KubernetesProviderFormData" - } + "default" : { + "description" : "successful operation" } - }, - "security" : [ { - "apiKeyAuth" : [ ] - } ] + } } }, - "/api/v1/customers/{cUUID}/providers" : { + "/api/v1/ui_theme" : { "get" : { - "tags" : [ "Provider1" ], - "summary" : "listProvider", + "tags" : [ "Session" ], + "operationId" : "getUITheme", + "parameters" : [ ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/register" : { + "post" : { + "tags" : [ "Session" ], + "operationId" : "register", + "parameters" : [ ], + "responses" : { + "default" : { + "description" : "successful operation" + } + } + } + }, + "/api/v1/customers/{cUUID}/tasks_list" : { + "get" : { + "tags" : [ "Customer Task" ], + "summary" : "List task", "description" : "", - "operationId" : "getListOfProviders", + "operationId" : "tasksList", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uUUID", + "in" : "query", + "required" : false, + "type" : "string", + "default" : "null", + "format" : "uuid" } ], "responses" : { "200" : { @@ -1071,7 +1035,7 @@ "schema" : { "type" : "array", "items" : { - "$ref" : "#/definitions/Provider" + "$ref" : "#/definitions/Customer Task Data" } } } @@ -1079,12 +1043,14 @@ "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "post" : { - "tags" : [ "Provider1" ], - "summary" : "createProvider", + } + }, + "/api/v1/customers/{cUUID}/tasks/{tUUID}" : { + "get" : { + "tags" : [ "Customer Task" ], + "summary" : "Status of task", "description" : "", - "operationId" : "createProviders", + "operationId" : "taskStatus", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1092,32 +1058,32 @@ "type" : "string", "format" : "uuid" }, { - "in" : "body", - "name" : "CreateProviderRequest", + "name" : "tUUID", + "in" : "path", "required" : true, - "schema" : { - "$ref" : "#/definitions/Provider" - } + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWTask" + "type" : "object", + "additionalProperties" : { + "type" : "object" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/resume" : { + }, "post" : { - "tags" : [ "Universe Actions" ], - "summary" : "Resume the universe", + "tags" : [ "Customer Task" ], + "summary" : "Retry task", "description" : "", - "operationId" : "resume", + "operationId" : "retryTask", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1125,7 +1091,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "tUUID", "in" : "path", "required" : true, "type" : "string", @@ -1135,7 +1101,7 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWTask" + "$ref" : "#/definitions/UniverseResp" } } }, @@ -1144,12 +1110,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/setup_universe_2dc" : { - "put" : { - "tags" : [ "Universe Actions" ], - "summary" : "resetVersion", + "/api/v1/customers/{cUUID}/tasks/{tUUID}/failed" : { + "get" : { + "tags" : [ "Customer Task" ], + "summary" : "Get failed sub task", "description" : "", - "operationId" : "resetVersion", + "operationId" : "failedSubtasks", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1157,7 +1123,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "tUUID", "in" : "path", "required" : true, "type" : "string", @@ -1167,7 +1133,10 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "type" : "object", + "additionalProperties" : { + "type" : "object" + } } } }, @@ -1176,44 +1145,39 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/set_key" : { - "post" : { - "tags" : [ "Universe Actions" ], - "summary" : "setUniverseKey", + "/api/v1/customers/{cUUID}/providers" : { + "get" : { + "tags" : [ "Provider1" ], + "summary" : "listProvider", "description" : "", - "operationId" : "setUniverseKey", + "operationId" : "getListOfProviders", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/UniverseResp" + "type" : "array", + "items" : { + "$ref" : "#/definitions/Provider" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/pause" : { + }, "post" : { - "tags" : [ "Universe Actions" ], - "summary" : "Pause the universe", + "tags" : [ "Provider1" ], + "summary" : "createProvider", "description" : "", - "operationId" : "pause", + "operationId" : "createProviders", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1221,11 +1185,12 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", - "in" : "path", + "in" : "body", + "name" : "CreateProviderRequest", "required" : true, - "type" : "string", - "format" : "uuid" + "schema" : { + "$ref" : "#/definitions/Provider" + } } ], "responses" : { "200" : { @@ -1240,12 +1205,10 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/mark_helm3_compatible" : { - "put" : { - "tags" : [ "Universe Actions" ], - "summary" : "Set the universe as helm3 compatible", - "description" : "", - "operationId" : "setHelm3Compatible", + "/api/v1/customers/{cUUID}/providers/{pUUID}/bootstrap" : { + "post" : { + "tags" : [ "Provider" ], + "operationId" : "bootstrap", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1253,18 +1216,15 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/YWSuccess" - } + "default" : { + "description" : "successful operation" } }, "security" : [ { @@ -1272,12 +1232,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/update_backup_state" : { + "/api/v1/customers/{cUUID}/providers/{pUUID}/edit" : { "put" : { - "tags" : [ "Universe Actions" ], - "summary" : "Set backup Flag for a universe", + "tags" : [ "Provider" ], + "summary" : "editProvider", "description" : "", - "operationId" : "setBackupFlag", + "operationId" : "editProvider", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1285,22 +1245,25 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { - "name" : "markActive", - "in" : "query", - "required" : false, - "type" : "boolean" + "in" : "body", + "name" : "EditProviderFormData", + "description" : "edit provider form data", + "required" : true, + "schema" : { + "$ref" : "#/definitions/EditProviderRequest" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "$ref" : "#/definitions/Provider" } } }, @@ -1309,20 +1272,35 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/config_alerts" : { + "/api/v1/customers/{cUUID}/providers/kubernetes" : { "post" : { - "tags" : [ "Universe Actions" ], - "summary" : "Configure Alerts for a universe", - "description" : "", - "operationId" : "configureAlerts", + "tags" : [ "Provider" ], + "operationId" : "createKubernetes", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "uniUUID", + } ], + "responses" : { + "default" : { + "description" : "successful operation" + } + }, + "security" : [ { + "apiKeyAuth" : [ ] + } ] + } + }, + "/api/v1/customers/{cUUID}/providers/suggested_kubernetes_config" : { + "get" : { + "tags" : [ "Provider" ], + "summary" : "getSuggestedKubernetesConfigs", + "description" : " Performs discovery of region, zones, pull secret, storageClass when running inside a Kubernetes cluster. Returns the discovered information as a JSON, which is similar to the one which is passed to the createKubernetes method.", + "operationId" : "getSuggestedKubernetesConfigs", + "parameters" : [ { + "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", @@ -1332,7 +1310,7 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "$ref" : "#/definitions/KubernetesProviderFormData" } } }, @@ -1341,12 +1319,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/toggle_tls" : { - "post" : { - "tags" : [ "Universe Actions" ], - "summary" : "API that toggles TLS state of the universe.", - "description" : "Can enable/disable node to node and client to node encryption. Supports rolling and non-rolling upgrade of the universe.", - "operationId" : "toggleTls", + "/api/v1/customers/{cUUID}/providers/{pUUID}/initialize" : { + "get" : { + "tags" : [ "Provider" ], + "summary" : "refreshPricing", + "description" : "Refresh Provider pricing info", + "operationId" : "initialize", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1354,7 +1332,30 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "pUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + } ], + "responses" : { + "default" : { + "description" : "successful operation" + } + }, + "security" : [ { + "apiKeyAuth" : [ ] + } ] + } + }, + "/api/v1/customers/{cUUID}/universes/import" : { + "post" : { + "tags" : [ "Import" ], + "summary" : "import", + "description" : "", + "operationId" : "importUniverse", + "parameters" : [ { + "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", @@ -1364,7 +1365,7 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/UniverseResp" + "$ref" : "#/definitions/ImportUniverseFormData" } } }, @@ -1373,12 +1374,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/kms" : { - "get" : { - "tags" : [ "Encryption At Rest" ], - "summary" : "Get key ref History", - "description" : "", - "operationId" : "getKeyRefHistory", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/run_query" : { + "post" : { + "tags" : [ "Universe YB Database" ], + "summary" : "Run YSQL query against this universe", + "description" : "Only valid when platform is running in mode is `OSS`", + "operationId" : "runQuery", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1396,22 +1397,21 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "type" : "object" - } + "type" : "object" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, + } + }, + "/api/v1/customers/{cUUID}/universes/{uniUUID}/run_in_shell" : { "post" : { - "tags" : [ "Encryption At Rest" ], - "summary" : "Retrive KMS key", - "description" : "", - "operationId" : "retrieveKey", + "tags" : [ "Universe YB Database" ], + "summary" : "run command in shell", + "description" : "This operation is no longer supported due to security reasons", + "operationId" : "runInShell", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1429,22 +1429,21 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" - } + "$ref" : "#/definitions/Generic error response from Yugawware Platform API" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "delete" : { - "tags" : [ "Encryption At Rest" ], - "summary" : "Remove key ref History", + } + }, + "/api/v1/customers/{cUUID}/universes/{uniUUID}/update_db_credentials" : { + "post" : { + "tags" : [ "Universe YB Database" ], + "summary" : "setDatabaseCredentials", "description" : "", - "operationId" : "removeKeyRefHistory", + "operationId" : "setDatabaseCredentials", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1471,27 +1470,30 @@ } ] } }, - "/api/v1/customers/{cUUID}/kms_configs" : { - "get" : { - "tags" : [ "Encryption At Rest" ], - "summary" : "List KMS config", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/create_db_credentials" : { + "post" : { + "tags" : [ "Universe YB Database" ], + "summary" : "createUserInDB", "description" : "", - "operationId" : "listKMSConfigs", + "operationId" : "createUserInDB", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "type" : "object" - } + "$ref" : "#/definitions/YWSuccess" } } }, @@ -1500,12 +1502,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/kms_configs/{configUUID}" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/masters" : { "get" : { - "tags" : [ "Encryption At Rest" ], - "summary" : "KMS config detail by config UUID", + "tags" : [ "Metamaster" ], + "summary" : "get master address", "description" : "", - "operationId" : "getKMSConfig", + "operationId" : "getMasterAddresses", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1513,7 +1515,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "configUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", @@ -1523,22 +1525,21 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" - } + "type" : "string" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "delete" : { - "tags" : [ "Encryption At Rest" ], - "summary" : "Delete KMS config", + } + }, + "/api/v1/customers/{cUUID}/universes/{uniUUID}/yqlservers" : { + "get" : { + "tags" : [ "Metamaster" ], + "summary" : "get YQL server address", "description" : "", - "operationId" : "deleteKMSConfig", + "operationId" : "getYQLServerAddresses", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1546,7 +1547,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "configUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", @@ -1556,7 +1557,7 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWTask" + "type" : "string" } } }, @@ -1565,12 +1566,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/kms_configs/{kmsProvider}" : { - "post" : { - "tags" : [ "Encryption At Rest" ], - "summary" : "Create KMS config", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/ysqlservers" : { + "get" : { + "tags" : [ "Metamaster" ], + "summary" : "get YSQL server address", "description" : "", - "operationId" : "createKMSConfig", + "operationId" : "getYSQLServerAddresses", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1578,24 +1579,17 @@ "type" : "string", "format" : "uuid" }, { - "name" : "kmsProvider", + "name" : "uniUUID", "in" : "path", "required" : true, - "type" : "string" - }, { - "in" : "body", - "name" : "KMS Config", - "description" : "KMS Config to be created", - "required" : true, - "schema" : { - "type" : "object" - } + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWTask" + "type" : "string" } } }, @@ -1604,12 +1598,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/kms/key_ref" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/redisservers" : { "get" : { - "tags" : [ "Encryption At Rest" ], - "summary" : "Get key ref", + "tags" : [ "Metamaster" ], + "summary" : "get redis server address", "description" : "", - "operationId" : "getCurrentKeyRef", + "operationId" : "getRedisServerAddresses", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1627,10 +1621,7 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" - } + "type" : "string" } } }, @@ -1639,14 +1630,14 @@ } ] } }, - "/api/v1/customers/{cUUID}/alerts" : { + "/metamaster/universe/{universeUUID}" : { "get" : { - "tags" : [ "Alert" ], - "summary" : "listAlerts", + "tags" : [ "Metamaster" ], + "summary" : "get masters list", "description" : "", - "operationId" : "listOfAlerts", + "operationId" : "get", "parameters" : [ { - "name" : "cUUID", + "name" : "universeUUID", "in" : "path", "required" : true, "type" : "string", @@ -1656,10 +1647,7 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Alert" - } + "$ref" : "#/definitions/MastersList" } } }, @@ -1668,12 +1656,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/alerts/acknowledge" : { - "post" : { - "tags" : [ "Alert" ], - "summary" : "acknowledgeAlerts", + "/api/v1/customers/{cUUID}/schedules/{sUUID}" : { + "delete" : { + "tags" : [ "Schedule" ], + "summary" : "delete", "description" : "", - "operationId" : "acknowledge", + "operationId" : "deleteSchedule", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1681,21 +1669,17 @@ "type" : "string", "format" : "uuid" }, { - "in" : "body", - "name" : "AcknowledgeAlertsRequest", + "name" : "sUUID", + "in" : "path", "required" : true, - "schema" : { - "$ref" : "#/definitions/AlertApiFilter" - } + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Alert" - } + "$ref" : "#/definitions/YWResults" } } }, @@ -1704,12 +1688,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/alerts/active" : { + "/api/v1/customers/{cUUID}/schedules" : { "get" : { - "tags" : [ "Alert" ], - "summary" : "listActiveAlerts", + "tags" : [ "Schedule" ], + "summary" : "list", "description" : "", - "operationId" : "listActive", + "operationId" : "listOfSchedule", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1723,7 +1707,7 @@ "schema" : { "type" : "array", "items" : { - "$ref" : "#/definitions/Alert" + "$ref" : "#/definitions/Schedule" } } } @@ -1733,12 +1717,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/alerts/page" : { - "post" : { - "tags" : [ "Alert" ], - "summary" : "pageAlerts", - "description" : "", - "operationId" : "pageAlerts", + "/api/v1/customers/{cUUID}/providers/{pUUID}/regions/{rUUID}/zones/{azUUID}" : { + "delete" : { + "tags" : [ "AvailabilityZone" ], + "summary" : "deleteAZ", + "description" : "", + "operationId" : "deleteAZ", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1746,18 +1730,29 @@ "type" : "string", "format" : "uuid" }, { - "in" : "body", - "name" : "PageAlertsRequest", + "name" : "pUUID", + "in" : "path", "required" : true, - "schema" : { - "$ref" : "#/definitions/AlertPagedApiQuery" - } + "type" : "string", + "format" : "uuid" + }, { + "name" : "rUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "azUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AlertPagedResponse" + "$ref" : "#/definitions/YWSuccess" } } }, @@ -1766,12 +1761,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/alert_definition_templates" : { - "post" : { - "tags" : [ "Alert" ], - "summary" : "listDefinitionGroupTemplates", + "/api/v1/customers/{cUUID}/providers/{pUUID}/regions/{rUUID}/zones" : { + "get" : { + "tags" : [ "AvailabilityZone" ], + "summary" : "listAZ", "description" : "", - "operationId" : "listDefinitionGroupTemplates", + "operationId" : "listOfAZ", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1779,12 +1774,17 @@ "type" : "string", "format" : "uuid" }, { - "in" : "body", - "name" : "ListTemplatesRequest", + "name" : "pUUID", + "in" : "path", "required" : true, - "schema" : { - "$ref" : "#/definitions/AlertDefinitionTemplateApiFilter" - } + "type" : "string", + "format" : "uuid" + }, { + "name" : "rUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { @@ -1792,7 +1792,7 @@ "schema" : { "type" : "array", "items" : { - "$ref" : "#/definitions/AlertDefinitionGroup" + "$ref" : "#/definitions/AvailabilityZone" } } } @@ -1800,14 +1800,12 @@ "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/alert_definition_groups/{groupUUID}" : { - "get" : { - "tags" : [ "Alert" ], - "summary" : "getDefinitionGroup", + }, + "post" : { + "tags" : [ "AvailabilityZone" ], + "summary" : "createAZ", "description" : "", - "operationId" : "getDefinitionGroup", + "operationId" : "createAZ", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1815,29 +1813,48 @@ "type" : "string", "format" : "uuid" }, { - "name" : "groupUUID", + "name" : "pUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "rUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "in" : "body", + "name" : "azFormData", + "description" : "az form data", + "required" : true, + "schema" : { + "$ref" : "#/definitions/AvailabilityZoneFormData" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AlertDefinitionGroup" + "type" : "object", + "additionalProperties" : { + "$ref" : "#/definitions/AvailabilityZone" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "put" : { - "tags" : [ "Alert" ], - "summary" : "updateDefinitionGroup", + } + }, + "/api/v1/customers/{cUUID}/universes/{uniUUID}/tables/{tableUUID}" : { + "get" : { + "tags" : [ "Tables" ], + "summary" : "Describe table", "description" : "", - "operationId" : "updateDefinitionGroup", + "operationId" : "describe", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1845,24 +1862,23 @@ "type" : "string", "format" : "uuid" }, { - "name" : "groupUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { - "in" : "body", - "name" : "UpdateGroupRequest", + "name" : "tableUUID", + "in" : "path", "required" : true, - "schema" : { - "$ref" : "#/definitions/AlertDefinitionGroup" - } + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AlertDefinitionGroup" + "$ref" : "#/definitions/Universe task" } } }, @@ -1870,11 +1886,11 @@ "apiKeyAuth" : [ ] } ] }, - "delete" : { - "tags" : [ "Alert" ], - "summary" : "deleteDefinitionGroup", + "put" : { + "tags" : [ "Tables" ], + "summary" : "Alter table in Yugabyte DB", "description" : "", - "operationId" : "deleteDefinitionGroup", + "operationId" : "alter", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1882,7 +1898,13 @@ "type" : "string", "format" : "uuid" }, { - "name" : "groupUUID", + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "tableUUID", "in" : "path", "required" : true, "type" : "string", @@ -1892,21 +1914,22 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "type" : "object", + "additionalProperties" : { + "type" : "object" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/alert_definition_groups/page" : { - "post" : { - "tags" : [ "Alert" ], - "summary" : "pageDefinitionGroups", + }, + "delete" : { + "tags" : [ "Tables" ], + "summary" : "Drop table in Yugabyte DB", "description" : "", - "operationId" : "pageDefinitionGroups", + "operationId" : "drop", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -1914,18 +1937,23 @@ "type" : "string", "format" : "uuid" }, { - "in" : "body", - "name" : "PageDefinitionGroupsRequest", + "name" : "uniUUID", + "in" : "path", "required" : true, - "schema" : { - "$ref" : "#/definitions/AlertDefinitionGroupPagedApiQuery" - } + "type" : "string", + "format" : "uuid" + }, { + "name" : "tableUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AlertDefinitionGroupPagedResponse" + "$ref" : "#/definitions/YWTask" } } }, @@ -1934,34 +1962,44 @@ } ] } }, - "/api/v1/customers/{cUUID}/alert_definition_groups/list" : { - "post" : { - "tags" : [ "Alert" ], - "summary" : "listDefinitionGroups", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/tables/{tableUUID}/bulk_import" : { + "put" : { + "tags" : [ "Tables" ], + "summary" : "Bulk import table", "description" : "", - "operationId" : "listDefinitionGroups", + "operationId" : "bulkImport", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "tableUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" }, { "in" : "body", - "name" : "ListGroupsRequest", + "name" : "Bulk import", + "description" : "Bulk data to be Imported", "required" : true, "schema" : { - "$ref" : "#/definitions/AlertDefinitionGroupApiFilter" + "$ref" : "#/definitions/Bulk import params" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/AlertDefinitionGroup" - } + "$ref" : "#/definitions/YWTask" } } }, @@ -1970,31 +2008,44 @@ } ] } }, - "/api/v1/customers/{cUUID}/alert_definition_groups" : { - "post" : { - "tags" : [ "Alert" ], - "summary" : "createDefinitionGroup", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/tables/{tableUUID}/create_backup" : { + "put" : { + "tags" : [ "Tables" ], + "summary" : "Create table backup", "description" : "", - "operationId" : "createDefinitionGroup", + "operationId" : "createBackup", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "tableUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" }, { "in" : "body", - "name" : "CreateGroupRequest", + "name" : "Backup", + "description" : "Backup data to be created", "required" : true, "schema" : { - "$ref" : "#/definitions/AlertDefinitionGroup" + "$ref" : "#/definitions/Backup table params" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AlertDefinitionGroup" + "$ref" : "#/definitions/YWTask" } } }, @@ -2003,18 +2054,24 @@ } ] } }, - "/api/v1/customers/{cUUID}/alert_receivers" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/tables" : { "get" : { - "tags" : [ "Alert" ], - "summary" : "listAlertReceivers", + "tags" : [ "Tables" ], + "summary" : "List of tables", "description" : "", - "operationId" : "listAlertReceivers", + "operationId" : "listTables", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { @@ -2022,7 +2079,7 @@ "schema" : { "type" : "array", "items" : { - "$ref" : "#/definitions/AlertReceiver" + "$ref" : "#/definitions/TableInfo" } } } @@ -2032,29 +2089,36 @@ } ] }, "post" : { - "tags" : [ "Alert" ], - "summary" : "createAlertReceiver", + "tags" : [ "Tables" ], + "summary" : "Create table in Yugabyte DB", "description" : "", - "operationId" : "createAlertReceiver", + "operationId" : "createTable", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" }, { "in" : "body", - "name" : "CreateAlertReceiverRequest", + "name" : "Table", + "description" : "Table Definition to be created", "required" : true, "schema" : { - "$ref" : "#/definitions/AlertReceiverFormData" + "$ref" : "#/definitions/Universe task" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AlertReceiver" + "$ref" : "#/definitions/YWTask" } } }, @@ -2063,12 +2127,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/alert_receivers/{arcUUID}" : { - "get" : { - "tags" : [ "Alert" ], - "summary" : "getAlertReceiver", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/multi_table_backup" : { + "put" : { + "tags" : [ "Tables" ], + "summary" : "Create multiple table backup", "description" : "", - "operationId" : "getAlertReceiver", + "operationId" : "createMultiTableBackup", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2076,84 +2140,114 @@ "type" : "string", "format" : "uuid" }, { - "name" : "arcUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "in" : "body", + "name" : "Table backup", + "description" : "Table backup data to be created", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Multi table backup request params" + } } ], + "responses" : { + "200" : { + "description" : "If requested schedule backup.", + "schema" : { + "$ref" : "#/definitions/Schedule" + } + } + }, + "security" : [ { + "apiKeyAuth" : [ ] + } ] + } + }, + "/api/v1/metadata/yql_data_types" : { + "get" : { + "tags" : [ "Tables" ], + "summary" : "Get columns Types", + "description" : "", + "operationId" : "getYQLDataTypes", + "parameters" : [ ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AlertReceiver" + "type" : "array", + "items" : { + "type" : "string", + "enum" : [ "TINYINT", "SMALLINT", "INT", "BIGINT", "VARCHAR", "BOOLEAN", "FLOAT", "DOUBLE_PRECISION", "BLOB", "TIMESTAMP", "DECIMAL", "VARINT", "INET", "LIST", "MAP", "SET", "UUID", "TIMEUUID", "FROZEN", "DATE", "TIME", "JSONB", "USER_DEFINED_TYPE" ] + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "put" : { + } + }, + "/api/v1/customers/{cUUID}/alerts/acknowledge" : { + "post" : { "tags" : [ "Alert" ], - "summary" : "updateAlertReceiver", + "summary" : "acknowledgeAlerts", "description" : "", - "operationId" : "updateAlertReceiver", + "operationId" : "acknowledge", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "arcUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" }, { "in" : "body", - "name" : "UpdateAlertReceiverRequest", + "name" : "AcknowledgeAlertsRequest", "required" : true, "schema" : { - "$ref" : "#/definitions/AlertReceiverFormData" + "$ref" : "#/definitions/AlertApiFilter" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AlertReceiver" + "type" : "array", + "items" : { + "$ref" : "#/definitions/Alert" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "delete" : { + } + }, + "/api/v1/customers/{cUUID}/alerts/active" : { + "get" : { "tags" : [ "Alert" ], - "summary" : "deleteAlertReceiver", + "summary" : "listActiveAlerts", "description" : "", - "operationId" : "deleteAlertReceiver", + "operationId" : "listActive", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "arcUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "type" : "array", + "items" : { + "$ref" : "#/definitions/Alert" + } } } }, @@ -2162,39 +2256,45 @@ } ] } }, - "/api/v1/customers/{cUUID}/alert_routes" : { - "get" : { + "/api/v1/customers/{cUUID}/alerts/page" : { + "post" : { "tags" : [ "Alert" ], - "summary" : "listAlertRoutes", + "summary" : "pageAlerts", "description" : "", - "operationId" : "listAlertRoutes", + "operationId" : "pageAlerts", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "in" : "body", + "name" : "PageAlertsRequest", + "required" : true, + "schema" : { + "$ref" : "#/definitions/AlertPagedApiQuery" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/AlertRoute" - } + "$ref" : "#/definitions/AlertPagedResponse" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, + } + }, + "/api/v1/customers/{cUUID}/alert_definition_templates" : { "post" : { "tags" : [ "Alert" ], - "summary" : "createAlertRoute", + "summary" : "listDefinitionGroupTemplates", "description" : "", - "operationId" : "createAlertRoute", + "operationId" : "listDefinitionGroupTemplates", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2203,17 +2303,20 @@ "format" : "uuid" }, { "in" : "body", - "name" : "CreateAlertRouteRequest", + "name" : "ListTemplatesRequest", "required" : true, "schema" : { - "$ref" : "#/definitions/AlertRouteFormData" + "$ref" : "#/definitions/AlertDefinitionTemplateApiFilter" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AlertRoute" + "type" : "array", + "items" : { + "$ref" : "#/definitions/AlertDefinitionGroup" + } } } }, @@ -2222,12 +2325,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/alert_routes/{artUUID}" : { + "/api/v1/customers/{cUUID}/alert_definition_groups/{groupUUID}" : { "get" : { "tags" : [ "Alert" ], - "summary" : "getAlertRoute", + "summary" : "getDefinitionGroup", "description" : "", - "operationId" : "getAlertRoute", + "operationId" : "getDefinitionGroup", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2235,7 +2338,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "artUUID", + "name" : "groupUUID", "in" : "path", "required" : true, "type" : "string", @@ -2245,7 +2348,7 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AlertRoute" + "$ref" : "#/definitions/AlertDefinitionGroup" } } }, @@ -2255,9 +2358,9 @@ }, "put" : { "tags" : [ "Alert" ], - "summary" : "updateAlertRoute", + "summary" : "updateDefinitionGroup", "description" : "", - "operationId" : "updateAlertRoute", + "operationId" : "updateDefinitionGroup", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2265,24 +2368,24 @@ "type" : "string", "format" : "uuid" }, { - "name" : "artUUID", + "name" : "groupUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { "in" : "body", - "name" : "UpdateAlertRouteRequest", + "name" : "UpdateGroupRequest", "required" : true, "schema" : { - "$ref" : "#/definitions/AlertRouteFormData" + "$ref" : "#/definitions/AlertDefinitionGroup" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AlertRoute" + "$ref" : "#/definitions/AlertDefinitionGroup" } } }, @@ -2292,9 +2395,9 @@ }, "delete" : { "tags" : [ "Alert" ], - "summary" : "deleteAlertRoute", + "summary" : "deleteDefinitionGroup", "description" : "", - "operationId" : "deleteAlertRoute", + "operationId" : "deleteDefinitionGroup", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2302,7 +2405,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "artUUID", + "name" : "groupUUID", "in" : "path", "required" : true, "type" : "string", @@ -2321,12 +2424,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/users/{uUUID}/audit_trail" : { - "get" : { - "tags" : [ "Audit" ], - "summary" : "list", + "/api/v1/customers/{cUUID}/alert_definition_groups/page" : { + "post" : { + "tags" : [ "Alert" ], + "summary" : "pageDefinitionGroups", "description" : "", - "operationId" : "ListOfAudit", + "operationId" : "pageDefinitionGroups", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2334,20 +2437,18 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uUUID", - "in" : "path", + "in" : "body", + "name" : "PageDefinitionGroupsRequest", "required" : true, - "type" : "string", - "format" : "uuid" + "schema" : { + "$ref" : "#/definitions/AlertDefinitionGroupPagedApiQuery" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Audit" - } + "$ref" : "#/definitions/AlertDefinitionGroupPagedResponse" } } }, @@ -2356,12 +2457,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/tasks/{tUUID}/audit_info" : { - "get" : { - "tags" : [ "Audit" ], - "summary" : "get", + "/api/v1/customers/{cUUID}/alert_definition_groups/list" : { + "post" : { + "tags" : [ "Alert" ], + "summary" : "listDefinitionGroups", "description" : "", - "operationId" : "getTaskAudit", + "operationId" : "listDefinitionGroups", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2369,17 +2470,21 @@ "type" : "string", "format" : "uuid" }, { - "name" : "tUUID", - "in" : "path", + "in" : "body", + "name" : "ListGroupsRequest", "required" : true, - "type" : "string", - "format" : "uuid" + "schema" : { + "$ref" : "#/definitions/AlertDefinitionGroupApiFilter" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Audit" + "type" : "array", + "items" : { + "$ref" : "#/definitions/AlertDefinitionGroup" + } } } }, @@ -2388,12 +2493,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/tasks/{tUUID}/audit_user" : { - "get" : { - "tags" : [ "Audit" ], - "summary" : "get user from task", + "/api/v1/customers/{cUUID}/alert_definition_groups" : { + "post" : { + "tags" : [ "Alert" ], + "summary" : "createDefinitionGroup", "description" : "", - "operationId" : "getUserFromTask", + "operationId" : "createDefinitionGroup", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2401,17 +2506,18 @@ "type" : "string", "format" : "uuid" }, { - "name" : "tUUID", - "in" : "path", + "in" : "body", + "name" : "CreateGroupRequest", "required" : true, - "type" : "string", - "format" : "uuid" + "schema" : { + "$ref" : "#/definitions/AlertDefinitionGroup" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Audit" + "$ref" : "#/definitions/AlertDefinitionGroup" } } }, @@ -2420,35 +2526,27 @@ } ] } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/access_keys/{keyCode}" : { + "/api/v1/customers/{cUUID}/alert_receivers" : { "get" : { - "tags" : [ "AccessKey" ], - "summary" : "get access Key", + "tags" : [ "Alert" ], + "summary" : "listAlertReceivers", "description" : "", - "operationId" : "index", + "operationId" : "listAlertReceivers", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "pUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "keyCode", - "in" : "path", - "required" : true, - "type" : "string" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AccessKey" + "type" : "array", + "items" : { + "$ref" : "#/definitions/AlertReceiver" + } } } }, @@ -2456,11 +2554,11 @@ "apiKeyAuth" : [ ] } ] }, - "delete" : { - "tags" : [ "AccessKey" ], - "summary" : "delete access Key", + "post" : { + "tags" : [ "Alert" ], + "summary" : "createAlertReceiver", "description" : "", - "operationId" : "delete", + "operationId" : "createAlertReceiver", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2468,22 +2566,18 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "keyCode", - "in" : "path", + "in" : "body", + "name" : "CreateAlertReceiverRequest", "required" : true, - "type" : "string" + "schema" : { + "$ref" : "#/definitions/AlertReceiverFormData" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "$ref" : "#/definitions/AlertReceiver" } } }, @@ -2492,12 +2586,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/access_keys" : { + "/api/v1/customers/{cUUID}/alert_receivers/{arcUUID}" : { "get" : { - "tags" : [ "AccessKey" ], - "summary" : "list AccessKeys for a specific provider", + "tags" : [ "Alert" ], + "summary" : "getAlertReceiver", "description" : "", - "operationId" : "list", + "operationId" : "getAlertReceiver", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2505,7 +2599,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", + "name" : "arcUUID", "in" : "path", "required" : true, "type" : "string", @@ -2515,7 +2609,7 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AccessKey" + "$ref" : "#/definitions/AlertReceiver" } } }, @@ -2523,11 +2617,11 @@ "apiKeyAuth" : [ ] } ] }, - "post" : { - "tags" : [ "AccessKey" ], - "summary" : "create access Key", + "put" : { + "tags" : [ "Alert" ], + "summary" : "updateAlertReceiver", "description" : "", - "operationId" : "create", + "operationId" : "updateAlertReceiver", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2535,33 +2629,44 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", + "name" : "arcUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "in" : "body", + "name" : "UpdateAlertReceiverRequest", + "required" : true, + "schema" : { + "$ref" : "#/definitions/AlertReceiverFormData" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/AccessKey" + "$ref" : "#/definitions/AlertReceiver" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/metamaster/universe/{universeUUID}" : { - "get" : { - "tags" : [ "Metamaster" ], - "summary" : "get masters list", + }, + "delete" : { + "tags" : [ "Alert" ], + "summary" : "deleteAlertReceiver", "description" : "", - "operationId" : "get", + "operationId" : "deleteAlertReceiver", "parameters" : [ { - "name" : "universeUUID", + "name" : "cUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "arcUUID", "in" : "path", "required" : true, "type" : "string", @@ -2571,7 +2676,7 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/MastersList" + "$ref" : "#/definitions/YWSuccess" } } }, @@ -2580,44 +2685,39 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/masters" : { + "/api/v1/customers/{cUUID}/alert_routes" : { "get" : { - "tags" : [ "Metamaster" ], - "summary" : "get master address", + "tags" : [ "Alert" ], + "summary" : "listAlertRoutes", "description" : "", - "operationId" : "getMasterAddresses", + "operationId" : "listAlertRoutes", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "string" + "type" : "array", + "items" : { + "$ref" : "#/definitions/AlertRoute" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/yqlservers" : { - "get" : { - "tags" : [ "Metamaster" ], - "summary" : "get YQL server address", + }, + "post" : { + "tags" : [ "Alert" ], + "summary" : "createAlertRoute", "description" : "", - "operationId" : "getYQLServerAddresses", + "operationId" : "createAlertRoute", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2625,17 +2725,18 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", - "in" : "path", + "in" : "body", + "name" : "CreateAlertRouteRequest", "required" : true, - "type" : "string", - "format" : "uuid" + "schema" : { + "$ref" : "#/definitions/AlertRouteFormData" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "string" + "$ref" : "#/definitions/AlertRoute" } } }, @@ -2644,12 +2745,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/ysqlservers" : { + "/api/v1/customers/{cUUID}/alert_routes/{artUUID}" : { "get" : { - "tags" : [ "Metamaster" ], - "summary" : "get YSQL server address", + "tags" : [ "Alert" ], + "summary" : "getAlertRoute", "description" : "", - "operationId" : "getYSQLServerAddresses", + "operationId" : "getAlertRoute", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2657,7 +2758,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "artUUID", "in" : "path", "required" : true, "type" : "string", @@ -2667,21 +2768,19 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "string" + "$ref" : "#/definitions/AlertRoute" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/redisservers" : { - "get" : { - "tags" : [ "Metamaster" ], - "summary" : "get redis server address", + }, + "put" : { + "tags" : [ "Alert" ], + "summary" : "updateAlertRoute", "description" : "", - "operationId" : "getRedisServerAddresses", + "operationId" : "updateAlertRoute", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2689,43 +2788,54 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "artUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "in" : "body", + "name" : "UpdateAlertRouteRequest", + "required" : true, + "schema" : { + "$ref" : "#/definitions/AlertRouteFormData" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "string" + "$ref" : "#/definitions/AlertRoute" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/backups" : { + }, "delete" : { - "tags" : [ "Backups" ], - "summary" : "delete", + "tags" : [ "Alert" ], + "summary" : "deleteAlertRoute", "description" : "", - "operationId" : "deleteBackups", + "operationId" : "deleteAlertRoute", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "artUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWTask" + "$ref" : "#/definitions/YWSuccess" } } }, @@ -2734,24 +2844,18 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/backups" : { + "/api/v1/customers/{cUUID}/alerts" : { "get" : { - "tags" : [ "Backups" ], - "summary" : "list Backups for a specific customer", + "tags" : [ "Alert" ], + "summary" : "listAlerts", "description" : "", - "operationId" : "ListOfBackups", + "operationId" : "listOfAlerts", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" } ], "responses" : { "200" : { @@ -2759,15 +2863,9 @@ "schema" : { "type" : "array", "items" : { - "$ref" : "#/definitions/Backup" + "$ref" : "#/definitions/Alert" } } - }, - "500" : { - "description" : "If there was a server or database issue when listing the backups", - "schema" : { - "$ref" : "#/definitions/Generic error response from Yugawware Platform API" - } } }, "security" : [ { @@ -2775,12 +2873,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/backups/restore" : { - "post" : { - "tags" : [ "Backups" ], - "summary" : "restore Backups", + "/api/v1/customers/{cUUID}/configs/{configUUID}" : { + "put" : { + "tags" : [ "Customer Config" ], + "summary" : "List of customer configuration", "description" : "", - "operationId" : "restore", + "operationId" : "getCustomerConfig", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2788,39 +2886,37 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "configUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { "in" : "body", - "name" : "backup", - "description" : "backup params of the backup to be restored", + "name" : "Config", + "description" : "Configuration data to be updated", "required" : true, "schema" : { - "$ref" : "#/definitions/Backup table params" + "type" : "object" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWTask" + "$ref" : "#/definitions/Customer Config" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/backups/tasks/{tUUID}" : { - "get" : { - "tags" : [ "Backups" ], - "summary" : "list Backups for a specific task", + }, + "delete" : { + "tags" : [ "Customer Config" ], + "summary" : "Delete customer configuration", "description" : "", - "operationId" : "fetchBackupsByTaskUUID", + "operationId" : "deleteCustomerConfig", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -2828,13 +2924,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "tUUID", + "name" : "configUUID", "in" : "path", "required" : true, "type" : "string", @@ -2844,16 +2934,7 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Backup" - } - } - }, - "500" : { - "description" : "If there was a server or database issue when listing the backups", - "schema" : { - "$ref" : "#/definitions/Generic error response from Yugawware Platform API" + "$ref" : "#/definitions/YWSuccess" } } }, @@ -2862,220 +2943,135 @@ } ] } }, - "/api/v1/register" : { - "post" : { - "tags" : [ "Session" ], - "operationId" : "register", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/universes/{uniUUID}/proxy/{proxyUrl}" : { + "/api/v1/customers/{cUUID}/configs" : { "get" : { - "tags" : [ "Session" ], - "operationId" : "proxyRequest", + "tags" : [ "Customer Config" ], + "summary" : "List of customer configuration", + "description" : "", + "operationId" : "getListOfCustomerConfig", "parameters" : [ { - "name" : "uniUUID", + "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "proxyUrl", - "in" : "path", - "required" : true, - "type" : "string" } ], "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/logout" : { - "get" : { - "tags" : [ "Session" ], - "operationId" : "logout", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Customer Config" + } + } } - } - } - }, - "/api/v1/login" : { + }, + "security" : [ { + "apiKeyAuth" : [ ] + } ] + }, "post" : { - "tags" : [ "Session" ], - "summary" : "login", + "tags" : [ "Customer Config" ], + "summary" : "Create customer configuration", "description" : "", - "operationId" : "login", + "operationId" : "createCustomerConfig", "parameters" : [ { + "name" : "cUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { "in" : "body", - "name" : "loginFormData", - "description" : "login form data", + "name" : "Config", + "description" : "Configuration data to be created", "required" : true, "schema" : { - "$ref" : "#/definitions/CustomerLoginFormData" + "type" : "object" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object" - } - } - } - } - }, - "/api/v1/insecure_login" : { - "get" : { - "tags" : [ "Session" ], - "summary" : "insecureLogin", - "description" : "", - "operationId" : "insecure_login", - "parameters" : [ ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "type" : "object" + "$ref" : "#/definitions/Customer Config" } } - } - } - }, - "/api/v1/platform_config" : { - "get" : { - "tags" : [ "Session" ], - "operationId" : "getPlatformConfig", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } + }, + "security" : [ { + "apiKeyAuth" : [ ] + } ] } }, - "/api/v1/third_party_login" : { + "/api/v1/customers/{cUUID}/runtime_config/{scope}" : { "get" : { - "tags" : [ "Session" ], - "operationId" : "thirdPartyLogin", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/customers/{cUUID}/security" : { - "put" : { - "tags" : [ "Session" ], - "operationId" : "set_security", + "tags" : [ "RuntimeConfig" ], + "summary" : "list config entries for a scope", + "description" : "Lists all runtime config entries for a given scopes for current customer.", + "operationId" : "getConfig", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - } ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/customers/{cUUID}/api_token" : { - "put" : { - "tags" : [ "Session" ], - "summary" : "apiToken", - "description" : "", - "operationId" : "api_token", - "parameters" : [ { - "name" : "cUUID", + }, { + "name" : "scope", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "includeInherited", + "in" : "query", + "required" : false, + "type" : "boolean", + "default" : false } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/Runtime config data" } } - } - } - }, - "/api/v1/customer_count" : { - "get" : { - "tags" : [ "Session" ], - "operationId" : "customerCount", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } + }, + "security" : [ { + "apiKeyAuth" : [ ] + } ] } }, - "/api/v1/app_version" : { + "/api/v1/runtime_config/mutable_keys" : { "get" : { - "tags" : [ "Session" ], - "operationId" : "appVersion", + "tags" : [ "RuntimeConfig" ], + "summary" : "list Mutable keys", + "description" : "List all the mutable runtime config keys", + "operationId" : "listKeys", "parameters" : [ ], "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/logs/{maxLines}" : { - "get" : { - "tags" : [ "Session" ], - "operationId" : "getLogs", - "parameters" : [ { - "name" : "maxLines", - "in" : "path", - "required" : true, - "type" : "integer", - "format" : "int32" - } ], - "responses" : { - "default" : { - "description" : "successful operation" + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "type" : "string" + } + } } - } + }, + "security" : [ { + "apiKeyAuth" : [ ] + } ] } }, - "/api/v1/ui_theme" : { + "/api/v1/customers/{cUUID}/runtime_config/{scope}/key/{key}" : { "get" : { - "tags" : [ "Session" ], - "operationId" : "getUITheme", - "parameters" : [ ], - "responses" : { - "default" : { - "description" : "successful operation" - } - } - } - }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/regions/{rUUID}" : { - "delete" : { - "tags" : [ "Region" ], - "summary" : "delete", + "tags" : [ "RuntimeConfig" ], + "summary" : "getKey", "description" : "", - "operationId" : "deleteRegion", + "operationId" : "getKey", + "produces" : [ "text/plain" ], "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3083,37 +3079,32 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", + "name" : "scope", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { - "name" : "rUUID", + "name" : "key", "in" : "path", "required" : true, - "type" : "string", - "format" : "uuid" + "type" : "string" } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "type" : "object" - } + "default" : { + "description" : "successful operation" } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/regions" : { - "get" : { - "tags" : [ "Region" ], - "summary" : "list Regions for a specific provider", + }, + "put" : { + "tags" : [ "RuntimeConfig" ], + "summary" : "setKey", "description" : "", - "operationId" : "getRegion", + "operationId" : "setKey", + "consumes" : [ "text/plain" ], "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3121,38 +3112,39 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", + "name" : "scope", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Region" - } - } - }, - "500" : { - "description" : "If there was a server or database issue when listing the regions", - "schema" : { - "$ref" : "#/definitions/Generic error response from Yugawware Platform API" - } + }, { + "name" : "key", + "in" : "path", + "required" : true, + "type" : "string" + }, { + "in" : "body", + "name" : "newValue", + "description" : "new value for config key", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "default" : { + "description" : "successful operation" } }, "security" : [ { "apiKeyAuth" : [ ] } ] }, - "post" : { - "tags" : [ "Region" ], - "summary" : "create new region", + "delete" : { + "tags" : [ "RuntimeConfig" ], + "summary" : "deleteKey", "description" : "", - "operationId" : "createRegion", + "operationId" : "deleteKey", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3160,26 +3152,20 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", + "name" : "scope", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { - "in" : "body", - "name" : "region", - "description" : "region form data for new region to be created", + "name" : "key", + "in" : "path", "required" : true, - "schema" : { - "$ref" : "#/definitions/RegionFormData" - } + "type" : "string" } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "$ref" : "#/definitions/Region" - } + "default" : { + "description" : "successful operation" } }, "security" : [ { @@ -3187,12 +3173,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/regions" : { + "/api/v1/customers/{cUUID}/runtime_config/scopes" : { "get" : { - "tags" : [ "Region" ], - "summary" : "list all Regions across all providers", - "description" : "", - "operationId" : "listAllRegions", + "tags" : [ "RuntimeConfig" ], + "summary" : "listScopes", + "description" : "Lists all (including empty scopes) runtime config scopes for current customer. List includes the Global scope that spans multiple customers, scope for customer specific overrides for current customer and one scope each for each universe and provider.", + "operationId" : "listScopes", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3204,10 +3190,7 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Region" - } + "$ref" : "#/definitions/Runtime config data" } } }, @@ -3216,12 +3199,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/nodes/{nodeUUID}/list" : { - "get" : { - "tags" : [ "Node Instances" ], - "summary" : "Get node instance by UUID", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/setup_universe_2dc" : { + "put" : { + "tags" : [ "Universe Actions" ], + "summary" : "resetVersion", "description" : "", - "operationId" : "getNodeInstance", + "operationId" : "resetVersion", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3229,7 +3212,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "nodeUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", @@ -3239,7 +3222,7 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/NodeInstance" + "$ref" : "#/definitions/YWSuccess" } } }, @@ -3248,12 +3231,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/zones/{azUUID}/nodes" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/set_key" : { "post" : { - "tags" : [ "Node Instances" ], - "summary" : "Create node instance", + "tags" : [ "Universe Actions" ], + "summary" : "setUniverseKey", "description" : "", - "operationId" : "createNodeInstance", + "operationId" : "setUniverseKey", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3261,28 +3244,17 @@ "type" : "string", "format" : "uuid" }, { - "name" : "azUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "in" : "body", - "name" : "Node instance", - "description" : "Node instance data to be created", - "required" : true, - "schema" : { - "$ref" : "#/definitions/NodeInstanceFormData" - } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "$ref" : "#/definitions/NodeInstance" - } + "$ref" : "#/definitions/UniverseResp" } } }, @@ -3291,12 +3263,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/zones/{azUUID}/nodes/list" : { - "get" : { - "tags" : [ "Node Instances" ], - "summary" : "List of node instances by zone", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/pause" : { + "post" : { + "tags" : [ "Universe Actions" ], + "summary" : "Pause the universe", "description" : "", - "operationId" : "listByZone", + "operationId" : "pause", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3304,7 +3276,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "azUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", @@ -3314,10 +3286,7 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/NodeInstance" - } + "$ref" : "#/definitions/YWTask" } } }, @@ -3326,12 +3295,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/nodes/list" : { - "get" : { - "tags" : [ "Node Instances" ], - "summary" : "List of node instances by provider", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/mark_helm3_compatible" : { + "put" : { + "tags" : [ "Universe Actions" ], + "summary" : "Set the universe as helm3 compatible", "description" : "", - "operationId" : "listByProvider", + "operationId" : "setHelm3Compatible", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3339,7 +3308,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", @@ -3349,10 +3318,7 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/NodeInstance" - } + "$ref" : "#/definitions/YWSuccess" } } }, @@ -3361,12 +3327,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/instances/{instanceIP}" : { - "delete" : { - "tags" : [ "Node Instances" ], - "summary" : "Delete node instance by IP", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/update_backup_state" : { + "put" : { + "tags" : [ "Universe Actions" ], + "summary" : "Set backup Flag for a universe", "description" : "", - "operationId" : "deleteInstance", + "operationId" : "setBackupFlag", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3374,20 +3340,23 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { - "name" : "instanceIP", - "in" : "path", - "required" : true, - "type" : "string" + "name" : "markActive", + "in" : "query", + "required" : false, + "type" : "boolean" } ], "responses" : { - "default" : { - "description" : "successful operation" + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/YWSuccess" + } } }, "security" : [ { @@ -3395,12 +3364,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{universeUUID}/nodes/{nodeName}" : { - "put" : { - "tags" : [ "Node Instances" ], - "summary" : "Update node actions", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/config_alerts" : { + "post" : { + "tags" : [ "Universe Actions" ], + "summary" : "Configure Alerts for a universe", "description" : "", - "operationId" : "nodeAction", + "operationId" : "configureAlerts", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3408,30 +3377,17 @@ "type" : "string", "format" : "uuid" }, { - "name" : "universeUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "nodeName", - "in" : "path", - "required" : true, - "type" : "string" - }, { - "in" : "body", - "name" : "Node action", - "description" : "Node action data to be updated", - "required" : true, - "schema" : { - "$ref" : "#/definitions/NodeActionFormData" - } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWTask" + "$ref" : "#/definitions/YWSuccess" } } }, @@ -3440,12 +3396,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/status" : { - "get" : { - "tags" : [ "UniverseInfo" ], - "summary" : "Status of the Universe", - "description" : "This will return a Map of node name to its status in json format", - "operationId" : "universeStatus", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/toggle_tls" : { + "post" : { + "tags" : [ "Universe Actions" ], + "summary" : "API that toggles TLS state of the universe.", + "description" : "Can enable/disable node to node and client to node encryption. Supports rolling and non-rolling upgrade of the universe.", + "operationId" : "toggleTls", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3463,10 +3419,7 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" - } + "$ref" : "#/definitions/UniverseResp" } } }, @@ -3475,12 +3428,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/health_check" : { - "get" : { - "tags" : [ "UniverseInfo" ], - "summary" : "health Check", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/resume" : { + "post" : { + "tags" : [ "Universe Actions" ], + "summary" : "Resume the universe", "description" : "", - "operationId" : "healthCheck", + "operationId" : "resume", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3498,7 +3451,7 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/YWTask" } } }, @@ -3507,27 +3460,30 @@ } ] } }, - "/api/v1/customers/{cUUID}/cost" : { + "/api/v1/customers/{cUUID}/tasks/{tUUID}/audit_info" : { "get" : { - "tags" : [ "UniverseInfo" ], - "summary" : "list universe cost for all universes", + "tags" : [ "Audit" ], + "summary" : "get", "description" : "", - "operationId" : "universeListCost", + "operationId" : "getTaskAudit", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "tUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/UniverseResource" - } + "$ref" : "#/definitions/Audit" } } }, @@ -3536,12 +3492,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/cost" : { + "/api/v1/customers/{cUUID}/tasks/{tUUID}/audit_user" : { "get" : { - "tags" : [ "UniverseInfo" ], - "summary" : "universeCost", + "tags" : [ "Audit" ], + "summary" : "get user from task", "description" : "", - "operationId" : "universeCost", + "operationId" : "getUserFromTask", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3549,7 +3505,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "tUUID", "in" : "path", "required" : true, "type" : "string", @@ -3559,7 +3515,7 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/UniverseResource" + "$ref" : "#/definitions/Audit" } } }, @@ -3568,12 +3524,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/leader" : { + "/api/v1/customers/{cUUID}/users/{uUUID}/audit_trail" : { "get" : { - "tags" : [ "UniverseInfo" ], - "summary" : "getMasterLeaderIP", + "tags" : [ "Audit" ], + "summary" : "list", "description" : "", - "operationId" : "getMasterLeaderIP", + "operationId" : "ListOfAudit", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3581,7 +3537,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "uUUID", "in" : "path", "required" : true, "type" : "string", @@ -3591,7 +3547,10 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "type" : "array", + "items" : { + "$ref" : "#/definitions/Audit" + } } } }, @@ -3600,12 +3559,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/live_queries" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}" : { "get" : { - "tags" : [ "UniverseInfo" ], - "summary" : "getLiveQueries", + "tags" : [ "Universe" ], + "summary" : "getUniverse", "description" : "", - "operationId" : "getLiveQueries", + "operationId" : "getUniverse", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3623,21 +3582,19 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/UniverseResp" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/slow_queries" : { - "get" : { - "tags" : [ "UniverseInfo" ], - "summary" : "getSlowQueries", + }, + "delete" : { + "tags" : [ "Universe" ], + "summary" : "Destroy the universe", "description" : "", - "operationId" : "getSlowQueries", + "operationId" : "deleteUniverse", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3650,24 +3607,38 @@ "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "isForceDelete", + "in" : "query", + "required" : false, + "type" : "boolean", + "default" : false + }, { + "name" : "isDeleteBackups", + "in" : "query", + "required" : false, + "type" : "boolean", + "default" : false } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/YWTask" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "delete" : { - "tags" : [ "UniverseInfo" ], - "summary" : "resetSlowQueries", + } + }, + "/api/v1/customers/{cUUID}/universes" : { + "get" : { + "tags" : [ "Universe" ], + "summary" : "List Universes", "description" : "", - "operationId" : "resetSlowQueries", + "operationId" : "getListOfUniverses", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3675,17 +3646,20 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, + "name" : "name", + "in" : "query", + "required" : false, "type" : "string", - "format" : "uuid" + "default" : "null" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "type" : "array", + "items" : { + "$ref" : "#/definitions/UniverseResp" + } } } }, @@ -3694,13 +3668,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/{nodeName}/download_logs" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/tablet-servers" : { "get" : { - "tags" : [ "UniverseInfo" ], - "summary" : "download Node logs", + "tags" : [ "Tablet Server" ], + "summary" : "List of tablet server", "description" : "", - "operationId" : "downloadNodeLogs", - "produces" : [ "application/x-compressed" ], + "operationId" : "listTabletServers", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3713,15 +3686,16 @@ "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "nodeName", - "in" : "path", - "required" : true, - "type" : "string" } ], "responses" : { - "default" : { - "description" : "successful operation" + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "object", + "additionalProperties" : { + "type" : "object" + } + } } }, "security" : [ { @@ -3729,12 +3703,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/tables" : { + "/api/v1/customers/{cUUID}/providers/{pUUID}/access_keys/{keyCode}" : { "get" : { - "tags" : [ "Tables" ], - "summary" : "List of tables", + "tags" : [ "AccessKey" ], + "summary" : "get access Key", "description" : "", - "operationId" : "listTables", + "operationId" : "index", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3742,20 +3716,22 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "keyCode", + "in" : "path", + "required" : true, + "type" : "string" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/TableInfo" - } + "$ref" : "#/definitions/AccessKey" } } }, @@ -3763,11 +3739,11 @@ "apiKeyAuth" : [ ] } ] }, - "post" : { - "tags" : [ "Tables" ], - "summary" : "Create table in Yugabyte DB", + "delete" : { + "tags" : [ "AccessKey" ], + "summary" : "delete access Key", "description" : "", - "operationId" : "createTable", + "operationId" : "delete", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3775,25 +3751,22 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { - "in" : "body", - "name" : "Table", - "description" : "Table Definition to be created", + "name" : "keyCode", + "in" : "path", "required" : true, - "schema" : { - "$ref" : "#/definitions/Universe task" - } + "type" : "string" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWTask" + "$ref" : "#/definitions/YWSuccess" } } }, @@ -3802,12 +3775,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/tables/{tableUUID}" : { + "/api/v1/customers/{cUUID}/providers/{pUUID}/access_keys" : { "get" : { - "tags" : [ "Tables" ], - "summary" : "Describe table", + "tags" : [ "AccessKey" ], + "summary" : "list AccessKeys for a specific provider", "description" : "", - "operationId" : "describe", + "operationId" : "list", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3815,13 +3788,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "tableUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", @@ -3831,7 +3798,7 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Universe task" + "$ref" : "#/definitions/AccessKey" } } }, @@ -3839,11 +3806,11 @@ "apiKeyAuth" : [ ] } ] }, - "put" : { - "tags" : [ "Tables" ], - "summary" : "Alter table in Yugabyte DB", + "post" : { + "tags" : [ "AccessKey" ], + "summary" : "create access Key", "description" : "", - "operationId" : "alter", + "operationId" : "create", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3851,13 +3818,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "tableUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", @@ -3867,22 +3828,21 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" - } + "$ref" : "#/definitions/AccessKey" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "delete" : { - "tags" : [ "Tables" ], - "summary" : "Drop table in Yugabyte DB", + } + }, + "/api/v1/customers/{cUUID}/releases" : { + "get" : { + "tags" : [ "Release" ], + "summary" : "Get list of releases", "description" : "", - "operationId" : "drop", + "operationId" : "getReleases", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -3890,115 +3850,76 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "tableUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" + "name" : "includeMetadata", + "in" : "query", + "required" : false, + "type" : "boolean", + "default" : false } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWTask" + "type" : "object", + "additionalProperties" : { + "type" : "object" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/tables/{tableUUID}/bulk_import" : { - "put" : { - "tags" : [ "Tables" ], - "summary" : "Bulk import table", + }, + "post" : { + "tags" : [ "Release" ], + "summary" : "Create release", "description" : "", - "operationId" : "bulkImport", + "operationId" : "createRelease", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "tableUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" }, { "in" : "body", - "name" : "Bulk import", - "description" : "Bulk data to be Imported", + "name" : "Release", + "description" : "Release data to be created", "required" : true, "schema" : { - "$ref" : "#/definitions/Bulk import params" + "$ref" : "#/definitions/ReleaseFormData" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWTask" + "$ref" : "#/definitions/YWSuccess" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/tables/{tableUUID}/create_backup" : { + }, "put" : { - "tags" : [ "Tables" ], - "summary" : "Create table backup", + "tags" : [ "Release" ], + "summary" : "Refresh release", "description" : "", - "operationId" : "createBackup", + "operationId" : "refresh", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "tableUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "in" : "body", - "name" : "Backup", - "description" : "Backup data to be created", - "required" : true, - "schema" : { - "$ref" : "#/definitions/Backup table params" - } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWTask" + "$ref" : "#/definitions/YWSuccess" } } }, @@ -4007,12 +3928,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/multi_table_backup" : { + "/api/v1/customers/{cUUID}/releases/{name}" : { "put" : { - "tags" : [ "Tables" ], - "summary" : "Create multiple table backup", + "tags" : [ "Release" ], + "summary" : "Update release", "description" : "", - "operationId" : "createMultiTableBackup", + "operationId" : "updateRelease", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4020,25 +3941,24 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "name", "in" : "path", "required" : true, - "type" : "string", - "format" : "uuid" + "type" : "string" }, { "in" : "body", - "name" : "Table backup", - "description" : "Table backup data to be created", + "name" : "Release", + "description" : "Release data to be updated", "required" : true, "schema" : { - "$ref" : "#/definitions/Multi table backup request params" + "type" : "object" } } ], "responses" : { "200" : { - "description" : "If requested schedule backup.", + "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Schedule" + "$ref" : "#/definitions/Release data" } } }, @@ -4047,21 +3967,26 @@ } ] } }, - "/api/v1/metadata/yql_data_types" : { + "/api/v1/customers/{cUUID}/regions" : { "get" : { - "tags" : [ "Tables" ], - "summary" : "Get columns Types", + "tags" : [ "Region" ], + "summary" : "list all Regions across all providers", "description" : "", - "operationId" : "getYQLDataTypes", - "parameters" : [ ], + "operationId" : "listAllRegions", + "parameters" : [ { + "name" : "cUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { "type" : "array", "items" : { - "type" : "string", - "enum" : [ "TINYINT", "SMALLINT", "INT", "BIGINT", "VARCHAR", "BOOLEAN", "FLOAT", "DOUBLE_PRECISION", "BLOB", "TIMESTAMP", "DECIMAL", "VARINT", "INET", "LIST", "MAP", "SET", "UUID", "TIMEUUID", "FROZEN", "DATE", "TIME", "JSONB", "USER_DEFINED_TYPE" ] + "$ref" : "#/definitions/Region" } } } @@ -4071,18 +3996,36 @@ } ] } }, - "/api/v1/prometheus_metrics" : { - "get" : { - "tags" : [ "Metrics" ], - "summary" : "index", + "/api/v1/customers/{cUUID}/providers/{pUUID}/regions/{rUUID}" : { + "delete" : { + "tags" : [ "Region" ], + "summary" : "delete", "description" : "", - "operationId" : "MetricsDetail", - "parameters" : [ ], + "operationId" : "deleteRegion", + "parameters" : [ { + "name" : "cUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "pUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "rUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "string" + "type" : "object" } } }, @@ -4091,12 +4034,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/tablet-servers" : { + "/api/v1/customers/{cUUID}/providers/{pUUID}/regions" : { "get" : { - "tags" : [ "Tablet Server" ], - "summary" : "List of tablet server", + "tags" : [ "Region" ], + "summary" : "list Regions for a specific provider", "description" : "", - "operationId" : "listTabletServers", + "operationId" : "getRegion", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4104,7 +4047,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", @@ -4114,24 +4057,28 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" + "type" : "array", + "items" : { + "$ref" : "#/definitions/Region" } } + }, + "500" : { + "description" : "If there was a server or database issue when listing the regions", + "schema" : { + "$ref" : "#/definitions/Generic error response from Yugawware Platform API" + } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/run_query" : { + }, "post" : { - "tags" : [ "Universe YB Database" ], - "summary" : "Run YSQL query against this universe", - "description" : "Only valid when platform is running in mode is `OSS`", - "operationId" : "runQuery", + "tags" : [ "Region" ], + "summary" : "create new region", + "description" : "", + "operationId" : "createRegion", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4139,17 +4086,25 @@ "type" : "string", "format" : "uuid" }, { - "name" : "uniUUID", + "name" : "pUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "in" : "body", + "name" : "region", + "description" : "region form data for new region to be created", + "required" : true, + "schema" : { + "$ref" : "#/definitions/RegionFormData" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object" + "$ref" : "#/definitions/Region" } } }, @@ -4158,12 +4113,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/run_in_shell" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/backups/restore" : { "post" : { - "tags" : [ "Universe YB Database" ], - "summary" : "run command in shell", - "description" : "This operation is no longer supported due to security reasons", - "operationId" : "runInShell", + "tags" : [ "Backups" ], + "summary" : "restore Backups", + "description" : "", + "operationId" : "restore", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4176,12 +4131,20 @@ "required" : true, "type" : "string", "format" : "uuid" + }, { + "in" : "body", + "name" : "backup", + "description" : "backup params of the backup to be restored", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Backup table params" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Generic error response from Yugawware Platform API" + "$ref" : "#/definitions/YWTask" } } }, @@ -4190,12 +4153,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/update_db_credentials" : { - "post" : { - "tags" : [ "Universe YB Database" ], - "summary" : "setDatabaseCredentials", + "/api/v1/customers/{cUUID}/universes/{uniUUID}/backups/tasks/{tUUID}" : { + "get" : { + "tags" : [ "Backups" ], + "summary" : "list Backups for a specific task", "description" : "", - "operationId" : "setDatabaseCredentials", + "operationId" : "fetchBackupsByTaskUUID", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4208,12 +4171,27 @@ "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "tUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "type" : "array", + "items" : { + "$ref" : "#/definitions/Backup" + } + } + }, + "500" : { + "description" : "If there was a server or database issue when listing the backups", + "schema" : { + "$ref" : "#/definitions/Generic error response from Yugawware Platform API" } } }, @@ -4222,30 +4200,24 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}/create_db_credentials" : { - "post" : { - "tags" : [ "Universe YB Database" ], - "summary" : "createUserInDB", + "/api/v1/customers/{cUUID}/backups" : { + "delete" : { + "tags" : [ "Backups" ], + "summary" : "delete", "description" : "", - "operationId" : "createUserInDB", + "operationId" : "deleteBackups", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "uniUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "$ref" : "#/definitions/YWTask" } } }, @@ -4254,13 +4226,10 @@ } ] } }, - "/api/v1/customers/{cUUID}/runtime_config/{scope}/key/{key}" : { - "get" : { - "tags" : [ "RuntimeConfig" ], - "summary" : "getKey", - "description" : "", - "operationId" : "getKey", - "produces" : [ "text/plain" ], + "/api/v1/customers/{cUUID}/backups/{backupUUID}/stop" : { + "post" : { + "tags" : [ "Backups" ], + "operationId" : "stop", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4268,16 +4237,11 @@ "type" : "string", "format" : "uuid" }, { - "name" : "scope", + "name" : "backupUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "key", - "in" : "path", - "required" : true, - "type" : "string" } ], "responses" : { "default" : { @@ -4287,13 +4251,14 @@ "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "put" : { - "tags" : [ "RuntimeConfig" ], - "summary" : "setKey", + } + }, + "/api/v1/customers/{cUUID}/universes/{uniUUID}/backups" : { + "get" : { + "tags" : [ "Backups" ], + "summary" : "list Backups for a specific customer", "description" : "", - "operationId" : "setKey", - "consumes" : [ "text/plain" ], + "operationId" : "ListOfBackups", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4301,60 +4266,27 @@ "type" : "string", "format" : "uuid" }, { - "name" : "scope", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "key", - "in" : "path", - "required" : true, - "type" : "string" - }, { - "in" : "body", - "name" : "newValue", - "description" : "new value for config key", - "required" : true, - "schema" : { - "type" : "string" - } } ], "responses" : { - "default" : { - "description" : "successful operation" - } - }, - "security" : [ { - "apiKeyAuth" : [ ] - } ] - }, - "delete" : { - "tags" : [ "RuntimeConfig" ], - "summary" : "deleteKey", - "description" : "", - "operationId" : "deleteKey", - "parameters" : [ { - "name" : "cUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "scope", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "key", - "in" : "path", - "required" : true, - "type" : "string" - } ], - "responses" : { - "default" : { - "description" : "successful operation" + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Backup" + } + } + }, + "500" : { + "description" : "If there was a server or database issue when listing the backups", + "schema" : { + "$ref" : "#/definitions/Generic error response from Yugawware Platform API" + } } }, "security" : [ { @@ -4362,59 +4294,66 @@ } ] } }, - "/api/v1/customers/{cUUID}/runtime_config/{scope}" : { + "/api/v1/customers/{cUUID}/certificates" : { "get" : { - "tags" : [ "RuntimeConfig" ], - "summary" : "list config entries for a scope", - "description" : "Lists all runtime config entries for a given scopes for current customer.", - "operationId" : "getConfig", + "tags" : [ "Certificate Info" ], + "summary" : "list Certificates for a specific customer", + "description" : "", + "operationId" : "getListOfCertificate", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "scope", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "includeInherited", - "in" : "query", - "required" : false, - "type" : "boolean", - "default" : false } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Runtime config data" + "type" : "array", + "items" : { + "$ref" : "#/definitions/CertificateInfo" + } + } + }, + "500" : { + "description" : "If there was a server or database issue when listing the regions", + "schema" : { + "$ref" : "#/definitions/Generic error response from Yugawware Platform API" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/runtime_config/mutable_keys" : { - "get" : { - "tags" : [ "RuntimeConfig" ], - "summary" : "list Mutable keys", - "description" : "List all the mutable runtime config keys", - "operationId" : "listKeys", - "parameters" : [ ], + }, + "post" : { + "tags" : [ "Certificate Info" ], + "summary" : "restore Backups", + "description" : "", + "operationId" : "upload", + "parameters" : [ { + "name" : "cUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "in" : "body", + "name" : "certificate", + "description" : "certificate params of the backup to be restored", + "required" : true, + "schema" : { + "$ref" : "#/definitions/CertificateParams" + } + } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "type" : "string" - } + "type" : "string", + "format" : "uuid" } } }, @@ -4423,24 +4362,30 @@ } ] } }, - "/api/v1/customers/{cUUID}/runtime_config/scopes" : { + "/api/v1/customers/{cUUID}/certificates/{rUUID}/download" : { "get" : { - "tags" : [ "RuntimeConfig" ], - "summary" : "listScopes", - "description" : "Lists all (including empty scopes) runtime config scopes for current customer. List includes the Global scope that spans multiple customers, scope for customer specific overrides for current customer and one scope each for each universe and provider.", - "operationId" : "listScopes", + "tags" : [ "Certificate Info" ], + "summary" : "get root certificate", + "description" : "", + "operationId" : "getRootCert", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "rUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Runtime config data" + "$ref" : "#/definitions/JsonNode" } } }, @@ -4449,12 +4394,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/configs/{configUUID}" : { - "put" : { - "tags" : [ "Customer Config" ], - "summary" : "List of customer configuration", + "/api/v1/customers/{cUUID}/certificates/{rUUID}" : { + "post" : { + "tags" : [ "Certificate Info" ], + "summary" : "post certificate info", "description" : "", - "operationId" : "getCustomerConfig", + "operationId" : "getClientCert", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4462,25 +4407,25 @@ "type" : "string", "format" : "uuid" }, { - "name" : "configUUID", + "name" : "rUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" }, { "in" : "body", - "name" : "Config", - "description" : "Configuration data to be updated", + "name" : "certificate", + "description" : "post certificate info", "required" : true, "schema" : { - "type" : "object" + "$ref" : "#/definitions/ClientCertParams" } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Customer Config" + "$ref" : "#/definitions/CertificateDetails" } } }, @@ -4489,10 +4434,10 @@ } ] }, "delete" : { - "tags" : [ "Customer Config" ], - "summary" : "Delete customer configuration", + "tags" : [ "Certificate Info" ], + "summary" : "delete certificate", "description" : "", - "operationId" : "deleteCustomerConfig", + "operationId" : "deleteCertificate", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4500,7 +4445,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "configUUID", + "name" : "rUUID", "in" : "path", "required" : true, "type" : "string", @@ -4519,39 +4464,44 @@ } ] } }, - "/api/v1/customers/{cUUID}/configs" : { - "get" : { - "tags" : [ "Customer Config" ], - "summary" : "List of customer configuration", + "/api/v1/customers/{cUUID}/certificates/{rUUID}/update_empty_cert" : { + "post" : { + "tags" : [ "Certificate Info" ], + "summary" : "update empty certs", "description" : "", - "operationId" : "getListOfCustomerConfig", + "operationId" : "updateEmptyCustomCert", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "rUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Customer Config" - } + "$ref" : "#/definitions/CertificateInfo" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "post" : { - "tags" : [ "Customer Config" ], - "summary" : "Create customer configuration", + } + }, + "/api/v1/customers/{cUUID}/certificates/{name}" : { + "get" : { + "tags" : [ "Certificate Info" ], + "summary" : "get certificate UUID", "description" : "", - "operationId" : "createCustomerConfig", + "operationId" : "getCertificate", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4559,19 +4509,17 @@ "type" : "string", "format" : "uuid" }, { - "in" : "body", - "name" : "Config", - "description" : "Configuration data to be created", + "name" : "name", + "in" : "path", "required" : true, - "schema" : { - "type" : "object" - } + "type" : "string" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/Customer Config" + "type" : "string", + "format" : "uuid" } } }, @@ -4580,12 +4528,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/instance_types/{code}" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/status" : { "get" : { - "tags" : [ "Instance Type" ], - "summary" : "get instance type through instance type code.", - "description" : "", - "operationId" : "instanceTypeDetail", + "tags" : [ "UniverseInfo" ], + "summary" : "Status of the Universe", + "description" : "This will return a Map of node name to its status in json format", + "operationId" : "universeStatus", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4593,34 +4541,34 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "code", - "in" : "path", - "required" : true, - "type" : "string" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/InstanceType" + "type" : "object", + "additionalProperties" : { + "type" : "object" + } } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "delete" : { - "tags" : [ "Instance Type" ], - "summary" : "delete", + } + }, + "/api/v1/customers/{cUUID}/universes/{uniUUID}/health_check" : { + "get" : { + "tags" : [ "UniverseInfo" ], + "summary" : "health Check", "description" : "", - "operationId" : "deleteInstanceType", + "operationId" : "healthCheck", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4628,22 +4576,17 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "code", - "in" : "path", - "required" : true, - "type" : "string" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "type" : "object" } } }, @@ -4652,34 +4595,18 @@ } ] } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/instance_types" : { + "/api/v1/customers/{cUUID}/cost" : { "get" : { - "tags" : [ "Instance Type" ], - "summary" : "list Instance Types for specific provider.", + "tags" : [ "UniverseInfo" ], + "summary" : "list universe cost for all universes", "description" : "", - "operationId" : "listOfInstanceType", + "operationId" : "universeListCost", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "pUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "zone", - "in" : "query", - "required" : false, - "type" : "array", - "items" : { - "type" : "string" - }, - "collectionFormat" : "multi", - "default" : "java.util.Collections.emptyList()" } ], "responses" : { "200" : { @@ -4687,26 +4614,22 @@ "schema" : { "type" : "array", "items" : { - "$ref" : "#/definitions/YWResults" + "$ref" : "#/definitions/UniverseResource" } } - }, - "500" : { - "description" : "If there was a server or database issue when listing the backups", - "schema" : { - "$ref" : "#/definitions/Generic error response from Yugawware Platform API" - } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - }, - "post" : { - "tags" : [ "Instance Type" ], - "summary" : "create Instance type", + } + }, + "/api/v1/customers/{cUUID}/universes/{uniUUID}/cost" : { + "get" : { + "tags" : [ "UniverseInfo" ], + "summary" : "universeCost", "description" : "", - "operationId" : "createInstanceType", + "operationId" : "universeCost", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4714,49 +4637,17 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", + "name" : "uniUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "in" : "body", - "name" : "instance type", - "description" : "instance type data of the instance to be stored", - "required" : true, - "schema" : { - "$ref" : "#/definitions/InstanceType" - } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/InstanceType" - } - } - }, - "security" : [ { - "apiKeyAuth" : [ ] - } ] - } - }, - "/api/v1/metadata/ebs_types" : { - "get" : { - "tags" : [ "Instance Type" ], - "summary" : "get EBS types", - "description" : "", - "operationId" : "getEBSTypes", - "parameters" : [ ], - "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "type" : "array", - "items" : { - "type" : "string", - "enum" : [ "IO1", "GP2", "GP3", "Scratch", "Persistent", "StandardSSD_LRS", "Premium_LRS", "UltraSSD_LRS" ] - } + "$ref" : "#/definitions/UniverseResource" } } }, @@ -4765,22 +4656,30 @@ } ] } }, - "/api/v1/metadata/gcp_types" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/leader" : { "get" : { - "tags" : [ "Instance Type" ], - "summary" : "get GCP types", + "tags" : [ "UniverseInfo" ], + "summary" : "getMasterLeaderIP", "description" : "", - "operationId" : "getGCPTypes", - "parameters" : [ ], + "operationId" : "getMasterLeaderIP", + "parameters" : [ { + "name" : "cUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "type" : "string", - "enum" : [ "IO1", "GP2", "GP3", "Scratch", "Persistent", "StandardSSD_LRS", "Premium_LRS", "UltraSSD_LRS" ] - } + "type" : "object" } } }, @@ -4789,22 +4688,30 @@ } ] } }, - "/api/v1/metadata/azu_types" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/live_queries" : { "get" : { - "tags" : [ "Instance Type" ], - "summary" : "get AZU types", + "tags" : [ "UniverseInfo" ], + "summary" : "getLiveQueries", "description" : "", - "operationId" : "getAZUTypes", - "parameters" : [ ], + "operationId" : "getLiveQueries", + "parameters" : [ { + "name" : "cUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + }, { + "name" : "uniUUID", + "in" : "path", + "required" : true, + "type" : "string", + "format" : "uuid" + } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "type" : "string", - "enum" : [ "IO1", "GP2", "GP3", "Scratch", "Persistent", "StandardSSD_LRS", "Premium_LRS", "UltraSSD_LRS" ] - } + "type" : "object" } } }, @@ -4813,12 +4720,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/{uniUUID}" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/slow_queries" : { "get" : { - "tags" : [ "Universe" ], - "summary" : "getUniverse", + "tags" : [ "UniverseInfo" ], + "summary" : "getSlowQueries", "description" : "", - "operationId" : "getUniverse", + "operationId" : "getSlowQueries", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4836,7 +4743,7 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/UniverseResp" + "type" : "object" } } }, @@ -4845,10 +4752,10 @@ } ] }, "delete" : { - "tags" : [ "Universe" ], - "summary" : "Destroy the universe", + "tags" : [ "UniverseInfo" ], + "summary" : "resetSlowQueries", "description" : "", - "operationId" : "deleteUniverse", + "operationId" : "resetSlowQueries", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4861,24 +4768,12 @@ "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "isForceDelete", - "in" : "query", - "required" : false, - "type" : "boolean", - "default" : false - }, { - "name" : "isDeleteBackups", - "in" : "query", - "required" : false, - "type" : "boolean", - "default" : false } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWTask" + "type" : "object" } } }, @@ -4887,12 +4782,13 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes" : { + "/api/v1/customers/{cUUID}/universes/{uniUUID}/{nodeName}/download_logs" : { "get" : { - "tags" : [ "Universe" ], - "summary" : "List Universes", + "tags" : [ "UniverseInfo" ], + "summary" : "download Node logs", "description" : "", - "operationId" : "getListOfUniverses", + "operationId" : "downloadNodeLogs", + "produces" : [ "application/x-compressed" ], "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4900,21 +4796,20 @@ "type" : "string", "format" : "uuid" }, { - "name" : "name", - "in" : "query", - "required" : false, + "name" : "uniUUID", + "in" : "path", + "required" : true, "type" : "string", - "default" : "null" + "format" : "uuid" + }, { + "name" : "nodeName", + "in" : "path", + "required" : true, + "type" : "string" } ], "responses" : { - "200" : { - "description" : "successful operation", - "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/UniverseResp" - } - } + "default" : { + "description" : "successful operation" } }, "security" : [ { @@ -4922,24 +4817,35 @@ } ] } }, - "/api/v1/customers/{cUUID}/universes/import" : { + "/api/v1/customers/{cUUID}/metrics" : { "post" : { - "tags" : [ "Import" ], - "summary" : "import", + "tags" : [ "Customer" ], + "summary" : "Add metrics of customer by UUID", "description" : "", - "operationId" : "importUniverse", + "operationId" : "metrics", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "in" : "body", + "name" : "Metrics", + "description" : "Metrics to be added", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Metrics" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/ImportUniverseFormData" + "type" : "object", + "additionalProperties" : { + "type" : "object" + } } } }, @@ -4948,12 +4854,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/regions/{rUUID}/zones/{azUUID}" : { - "delete" : { - "tags" : [ "AvailabilityZone" ], - "summary" : "deleteAZ", + "/api/v1/customers/{cUUID}/features" : { + "put" : { + "tags" : [ "Customer" ], + "summary" : "Upsert features of customer by UUID", "description" : "", - "operationId" : "deleteAZ", + "operationId" : "upsertFeatures", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -4961,29 +4867,22 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "rUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "azUUID", - "in" : "path", + "in" : "body", + "name" : "Feature", + "description" : "Feature to be upserted", "required" : true, - "type" : "string", - "format" : "uuid" + "schema" : { + "$ref" : "#/definitions/FeatureUpdateFormData" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/YWSuccess" + "type" : "object", + "additionalProperties" : { + "type" : "object" + } } } }, @@ -4992,26 +4891,43 @@ } ] } }, - "/api/v1/customers/{cUUID}/providers/{pUUID}/regions/{rUUID}/zones" : { + "/api/v1/customers/{cUUID}/host_info" : { "get" : { - "tags" : [ "AvailabilityZone" ], - "summary" : "listAZ", + "tags" : [ "Customer" ], + "summary" : "Get host info by customer UUID", "description" : "", - "operationId" : "listOfAZ", + "operationId" : "getHostInfo", "parameters" : [ { "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "name" : "pUUID", - "in" : "path", - "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "rUUID", + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "object", + "additionalProperties" : { + "type" : "object" + } + } + } + }, + "security" : [ { + "apiKeyAuth" : [ ] + } ] + } + }, + "/api/v1/customers/{cUUID}" : { + "get" : { + "tags" : [ "Customer" ], + "summary" : "Get customer by UUID", + "description" : "", + "operationId" : "CustomerDetail", + "parameters" : [ { + "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", @@ -5021,10 +4937,7 @@ "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/AvailabilityZone" - } + "$ref" : "#/definitions/Customer Detail" } } }, @@ -5032,11 +4945,11 @@ "apiKeyAuth" : [ ] } ] }, - "post" : { - "tags" : [ "AvailabilityZone" ], - "summary" : "createAZ", + "put" : { + "tags" : [ "Customer" ], + "summary" : "Update customer by UUID", "description" : "", - "operationId" : "createAZ", + "operationId" : "UpdateCustomer", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -5044,33 +4957,65 @@ "type" : "string", "format" : "uuid" }, { - "name" : "pUUID", - "in" : "path", + "in" : "body", + "name" : "Customer", + "description" : "Customer data to be updated", "required" : true, - "type" : "string", - "format" : "uuid" - }, { - "name" : "rUUID", + "schema" : { + "$ref" : "#/definitions/Alerts" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/Customer" + } + } + }, + "security" : [ { + "apiKeyAuth" : [ ] + } ] + }, + "delete" : { + "tags" : [ "Customer" ], + "summary" : "Delete customer by UUID", + "description" : "", + "operationId" : "deleteCustomer", + "parameters" : [ { + "name" : "cUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" - }, { - "in" : "body", - "name" : "azFormData", - "description" : "az form data", - "required" : true, - "schema" : { - "$ref" : "#/definitions/AvailabilityZoneFormData" - } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "$ref" : "#/definitions/AvailabilityZone" + "$ref" : "#/definitions/YWSuccess" + } + } + }, + "security" : [ { + "apiKeyAuth" : [ ] + } ] + } + }, + "/api/v1/customers" : { + "get" : { + "tags" : [ "Customer" ], + "summary" : "List customer", + "description" : "", + "operationId" : "ListOfCustomers", + "parameters" : [ ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Customer" } } } @@ -5080,12 +5025,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/tasks_list" : { + "/api/v1/customers/{cUUID}/users/{uUUID}" : { "get" : { - "tags" : [ "Customer Task" ], - "summary" : "List task", + "tags" : [ "Users" ], + "summary" : "User detail by UUID", "description" : "", - "operationId" : "tasksList", + "operationId" : "usersDetail", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -5094,34 +5039,28 @@ "format" : "uuid" }, { "name" : "uUUID", - "in" : "query", - "required" : false, + "in" : "path", + "required" : true, "type" : "string", - "default" : "null", "format" : "uuid" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Customer Task Data" - } + "$ref" : "#/definitions/Users" } } }, "security" : [ { "apiKeyAuth" : [ ] } ] - } - }, - "/api/v1/customers/{cUUID}/tasks/{tUUID}" : { - "get" : { - "tags" : [ "Customer Task" ], - "summary" : "Status of task", + }, + "put" : { + "tags" : [ "Users" ], + "summary" : "Change role of user by UUID", "description" : "", - "operationId" : "taskStatus", + "operationId" : "changeRole", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -5129,20 +5068,22 @@ "type" : "string", "format" : "uuid" }, { - "name" : "tUUID", + "name" : "uUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "name" : "role", + "in" : "query", + "required" : false, + "type" : "string" } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" - } + "$ref" : "#/definitions/YWSuccess" } } }, @@ -5150,11 +5091,11 @@ "apiKeyAuth" : [ ] } ] }, - "post" : { - "tags" : [ "Customer Task" ], - "summary" : "Retry task", + "delete" : { + "tags" : [ "Users" ], + "summary" : "Delete customer", "description" : "", - "operationId" : "retryTask", + "operationId" : "deleteUsers", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -5162,7 +5103,7 @@ "type" : "string", "format" : "uuid" }, { - "name" : "tUUID", + "name" : "uUUID", "in" : "path", "required" : true, "type" : "string", @@ -5172,7 +5113,7 @@ "200" : { "description" : "successful operation", "schema" : { - "$ref" : "#/definitions/UniverseResp" + "$ref" : "#/definitions/YWSuccess" } } }, @@ -5181,12 +5122,12 @@ } ] } }, - "/api/v1/customers/{cUUID}/tasks/{tUUID}/failed" : { - "get" : { - "tags" : [ "Customer Task" ], - "summary" : "Get failed sub task", + "/api/v1/customers/{cUUID}/users/{uUUID}/change_password" : { + "put" : { + "tags" : [ "Users" ], + "summary" : "Chnage password of User", "description" : "", - "operationId" : "failedSubtasks", + "operationId" : "changePassword", "parameters" : [ { "name" : "cUUID", "in" : "path", @@ -5194,20 +5135,25 @@ "type" : "string", "format" : "uuid" }, { - "name" : "tUUID", + "name" : "uUUID", "in" : "path", "required" : true, "type" : "string", "format" : "uuid" + }, { + "in" : "body", + "name" : "Users", + "description" : "Users data to be updated", + "required" : true, + "schema" : { + "$ref" : "#/definitions/User Register" + } } ], "responses" : { "200" : { "description" : "successful operation", "schema" : { - "type" : "object", - "additionalProperties" : { - "type" : "object" - } + "$ref" : "#/definitions/YWSuccess" } } }, @@ -5215,939 +5161,680 @@ "apiKeyAuth" : [ ] } ] } - } - }, - "securityDefinitions" : { - "apiKeyAuth" : { - "description" : "Api key passed as header", - "type" : "apiKey", - "name" : "X-AUTH-YW-API-TOKEN", - "in" : "header" - } - }, - "definitions" : { - "YWSuccess" : { - "type" : "object", - "properties" : { - "success" : { - "type" : "boolean", - "description" : "Has API success", - "readOnly" : true - }, - "message" : { - "type" : "string", - "description" : "API response mssage.", - "readOnly" : true - } - } }, - "Release data" : { - "type" : "object", - "properties" : { - "state" : { + "/api/v1/customers/{cUUID}/users" : { + "get" : { + "tags" : [ "Users" ], + "summary" : "List of Users", + "description" : "", + "operationId" : "ListOfUsers", + "parameters" : [ { + "name" : "cUUID", + "in" : "path", + "required" : true, "type" : "string", - "example" : "ACTIVE", - "description" : "Release state", - "enum" : [ "ACTIVE", "DISABLED", "DELETED" ] - }, - "notes" : { - "type" : "array", - "description" : "Release notes", - "items" : { - "type" : "string" + "format" : "uuid" + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Users" + } + } } }, - "filePath" : { - "type" : "string", - "description" : "Release file path" - }, - "imageTag" : { - "type" : "string", - "description" : "Release image tag" - } - }, - "description" : "Release data" - }, - "ReleaseFormData" : { - "type" : "object", - "required" : [ "version" ], - "properties" : { - "version" : { - "type" : "string" - } - } - }, - "ArrayNode" : { - "type" : "object", - "required" : [ "array", "bigDecimal", "bigInteger", "binary", "boolean", "containerNode", "double", "float", "floatingPointNumber", "int", "integralNumber", "long", "missingNode", "nodeType", "null", "number", "object", "pojo", "short", "textual", "valueNode" ], - "properties" : { - "array" : { - "type" : "boolean" - }, - "nodeType" : { - "type" : "string", - "enum" : [ "ARRAY", "BINARY", "BOOLEAN", "MISSING", "NULL", "NUMBER", "OBJECT", "POJO", "STRING" ] - }, - "float" : { - "type" : "boolean" - }, - "null" : { - "type" : "boolean" - }, - "object" : { - "type" : "boolean" - }, - "valueNode" : { - "type" : "boolean" - }, - "containerNode" : { - "type" : "boolean" - }, - "missingNode" : { - "type" : "boolean" - }, - "pojo" : { - "type" : "boolean" - }, - "number" : { - "type" : "boolean" - }, - "integralNumber" : { - "type" : "boolean" - }, - "floatingPointNumber" : { - "type" : "boolean" - }, - "short" : { - "type" : "boolean" - }, - "int" : { - "type" : "boolean" - }, - "long" : { - "type" : "boolean" - }, - "double" : { - "type" : "boolean" - }, - "bigDecimal" : { - "type" : "boolean" - }, - "bigInteger" : { - "type" : "boolean" - }, - "textual" : { - "type" : "boolean" - }, - "boolean" : { - "type" : "boolean" - }, - "binary" : { - "type" : "boolean" - } - } - }, - "CertificateInfo" : { - "type" : "object", - "required" : [ "customServerCertInfo" ], - "properties" : { - "uuid" : { - "type" : "string", - "format" : "uuid", - "description" : "Certificate uuid", - "readOnly" : true - }, - "customerUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Customer UUID of the backup which it belongs to" - }, - "label" : { - "type" : "string", - "example" : "yb-admin-example", - "description" : "Certificate label" - }, - "startDate" : { - "type" : "string", - "format" : "date-time", - "description" : "Certificate created date" - }, - "expiryDate" : { - "type" : "string", - "format" : "date-time", - "description" : "Expiry date of the Certificate" - }, - "privateKey" : { - "type" : "string", - "example" : "/opt/yugaware/..../example.key.pem", - "description" : "Private key path" - }, - "certificate" : { - "type" : "string", - "example" : "/opt/yugaware/certs/.../ca.root.cert", - "description" : "Certificate path" - }, - "certType" : { - "type" : "string", - "example" : "SelfSigned", - "description" : "Type of the certificate", - "enum" : [ "SelfSigned", "CustomCertHostPath", "CustomServerCert" ] - }, - "checksum" : { - "type" : "string", - "description" : "Checksome of a cert file", - "readOnly" : true - }, - "customCertInfo" : { - "description" : "Details about the Certificate", - "$ref" : "#/definitions/CustomCertInfo" - }, - "universeDetails" : { - "description" : "Associated universe details of the Certificate", - "readOnly" : true, - "$ref" : "#/definitions/ArrayNode" - }, - "inUse" : { - "type" : "boolean", - "description" : "Indicates whether the Certificate is in use or not", - "readOnly" : true - }, - "customServerCertInfo" : { - "$ref" : "#/definitions/CustomServerCertInfo" - } + "security" : [ { + "apiKeyAuth" : [ ] + } ] }, - "description" : "Certificate used by the universe to send sensitive information" - }, - "CustomCertInfo" : { - "type" : "object", - "required" : [ "clientCertPath", "clientKeyPath", "nodeCertPath", "nodeKeyPath", "rootCertPath" ], - "properties" : { - "nodeCertPath" : { - "type" : "string" - }, - "nodeKeyPath" : { - "type" : "string" - }, - "rootCertPath" : { - "type" : "string" - }, - "clientCertPath" : { - "type" : "string" - }, - "clientKeyPath" : { - "type" : "string" - } - } - }, - "CustomServerCertInfo" : { - "type" : "object", - "required" : [ "serverCert", "serverKey" ], - "properties" : { - "serverCert" : { - "type" : "string" - }, - "serverKey" : { - "type" : "string" - } - } - }, - "Generic error response from Yugawware Platform API" : { - "type" : "object", - "required" : [ "success" ], - "properties" : { - "success" : { - "type" : "boolean" - }, - "error" : { - "type" : "string", - "example" : "There was a problem creating universe", - "description" : "User visible unstructurred error message" - } - } - }, - "CertificateParams" : { - "type" : "object", - "required" : [ "certContent", "certExpiry", "certStart", "certType", "customCertInfo", "customServerCertData", "keyContent", "label" ], - "properties" : { - "label" : { - "type" : "string" - }, - "certStart" : { - "type" : "integer", - "format" : "int64" - }, - "certExpiry" : { - "type" : "integer", - "format" : "int64" - }, - "certContent" : { - "type" : "string" - }, - "keyContent" : { - "type" : "string" - }, - "certType" : { + "post" : { + "tags" : [ "Users" ], + "summary" : "Create User", + "description" : "", + "operationId" : "createUsers", + "parameters" : [ { + "name" : "cUUID", + "in" : "path", + "required" : true, "type" : "string", - "enum" : [ "SelfSigned", "CustomCertHostPath", "CustomServerCert" ] - }, - "customCertInfo" : { - "$ref" : "#/definitions/CustomCertInfo" + "format" : "uuid" + }, { + "in" : "body", + "name" : "User", + "description" : "Users data to be created", + "required" : true, + "schema" : { + "$ref" : "#/definitions/User Register" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/Users" + } + } }, - "customServerCertData" : { - "$ref" : "#/definitions/CustomServerCertData" - } + "security" : [ { + "apiKeyAuth" : [ ] + } ] } }, - "CustomServerCertData" : { - "type" : "object", - "required" : [ "serverCertContent", "serverKeyContent" ], - "properties" : { - "serverCertContent" : { - "type" : "string" + "/api/v1/prometheus_metrics" : { + "get" : { + "tags" : [ "Metrics" ], + "summary" : "index", + "description" : "", + "operationId" : "MetricsDetail", + "parameters" : [ ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "type" : "string" + } + } }, - "serverKeyContent" : { - "type" : "string" - } + "security" : [ { + "apiKeyAuth" : [ ] + } ] } - }, - "JsonNode" : { + } + }, + "securityDefinitions" : { + "apiKeyAuth" : { + "description" : "Api key passed as header", + "type" : "apiKey", + "name" : "X-AUTH-YW-API-TOKEN", + "in" : "header" + } + }, + "definitions" : { + "NodeInstance" : { "type" : "object", - "required" : [ "array", "bigDecimal", "bigInteger", "binary", "boolean", "containerNode", "double", "float", "floatingPointNumber", "int", "integralNumber", "long", "missingNode", "nodeType", "null", "number", "object", "pojo", "short", "textual", "valueNode" ], + "required" : [ "details" ], "properties" : { - "float" : { - "type" : "boolean" - }, - "array" : { - "type" : "boolean" - }, - "null" : { - "type" : "boolean" - }, - "nodeType" : { + "nodeUuid" : { "type" : "string", - "enum" : [ "ARRAY", "BINARY", "BOOLEAN", "MISSING", "NULL", "NUMBER", "OBJECT", "POJO", "STRING" ] - }, - "object" : { - "type" : "boolean" - }, - "valueNode" : { - "type" : "boolean" - }, - "containerNode" : { - "type" : "boolean" + "format" : "uuid", + "description" : "Node instance UUID", + "readOnly" : true }, - "missingNode" : { - "type" : "boolean" + "instanceTypeCode" : { + "type" : "string", + "example" : "c5large", + "description" : "Node instance type code" }, - "pojo" : { - "type" : "boolean" + "nodeName" : { + "type" : "string", + "example" : "India node", + "description" : "Node instance node name" }, - "number" : { - "type" : "boolean" + "instanceName" : { + "type" : "string", + "example" : "Mumbai instance", + "description" : "Node instance instance name" }, - "integralNumber" : { - "type" : "boolean" + "zoneUuid" : { + "type" : "string", + "format" : "uuid", + "description" : "Node instance zone UUID" }, - "floatingPointNumber" : { - "type" : "boolean" + "inUse" : { + "type" : "boolean", + "description" : "Node instance is in used or not" }, - "short" : { - "type" : "boolean" + "details" : { + "$ref" : "#/definitions/NodeInstanceData" }, - "int" : { - "type" : "boolean" + "detailsJson" : { + "type" : "string", + "example" : "{\"ip\":\"1.1.1.1\",\"sshUser\":\"centos\"}", + "description" : "Node details" + } + }, + "description" : "Node instance attched to provider and zones" + }, + "NodeInstanceData" : { + "type" : "object", + "required" : [ "instanceName", "instanceType", "ip", "region", "sshUser", "zone" ], + "properties" : { + "ip" : { + "type" : "string", + "example" : "1.1.1.1", + "description" : "IP address of node instance" }, - "long" : { - "type" : "boolean" + "sshUser" : { + "type" : "string", + "example" : "centos", + "description" : "SSH user of node instance" }, - "double" : { - "type" : "boolean" + "region" : { + "type" : "string", + "example" : "south-east", + "description" : "Region of node instance" }, - "bigDecimal" : { - "type" : "boolean" + "zone" : { + "type" : "string", + "example" : "south-east", + "description" : "Zone of node instance" }, - "bigInteger" : { - "type" : "boolean" + "instanceType" : { + "type" : "string", + "example" : "c5large", + "description" : "Instance type of node instance" }, - "textual" : { - "type" : "boolean" + "instanceName" : { + "type" : "string", + "example" : "Mumbai instance", + "description" : "Instance name of node instance" }, - "boolean" : { - "type" : "boolean" + "nodeName" : { + "type" : "string", + "example" : "India node", + "description" : "Node name of node instance" + } + }, + "description" : "Detail of node instance" + }, + "YWTask" : { + "type" : "object", + "properties" : { + "taskUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "Task UUID", + "readOnly" : true }, - "binary" : { - "type" : "boolean" + "resourceUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "UUID of the resource being modified by the task", + "readOnly" : true } } }, - "CertificateDetails" : { + "NodeActionFormData" : { "type" : "object", + "required" : [ "nodeAction" ], "properties" : { - "yugabytedb.crt" : { - "type" : "string" - }, - "yugabytedb.key" : { - "type" : "string" + "nodeAction" : { + "type" : "string", + "enum" : [ "ADD", "REMOVE", "START", "STOP", "DELETE", "QUERY", "RELEASE", "START_MASTER" ] } } }, - "ClientCertParams" : { + "NodeInstanceFormData" : { "type" : "object", - "required" : [ "certExpiry", "certStart", "username" ], + "required" : [ "nodes" ], "properties" : { - "username" : { - "type" : "string" - }, - "certStart" : { - "type" : "integer", - "format" : "int64" - }, - "certExpiry" : { - "type" : "integer", - "format" : "int64" + "nodes" : { + "type" : "array", + "description" : "Node instances", + "items" : { + "$ref" : "#/definitions/NodeInstanceData" + } } } }, - "Users" : { + "AvailabilityZone" : { "type" : "object", - "required" : [ "email" ], + "required" : [ "name" ], "properties" : { "uuid" : { "type" : "string", "format" : "uuid", - "description" : "User uuid", - "readOnly" : true - }, - "customerUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Customer uuid", - "readOnly" : true - }, - "email" : { - "type" : "string", - "example" : "username1@email.com", - "description" : "User email id" - }, - "creationDate" : { - "type" : "string", - "format" : "date-time", - "example" : "2021-06-17 15:00:05", - "description" : "Creation time", + "description" : "AZ uuid", "readOnly" : true }, - "authTokenIssueDate" : { + "code" : { "type" : "string", - "format" : "date-time", - "example" : "1624255408795", - "description" : "Token issued date", - "readOnly" : true - }, - "features" : { - "description" : "Features", - "readOnly" : true, - "$ref" : "#/definitions/JsonNode" + "example" : "AWS", + "description" : "AZ code" }, - "role" : { + "name" : { "type" : "string", - "description" : "User role", - "enum" : [ "Admin", "ReadOnly", "SuperAdmin", "BackupAdmin" ] + "example" : "south-east-1", + "description" : "AZ name" }, - "isPrimary" : { + "active" : { "type" : "boolean", - "description" : "User is primary user or not" - } - }, - "description" : "Users associated customers." - }, - "User Register" : { - "type" : "object", - "required" : [ "email", "role" ], - "properties" : { - "email" : { - "type" : "string", - "example" : "test@gmail.com", - "description" : "User email address" - }, - "password" : { - "type" : "string", - "example" : "Test@1234", - "description" : "User password" + "description" : "AZ is active or not", + "readOnly" : true }, - "confirmPassword" : { + "subnet" : { "type" : "string", - "example" : "Test@1234", - "description" : "User password" - }, - "features" : { - "type" : "object", - "description" : "User Features", - "additionalProperties" : { - "type" : "object" - } + "example" : "subnet id", + "description" : "AZ Subnet" }, - "role" : { + "kubeconfigPath" : { "type" : "string", - "example" : "Admin", - "description" : "User role", - "enum" : [ "Admin", "ReadOnly", "SuperAdmin", "BackupAdmin" ] + "description" : "Kubernetes Config path", + "readOnly" : true } }, - "description" : "User registration data" - }, - "YWResults" : { - "type" : "object" + "description" : "Availability Zone of regions." }, - "Schedule" : { + "InstanceType" : { "type" : "object", + "required" : [ "idKey", "instanceTypeCode", "instanceTypeDetails", "provider", "providerCode", "providerUuid" ], "properties" : { - "scheduleUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Schedule UUID", - "readOnly" : true + "idKey" : { + "$ref" : "#/definitions/InstanceTypeKey" }, - "customerUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Customer uuid", - "readOnly" : true + "provider" : { + "$ref" : "#/definitions/Provider" }, - "failureCount" : { - "type" : "integer", - "format" : "int32", - "description" : "Number of failed schedule", + "active" : { + "type" : "boolean", + "description" : "indiacates whether this instance is active or not", "readOnly" : true }, - "frequency" : { - "type" : "integer", - "format" : "int64", - "description" : "Frequency of the schedule" + "numCores" : { + "type" : "number", + "format" : "double", + "description" : "Number of cores in an instance" }, - "taskParams" : { - "description" : "Schedule task params", - "$ref" : "#/definitions/JsonNode" + "memSizeGB" : { + "type" : "number", + "format" : "double", + "description" : "Memory size of an instance" }, - "taskType" : { - "type" : "string", - "description" : "Type of the task to be schedules", - "enum" : [ "CloudBootstrap", "CloudCleanup", "CreateCassandraTable", "CreateUniverse", "ReadOnlyClusterCreate", "ReadOnlyClusterDelete", "CreateKubernetesUniverse", "DestroyUniverse", "PauseUniverse", "ResumeUniverse", "DestroyKubernetesUniverse", "DeleteTable", "BackupUniverse", "MultiTableBackup", "EditUniverse", "EditKubernetesUniverse", "KubernetesProvision", "ImportIntoTable", "UpgradeUniverse", "CreateRootVolumes", "ReplaceRootVolume", "ChangeInstanceType", "PersistResizeNode", "UpdateNodeDetails", "UpgradeKubernetesUniverse", "DeleteNodeFromUniverse", "StopNodeInUniverse", "StartNodeInUniverse", "AddNodeToUniverse", "RemoveNodeFromUniverse", "ReleaseInstanceFromUniverse", "SetUniverseKey", "SetKubernetesUniverseKey", "CreateKMSConfig", "DeleteKMSConfig", "UpdateDiskSize", "StartMasterOnNode", "SyncDBStateWithPlatform", "AnsibleClusterServerCtl", "AnsibleConfigureServers", "AnsibleDestroyServer", "PauseServer", "ResumeServer", "AnsibleSetupServer", "PrecheckNode", "AnsibleUpdateNodeInfo", "BulkImport", "ChangeMasterConfig", "CreateTable", "DeleteNode", "DeleteBackup", "UpdateNodeProcess", "DeleteTableFromUniverse", "LoadBalancerStateChange", "ModifyBlackList", "ManipulateDnsRecordTask", "RemoveUniverseEntry", "SetFlagInMemory", "SetNodeState", "SwamperTargetsFileUpdate", "UniverseUpdateSucceeded", "UpdateAndPersistGFlags", "UpdatePlacementInfo", "UpdateSoftwareVersion", "WaitForDataMove", "WaitForLoadBalance", "WaitForMasterLeader", "WaitForServer", "WaitForTServerHeartBeats", "DeleteClusterFromUniverse", "InstanceActions", "WaitForServerReady", "CloudAccessKeyCleanup", "CloudAccessKeySetup", "CloudInitializer", "CloudProviderCleanup", "CloudRegionCleanup", "CloudRegionSetup", "CloudSetup", "BackupTable", "BackupUniverseKeys", "RestoreUniverseKeys", "WaitForLeadersOnPreferredOnly", "EnableEncryptionAtRest", "DisableEncryptionAtRest", "DestroyEncryptionAtRest", "KubernetesCommandExecutor", "KubernetesWaitForPod", "KubernetesCheckNumPod", "CopyEncryptionKeyFile", "WaitForEncryptionKeyInMemory", "UnivSetCertificate", "CreateAlertDefinitions", "UniverseSetTlsParams", "AsyncReplicationPlatformSync", "ResetUniverseVersion" ] + "instanceTypeDetails" : { + "$ref" : "#/definitions/InstanceTypeDetails" }, - "status" : { - "type" : "string", - "description" : "Status of the task", - "readOnly" : true, - "enum" : [ "Active", "Paused", "Stopped" ] + "instanceTypeCode" : { + "type" : "string" }, - "cronExpression" : { + "providerCode" : { + "type" : "string" + }, + "providerUuid" : { "type" : "string", - "description" : "Cron expression for schedule" + "format" : "uuid" } }, - "description" : "Scheduled backup" + "description" : "Instance type model which holds the information about the instance." }, - "Metrics" : { + "InstanceTypeDetails" : { "type" : "object", - "required" : [ "metrics", "start" ], + "required" : [ "tenancy", "volumeDetailsList" ], "properties" : { - "metrics" : { + "volumeDetailsList" : { "type" : "array", - "description" : "metrics", "items" : { - "type" : "string" + "$ref" : "#/definitions/VolumeDetails" } }, - "start" : { - "type" : "integer", - "format" : "int64", - "description" : "Start time" - }, - "end" : { - "type" : "integer", - "format" : "int64", - "description" : "End time" - }, - "nodePrefix" : { - "type" : "string", - "description" : "Node prefix" - }, - "nodeName" : { + "tenancy" : { "type" : "string", - "description" : "Node name" + "enum" : [ "Shared", "Dedicated", "Host" ] } - }, - "description" : "Metrics details" + } }, - "Alert Detail" : { + "InstanceTypeKey" : { "type" : "object", + "required" : [ "instanceTypeCode", "providerUuid" ], "properties" : { - "alertingEmail" : { + "providerUuid" : { "type" : "string", - "example" : "test@gmail.com", - "description" : "Alert email id" - }, - "sendAlertsToYb" : { - "type" : "boolean", - "description" : "Is alert has sent to YB" - }, - "checkIntervalMs" : { - "type" : "integer", - "format" : "int64", - "description" : "Alert interval" - }, - "statusUpdateIntervalMs" : { - "type" : "integer", - "format" : "int64", - "description" : "Status update of alert interval" - }, - "reportOnlyErrors" : { - "type" : "boolean", - "description" : "Is alert is just for error" - }, - "reportBackupFailures" : { - "type" : "boolean", - "description" : "Is alert needed for backup failure" + "format" : "uuid" }, - "enableClockSkew" : { - "type" : "boolean", - "description" : "Is Clock skew is enabled" + "instanceTypeCode" : { + "type" : "string" } - }, - "description" : "Alerts associated with customers" + } }, - "Customer Detail" : { + "Provider" : { "type" : "object", - "required" : [ "code", "name" ], + "required" : [ "hostedZoneId", "hostedZoneName", "regions" ], "properties" : { "uuid" : { "type" : "string", - "description" : "User uuid", + "format" : "uuid", + "description" : "Provide uuid", "readOnly" : true }, "code" : { "type" : "string", - "example" : "admin", - "description" : "Customer code" + "description" : "Cloud Provider code" }, "name" : { "type" : "string", - "example" : "sridhar", - "description" : "Name of customer" + "description" : "Cloud Provider code" }, - "creationDate" : { - "type" : "string", - "format" : "date-time", - "example" : "2021-06-17 15:00:05", - "description" : "Creation time", + "active" : { + "type" : "boolean", + "description" : "Cloud Provider code", "readOnly" : true }, - "features" : { - "description" : "Features", - "readOnly" : true, - "$ref" : "#/definitions/JsonNode" + "customerUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "Cloud Provider code", + "readOnly" : true }, - "universeUUIDs" : { + "regions" : { "type" : "array", - "example" : "[\"c3595ca7-68a3-47f0-b1b2-1725886d5ed5\", \"9e0bb733-556c-4935-83dd-6b742a2c32e6\"]", - "description" : "Associated Universe Id's", - "readOnly" : true, "items" : { - "type" : "string", - "format" : "uuid" + "$ref" : "#/definitions/Region" } }, - "customerId" : { - "type" : "integer", - "format" : "int32", - "description" : "Customer id", - "readOnly" : true - }, - "alertingData" : { - "description" : "Alerts", - "readOnly" : true, - "$ref" : "#/definitions/Alert Detail" - }, - "smtpData" : { - "description" : "SMTP", - "readOnly" : true, - "$ref" : "#/definitions/Smtp Data" - }, - "callhomeLevel" : { - "type" : "string", - "example" : "MEDIUM", - "description" : "Call home level", - "readOnly" : true - } - }, - "description" : "Customers features and Universe UUID." - }, - "Smtp Data" : { - "type" : "object", - "properties" : { - "smtpServer" : { - "type" : "string", - "example" : "smtp.gmail.com", - "description" : "SMTP server" - }, - "smtpPort" : { - "type" : "integer", - "format" : "int32", - "example" : 465, - "description" : "SMTP port number" - }, - "emailFrom" : { + "keyPairName" : { "type" : "string", - "example" : "test@gmail.com", - "description" : "SMTP email id" + "description" : "Transient property - only present in mutate API request" }, - "smtpUsername" : { + "sshPrivateKeyContent" : { "type" : "string", - "example" : "testsmtp", - "description" : "SMTP email username" + "description" : "Transient property - only present in mutate API request" }, - "smtpPassword" : { + "sshUser" : { "type" : "string", - "example" : "XurenRknsc", - "description" : "SMTP password" - }, - "useSSL" : { - "type" : "boolean", - "example" : true, - "description" : "Use SMTP SSL" + "description" : "Transient property - only present in mutate API request" }, - "useTLS" : { + "airGapInstall" : { "type" : "boolean", - "example" : false, - "description" : "Use SMTP TLS" - } - }, - "description" : "Customers SMTP data." - }, - "Customer" : { - "type" : "object", - "required" : [ "code", "name" ], - "properties" : { - "uuid" : { - "type" : "string", - "format" : "uuid", - "description" : "Customer uuid", - "readOnly" : true + "description" : "Transient property - only present in mutate API request" }, - "code" : { - "type" : "string", - "example" : "admin", - "description" : "Customer code" + "sshPort" : { + "type" : "integer", + "format" : "int32", + "description" : "Transient property - only present in mutate API request" }, - "name" : { + "hostVpcId" : { "type" : "string", - "example" : "sridhar", - "description" : "Name of customer" + "description" : "Transient property - only present in mutate API request" }, - "creationDate" : { + "hostVpcRegion" : { "type" : "string", - "format" : "date-time", - "example" : "2021-06-17 15:00:05", - "description" : "Creation time", - "readOnly" : true - }, - "features" : { - "description" : "Features", - "readOnly" : true, - "$ref" : "#/definitions/JsonNode" + "description" : "Transient property - only present in mutate API request" }, - "universeUUIDs" : { + "customHostCidrs" : { "type" : "array", - "example" : "[\"c3595ca7-68a3-47f0-b1b2-1725886d5ed5\", \"9e0bb733-556c-4935-83dd-6b742a2c32e6\"]", - "description" : "Universe UUIDs", - "readOnly" : true, - "uniqueItems" : true, + "description" : "Transient property - only present in mutate API request", "items" : { - "type" : "string", - "format" : "uuid" + "type" : "string" } }, - "customerId" : { - "type" : "integer", - "format" : "int64", - "example" : 1, - "description" : "Customer id", - "readOnly" : true + "destVpcId" : { + "type" : "string", + "description" : "Transient property - only present in mutate API request" + }, + "hostedZoneName" : { + "type" : "string" + }, + "hostedZoneId" : { + "type" : "string" + }, + "config" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } } - }, - "description" : "Customers features and Universe UUID." + } }, - "Alerts" : { + "Region" : { "type" : "object", - "required" : [ "alertingData", "callhomeLevel", "smtpData" ], + "required" : [ "details", "securityGroupId", "vnetName", "zones" ], "properties" : { - "code" : { + "uuid" : { "type" : "string", - "description" : "Alert code" + "format" : "uuid", + "description" : "Region uuid", + "readOnly" : true }, - "email" : { + "code" : { "type" : "string", - "example" : "test@gmail.com", - "description" : "Alert email" + "example" : "us-west-2", + "description" : "Cloud provider region code", + "readOnly" : true }, - "password" : { + "name" : { "type" : "string", - "example" : "XurenRknsc", - "description" : "Email password" + "example" : "TODO", + "description" : "Cloud provider region name" }, - "confirmPassword" : { + "ybImage" : { "type" : "string", - "example" : "XurenRknsc", - "description" : "Email password" + "example" : "TODO", + "description" : "The AMI to be used in this region." }, - "name" : { - "type" : "string", - "example" : "Test alert", - "description" : "Alert name" + "longitude" : { + "type" : "number", + "format" : "double", + "example" : -120.01, + "description" : "Longitude of this region", + "readOnly" : true }, - "features" : { - "type" : "object", - "description" : "Feature", - "additionalProperties" : { - "type" : "object" + "latitude" : { + "type" : "number", + "format" : "double", + "example" : 37.22, + "description" : "Latitude of this region", + "readOnly" : true + }, + "zones" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/AvailabilityZone" } }, - "alertingData" : { - "$ref" : "#/definitions/Alert Detail" + "details" : { + "$ref" : "#/definitions/RegionDetails" }, - "smtpData" : { - "$ref" : "#/definitions/Smtp Data" + "securityGroupId" : { + "type" : "string" }, - "callhomeLevel" : { + "vnetName" : { "type" : "string" + }, + "config" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } } }, - "description" : "Alerts associated with customers" + "description" : "Region within a given provider. Typically this will map to a single cloud provider region" }, - "FeatureUpdateFormData" : { + "RegionDetails" : { "type" : "object", - "required" : [ "features" ], + "required" : [ "sg_id", "vnet" ], "properties" : { - "features" : { - "$ref" : "#/definitions/JsonNode" + "sg_id" : { + "type" : "string" + }, + "vnet" : { + "type" : "string" } } }, - "AvailabilityZone" : { + "VolumeDetails" : { "type" : "object", - "required" : [ "name" ], + "required" : [ "mountPath", "volumeSizeGB", "volumeType" ], "properties" : { - "uuid" : { - "type" : "string", - "format" : "uuid", - "description" : "AZ uuid", - "readOnly" : true - }, - "code" : { - "type" : "string", - "example" : "AWS", - "description" : "AZ code" + "volumeSizeGB" : { + "type" : "integer", + "format" : "int32" }, - "name" : { + "volumeType" : { "type" : "string", - "example" : "south-east-1", - "description" : "AZ name" + "enum" : [ "EBS", "SSD", "HDD", "NVME" ] }, - "active" : { + "mountPath" : { + "type" : "string" + } + } + }, + "YWSuccess" : { + "type" : "object", + "properties" : { + "success" : { "type" : "boolean", - "description" : "AZ is active or not", + "description" : "Has API success", "readOnly" : true }, - "subnet" : { + "message" : { "type" : "string", - "example" : "subnet id", - "description" : "AZ Subnet" + "description" : "API response mssage.", + "readOnly" : true + } + } + }, + "YWResults" : { + "type" : "object" + }, + "Generic error response from Yugawware Platform API" : { + "type" : "object", + "required" : [ "success" ], + "properties" : { + "success" : { + "type" : "boolean" }, - "kubeconfigPath" : { + "error" : { "type" : "string", - "description" : "Kubernetes Config path", - "readOnly" : true + "example" : "There was a problem creating universe", + "description" : "User visible unstructurred error message" } - }, - "description" : "Availability Zone of regions." + } }, - "Provider" : { + "CustomerLoginFormData" : { "type" : "object", - "required" : [ "hostedZoneId", "hostedZoneName", "regions" ], + "required" : [ "email", "password" ], "properties" : { - "uuid" : { + "email" : { + "type" : "string" + }, + "password" : { + "type" : "string" + } + } + }, + "Customer Task Data" : { + "type" : "object", + "properties" : { + "id" : { "type" : "string", "format" : "uuid", - "description" : "Provide uuid", - "readOnly" : true + "description" : "Customer Task UUID" }, - "code" : { + "title" : { "type" : "string", - "description" : "Cloud Provider code" + "example" : "Deleted Universe : test-universe", + "description" : "Customer Task title" }, - "name" : { + "percentComplete" : { + "type" : "integer", + "format" : "int32", + "example" : 100, + "description" : "Customer Task percentage completed" + }, + "createTime" : { "type" : "string", - "description" : "Cloud Provider code" + "format" : "date-time", + "example" : "1624295417405", + "description" : "Customer Task creation time" }, - "active" : { - "type" : "boolean", - "description" : "Cloud Provider code", - "readOnly" : true + "completionTime" : { + "type" : "string", + "format" : "date-time", + "example" : "1624295417405", + "description" : "Customer Task completion time" }, - "customerUUID" : { + "target" : { "type" : "string", - "format" : "uuid", - "description" : "Cloud Provider code", - "readOnly" : true + "example" : "Universe", + "description" : "Customer Task target" }, - "regions" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Region" - } + "targetUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "Customer Task target UUID" }, - "keyPairName" : { + "type" : { "type" : "string", - "description" : "Transient property - only present in mutate API request" + "example" : "Delete", + "description" : "Customer Task type" }, - "sshPrivateKeyContent" : { + "status" : { "type" : "string", - "description" : "Transient property - only present in mutate API request" + "example" : "Complete", + "description" : "Customer Task status" + } + }, + "description" : "Customer Task data" + }, + "UniverseResp" : { + "type" : "object", + "properties" : { + "universeUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "Universe UUID" }, - "sshUser" : { + "name" : { "type" : "string", - "description" : "Transient property - only present in mutate API request" + "description" : "Universe name" }, - "airGapInstall" : { - "type" : "boolean", - "description" : "Transient property - only present in mutate API request" + "creationDate" : { + "type" : "string", + "description" : "Creation time" }, - "sshPort" : { + "version" : { "type" : "integer", "format" : "int32", - "description" : "Transient property - only present in mutate API request" + "description" : "Version" }, - "hostVpcId" : { + "dnsName" : { "type" : "string", - "description" : "Transient property - only present in mutate API request" + "description" : "DNS name" }, - "hostVpcRegion" : { - "type" : "string", - "description" : "Transient property - only present in mutate API request" + "resources" : { + "type" : "object", + "description" : "Universe Resources", + "additionalProperties" : { + "type" : "object" + } }, - "customHostCidrs" : { - "type" : "array", - "description" : "Transient property - only present in mutate API request", - "items" : { + "universeDetails" : { + "type" : "object", + "description" : "Universe Details", + "additionalProperties" : { + "type" : "object" + } + }, + "universeConfig" : { + "type" : "object", + "description" : "Universe config", + "additionalProperties" : { "type" : "string" } }, - "destVpcId" : { + "taskUUID" : { "type" : "string", - "description" : "Transient property - only present in mutate API request" + "format" : "uuid", + "description" : "Task UUID" }, - "hostedZoneName" : { - "type" : "string" + "sampleAppCommandTxt" : { + "type" : "string", + "description" : "Sample command" }, + "pricePerHour" : { + "type" : "number", + "format" : "double", + "description" : "Price" + } + }, + "description" : "Universe Resp" + }, + "EditProviderRequest" : { + "type" : "object", + "required" : [ "config", "hostedZoneId" ], + "properties" : { "hostedZoneId" : { "type" : "string" }, @@ -6159,59 +5846,74 @@ } } }, - "Region" : { + "KubernetesProviderFormData" : { "type" : "object", - "required" : [ "details", "securityGroupId", "vnetName", "zones" ], + "required" : [ "code", "config", "name", "region", "regionList" ], "properties" : { - "uuid" : { - "type" : "string", - "format" : "uuid", - "description" : "Region uuid", - "readOnly" : true - }, "code" : { "type" : "string", - "example" : "us-west-2", - "description" : "Cloud provider region code", - "readOnly" : true + "enum" : [ "unknown", "aws", "gcp", "azu", "docker", "onprem", "kubernetes", "local", "other" ] }, "name" : { - "type" : "string", - "example" : "TODO", - "description" : "Cloud provider region name" + "type" : "string" }, - "ybImage" : { - "type" : "string", - "example" : "TODO", - "description" : "The AMI to be used in this region." + "config" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } }, - "longitude" : { - "type" : "number", - "format" : "double", - "example" : -120.01, - "description" : "Longitude of this region", - "readOnly" : true + "region" : { + "type" : "string" + }, + "regionList" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/RegionData" + } + } + } + }, + "RegionData" : { + "type" : "object", + "required" : [ "code", "config", "latitude", "longitude", "name", "zoneList" ], + "properties" : { + "code" : { + "type" : "string" + }, + "name" : { + "type" : "string" }, "latitude" : { "type" : "number", - "format" : "double", - "example" : 37.22, - "description" : "Latitude of this region", - "readOnly" : true + "format" : "double" }, - "zones" : { + "longitude" : { + "type" : "number", + "format" : "double" + }, + "zoneList" : { "type" : "array", "items" : { - "$ref" : "#/definitions/AvailabilityZone" + "$ref" : "#/definitions/ZoneData" } }, - "details" : { - "$ref" : "#/definitions/RegionDetails" - }, - "securityGroupId" : { + "config" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } + } + } + }, + "ZoneData" : { + "type" : "object", + "required" : [ "code", "config", "name" ], + "properties" : { + "code" : { "type" : "string" }, - "vnetName" : { + "name" : { "type" : "string" }, "config" : { @@ -6220,1006 +5922,1037 @@ "type" : "string" } } - }, - "description" : "Region within a given provider. Typically this will map to a single cloud provider region" + } }, - "RegionDetails" : { + "ImportUniverseFormData" : { "type" : "object", - "required" : [ "sg_id", "vnet" ], + "required" : [ "cloudName", "cloudProviderType", "currentState", "instanceType", "masterAddresses", "providerType", "regionCode", "regionName", "replicationFactor", "singleStep", "universeName", "universeUUID", "zoneCode", "zoneName" ], "properties" : { - "sg_id" : { + "universeName" : { "type" : "string" }, - "vnet" : { + "masterAddresses" : { + "type" : "string" + }, + "cloudProviderType" : { + "type" : "string" + }, + "currentState" : { + "type" : "string", + "enum" : [ "BEGIN", "IMPORTED_MASTERS", "IMPORTED_TSERVERS", "FINISHED" ] + }, + "singleStep" : { + "type" : "boolean" + }, + "universeUUID" : { + "type" : "string", + "format" : "uuid" + }, + "cloudName" : { + "type" : "string" + }, + "providerType" : { + "type" : "string", + "enum" : [ "unknown", "aws", "gcp", "azu", "docker", "onprem", "kubernetes", "local", "other" ] + }, + "regionName" : { + "type" : "string" + }, + "regionCode" : { + "type" : "string" + }, + "zoneName" : { + "type" : "string" + }, + "zoneCode" : { + "type" : "string" + }, + "instanceType" : { "type" : "string" + }, + "replicationFactor" : { + "type" : "integer", + "format" : "int32" } } }, - "EditProviderRequest" : { + "Cloud specific info" : { "type" : "object", - "required" : [ "config", "hostedZoneId" ], "properties" : { - "hostedZoneId" : { - "type" : "string" + "private_ip" : { + "type" : "string", + "description" : "Private IP" }, - "config" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } + "public_ip" : { + "type" : "string", + "description" : "Public IP" + }, + "public_dns" : { + "type" : "string", + "description" : "Public DNS" + }, + "private_dns" : { + "type" : "string", + "description" : "Private DNS" + }, + "instance_type" : { + "type" : "string", + "description" : "Instance type" + }, + "subnet_id" : { + "type" : "string", + "description" : "Subnet IP" + }, + "az" : { + "type" : "string", + "description" : "AZ" + }, + "region" : { + "type" : "string", + "description" : "Region" + }, + "cloud" : { + "type" : "string", + "description" : "Cloud" + }, + "assignPublicIP" : { + "type" : "boolean", + "description" : "Public IP assigned" + }, + "useTimeSync" : { + "type" : "boolean", + "description" : "Is use time sync enable" + }, + "mount_roots" : { + "type" : "string", + "description" : "Mount roots" + } + }, + "description" : "Cloud specific information" + }, + "MasterNode" : { + "type" : "object", + "required" : [ "cloudInfo", "masterRpcPort" ], + "properties" : { + "cloudInfo" : { + "$ref" : "#/definitions/Cloud specific info" + }, + "masterRpcPort" : { + "type" : "integer", + "format" : "int32" } } }, - "KubernetesProviderFormData" : { + "MastersList" : { "type" : "object", - "required" : [ "code", "config", "name", "region", "regionList" ], + "required" : [ "masters" ], "properties" : { - "code" : { - "type" : "string", - "enum" : [ "unknown", "aws", "gcp", "azu", "docker", "onprem", "kubernetes", "local", "other" ] - }, - "name" : { - "type" : "string" - }, - "config" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } - }, - "region" : { - "type" : "string" - }, - "regionList" : { + "masters" : { "type" : "array", "items" : { - "$ref" : "#/definitions/RegionData" + "$ref" : "#/definitions/MasterNode" } } } }, - "RegionData" : { + "JsonNode" : { "type" : "object", - "required" : [ "code", "config", "latitude", "longitude", "name", "zoneList" ], + "required" : [ "array", "bigDecimal", "bigInteger", "binary", "boolean", "containerNode", "double", "float", "floatingPointNumber", "int", "integralNumber", "long", "missingNode", "nodeType", "null", "number", "object", "pojo", "short", "textual", "valueNode" ], "properties" : { - "code" : { - "type" : "string" + "float" : { + "type" : "boolean" }, - "name" : { - "type" : "string" + "nodeType" : { + "type" : "string", + "enum" : [ "ARRAY", "BINARY", "BOOLEAN", "MISSING", "NULL", "NUMBER", "OBJECT", "POJO", "STRING" ] }, - "latitude" : { - "type" : "number", - "format" : "double" + "object" : { + "type" : "boolean" }, - "longitude" : { - "type" : "number", - "format" : "double" + "valueNode" : { + "type" : "boolean" }, - "zoneList" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/ZoneData" - } + "containerNode" : { + "type" : "boolean" }, - "config" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } - } - } - }, - "ZoneData" : { - "type" : "object", - "required" : [ "code", "config", "name" ], - "properties" : { - "code" : { - "type" : "string" + "missingNode" : { + "type" : "boolean" }, - "name" : { - "type" : "string" + "pojo" : { + "type" : "boolean" }, - "config" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } + "number" : { + "type" : "boolean" + }, + "integralNumber" : { + "type" : "boolean" + }, + "floatingPointNumber" : { + "type" : "boolean" + }, + "short" : { + "type" : "boolean" + }, + "int" : { + "type" : "boolean" + }, + "long" : { + "type" : "boolean" + }, + "double" : { + "type" : "boolean" + }, + "bigDecimal" : { + "type" : "boolean" + }, + "bigInteger" : { + "type" : "boolean" + }, + "textual" : { + "type" : "boolean" + }, + "boolean" : { + "type" : "boolean" + }, + "binary" : { + "type" : "boolean" + }, + "array" : { + "type" : "boolean" + }, + "null" : { + "type" : "boolean" } } }, - "YWTask" : { + "Schedule" : { "type" : "object", "properties" : { - "taskUUID" : { + "scheduleUUID" : { "type" : "string", "format" : "uuid", - "description" : "Task UUID", + "description" : "Schedule UUID", "readOnly" : true }, - "resourceUUID" : { + "customerUUID" : { "type" : "string", "format" : "uuid", - "description" : "UUID of the resource being modified by the task", + "description" : "Customer uuid", "readOnly" : true - } - } - }, - "UniverseResp" : { - "type" : "object", - "properties" : { - "universeUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Universe UUID" - }, - "name" : { - "type" : "string", - "description" : "Universe name" - }, - "creationDate" : { - "type" : "string", - "description" : "Creation time" }, - "version" : { + "failureCount" : { "type" : "integer", "format" : "int32", - "description" : "Version" - }, - "dnsName" : { - "type" : "string", - "description" : "DNS name" - }, - "resources" : { - "type" : "object", - "description" : "Universe Resources", - "additionalProperties" : { - "type" : "object" - } + "description" : "Number of failed schedule", + "readOnly" : true }, - "universeDetails" : { - "type" : "object", - "description" : "Universe Details", - "additionalProperties" : { - "type" : "object" - } + "frequency" : { + "type" : "integer", + "format" : "int64", + "description" : "Frequency of the schedule" }, - "universeConfig" : { - "type" : "object", - "description" : "Universe config", - "additionalProperties" : { - "type" : "string" - } + "taskParams" : { + "description" : "Schedule task params", + "$ref" : "#/definitions/JsonNode" }, - "taskUUID" : { + "taskType" : { "type" : "string", - "format" : "uuid", - "description" : "Task UUID" + "description" : "Type of the task to be schedules", + "enum" : [ "CloudBootstrap", "CloudCleanup", "CreateCassandraTable", "CreateUniverse", "ReadOnlyClusterCreate", "ReadOnlyClusterDelete", "CreateKubernetesUniverse", "DestroyUniverse", "PauseUniverse", "ResumeUniverse", "DestroyKubernetesUniverse", "DeleteTable", "BackupUniverse", "MultiTableBackup", "EditUniverse", "EditKubernetesUniverse", "KubernetesProvision", "ImportIntoTable", "UpgradeUniverse", "CreateRootVolumes", "ReplaceRootVolume", "ChangeInstanceType", "PersistResizeNode", "UpdateNodeDetails", "UpgradeKubernetesUniverse", "DeleteNodeFromUniverse", "StopNodeInUniverse", "StartNodeInUniverse", "AddNodeToUniverse", "RemoveNodeFromUniverse", "ReleaseInstanceFromUniverse", "SetUniverseKey", "SetKubernetesUniverseKey", "CreateKMSConfig", "DeleteKMSConfig", "UpdateDiskSize", "StartMasterOnNode", "SyncDBStateWithPlatform", "AnsibleClusterServerCtl", "AnsibleConfigureServers", "AnsibleDestroyServer", "PauseServer", "ResumeServer", "AnsibleSetupServer", "PrecheckNode", "AnsibleUpdateNodeInfo", "BulkImport", "ChangeMasterConfig", "CreateTable", "DeleteNode", "DeleteBackup", "UpdateNodeProcess", "DeleteTableFromUniverse", "LoadBalancerStateChange", "ModifyBlackList", "ManipulateDnsRecordTask", "RemoveUniverseEntry", "SetFlagInMemory", "SetNodeState", "SwamperTargetsFileUpdate", "UniverseUpdateSucceeded", "UpdateAndPersistGFlags", "UpdatePlacementInfo", "UpdateSoftwareVersion", "WaitForDataMove", "WaitForLoadBalance", "WaitForMasterLeader", "WaitForServer", "WaitForTServerHeartBeats", "DeleteClusterFromUniverse", "InstanceActions", "WaitForServerReady", "CloudAccessKeyCleanup", "CloudAccessKeySetup", "CloudInitializer", "CloudProviderCleanup", "CloudRegionCleanup", "CloudRegionSetup", "CloudSetup", "BackupTable", "BackupUniverseKeys", "RestoreUniverseKeys", "WaitForLeadersOnPreferredOnly", "EnableEncryptionAtRest", "DisableEncryptionAtRest", "DestroyEncryptionAtRest", "KubernetesCommandExecutor", "KubernetesWaitForPod", "KubernetesCheckNumPod", "CopyEncryptionKeyFile", "WaitForEncryptionKeyInMemory", "UnivSetCertificate", "CreateAlertDefinitions", "UniverseSetTlsParams", "AsyncReplicationPlatformSync", "ResetUniverseVersion" ] }, - "sampleAppCommandTxt" : { + "status" : { "type" : "string", - "description" : "Sample command" + "description" : "Status of the task", + "readOnly" : true, + "enum" : [ "Active", "Paused", "Stopped" ] }, - "pricePerHour" : { - "type" : "number", - "format" : "double", - "description" : "Price" + "cronExpression" : { + "type" : "string", + "description" : "Cron expression for schedule" } }, - "description" : "Universe Resp" + "description" : "Scheduled backup" }, - "Alert" : { + "Availability Zones" : { "type" : "object", - "required" : [ "labels" ], + "required" : [ "code", "name" ], "properties" : { - "uuid" : { - "type" : "string", - "format" : "uuid", - "description" : "Alert uuid", - "readOnly" : true - }, - "customerUUID" : { + "code" : { "type" : "string", - "format" : "uuid", - "description" : "Cutomer uuid", - "readOnly" : true + "description" : "Az code" }, - "createTime" : { + "name" : { "type" : "string", - "format" : "date-time", - "description" : "Create Date time info.", - "readOnly" : true + "description" : "Az name" }, - "acknowledgedTime" : { + "subnet" : { "type" : "string", - "format" : "date-time", - "description" : "Acknowledge Date time info.", - "readOnly" : true + "description" : "Az subnet" + } + }, + "description" : "Availability Zones." + }, + "AvailabilityZoneFormData" : { + "type" : "object", + "required" : [ "availabilityZones" ], + "properties" : { + "availabilityZones" : { + "type" : "array", + "description" : "Availability zones", + "items" : { + "$ref" : "#/definitions/Availability Zones" + } + } + } + }, + "AsyncReplicationConfig" : { + "type" : "object", + "required" : [ "active", "sourceTableID", "sourceUniverseUUID", "targetTableID", "targetUniverseUUID" ], + "properties" : { + "sourceTableID" : { + "type" : "string" }, - "resolvedTime" : { + "sourceUniverseUUID" : { "type" : "string", - "format" : "date-time", - "description" : "Resolved Date time info.", - "readOnly" : true + "format" : "uuid" }, - "errCode" : { + "targetTableID" : { + "type" : "string" + }, + "targetUniverseUUID" : { "type" : "string", - "description" : "Error Code.", - "readOnly" : true + "format" : "uuid" }, - "severity" : { + "active" : { + "type" : "boolean" + } + } + }, + "Column details" : { + "type" : "object", + "properties" : { + "columnOrder" : { + "type" : "integer", + "format" : "int32", + "description" : "Column order" + }, + "name" : { "type" : "string", - "description" : "Alert definition group serverity.", - "readOnly" : true, - "enum" : [ "SEVERE", "WARNING" ] + "description" : "Column name" }, - "message" : { + "type" : { "type" : "string", - "description" : "Alert Message.", - "readOnly" : true + "description" : "Column type", + "enum" : [ "TINYINT", "SMALLINT", "INT", "BIGINT", "VARCHAR", "BOOLEAN", "FLOAT", "DOUBLE_PRECISION", "BLOB", "TIMESTAMP", "DECIMAL", "VARINT", "INET", "LIST", "MAP", "SET", "UUID", "TIMEUUID", "FROZEN", "DATE", "TIME", "JSONB", "USER_DEFINED_TYPE" ] }, - "state" : { + "keyType" : { "type" : "string", - "description" : "Alert State.", - "readOnly" : true, - "enum" : [ "CREATED", "ACTIVE", "ACKNOWLEDGED", "RESOLVED" ] + "description" : "Column key type", + "enum" : [ "TINYINT", "SMALLINT", "INT", "BIGINT", "VARCHAR", "BOOLEAN", "FLOAT", "DOUBLE_PRECISION", "BLOB", "TIMESTAMP", "DECIMAL", "VARINT", "INET", "LIST", "MAP", "SET", "UUID", "TIMEUUID", "FROZEN", "DATE", "TIME", "JSONB", "USER_DEFINED_TYPE" ] }, - "targetState" : { + "valueType" : { "type" : "string", - "description" : "Target State.", - "readOnly" : true, - "enum" : [ "CREATED", "ACTIVE", "ACKNOWLEDGED", "RESOLVED" ] + "description" : "Column value name", + "enum" : [ "TINYINT", "SMALLINT", "INT", "BIGINT", "VARCHAR", "BOOLEAN", "FLOAT", "DOUBLE_PRECISION", "BLOB", "TIMESTAMP", "DECIMAL", "VARINT", "INET", "LIST", "MAP", "SET", "UUID", "TIMEUUID", "FROZEN", "DATE", "TIME", "JSONB", "USER_DEFINED_TYPE" ] }, - "sendEmail" : { + "isPartitionKey" : { "type" : "boolean", - "description" : "Whether to send an Email or not.", - "readOnly" : true - }, - "definitionUuid" : { - "type" : "string", - "format" : "uuid", - "description" : "Alert Definition Uuid", - "readOnly" : true + "description" : "True if this column is a partition key" }, - "groupUuid" : { - "type" : "string", - "format" : "uuid", - "description" : "Alert group Uuid", - "readOnly" : true + "isClusteringKey" : { + "type" : "boolean", + "description" : "True if this column is a clustering key" }, - "groupType" : { + "sortOrder" : { "type" : "string", - "description" : "Alert definition group type", - "readOnly" : true, - "enum" : [ "CUSTOMER", "UNIVERSE" ] - }, - "labels" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/AlertLabel" - } + "description" : "SortOrder for this column", + "enum" : [ "NONE", "ASC", "DESC" ] } }, - "description" : "Alert information. which is used to send alert notification." + "description" : "Column details" }, - "AlertLabel" : { + "Communication ports" : { "type" : "object", - "required" : [ "key", "name", "value" ], "properties" : { - "key" : { - "$ref" : "#/definitions/AlertLabelKey" + "masterHttpPort" : { + "type" : "integer", + "format" : "int32", + "description" : "HTTP port for master table" }, - "value" : { - "type" : "string" + "masterRpcPort" : { + "type" : "integer", + "format" : "int32", + "description" : "RCP port for master table" }, - "name" : { - "type" : "string" - } - } - }, - "AlertLabelKey" : { - "type" : "object", - "required" : [ "name" ], - "properties" : { - "name" : { - "type" : "string" + "tserverHttpPort" : { + "type" : "integer", + "format" : "int32", + "description" : "HTTP port for tserver" + }, + "tserverRpcPort" : { + "type" : "integer", + "format" : "int32", + "description" : "RPC port for tserver" + }, + "redisServerHttpPort" : { + "type" : "integer", + "format" : "int32", + "description" : "HTTP port for redis" + }, + "redisServerRpcPort" : { + "type" : "integer", + "format" : "int32", + "description" : "RPC port for redis" + }, + "yqlServerHttpPort" : { + "type" : "integer", + "format" : "int32", + "description" : "HTTP port for yql" + }, + "yqlServerRpcPort" : { + "type" : "integer", + "format" : "int32", + "description" : "RPC port for yql" + }, + "ysqlServerHttpPort" : { + "type" : "integer", + "format" : "int32", + "description" : "HTTP port for ysql" + }, + "ysqlServerRpcPort" : { + "type" : "integer", + "format" : "int32", + "description" : "RPC port for ysql" + }, + "nodeExporterPort" : { + "type" : "integer", + "format" : "int32", + "description" : "Node exporter port" } - } + }, + "description" : "Communication ports" }, - "AlertApiFilter" : { + "Device info" : { "type" : "object", - "required" : [ "groupType", "groupUuid", "severity", "states", "targetStates", "uuids" ], "properties" : { - "uuids" : { - "type" : "array", - "uniqueItems" : true, - "items" : { - "type" : "string", - "format" : "uuid" - } + "volumeSize" : { + "type" : "integer", + "format" : "int32", + "description" : "he size of each volume in each instance" }, - "groupUuid" : { - "type" : "string", - "format" : "uuid" + "numVolumes" : { + "type" : "integer", + "format" : "int32", + "description" : "Number of volumes to be mounted on this instance at the default path" }, - "severity" : { - "type" : "string", - "enum" : [ "SEVERE", "WARNING" ] + "diskIops" : { + "type" : "integer", + "format" : "int32", + "description" : "Desired iops for the volumes mounted on this instance" }, - "groupType" : { + "throughput" : { + "type" : "integer", + "format" : "int32", + "description" : "Desired throughput for the volumes mounted on this instance" + }, + "storageClass" : { "type" : "string", - "enum" : [ "CUSTOMER", "UNIVERSE" ] + "description" : "Name of storage class" }, - "states" : { - "type" : "array", - "uniqueItems" : true, - "items" : { - "type" : "string", - "enum" : [ "CREATED", "ACTIVE", "ACKNOWLEDGED", "RESOLVED" ] - } + "mountPoints" : { + "type" : "string", + "description" : "Comma separated list of mount points for the devices in each instance" }, - "targetStates" : { - "type" : "array", - "uniqueItems" : true, - "items" : { - "type" : "string", - "enum" : [ "CREATED", "ACTIVE", "ACKNOWLEDGED", "RESOLVED" ] - } + "storageType" : { + "type" : "string", + "description" : "The type of storage used for this instance", + "enum" : [ "IO1", "GP2", "GP3", "Scratch", "Persistent", "StandardSSD_LRS", "Premium_LRS", "UltraSSD_LRS" ] } - } + }, + "description" : "Device information" }, - "AlertPagedResponse" : { + "Encryption at rest config" : { "type" : "object", - "required" : [ "entities", "hasNext", "hasPrev", "totalCount" ], "properties" : { - "entities" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Alert" - } + "encryptionAtRestEnabled" : { + "type" : "boolean", + "description" : "Whether a universe is currently encrypted at rest or not" }, - "hasNext" : { - "type" : "boolean" + "kmsConfigUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "KMS configuration" }, - "hasPrev" : { - "type" : "boolean" + "opType" : { + "type" : "string", + "description" : "Whether to enable/disable/rotate universe key/encryption at rest", + "enum" : [ "ENABLE", "DISABLE", "UNDEFINED" ] }, - "totalCount" : { - "type" : "integer", - "format" : "int32" + "type" : { + "type" : "string", + "description" : "Whether to generate a data key or just retrieve the CMK arn", + "enum" : [ "CMK", "DATA_KEY" ] + } + }, + "description" : "Encryption at rest config" + }, + "Extra dependencies" : { + "type" : "object", + "properties" : { + "installNodeExporter" : { + "type" : "boolean", + "description" : "Is install node exporter required" } - } + }, + "description" : "Extra dependencies" }, - "AlertPagedApiQuery" : { + "Node details" : { "type" : "object", - "required" : [ "direction", "filter", "limit", "needTotalCount", "offset", "sortBy" ], "properties" : { - "filter" : { - "$ref" : "#/definitions/AlertApiFilter" + "nodeIdx" : { + "type" : "integer", + "format" : "int32", + "description" : "Node id" }, - "sortBy" : { + "nodeName" : { "type" : "string", - "enum" : [ "CREATE_TIME", "SEVERITY" ] + "description" : "Node name" }, - "direction" : { + "nodeUuid" : { "type" : "string", - "enum" : [ "ASC", "DESC" ] + "format" : "uuid", + "description" : "Node UUID" }, - "offset" : { - "type" : "integer", - "format" : "int32" + "cloudInfo" : { + "description" : "Cloud information", + "$ref" : "#/definitions/Cloud specific info" }, - "limit" : { - "type" : "integer", - "format" : "int32" + "azUuid" : { + "type" : "string", + "format" : "uuid", + "description" : "Az UUID" }, - "needTotalCount" : { - "type" : "boolean" - } - } - }, - "AlertDefinitionGroup" : { - "type" : "object", - "required" : [ "active", "createTime", "customerUUID", "description", "durationSec", "name", "routeUUID", "target", "targetType", "template", "thresholdUnit", "thresholds", "uuid" ], - "properties" : { - "uuid" : { + "placementUuid" : { "type" : "string", - "format" : "uuid" + "format" : "uuid", + "description" : "Placement UUID" }, - "customerUUID" : { + "machineImage" : { "type" : "string", - "format" : "uuid" + "description" : "Machine image" }, - "name" : { - "type" : "string" + "state" : { + "type" : "string", + "description" : "Node state", + "enum" : [ "ToBeAdded", "ToJoinCluster", "Provisioned", "SoftwareInstalled", "UpgradeSoftware", "UpdateGFlags", "Live", "Stopping", "Starting", "Stopped", "Unreachable", "ToBeRemoved", "Removing", "Removed", "Adding", "BeingDecommissioned", "Decommissioned", "UpdateCert", "ToggleTls", "Resizing" ] }, - "description" : { - "type" : "string" + "isMaster" : { + "type" : "boolean", + "description" : "True if this node is a master" }, - "createTime" : { - "type" : "string", - "format" : "date-time" + "masterHttpPort" : { + "type" : "integer", + "format" : "int32", + "description" : "Master HTTP port" }, - "targetType" : { - "type" : "string", - "enum" : [ "CUSTOMER", "UNIVERSE" ] + "masterRpcPort" : { + "type" : "integer", + "format" : "int32", + "description" : "Master RCP port" }, - "target" : { - "$ref" : "#/definitions/AlertDefinitionGroupTarget" + "isTserver" : { + "type" : "boolean", + "description" : "True if this node is a tserver" }, - "thresholds" : { - "type" : "object", - "additionalProperties" : { - "$ref" : "#/definitions/AlertDefinitionGroupThreshold" - } + "tserverHttpPort" : { + "type" : "integer", + "format" : "int32", + "description" : "Tserver HTTP port" }, - "thresholdUnit" : { - "type" : "string", - "enum" : [ "PERCENT", "MILLISECOND" ] + "tserverRpcPort" : { + "type" : "integer", + "format" : "int32", + "description" : "Tserver RPC port" }, - "template" : { - "type" : "string", - "enum" : [ "REPLICATION_LAG", "CLOCK_SKEW", "MEMORY_CONSUMPTION" ] + "isRedisServer" : { + "type" : "boolean", + "description" : "True if this node is a redis server" }, - "durationSec" : { + "redisServerHttpPort" : { "type" : "integer", - "format" : "int32" + "format" : "int32", + "description" : "Redis HTTP port" }, - "active" : { - "type" : "boolean" + "redisServerRpcPort" : { + "type" : "integer", + "format" : "int32", + "description" : "Redis RPC port" }, - "routeUUID" : { - "type" : "string", - "format" : "uuid" - } - } - }, - "AlertDefinitionGroupTarget" : { - "type" : "object", - "required" : [ "all", "uuids" ], - "properties" : { - "all" : { - "type" : "boolean" + "isYqlServer" : { + "type" : "boolean", + "description" : "True if this node is a Yql" }, - "uuids" : { - "type" : "array", - "uniqueItems" : true, - "items" : { - "type" : "string", - "format" : "uuid" - } - } - } - }, - "AlertDefinitionGroupThreshold" : { - "type" : "object", - "required" : [ "condition", "threshold" ], - "properties" : { - "condition" : { - "type" : "string", - "enum" : [ "GREATER_THAN", "LESS_THAN" ] + "yqlServerHttpPort" : { + "type" : "integer", + "format" : "int32", + "description" : "Yql HTTP port" }, - "threshold" : { - "type" : "number", - "format" : "double" - } - } - }, - "AlertDefinitionTemplateApiFilter" : { - "type" : "object", - "required" : [ "name", "targetType" ], - "properties" : { - "name" : { - "type" : "string" + "yqlServerRpcPort" : { + "type" : "integer", + "format" : "int32", + "description" : "Yql RPC port" }, - "targetType" : { - "type" : "string", - "enum" : [ "CUSTOMER", "UNIVERSE" ] - } - } - }, - "AlertDefinitionGroupPagedResponse" : { - "type" : "object", - "required" : [ "entities", "hasNext", "hasPrev", "totalCount" ], - "properties" : { - "entities" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/AlertDefinitionGroup" - } + "isYsqlServer" : { + "type" : "boolean", + "description" : "True if this node is a Ysql" }, - "hasNext" : { - "type" : "boolean" + "ysqlServerHttpPort" : { + "type" : "integer", + "format" : "int32", + "description" : "Ysql HTTP port" }, - "hasPrev" : { - "type" : "boolean" + "ysqlServerRpcPort" : { + "type" : "integer", + "format" : "int32", + "description" : "Ysql RPC port" }, - "totalCount" : { + "nodeExporterPort" : { "type" : "integer", - "format" : "int32" + "format" : "int32", + "description" : "Node exporter port" + }, + "cronsActive" : { + "type" : "boolean", + "description" : "True if cronjobs were properly configured for this node" } - } + }, + "description" : "Node details" }, - "AlertDefinitionGroupApiFilter" : { + "Table details" : { "type" : "object", - "required" : [ "active", "name", "routeUuid", "targetType", "template", "uuids" ], "properties" : { - "uuids" : { + "tableName" : { + "type" : "string", + "description" : "Table name" + }, + "keyspace" : { + "type" : "string", + "description" : "Keyspace that this table belongs to" + }, + "ttlInSeconds" : { + "type" : "integer", + "format" : "int64", + "description" : "The default table-level time to live" + }, + "columns" : { "type" : "array", - "uniqueItems" : true, + "description" : "Details of the columns that make up the table", "items" : { - "type" : "string", - "format" : "uuid" + "$ref" : "#/definitions/Column details" } }, - "name" : { - "type" : "string" - }, - "active" : { - "type" : "boolean" - }, - "targetType" : { + "cqlcreateKeyspaceString" : { "type" : "string", - "enum" : [ "CUSTOMER", "UNIVERSE" ] + "description" : "CQL create keyspace detail" }, - "template" : { + "cqluseKeyspaceString" : { "type" : "string", - "enum" : [ "REPLICATION_LAG", "CLOCK_SKEW", "MEMORY_CONSUMPTION" ] + "description" : "CQL use keyspace detail" }, - "routeUuid" : { + "cqlcreateTableString" : { "type" : "string", - "format" : "uuid" + "description" : "CQL create table detail" } - } + }, + "description" : "Table details" }, - "AlertDefinitionGroupPagedApiQuery" : { + "Universe task" : { "type" : "object", - "required" : [ "direction", "filter", "limit", "needTotalCount", "offset", "sortBy" ], + "required" : [ "tableDetails", "tableType", "tableUUID" ], "properties" : { - "filter" : { - "$ref" : "#/definitions/AlertDefinitionGroupApiFilter" - }, - "sortBy" : { + "errorString" : { "type" : "string", - "enum" : [ "NAME", "ACTIVE", "TARGET_TYPE", "CREATE_TIME", "ALERT_COUNT" ] + "description" : "Error message" }, - "direction" : { + "nodeExporterUser" : { "type" : "string", - "enum" : [ "ASC", "DESC" ] + "description" : "Node exporter user" }, - "offset" : { - "type" : "integer", - "format" : "int32" + "deviceInfo" : { + "description" : "Device information", + "$ref" : "#/definitions/Device info" }, - "limit" : { + "universeUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "Associate universe UUID" + }, + "expectedUniverseVersion" : { "type" : "integer", - "format" : "int32" + "format" : "int32", + "description" : "Universe version" }, - "needTotalCount" : { - "type" : "boolean" - } - } - }, - "AlertReceiver" : { - "type" : "object", - "required" : [ "name", "params", "uuid" ], - "properties" : { - "uuid" : { + "cmkArn" : { "type" : "string", - "format" : "uuid" - }, - "name" : { - "type" : "string" + "description" : "Amazon Resource Name (ARN) of the CMK" }, - "params" : { - "$ref" : "#/definitions/AlertReceiverParams" + "encryptionAtRestConfig" : { + "description" : "Encryption at rest configation", + "$ref" : "#/definitions/Encryption at rest config" }, - "customer_uuid" : { - "type" : "string", - "format" : "uuid" - } - } - }, - "AlertReceiverEmailParams" : { - "allOf" : [ { - "$ref" : "#/definitions/AlertReceiverParams" - }, { - "type" : "object", - "required" : [ "defaultRecipients", "defaultSmtpSettings", "recipients", "smtpData" ], - "properties" : { - "defaultRecipients" : { - "type" : "boolean" - }, - "recipients" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "defaultSmtpSettings" : { - "type" : "boolean" - }, - "smtpData" : { - "$ref" : "#/definitions/Smtp Data" + "nodeDetailsSet" : { + "type" : "array", + "description" : "Node details", + "uniqueItems" : true, + "items" : { + "$ref" : "#/definitions/Node details" } - } - } ] - }, - "AlertReceiverParams" : { - "type" : "object", - "required" : [ "textTemplate", "titleTemplate" ], - "discriminator" : "targetType", - "properties" : { - "titleTemplate" : { - "type" : "string" }, - "textTemplate" : { - "type" : "string" - } - } - }, - "AlertReceiverSlackParams" : { - "allOf" : [ { - "$ref" : "#/definitions/AlertReceiverParams" - }, { - "type" : "object", - "required" : [ "channel", "iconUrl", "webhookUrl" ], - "properties" : { - "channel" : { - "type" : "string" - }, - "webhookUrl" : { - "type" : "string" - }, - "iconUrl" : { - "type" : "string" - } - } - } ] - }, - "AlertReceiverFormData" : { - "type" : "object", - "required" : [ "alertReceiverUUID", "name", "params" ], - "properties" : { - "alertReceiverUUID" : { - "type" : "string", - "format" : "uuid" + "communicationPorts" : { + "description" : "Communication ports", + "$ref" : "#/definitions/Communication ports" }, - "name" : { - "type" : "string" + "extraDependencies" : { + "description" : "Extra dependencies", + "$ref" : "#/definitions/Extra dependencies" }, - "params" : { - "$ref" : "#/definitions/AlertReceiverParams" - } - } - }, - "AlertRoute" : { - "type" : "object", - "required" : [ "customerUUID", "defaultRoute", "name", "uuid" ], - "properties" : { - "uuid" : { + "firstTry" : { + "type" : "boolean", + "description" : "Whether this task has been tried before or not" + }, + "tableUUID" : { "type" : "string", "format" : "uuid" }, - "customerUUID" : { + "tableType" : { "type" : "string", - "format" : "uuid" + "enum" : [ "YQL_TABLE_TYPE", "REDIS_TABLE_TYPE", "PGSQL_TABLE_TYPE", "TRANSACTION_STATUS_TABLE_TYPE" ] }, - "name" : { - "type" : "string" + "tableDetails" : { + "$ref" : "#/definitions/Table details" }, - "receivers" : { + "targetAsyncReplicationRelationships" : { "type" : "array", + "description" : "Async replication relationships as the target universe", "readOnly" : true, "items" : { - "type" : "string", - "format" : "uuid" + "$ref" : "#/definitions/AsyncReplicationConfig" } }, - "defaultRoute" : { - "type" : "boolean" - } - } - }, - "AlertRouteFormData" : { - "type" : "object", - "required" : [ "defaultRoute", "name", "receivers" ], - "properties" : { - "name" : { - "type" : "string" - }, - "defaultRoute" : { - "type" : "boolean" - }, - "receivers" : { + "sourceAsyncReplicationRelationships" : { "type" : "array", + "description" : "Async replication relationships as the source universe", + "readOnly" : true, "items" : { - "type" : "string", - "format" : "uuid" + "$ref" : "#/definitions/AsyncReplicationConfig" } } - } + }, + "description" : "Universe task" }, - "Audit" : { + "Bulk import params" : { "type" : "object", - "required" : [ "auditID", "timestamp" ], + "required" : [ "s3Bucket" ], "properties" : { - "userUUID" : { + "errorString" : { "type" : "string", - "format" : "uuid", - "description" : "User uuid", - "readOnly" : true + "description" : "Error message" }, - "customerUUID" : { + "nodeExporterUser" : { + "type" : "string", + "description" : "Node exporter user" + }, + "deviceInfo" : { + "description" : "Device information", + "$ref" : "#/definitions/Device info" + }, + "universeUUID" : { "type" : "string", "format" : "uuid", - "description" : "Customer uuid", - "readOnly" : true + "description" : "Associate universe UUID" }, - "timestamp" : { + "expectedUniverseVersion" : { + "type" : "integer", + "format" : "int32", + "description" : "Universe version" + }, + "cmkArn" : { "type" : "string", - "format" : "date-time" + "description" : "Amazon Resource Name (ARN) of the CMK" }, - "payload" : { - "description" : "Audit uuid", - "readOnly" : true, - "$ref" : "#/definitions/JsonNode" + "encryptionAtRestConfig" : { + "description" : "Encryption at rest configation", + "$ref" : "#/definitions/Encryption at rest config" }, - "apiCall" : { + "nodeDetailsSet" : { + "type" : "array", + "description" : "Node details", + "uniqueItems" : true, + "items" : { + "$ref" : "#/definitions/Node details" + } + }, + "communicationPorts" : { + "description" : "Communication ports", + "$ref" : "#/definitions/Communication ports" + }, + "extraDependencies" : { + "description" : "Extra dependencies", + "$ref" : "#/definitions/Extra dependencies" + }, + "firstTry" : { + "type" : "boolean", + "description" : "Whether this task has been tried before or not" + }, + "keyspace" : { "type" : "string", - "example" : "/api/v1/customers/<496fdea8-df25-11eb-ba80-0242ac130004>/providers", - "description" : "Api call", - "readOnly" : true + "description" : "Key space" }, - "apiMethod" : { + "tableName" : { "type" : "string", - "example" : "GET", - "description" : "API method", - "readOnly" : true + "description" : "Table name" }, - "taskUUID" : { + "tableUUID" : { "type" : "string", "format" : "uuid", - "description" : "Task UUID", - "readOnly" : true + "description" : "Table UUID" }, - "auditID" : { + "sse" : { + "type" : "boolean", + "description" : "Is SSE" + }, + "s3Bucket" : { + "type" : "string", + "description" : "S3 bucket URL" + }, + "instanceCount" : { "type" : "integer", - "format" : "int64" - } - }, - "description" : "Audit for audit logging of the requests and responses." - }, - "AccessKey" : { - "type" : "object", - "required" : [ "idKey", "keyInfo" ], - "properties" : { - "idKey" : { - "$ref" : "#/definitions/AccessKeyId" + "format" : "int32", + "description" : "Instance count" }, - "keyInfo" : { - "description" : "Cloud provider key info", - "$ref" : "#/definitions/KeyInfo" + "targetAsyncReplicationRelationships" : { + "type" : "array", + "description" : "Async replication relationships as the target universe", + "readOnly" : true, + "items" : { + "$ref" : "#/definitions/AsyncReplicationConfig" + } + }, + "sourceAsyncReplicationRelationships" : { + "type" : "array", + "description" : "Async replication relationships as the source universe", + "readOnly" : true, + "items" : { + "$ref" : "#/definitions/AsyncReplicationConfig" + } } }, - "description" : "Access key for the provider. This will help to authenticate the user and get the access to the cloud provider." + "description" : "Bulk import params" }, - "AccessKeyId" : { + "Backup table params" : { "type" : "object", - "required" : [ "keyCode", "providerUUID" ], + "required" : [ "actionType", "storageConfigUUID" ], "properties" : { - "keyCode" : { - "type" : "string" - }, - "providerUUID" : { + "errorString" : { "type" : "string", - "format" : "uuid" - } - } - }, - "KeyInfo" : { - "type" : "object", - "required" : [ "airGapInstall", "installNodeExporter", "nodeExporterPort", "nodeExporterUser", "passwordlessSudoAccess", "privateKey", "provisionInstanceScript", "publicKey", "skipProvisioning", "sshPort", "sshUser", "vaultFile", "vaultPasswordFile" ], - "properties" : { - "publicKey" : { - "type" : "string" - }, - "privateKey" : { - "type" : "string" + "description" : "Error message" }, - "vaultPasswordFile" : { - "type" : "string" + "nodeExporterUser" : { + "type" : "string", + "description" : "Node exporter user" }, - "vaultFile" : { - "type" : "string" + "deviceInfo" : { + "description" : "Device information", + "$ref" : "#/definitions/Device info" }, - "sshUser" : { - "type" : "string" + "universeUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "Associate universe UUID" }, - "sshPort" : { + "expectedUniverseVersion" : { "type" : "integer", - "format" : "int32" + "format" : "int32", + "description" : "Universe version" }, - "airGapInstall" : { - "type" : "boolean" + "cmkArn" : { + "type" : "string", + "description" : "Amazon Resource Name (ARN) of the CMK" }, - "passwordlessSudoAccess" : { - "type" : "boolean" + "encryptionAtRestConfig" : { + "description" : "Encryption at rest configation", + "$ref" : "#/definitions/Encryption at rest config" }, - "provisionInstanceScript" : { - "type" : "string" + "nodeDetailsSet" : { + "type" : "array", + "description" : "Node details", + "uniqueItems" : true, + "items" : { + "$ref" : "#/definitions/Node details" + } }, - "installNodeExporter" : { - "type" : "boolean" + "communicationPorts" : { + "description" : "Communication ports", + "$ref" : "#/definitions/Communication ports" }, - "nodeExporterPort" : { - "type" : "integer", - "format" : "int32" + "extraDependencies" : { + "description" : "Extra dependencies", + "$ref" : "#/definitions/Extra dependencies" }, - "nodeExporterUser" : { - "type" : "string" + "firstTry" : { + "type" : "boolean", + "description" : "Whether this task has been tried before or not" }, - "skipProvisioning" : { - "type" : "boolean" - } - } - }, - "Cloud specific info" : { - "type" : "object", - "properties" : { - "private_ip" : { + "keyspace" : { "type" : "string", - "description" : "Private IP" + "description" : "Key space" }, - "public_ip" : { + "tableName" : { "type" : "string", - "description" : "Public IP" + "description" : "Table name" }, - "public_dns" : { + "tableUUID" : { "type" : "string", - "description" : "Public DNS" + "format" : "uuid", + "description" : "Table UUID" }, - "private_dns" : { - "type" : "string", - "description" : "Private DNS" + "sse" : { + "type" : "boolean", + "description" : "Is SSE" }, - "instance_type" : { + "storageConfigUUID" : { "type" : "string", - "description" : "Instance type" + "format" : "uuid", + "description" : "Storage config UUID" }, - "subnet_id" : { + "kmsConfigUUID" : { "type" : "string", - "description" : "Subnet IP" + "format" : "uuid", + "description" : "KMS config UUID" }, - "az" : { + "storageLocation" : { "type" : "string", - "description" : "AZ" + "description" : "Storage location" }, - "region" : { + "actionType" : { "type" : "string", - "description" : "Region" + "description" : "Action type", + "enum" : [ "CREATE", "RESTORE", "RESTORE_KEYS", "DELETE" ] }, - "cloud" : { + "backupType" : { "type" : "string", - "description" : "Cloud" - }, - "assignPublicIP" : { - "type" : "boolean", - "description" : "Public IP assigned" + "description" : "Backup type", + "enum" : [ "YQL_TABLE_TYPE", "REDIS_TABLE_TYPE", "PGSQL_TABLE_TYPE", "TRANSACTION_STATUS_TABLE_TYPE" ] }, - "useTimeSync" : { - "type" : "boolean", - "description" : "Is use time sync enable" + "tableNameList" : { + "type" : "array", + "description" : "Tables", + "items" : { + "type" : "string" + } }, - "mount_roots" : { - "type" : "string", - "description" : "Mount roots" - } - }, - "description" : "Cloud specific information" - }, - "MasterNode" : { - "type" : "object", - "required" : [ "cloudInfo", "masterRpcPort" ], - "properties" : { - "cloudInfo" : { - "$ref" : "#/definitions/Cloud specific info" + "tableUUIDList" : { + "type" : "array", + "description" : "Tables UUID's", + "items" : { + "type" : "string", + "format" : "uuid" + } }, - "masterRpcPort" : { - "type" : "integer", - "format" : "int32" - } - } - }, - "MastersList" : { - "type" : "object", - "required" : [ "masters" ], - "properties" : { - "masters" : { + "backupList" : { "type" : "array", + "description" : "Backups", "items" : { - "$ref" : "#/definitions/MasterNode" + "$ref" : "#/definitions/Backup table params" } - } - } - }, - "AsyncReplicationConfig" : { - "type" : "object", - "required" : [ "active", "sourceTableID", "sourceUniverseUUID", "targetTableID", "targetUniverseUUID" ], - "properties" : { - "sourceTableID" : { - "type" : "string" }, - "sourceUniverseUUID" : { - "type" : "string", - "format" : "uuid" + "schedulingFrequency" : { + "type" : "integer", + "format" : "int64", + "description" : "Frequency for running the backup in milliseconds" + }, + "cronExpression" : { + "type" : "string", + "description" : "Cron expression in case a recurring backup" + }, + "timeBeforeDelete" : { + "type" : "integer", + "format" : "int64", + "description" : "Time in millisecs before deleting the backup from the storage" + }, + "enableVerboseLogs" : { + "type" : "boolean", + "description" : "Is verbose logging is enable" + }, + "transactionalBackup" : { + "type" : "boolean", + "description" : "Is backup be transactional across tables" }, - "targetTableID" : { - "type" : "string" + "parallelism" : { + "type" : "integer", + "format" : "int32", + "description" : "The number of concurrent commands to run on nodes over SSH" }, - "targetUniverseUUID" : { + "scheduleUUID" : { "type" : "string", - "format" : "uuid" + "format" : "uuid", + "description" : "Schedule UUID" }, - "active" : { - "type" : "boolean" + "targetAsyncReplicationRelationships" : { + "type" : "array", + "description" : "Async replication relationships as the target universe", + "readOnly" : true, + "items" : { + "$ref" : "#/definitions/AsyncReplicationConfig" + } + }, + "sourceAsyncReplicationRelationships" : { + "type" : "array", + "description" : "Async replication relationships as the source universe", + "readOnly" : true, + "items" : { + "$ref" : "#/definitions/AsyncReplicationConfig" + } } - } + }, + "description" : "Backup table params" }, - "Backup" : { + "TableInfo" : { "type" : "object", - "required" : [ "createTime", "updateTime" ], "properties" : { - "backupUUID" : { + "tableUUID" : { "type" : "string", "format" : "uuid", - "description" : "Backup uuid", + "description" : "Table UUID", "readOnly" : true }, - "customerUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Customer UUID of the backup which it belongs to" - }, - "state" : { - "type" : "string", - "example" : "DELETED", - "description" : "State of the backup", - "readOnly" : true, - "enum" : [ "InProgress", "Completed", "Failed", "Deleted", "Skipped", "FailedToDelete" ] - }, - "backupInfo" : { - "description" : "Details of the backup", - "$ref" : "#/definitions/Backup table params" - }, - "taskUUID" : { + "keySpace" : { "type" : "string", - "format" : "uuid", - "description" : "Backup UUID", - "readOnly" : true + "description" : "Key space" }, - "scheduleUUID" : { + "tableType" : { "type" : "string", - "format" : "uuid", - "description" : "Schedule UUID if this backup is taken from scheduling it" + "description" : "Table type", + "enum" : [ "YQL_TABLE_TYPE", "REDIS_TABLE_TYPE", "PGSQL_TABLE_TYPE", "TRANSACTION_STATUS_TABLE_TYPE" ] }, - "expiry" : { + "tableName" : { "type" : "string", - "format" : "date-time", - "description" : "Expiry time of the backup" + "description" : "Table name" }, - "createTime" : { + "relationType" : { "type" : "string", - "format" : "date-time" + "description" : "Relation type", + "enum" : [ "SYSTEM_TABLE_RELATION", "USER_TABLE_RELATION", "INDEX_TABLE_RELATION" ] }, - "updateTime" : { - "type" : "string", - "format" : "date-time" + "sizeBytes" : { + "type" : "number", + "format" : "double", + "description" : "Size in bytes", + "readOnly" : true } - }, - "description" : "Backup with a status, expiry and backup configs" + } }, - "Backup table params" : { + "Multi table backup request params" : { "type" : "object", "required" : [ "actionType", "storageConfigUUID" ], "properties" : { @@ -7314,1352 +7047,1646 @@ "description" : "Backup type", "enum" : [ "YQL_TABLE_TYPE", "REDIS_TABLE_TYPE", "PGSQL_TABLE_TYPE", "TRANSACTION_STATUS_TABLE_TYPE" ] }, - "tableNameList" : { + "tableNameList" : { + "type" : "array", + "description" : "Tables", + "items" : { + "type" : "string" + } + }, + "tableUUIDList" : { + "type" : "array", + "description" : "Table UUID List", + "items" : { + "type" : "string", + "format" : "uuid" + } + }, + "backupList" : { + "type" : "array", + "description" : "Backups", + "items" : { + "$ref" : "#/definitions/Backup table params" + } + }, + "schedulingFrequency" : { + "type" : "integer", + "format" : "int64", + "description" : "Frequency for running the backup in milliseconds" + }, + "cronExpression" : { + "type" : "string", + "description" : "Cron expression in case a recurring backup" + }, + "timeBeforeDelete" : { + "type" : "integer", + "format" : "int64", + "description" : "Time in millisecs before deleting the backup from the storage" + }, + "enableVerboseLogs" : { + "type" : "boolean", + "description" : "Is verbose logging is enable" + }, + "transactionalBackup" : { + "type" : "boolean", + "description" : "Is backup be transactional across tables" + }, + "parallelism" : { + "type" : "integer", + "format" : "int32", + "description" : "The number of concurrent commands to run on nodes over SSH" + }, + "scheduleUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "Schedule UUID" + }, + "customerUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "Customer UUID" + }, + "targetAsyncReplicationRelationships" : { + "type" : "array", + "description" : "Async replication relationships as the target universe", + "readOnly" : true, + "items" : { + "$ref" : "#/definitions/AsyncReplicationConfig" + } + }, + "sourceAsyncReplicationRelationships" : { + "type" : "array", + "description" : "Async replication relationships as the source universe", + "readOnly" : true, + "items" : { + "$ref" : "#/definitions/AsyncReplicationConfig" + } + } + }, + "description" : "Backup table params" + }, + "Alert" : { + "type" : "object", + "required" : [ "labels" ], + "properties" : { + "uuid" : { + "type" : "string", + "format" : "uuid", + "description" : "Alert uuid", + "readOnly" : true + }, + "customerUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "Cutomer uuid", + "readOnly" : true + }, + "createTime" : { + "type" : "string", + "format" : "date-time", + "description" : "Create Date time info.", + "readOnly" : true + }, + "acknowledgedTime" : { + "type" : "string", + "format" : "date-time", + "description" : "Acknowledge Date time info.", + "readOnly" : true + }, + "resolvedTime" : { + "type" : "string", + "format" : "date-time", + "description" : "Resolved Date time info.", + "readOnly" : true + }, + "errCode" : { + "type" : "string", + "description" : "Error Code.", + "readOnly" : true + }, + "severity" : { + "type" : "string", + "description" : "Alert definition group serverity.", + "readOnly" : true, + "enum" : [ "SEVERE", "WARNING" ] + }, + "message" : { + "type" : "string", + "description" : "Alert Message.", + "readOnly" : true + }, + "state" : { + "type" : "string", + "description" : "Alert State.", + "readOnly" : true, + "enum" : [ "CREATED", "ACTIVE", "ACKNOWLEDGED", "RESOLVED" ] + }, + "targetState" : { + "type" : "string", + "description" : "Target State.", + "readOnly" : true, + "enum" : [ "CREATED", "ACTIVE", "ACKNOWLEDGED", "RESOLVED" ] + }, + "sendEmail" : { + "type" : "boolean", + "description" : "Whether to send an Email or not.", + "readOnly" : true + }, + "definitionUuid" : { + "type" : "string", + "format" : "uuid", + "description" : "Alert Definition Uuid", + "readOnly" : true + }, + "groupUuid" : { + "type" : "string", + "format" : "uuid", + "description" : "Alert group Uuid", + "readOnly" : true + }, + "groupType" : { + "type" : "string", + "description" : "Alert definition group type", + "readOnly" : true, + "enum" : [ "CUSTOMER", "UNIVERSE" ] + }, + "labels" : { "type" : "array", - "description" : "Tables", "items" : { - "type" : "string" + "$ref" : "#/definitions/AlertLabel" } + } + }, + "description" : "Alert information. which is used to send alert notification." + }, + "AlertLabel" : { + "type" : "object", + "required" : [ "key", "name", "value" ], + "properties" : { + "key" : { + "$ref" : "#/definitions/AlertLabelKey" }, - "tableUUIDList" : { + "value" : { + "type" : "string" + }, + "name" : { + "type" : "string" + } + } + }, + "AlertLabelKey" : { + "type" : "object", + "required" : [ "name" ], + "properties" : { + "name" : { + "type" : "string" + } + } + }, + "AlertApiFilter" : { + "type" : "object", + "required" : [ "groupType", "groupUuid", "severity", "states", "targetStates", "uuids" ], + "properties" : { + "uuids" : { "type" : "array", - "description" : "Tables UUID's", + "uniqueItems" : true, "items" : { "type" : "string", "format" : "uuid" } }, - "backupList" : { - "type" : "array", - "description" : "Backups", - "items" : { - "$ref" : "#/definitions/Backup table params" - } - }, - "schedulingFrequency" : { - "type" : "integer", - "format" : "int64", - "description" : "Frequency for running the backup in milliseconds" - }, - "cronExpression" : { + "groupUuid" : { "type" : "string", - "description" : "Cron expression in case a recurring backup" - }, - "timeBeforeDelete" : { - "type" : "integer", - "format" : "int64", - "description" : "Time in millisecs before deleting the backup from the storage" - }, - "enableVerboseLogs" : { - "type" : "boolean", - "description" : "Is verbose logging is enable" - }, - "transactionalBackup" : { - "type" : "boolean", - "description" : "Is backup be transactional across tables" + "format" : "uuid" }, - "parallelism" : { - "type" : "integer", - "format" : "int32", - "description" : "The number of concurrent commands to run on nodes over SSH" + "severity" : { + "type" : "string", + "enum" : [ "SEVERE", "WARNING" ] }, - "scheduleUUID" : { + "groupType" : { "type" : "string", - "format" : "uuid", - "description" : "Schedule UUID" + "enum" : [ "CUSTOMER", "UNIVERSE" ] }, - "targetAsyncReplicationRelationships" : { + "states" : { "type" : "array", - "description" : "Async replication relationships as the target universe", - "readOnly" : true, + "uniqueItems" : true, "items" : { - "$ref" : "#/definitions/AsyncReplicationConfig" + "type" : "string", + "enum" : [ "CREATED", "ACTIVE", "ACKNOWLEDGED", "RESOLVED" ] } }, - "sourceAsyncReplicationRelationships" : { + "targetStates" : { "type" : "array", - "description" : "Async replication relationships as the source universe", - "readOnly" : true, + "uniqueItems" : true, "items" : { - "$ref" : "#/definitions/AsyncReplicationConfig" + "type" : "string", + "enum" : [ "CREATED", "ACTIVE", "ACKNOWLEDGED", "RESOLVED" ] } } - }, - "description" : "Backup table params" + } }, - "Communication ports" : { + "AlertPagedResponse" : { "type" : "object", + "required" : [ "entities", "hasNext", "hasPrev", "totalCount" ], "properties" : { - "masterHttpPort" : { - "type" : "integer", - "format" : "int32", - "description" : "HTTP port for master table" - }, - "masterRpcPort" : { - "type" : "integer", - "format" : "int32", - "description" : "RCP port for master table" - }, - "tserverHttpPort" : { - "type" : "integer", - "format" : "int32", - "description" : "HTTP port for tserver" + "entities" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/Alert" + } }, - "tserverRpcPort" : { - "type" : "integer", - "format" : "int32", - "description" : "RPC port for tserver" + "hasNext" : { + "type" : "boolean" }, - "redisServerHttpPort" : { - "type" : "integer", - "format" : "int32", - "description" : "HTTP port for redis" + "hasPrev" : { + "type" : "boolean" }, - "redisServerRpcPort" : { + "totalCount" : { "type" : "integer", - "format" : "int32", - "description" : "RPC port for redis" + "format" : "int32" + } + } + }, + "AlertPagedApiQuery" : { + "type" : "object", + "required" : [ "direction", "filter", "limit", "needTotalCount", "offset", "sortBy" ], + "properties" : { + "filter" : { + "$ref" : "#/definitions/AlertApiFilter" }, - "yqlServerHttpPort" : { - "type" : "integer", - "format" : "int32", - "description" : "HTTP port for yql" + "sortBy" : { + "type" : "string", + "enum" : [ "CREATE_TIME", "SEVERITY" ] }, - "yqlServerRpcPort" : { - "type" : "integer", - "format" : "int32", - "description" : "RPC port for yql" + "direction" : { + "type" : "string", + "enum" : [ "ASC", "DESC" ] }, - "ysqlServerHttpPort" : { + "offset" : { "type" : "integer", - "format" : "int32", - "description" : "HTTP port for ysql" + "format" : "int32" }, - "ysqlServerRpcPort" : { + "limit" : { "type" : "integer", - "format" : "int32", - "description" : "RPC port for ysql" + "format" : "int32" }, - "nodeExporterPort" : { - "type" : "integer", - "format" : "int32", - "description" : "Node exporter port" + "needTotalCount" : { + "type" : "boolean" } - }, - "description" : "Communication ports" + } }, - "Device info" : { + "AlertDefinitionGroup" : { "type" : "object", + "required" : [ "active", "createTime", "customerUUID", "description", "durationSec", "name", "routeUUID", "target", "targetType", "template", "thresholdUnit", "thresholds", "uuid" ], "properties" : { - "volumeSize" : { - "type" : "integer", - "format" : "int32", - "description" : "he size of each volume in each instance" + "uuid" : { + "type" : "string", + "format" : "uuid" }, - "numVolumes" : { - "type" : "integer", - "format" : "int32", - "description" : "Number of volumes to be mounted on this instance at the default path" + "customerUUID" : { + "type" : "string", + "format" : "uuid" }, - "diskIops" : { - "type" : "integer", - "format" : "int32", - "description" : "Desired iops for the volumes mounted on this instance" + "name" : { + "type" : "string" }, - "throughput" : { - "type" : "integer", - "format" : "int32", - "description" : "Desired throughput for the volumes mounted on this instance" + "description" : { + "type" : "string" }, - "storageClass" : { + "createTime" : { "type" : "string", - "description" : "Name of storage class" + "format" : "date-time" }, - "mountPoints" : { + "targetType" : { "type" : "string", - "description" : "Comma separated list of mount points for the devices in each instance" + "enum" : [ "CUSTOMER", "UNIVERSE" ] + }, + "target" : { + "$ref" : "#/definitions/AlertDefinitionGroupTarget" + }, + "thresholds" : { + "type" : "object", + "additionalProperties" : { + "$ref" : "#/definitions/AlertDefinitionGroupThreshold" + } + }, + "thresholdUnit" : { + "type" : "string", + "enum" : [ "PERCENT", "MILLISECOND" ] + }, + "template" : { + "type" : "string", + "enum" : [ "REPLICATION_LAG", "CLOCK_SKEW", "MEMORY_CONSUMPTION" ] + }, + "durationSec" : { + "type" : "integer", + "format" : "int32" + }, + "active" : { + "type" : "boolean" + }, + "routeUUID" : { + "type" : "string", + "format" : "uuid" + } + } + }, + "AlertDefinitionGroupTarget" : { + "type" : "object", + "required" : [ "all", "uuids" ], + "properties" : { + "all" : { + "type" : "boolean" }, - "storageType" : { - "type" : "string", - "description" : "The type of storage used for this instance", - "enum" : [ "IO1", "GP2", "GP3", "Scratch", "Persistent", "StandardSSD_LRS", "Premium_LRS", "UltraSSD_LRS" ] + "uuids" : { + "type" : "array", + "uniqueItems" : true, + "items" : { + "type" : "string", + "format" : "uuid" + } } - }, - "description" : "Device information" + } }, - "Encryption at rest config" : { + "AlertDefinitionGroupThreshold" : { "type" : "object", + "required" : [ "condition", "threshold" ], "properties" : { - "encryptionAtRestEnabled" : { - "type" : "boolean", - "description" : "Whether a universe is currently encrypted at rest or not" - }, - "kmsConfigUUID" : { + "condition" : { "type" : "string", - "format" : "uuid", - "description" : "KMS configuration" + "enum" : [ "GREATER_THAN", "LESS_THAN" ] }, - "opType" : { - "type" : "string", - "description" : "Whether to enable/disable/rotate universe key/encryption at rest", - "enum" : [ "ENABLE", "DISABLE", "UNDEFINED" ] + "threshold" : { + "type" : "number", + "format" : "double" + } + } + }, + "AlertDefinitionTemplateApiFilter" : { + "type" : "object", + "required" : [ "name", "targetType" ], + "properties" : { + "name" : { + "type" : "string" }, - "type" : { + "targetType" : { "type" : "string", - "description" : "Whether to generate a data key or just retrieve the CMK arn", - "enum" : [ "CMK", "DATA_KEY" ] + "enum" : [ "CUSTOMER", "UNIVERSE" ] } - }, - "description" : "Encryption at rest config" + } }, - "Extra dependencies" : { + "AlertDefinitionGroupPagedResponse" : { "type" : "object", + "required" : [ "entities", "hasNext", "hasPrev", "totalCount" ], "properties" : { - "installNodeExporter" : { - "type" : "boolean", - "description" : "Is install node exporter required" + "entities" : { + "type" : "array", + "items" : { + "$ref" : "#/definitions/AlertDefinitionGroup" + } + }, + "hasNext" : { + "type" : "boolean" + }, + "hasPrev" : { + "type" : "boolean" + }, + "totalCount" : { + "type" : "integer", + "format" : "int32" } - }, - "description" : "Extra dependencies" + } }, - "Node details" : { + "AlertDefinitionGroupApiFilter" : { "type" : "object", + "required" : [ "active", "name", "routeUuid", "targetType", "template", "uuids" ], "properties" : { - "nodeIdx" : { - "type" : "integer", - "format" : "int32", - "description" : "Node id" - }, - "nodeName" : { - "type" : "string", - "description" : "Node name" + "uuids" : { + "type" : "array", + "uniqueItems" : true, + "items" : { + "type" : "string", + "format" : "uuid" + } }, - "nodeUuid" : { - "type" : "string", - "format" : "uuid", - "description" : "Node UUID" + "name" : { + "type" : "string" }, - "cloudInfo" : { - "description" : "Cloud information", - "$ref" : "#/definitions/Cloud specific info" + "active" : { + "type" : "boolean" }, - "azUuid" : { + "targetType" : { "type" : "string", - "format" : "uuid", - "description" : "Az UUID" + "enum" : [ "CUSTOMER", "UNIVERSE" ] }, - "placementUuid" : { + "template" : { "type" : "string", - "format" : "uuid", - "description" : "Placement UUID" + "enum" : [ "REPLICATION_LAG", "CLOCK_SKEW", "MEMORY_CONSUMPTION" ] }, - "machineImage" : { + "routeUuid" : { "type" : "string", - "description" : "Machine image" + "format" : "uuid" + } + } + }, + "AlertDefinitionGroupPagedApiQuery" : { + "type" : "object", + "required" : [ "direction", "filter", "limit", "needTotalCount", "offset", "sortBy" ], + "properties" : { + "filter" : { + "$ref" : "#/definitions/AlertDefinitionGroupApiFilter" }, - "state" : { + "sortBy" : { "type" : "string", - "description" : "Node state", - "enum" : [ "ToBeAdded", "ToJoinCluster", "Provisioned", "SoftwareInstalled", "UpgradeSoftware", "UpdateGFlags", "Live", "Stopping", "Starting", "Stopped", "Unreachable", "ToBeRemoved", "Removing", "Removed", "Adding", "BeingDecommissioned", "Decommissioned", "UpdateCert", "ToggleTls", "Resizing" ] - }, - "isMaster" : { - "type" : "boolean", - "description" : "True if this node is a master" - }, - "masterHttpPort" : { - "type" : "integer", - "format" : "int32", - "description" : "Master HTTP port" - }, - "masterRpcPort" : { - "type" : "integer", - "format" : "int32", - "description" : "Master RCP port" + "enum" : [ "NAME", "ACTIVE", "TARGET_TYPE", "CREATE_TIME", "ALERT_COUNT" ] }, - "isTserver" : { - "type" : "boolean", - "description" : "True if this node is a tserver" + "direction" : { + "type" : "string", + "enum" : [ "ASC", "DESC" ] }, - "tserverHttpPort" : { + "offset" : { "type" : "integer", - "format" : "int32", - "description" : "Tserver HTTP port" + "format" : "int32" }, - "tserverRpcPort" : { + "limit" : { "type" : "integer", - "format" : "int32", - "description" : "Tserver RPC port" + "format" : "int32" }, - "isRedisServer" : { - "type" : "boolean", - "description" : "True if this node is a redis server" + "needTotalCount" : { + "type" : "boolean" + } + } + }, + "AlertReceiver" : { + "type" : "object", + "required" : [ "name", "params", "uuid" ], + "properties" : { + "uuid" : { + "type" : "string", + "format" : "uuid" }, - "redisServerHttpPort" : { - "type" : "integer", - "format" : "int32", - "description" : "Redis HTTP port" + "name" : { + "type" : "string" }, - "redisServerRpcPort" : { - "type" : "integer", - "format" : "int32", - "description" : "Redis RPC port" + "params" : { + "$ref" : "#/definitions/AlertReceiverParams" }, - "isYqlServer" : { - "type" : "boolean", - "description" : "True if this node is a Yql" + "customer_uuid" : { + "type" : "string", + "format" : "uuid" + } + } + }, + "AlertReceiverEmailParams" : { + "allOf" : [ { + "$ref" : "#/definitions/AlertReceiverParams" + }, { + "type" : "object", + "required" : [ "defaultRecipients", "defaultSmtpSettings", "recipients", "smtpData" ], + "properties" : { + "defaultRecipients" : { + "type" : "boolean" + }, + "recipients" : { + "type" : "array", + "items" : { + "type" : "string" + } + }, + "defaultSmtpSettings" : { + "type" : "boolean" + }, + "smtpData" : { + "$ref" : "#/definitions/Smtp Data" + } + } + } ] + }, + "AlertReceiverParams" : { + "type" : "object", + "required" : [ "textTemplate", "titleTemplate" ], + "discriminator" : "targetType", + "properties" : { + "titleTemplate" : { + "type" : "string" }, - "yqlServerHttpPort" : { - "type" : "integer", - "format" : "int32", - "description" : "Yql HTTP port" + "textTemplate" : { + "type" : "string" + } + } + }, + "AlertReceiverSlackParams" : { + "allOf" : [ { + "$ref" : "#/definitions/AlertReceiverParams" + }, { + "type" : "object", + "required" : [ "channel", "iconUrl", "webhookUrl" ], + "properties" : { + "channel" : { + "type" : "string" + }, + "webhookUrl" : { + "type" : "string" + }, + "iconUrl" : { + "type" : "string" + } + } + } ] + }, + "Smtp Data" : { + "type" : "object", + "properties" : { + "smtpServer" : { + "type" : "string", + "example" : "smtp.gmail.com", + "description" : "SMTP server" }, - "yqlServerRpcPort" : { + "smtpPort" : { "type" : "integer", "format" : "int32", - "description" : "Yql RPC port" + "example" : 465, + "description" : "SMTP port number" }, - "isYsqlServer" : { - "type" : "boolean", - "description" : "True if this node is a Ysql" + "emailFrom" : { + "type" : "string", + "example" : "test@gmail.com", + "description" : "SMTP email id" }, - "ysqlServerHttpPort" : { - "type" : "integer", - "format" : "int32", - "description" : "Ysql HTTP port" + "smtpUsername" : { + "type" : "string", + "example" : "testsmtp", + "description" : "SMTP email username" }, - "ysqlServerRpcPort" : { - "type" : "integer", - "format" : "int32", - "description" : "Ysql RPC port" + "smtpPassword" : { + "type" : "string", + "example" : "XurenRknsc", + "description" : "SMTP password" }, - "nodeExporterPort" : { - "type" : "integer", - "format" : "int32", - "description" : "Node exporter port" + "useSSL" : { + "type" : "boolean", + "example" : true, + "description" : "Use SMTP SSL" }, - "cronsActive" : { + "useTLS" : { "type" : "boolean", - "description" : "True if cronjobs were properly configured for this node" + "example" : false, + "description" : "Use SMTP TLS" } }, - "description" : "Node details" + "description" : "Customers SMTP data." }, - "CustomerLoginFormData" : { + "AlertReceiverFormData" : { "type" : "object", - "required" : [ "email", "password" ], + "required" : [ "alertReceiverUUID", "name", "params" ], "properties" : { - "email" : { - "type" : "string" + "alertReceiverUUID" : { + "type" : "string", + "format" : "uuid" }, - "password" : { + "name" : { "type" : "string" + }, + "params" : { + "$ref" : "#/definitions/AlertReceiverParams" } } }, - "RegionFormData" : { + "AlertRoute" : { "type" : "object", - "required" : [ "code", "destVpcId", "hostVpcId", "hostVpcRegion", "latitude", "longitude", "name", "ybImage" ], + "required" : [ "customerUUID", "defaultRoute", "name", "uuid" ], "properties" : { - "code" : { - "type" : "string" - }, - "name" : { - "type" : "string" + "uuid" : { + "type" : "string", + "format" : "uuid" }, - "ybImage" : { - "type" : "string" + "customerUUID" : { + "type" : "string", + "format" : "uuid" }, - "hostVpcRegion" : { + "name" : { "type" : "string" }, - "hostVpcId" : { - "type" : "string" + "receivers" : { + "type" : "array", + "readOnly" : true, + "items" : { + "type" : "string", + "format" : "uuid" + } }, - "destVpcId" : { + "defaultRoute" : { + "type" : "boolean" + } + } + }, + "AlertRouteFormData" : { + "type" : "object", + "required" : [ "defaultRoute", "name", "receivers" ], + "properties" : { + "name" : { "type" : "string" }, - "latitude" : { - "type" : "number", - "format" : "double" + "defaultRoute" : { + "type" : "boolean" }, - "longitude" : { - "type" : "number", - "format" : "double" + "receivers" : { + "type" : "array", + "items" : { + "type" : "string", + "format" : "uuid" + } } } }, - "NodeInstance" : { + "ArrayNode" : { "type" : "object", - "required" : [ "details" ], + "required" : [ "array", "bigDecimal", "bigInteger", "binary", "boolean", "containerNode", "double", "float", "floatingPointNumber", "int", "integralNumber", "long", "missingNode", "nodeType", "null", "number", "object", "pojo", "short", "textual", "valueNode" ], "properties" : { - "nodeUuid" : { + "nodeType" : { "type" : "string", - "format" : "uuid", - "description" : "Node instance UUID", - "readOnly" : true + "enum" : [ "ARRAY", "BINARY", "BOOLEAN", "MISSING", "NULL", "NUMBER", "OBJECT", "POJO", "STRING" ] }, - "instanceTypeCode" : { - "type" : "string", - "example" : "c5large", - "description" : "Node instance type code" + "array" : { + "type" : "boolean" }, - "nodeName" : { - "type" : "string", - "example" : "India node", - "description" : "Node instance node name" + "float" : { + "type" : "boolean" }, - "instanceName" : { - "type" : "string", - "example" : "Mumbai instance", - "description" : "Node instance instance name" + "object" : { + "type" : "boolean" }, - "zoneUuid" : { - "type" : "string", - "format" : "uuid", - "description" : "Node instance zone UUID" + "valueNode" : { + "type" : "boolean" }, - "inUse" : { - "type" : "boolean", - "description" : "Node instance is in used or not" + "containerNode" : { + "type" : "boolean" }, - "details" : { - "$ref" : "#/definitions/NodeInstanceData" + "missingNode" : { + "type" : "boolean" }, - "detailsJson" : { - "type" : "string", - "example" : "{\"ip\":\"1.1.1.1\",\"sshUser\":\"centos\"}", - "description" : "Node details" + "pojo" : { + "type" : "boolean" + }, + "number" : { + "type" : "boolean" + }, + "integralNumber" : { + "type" : "boolean" + }, + "floatingPointNumber" : { + "type" : "boolean" + }, + "short" : { + "type" : "boolean" + }, + "int" : { + "type" : "boolean" + }, + "long" : { + "type" : "boolean" + }, + "double" : { + "type" : "boolean" + }, + "bigDecimal" : { + "type" : "boolean" + }, + "bigInteger" : { + "type" : "boolean" + }, + "textual" : { + "type" : "boolean" + }, + "boolean" : { + "type" : "boolean" + }, + "binary" : { + "type" : "boolean" + }, + "null" : { + "type" : "boolean" } - }, - "description" : "Node instance attched to provider and zones" + } }, - "NodeInstanceData" : { + "Customer Config" : { "type" : "object", - "required" : [ "instanceName", "instanceType", "ip", "region", "sshUser", "zone" ], + "required" : [ "data" ], "properties" : { - "ip" : { + "configUUID" : { "type" : "string", - "example" : "1.1.1.1", - "description" : "IP address of node instance" + "format" : "uuid", + "description" : "Config UUID", + "readOnly" : true }, - "sshUser" : { + "configName" : { "type" : "string", - "example" : "centos", - "description" : "SSH user of node instance" + "example" : "backup20-01-2021", + "description" : "Config name" }, - "region" : { + "customerUUID" : { "type" : "string", - "example" : "south-east", - "description" : "Region of node instance" + "format" : "uuid", + "description" : "Customer UUID", + "readOnly" : true }, - "zone" : { + "type" : { "type" : "string", - "example" : "south-east", - "description" : "Zone of node instance" + "example" : "STORAGE", + "description" : "Config type", + "enum" : [ "STORAGE", "ALERTS", "CALLHOME", "PASSWORD_POLICY", "OTHER" ] + }, + "name" : { + "type" : "string", + "example" : "S3", + "description" : "Name" + }, + "data" : { + "example" : "{\"AWS_ACCESS_KEY_ID\": \"AK****************ZD\"}", + "description" : "Configuration data", + "$ref" : "#/definitions/JsonNode" + }, + "universeDetails" : { + "example" : "{\"name\": \"jd-aws-21-6-21-test4\"}", + "description" : "Universe details", + "$ref" : "#/definitions/ArrayNode" }, - "instanceType" : { - "type" : "string", - "example" : "c5large", - "description" : "Instance type of node instance" + "inUse" : { + "type" : "boolean", + "description" : "True if there is an in use reference to the object" + } + }, + "description" : "Customers Configuration" + }, + "Configs entry" : { + "type" : "object", + "properties" : { + "inherited" : { + "type" : "boolean", + "description" : "Is config inherited" }, - "instanceName" : { + "key" : { "type" : "string", - "example" : "Mumbai instance", - "description" : "Instance name of node instance" + "description" : "Config key" }, - "nodeName" : { + "value" : { "type" : "string", - "example" : "India node", - "description" : "Node name of node instance" + "description" : "Config value" } }, - "description" : "Detail of node instance" + "description" : "Configs entry" }, - "NodeInstanceFormData" : { + "Runtime config data" : { "type" : "object", - "required" : [ "nodes" ], "properties" : { - "nodes" : { + "scopedConfigList" : { "type" : "array", - "description" : "Node instances", + "description" : "list of scoped config", "items" : { - "$ref" : "#/definitions/NodeInstanceData" + "$ref" : "#/definitions/Scoped config" } } - } + }, + "description" : "Runtime config data" }, - "NodeActionFormData" : { + "Scoped config" : { "type" : "object", - "required" : [ "nodeAction" ], "properties" : { - "nodeAction" : { + "type" : { "type" : "string", - "enum" : [ "ADD", "REMOVE", "START", "STOP", "DELETE", "QUERY", "RELEASE", "START_MASTER" ] - } - } - }, - "UniverseResource" : { - "type" : "object", - "properties" : { - "pricePerHour" : { - "type" : "number", - "format" : "double", - "description" : "Price per hour" - }, - "ebsPricePerHour" : { - "type" : "number", - "format" : "double", - "description" : "EBS price per hour" - }, - "numCores" : { - "type" : "number", - "format" : "double", - "description" : "Numbers of cores" - }, - "memSizeGB" : { - "type" : "number", - "format" : "double", - "description" : "Memory GB" - }, - "volumeCount" : { - "type" : "integer", - "format" : "int32", - "description" : "Volume count" - }, - "volumeSizeGB" : { - "type" : "integer", - "format" : "int32", - "description" : "Volume in GB" - }, - "numNodes" : { - "type" : "integer", - "format" : "int32", - "description" : "Numbers of node" + "description" : "Scope type", + "enum" : [ "GLOBAL", "CUSTOMER", "UNIVERSE", "PROVIDER" ] }, - "gp3FreePiops" : { - "type" : "integer", - "format" : "int32", - "description" : "gp3 free piops" + "uuid" : { + "type" : "string", + "format" : "uuid", + "description" : "Scope UIID" }, - "gp3FreeThroughput" : { - "type" : "integer", - "format" : "int32", - "description" : "gp3 free throughput" + "mutableScope" : { + "type" : "boolean", + "description" : "Is scope mutable" }, - "azList" : { + "configEntries" : { "type" : "array", - "description" : "Azs", - "uniqueItems" : true, + "description" : "List of configs", "items" : { - "type" : "string" + "$ref" : "#/definitions/Configs entry" } } }, - "description" : "Universe Resource" + "description" : "Scoped config" }, - "Column details" : { + "Audit" : { "type" : "object", + "required" : [ "auditID", "timestamp" ], "properties" : { - "columnOrder" : { - "type" : "integer", - "format" : "int32", - "description" : "Column order" - }, - "name" : { + "userUUID" : { "type" : "string", - "description" : "Column name" + "format" : "uuid", + "description" : "User uuid", + "readOnly" : true }, - "type" : { + "customerUUID" : { "type" : "string", - "description" : "Column type", - "enum" : [ "TINYINT", "SMALLINT", "INT", "BIGINT", "VARCHAR", "BOOLEAN", "FLOAT", "DOUBLE_PRECISION", "BLOB", "TIMESTAMP", "DECIMAL", "VARINT", "INET", "LIST", "MAP", "SET", "UUID", "TIMEUUID", "FROZEN", "DATE", "TIME", "JSONB", "USER_DEFINED_TYPE" ] + "format" : "uuid", + "description" : "Customer uuid", + "readOnly" : true }, - "keyType" : { + "timestamp" : { "type" : "string", - "description" : "Column key type", - "enum" : [ "TINYINT", "SMALLINT", "INT", "BIGINT", "VARCHAR", "BOOLEAN", "FLOAT", "DOUBLE_PRECISION", "BLOB", "TIMESTAMP", "DECIMAL", "VARINT", "INET", "LIST", "MAP", "SET", "UUID", "TIMEUUID", "FROZEN", "DATE", "TIME", "JSONB", "USER_DEFINED_TYPE" ] + "format" : "date-time" }, - "valueType" : { - "type" : "string", - "description" : "Column value name", - "enum" : [ "TINYINT", "SMALLINT", "INT", "BIGINT", "VARCHAR", "BOOLEAN", "FLOAT", "DOUBLE_PRECISION", "BLOB", "TIMESTAMP", "DECIMAL", "VARINT", "INET", "LIST", "MAP", "SET", "UUID", "TIMEUUID", "FROZEN", "DATE", "TIME", "JSONB", "USER_DEFINED_TYPE" ] + "payload" : { + "description" : "Audit uuid", + "readOnly" : true, + "$ref" : "#/definitions/JsonNode" }, - "isPartitionKey" : { - "type" : "boolean", - "description" : "True if this column is a partition key" + "apiCall" : { + "type" : "string", + "example" : "/api/v1/customers/<496fdea8-df25-11eb-ba80-0242ac130004>/providers", + "description" : "Api call", + "readOnly" : true }, - "isClusteringKey" : { - "type" : "boolean", - "description" : "True if this column is a clustering key" + "apiMethod" : { + "type" : "string", + "example" : "GET", + "description" : "API method", + "readOnly" : true }, - "sortOrder" : { + "taskUUID" : { "type" : "string", - "description" : "SortOrder for this column", - "enum" : [ "NONE", "ASC", "DESC" ] + "format" : "uuid", + "description" : "Task UUID", + "readOnly" : true + }, + "auditID" : { + "type" : "integer", + "format" : "int64" } }, - "description" : "Column details" + "description" : "Audit for audit logging of the requests and responses." }, - "Table details" : { + "AccessKey" : { "type" : "object", + "required" : [ "idKey", "keyInfo" ], "properties" : { - "tableName" : { - "type" : "string", - "description" : "Table name" - }, - "keyspace" : { - "type" : "string", - "description" : "Keyspace that this table belongs to" - }, - "ttlInSeconds" : { - "type" : "integer", - "format" : "int64", - "description" : "The default table-level time to live" - }, - "columns" : { - "type" : "array", - "description" : "Details of the columns that make up the table", - "items" : { - "$ref" : "#/definitions/Column details" - } - }, - "cqlcreateKeyspaceString" : { - "type" : "string", - "description" : "CQL create keyspace detail" - }, - "cqluseKeyspaceString" : { - "type" : "string", - "description" : "CQL use keyspace detail" + "idKey" : { + "$ref" : "#/definitions/AccessKeyId" }, - "cqlcreateTableString" : { - "type" : "string", - "description" : "CQL create table detail" + "keyInfo" : { + "description" : "Cloud provider key info", + "$ref" : "#/definitions/KeyInfo" } }, - "description" : "Table details" + "description" : "Access key for the provider. This will help to authenticate the user and get the access to the cloud provider." }, - "Universe task" : { + "AccessKeyId" : { "type" : "object", - "required" : [ "tableDetails", "tableType", "tableUUID" ], + "required" : [ "keyCode", "providerUUID" ], "properties" : { - "errorString" : { - "type" : "string", - "description" : "Error message" + "keyCode" : { + "type" : "string" }, - "nodeExporterUser" : { + "providerUUID" : { "type" : "string", - "description" : "Node exporter user" + "format" : "uuid" + } + } + }, + "KeyInfo" : { + "type" : "object", + "required" : [ "airGapInstall", "installNodeExporter", "nodeExporterPort", "nodeExporterUser", "passwordlessSudoAccess", "privateKey", "provisionInstanceScript", "publicKey", "skipProvisioning", "sshPort", "sshUser", "vaultFile", "vaultPasswordFile" ], + "properties" : { + "publicKey" : { + "type" : "string" }, - "deviceInfo" : { - "description" : "Device information", - "$ref" : "#/definitions/Device info" + "privateKey" : { + "type" : "string" }, - "universeUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Associate universe UUID" + "vaultPasswordFile" : { + "type" : "string" + }, + "vaultFile" : { + "type" : "string" + }, + "sshUser" : { + "type" : "string" }, - "expectedUniverseVersion" : { + "sshPort" : { "type" : "integer", - "format" : "int32", - "description" : "Universe version" - }, - "cmkArn" : { - "type" : "string", - "description" : "Amazon Resource Name (ARN) of the CMK" + "format" : "int32" }, - "encryptionAtRestConfig" : { - "description" : "Encryption at rest configation", - "$ref" : "#/definitions/Encryption at rest config" + "airGapInstall" : { + "type" : "boolean" }, - "nodeDetailsSet" : { - "type" : "array", - "description" : "Node details", - "uniqueItems" : true, - "items" : { - "$ref" : "#/definitions/Node details" - } + "passwordlessSudoAccess" : { + "type" : "boolean" }, - "communicationPorts" : { - "description" : "Communication ports", - "$ref" : "#/definitions/Communication ports" + "provisionInstanceScript" : { + "type" : "string" }, - "extraDependencies" : { - "description" : "Extra dependencies", - "$ref" : "#/definitions/Extra dependencies" + "installNodeExporter" : { + "type" : "boolean" }, - "firstTry" : { - "type" : "boolean", - "description" : "Whether this task has been tried before or not" + "nodeExporterPort" : { + "type" : "integer", + "format" : "int32" }, - "tableUUID" : { - "type" : "string", - "format" : "uuid" + "nodeExporterUser" : { + "type" : "string" }, - "tableType" : { + "skipProvisioning" : { + "type" : "boolean" + } + } + }, + "Release data" : { + "type" : "object", + "properties" : { + "state" : { "type" : "string", - "enum" : [ "YQL_TABLE_TYPE", "REDIS_TABLE_TYPE", "PGSQL_TABLE_TYPE", "TRANSACTION_STATUS_TABLE_TYPE" ] - }, - "tableDetails" : { - "$ref" : "#/definitions/Table details" + "example" : "ACTIVE", + "description" : "Release state", + "enum" : [ "ACTIVE", "DISABLED", "DELETED" ] }, - "targetAsyncReplicationRelationships" : { + "notes" : { "type" : "array", - "description" : "Async replication relationships as the target universe", - "readOnly" : true, + "description" : "Release notes", "items" : { - "$ref" : "#/definitions/AsyncReplicationConfig" + "type" : "string" } }, - "sourceAsyncReplicationRelationships" : { - "type" : "array", - "description" : "Async replication relationships as the source universe", - "readOnly" : true, - "items" : { - "$ref" : "#/definitions/AsyncReplicationConfig" - } + "filePath" : { + "type" : "string", + "description" : "Release file path" + }, + "imageTag" : { + "type" : "string", + "description" : "Release image tag" } }, - "description" : "Universe task" + "description" : "Release data" }, - "Bulk import params" : { + "ReleaseFormData" : { "type" : "object", - "required" : [ "s3Bucket" ], + "required" : [ "version" ], "properties" : { - "errorString" : { - "type" : "string", - "description" : "Error message" + "version" : { + "type" : "string" + } + } + }, + "RegionFormData" : { + "type" : "object", + "required" : [ "code", "destVpcId", "hostVpcId", "hostVpcRegion", "latitude", "longitude", "name", "ybImage" ], + "properties" : { + "code" : { + "type" : "string" }, - "nodeExporterUser" : { - "type" : "string", - "description" : "Node exporter user" + "name" : { + "type" : "string" }, - "deviceInfo" : { - "description" : "Device information", - "$ref" : "#/definitions/Device info" + "ybImage" : { + "type" : "string" }, - "universeUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Associate universe UUID" + "hostVpcRegion" : { + "type" : "string" }, - "expectedUniverseVersion" : { - "type" : "integer", - "format" : "int32", - "description" : "Universe version" + "hostVpcId" : { + "type" : "string" }, - "cmkArn" : { - "type" : "string", - "description" : "Amazon Resource Name (ARN) of the CMK" + "destVpcId" : { + "type" : "string" }, - "encryptionAtRestConfig" : { - "description" : "Encryption at rest configation", - "$ref" : "#/definitions/Encryption at rest config" + "latitude" : { + "type" : "number", + "format" : "double" }, - "nodeDetailsSet" : { - "type" : "array", - "description" : "Node details", - "uniqueItems" : true, - "items" : { - "$ref" : "#/definitions/Node details" - } + "longitude" : { + "type" : "number", + "format" : "double" + } + } + }, + "Backup" : { + "type" : "object", + "required" : [ "createTime", "updateTime" ], + "properties" : { + "backupUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "Backup uuid", + "readOnly" : true }, - "communicationPorts" : { - "description" : "Communication ports", - "$ref" : "#/definitions/Communication ports" + "customerUUID" : { + "type" : "string", + "format" : "uuid", + "description" : "Customer UUID of the backup which it belongs to" }, - "extraDependencies" : { - "description" : "Extra dependencies", - "$ref" : "#/definitions/Extra dependencies" + "state" : { + "type" : "string", + "example" : "DELETED", + "description" : "State of the backup", + "readOnly" : true, + "enum" : [ "InProgress", "Completed", "Failed", "Deleted", "Skipped", "FailedToDelete", "Stopped" ] }, - "firstTry" : { - "type" : "boolean", - "description" : "Whether this task has been tried before or not" + "backupInfo" : { + "description" : "Details of the backup", + "$ref" : "#/definitions/Backup table params" }, - "keyspace" : { + "taskUUID" : { "type" : "string", - "description" : "Key space" + "format" : "uuid", + "description" : "Backup UUID", + "readOnly" : true }, - "tableName" : { + "scheduleUUID" : { "type" : "string", - "description" : "Table name" + "format" : "uuid", + "description" : "Schedule UUID if this backup is taken from scheduling it" }, - "tableUUID" : { + "expiry" : { "type" : "string", - "format" : "uuid", - "description" : "Table UUID" + "format" : "date-time", + "description" : "Expiry time of the backup" }, - "sse" : { - "type" : "boolean", - "description" : "Is SSE" + "createTime" : { + "type" : "string", + "format" : "date-time" }, - "s3Bucket" : { + "updateTime" : { "type" : "string", - "description" : "S3 bucket URL" + "format" : "date-time" + } + }, + "description" : "Backup with a status, expiry and backup configs" + }, + "CertificateParams" : { + "type" : "object", + "required" : [ "certContent", "certExpiry", "certStart", "certType", "customCertInfo", "customServerCertData", "keyContent", "label" ], + "properties" : { + "label" : { + "type" : "string" }, - "instanceCount" : { + "certStart" : { "type" : "integer", - "format" : "int32", - "description" : "Instance count" + "format" : "int64" }, - "targetAsyncReplicationRelationships" : { - "type" : "array", - "description" : "Async replication relationships as the target universe", - "readOnly" : true, - "items" : { - "$ref" : "#/definitions/AsyncReplicationConfig" - } + "certExpiry" : { + "type" : "integer", + "format" : "int64" }, - "sourceAsyncReplicationRelationships" : { - "type" : "array", - "description" : "Async replication relationships as the source universe", - "readOnly" : true, - "items" : { - "$ref" : "#/definitions/AsyncReplicationConfig" - } + "certContent" : { + "type" : "string" + }, + "keyContent" : { + "type" : "string" + }, + "certType" : { + "type" : "string", + "enum" : [ "SelfSigned", "CustomCertHostPath", "CustomServerCert" ] + }, + "customCertInfo" : { + "$ref" : "#/definitions/CustomCertInfo" + }, + "customServerCertData" : { + "$ref" : "#/definitions/CustomServerCertData" } - }, - "description" : "Bulk import params" + } }, - "TableInfo" : { + "CustomCertInfo" : { "type" : "object", + "required" : [ "clientCertPath", "clientKeyPath", "nodeCertPath", "nodeKeyPath", "rootCertPath" ], "properties" : { - "tableUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Table UUID", - "readOnly" : true - }, - "keySpace" : { - "type" : "string", - "description" : "Key space" + "nodeCertPath" : { + "type" : "string" }, - "tableType" : { - "type" : "string", - "description" : "Table type", - "enum" : [ "YQL_TABLE_TYPE", "REDIS_TABLE_TYPE", "PGSQL_TABLE_TYPE", "TRANSACTION_STATUS_TABLE_TYPE" ] + "nodeKeyPath" : { + "type" : "string" }, - "tableName" : { - "type" : "string", - "description" : "Table name" + "rootCertPath" : { + "type" : "string" }, - "relationType" : { - "type" : "string", - "description" : "Relation type", - "enum" : [ "SYSTEM_TABLE_RELATION", "USER_TABLE_RELATION", "INDEX_TABLE_RELATION" ] + "clientCertPath" : { + "type" : "string" }, - "sizeBytes" : { - "type" : "number", - "format" : "double", - "description" : "Size in bytes", - "readOnly" : true + "clientKeyPath" : { + "type" : "string" } } }, - "Multi table backup request params" : { + "CustomServerCertData" : { "type" : "object", - "required" : [ "actionType", "storageConfigUUID" ], + "required" : [ "serverCertContent", "serverKeyContent" ], "properties" : { - "errorString" : { - "type" : "string", - "description" : "Error message" - }, - "nodeExporterUser" : { - "type" : "string", - "description" : "Node exporter user" + "serverCertContent" : { + "type" : "string" }, - "deviceInfo" : { - "description" : "Device information", - "$ref" : "#/definitions/Device info" + "serverKeyContent" : { + "type" : "string" + } + } + }, + "CertificateDetails" : { + "type" : "object", + "properties" : { + "yugabytedb.crt" : { + "type" : "string" }, - "universeUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Associate universe UUID" + "yugabytedb.key" : { + "type" : "string" + } + } + }, + "ClientCertParams" : { + "type" : "object", + "required" : [ "certExpiry", "certStart", "username" ], + "properties" : { + "username" : { + "type" : "string" }, - "expectedUniverseVersion" : { + "certStart" : { "type" : "integer", - "format" : "int32", - "description" : "Universe version" + "format" : "int64" }, - "cmkArn" : { + "certExpiry" : { + "type" : "integer", + "format" : "int64" + } + } + }, + "CertificateInfo" : { + "type" : "object", + "required" : [ "customServerCertInfo" ], + "properties" : { + "uuid" : { "type" : "string", - "description" : "Amazon Resource Name (ARN) of the CMK" - }, - "encryptionAtRestConfig" : { - "description" : "Encryption at rest configation", - "$ref" : "#/definitions/Encryption at rest config" - }, - "nodeDetailsSet" : { - "type" : "array", - "description" : "Node details", - "uniqueItems" : true, - "items" : { - "$ref" : "#/definitions/Node details" - } - }, - "communicationPorts" : { - "description" : "Communication ports", - "$ref" : "#/definitions/Communication ports" - }, - "extraDependencies" : { - "description" : "Extra dependencies", - "$ref" : "#/definitions/Extra dependencies" - }, - "firstTry" : { - "type" : "boolean", - "description" : "Whether this task has been tried before or not" + "format" : "uuid", + "description" : "Certificate uuid", + "readOnly" : true }, - "keyspace" : { + "customerUUID" : { "type" : "string", - "description" : "Key space" + "format" : "uuid", + "description" : "Customer UUID of the backup which it belongs to" }, - "tableName" : { + "label" : { "type" : "string", - "description" : "Table name" + "example" : "yb-admin-example", + "description" : "Certificate label" }, - "tableUUID" : { + "startDate" : { "type" : "string", - "format" : "uuid", - "description" : "Table UUID" - }, - "sse" : { - "type" : "boolean", - "description" : "Is SSE" + "format" : "date-time", + "description" : "Certificate created date" }, - "storageConfigUUID" : { + "expiryDate" : { "type" : "string", - "format" : "uuid", - "description" : "Storage config UUID" + "format" : "date-time", + "description" : "Expiry date of the Certificate" }, - "kmsConfigUUID" : { + "privateKey" : { "type" : "string", - "format" : "uuid", - "description" : "KMS config UUID" + "example" : "/opt/yugaware/..../example.key.pem", + "description" : "Private key path" }, - "storageLocation" : { + "certificate" : { "type" : "string", - "description" : "Storage location" + "example" : "/opt/yugaware/certs/.../ca.root.cert", + "description" : "Certificate path" }, - "actionType" : { + "certType" : { "type" : "string", - "description" : "Action type", - "enum" : [ "CREATE", "RESTORE", "RESTORE_KEYS", "DELETE" ] + "example" : "SelfSigned", + "description" : "Type of the certificate", + "enum" : [ "SelfSigned", "CustomCertHostPath", "CustomServerCert" ] }, - "backupType" : { + "checksum" : { "type" : "string", - "description" : "Backup type", - "enum" : [ "YQL_TABLE_TYPE", "REDIS_TABLE_TYPE", "PGSQL_TABLE_TYPE", "TRANSACTION_STATUS_TABLE_TYPE" ] + "description" : "Checksome of a cert file", + "readOnly" : true }, - "tableNameList" : { - "type" : "array", - "description" : "Tables", - "items" : { - "type" : "string" - } + "customCertInfo" : { + "description" : "Details about the Certificate", + "$ref" : "#/definitions/CustomCertInfo" }, - "tableUUIDList" : { - "type" : "array", - "description" : "Table UUID List", - "items" : { - "type" : "string", - "format" : "uuid" - } + "universeDetails" : { + "description" : "Associated universe details of the Certificate", + "readOnly" : true, + "$ref" : "#/definitions/ArrayNode" }, - "backupList" : { - "type" : "array", - "description" : "Backups", - "items" : { - "$ref" : "#/definitions/Backup table params" - } + "inUse" : { + "type" : "boolean", + "description" : "Indicates whether the Certificate is in use or not", + "readOnly" : true }, - "schedulingFrequency" : { - "type" : "integer", - "format" : "int64", - "description" : "Frequency for running the backup in milliseconds" + "customServerCertInfo" : { + "$ref" : "#/definitions/CustomServerCertInfo" + } + }, + "description" : "Certificate used by the universe to send sensitive information" + }, + "CustomServerCertInfo" : { + "type" : "object", + "required" : [ "serverCert", "serverKey" ], + "properties" : { + "serverCert" : { + "type" : "string" }, - "cronExpression" : { - "type" : "string", - "description" : "Cron expression in case a recurring backup" + "serverKey" : { + "type" : "string" + } + } + }, + "UniverseResource" : { + "type" : "object", + "properties" : { + "pricePerHour" : { + "type" : "number", + "format" : "double", + "description" : "Price per hour" }, - "timeBeforeDelete" : { - "type" : "integer", - "format" : "int64", - "description" : "Time in millisecs before deleting the backup from the storage" + "ebsPricePerHour" : { + "type" : "number", + "format" : "double", + "description" : "EBS price per hour" }, - "enableVerboseLogs" : { - "type" : "boolean", - "description" : "Is verbose logging is enable" + "numCores" : { + "type" : "number", + "format" : "double", + "description" : "Numbers of cores" }, - "transactionalBackup" : { - "type" : "boolean", - "description" : "Is backup be transactional across tables" + "memSizeGB" : { + "type" : "number", + "format" : "double", + "description" : "Memory GB" }, - "parallelism" : { + "volumeCount" : { "type" : "integer", "format" : "int32", - "description" : "The number of concurrent commands to run on nodes over SSH" + "description" : "Volume count" }, - "scheduleUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Schedule UUID" + "volumeSizeGB" : { + "type" : "integer", + "format" : "int32", + "description" : "Volume in GB" }, - "customerUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Customer UUID" + "numNodes" : { + "type" : "integer", + "format" : "int32", + "description" : "Numbers of node" }, - "targetAsyncReplicationRelationships" : { - "type" : "array", - "description" : "Async replication relationships as the target universe", - "readOnly" : true, - "items" : { - "$ref" : "#/definitions/AsyncReplicationConfig" - } + "gp3FreePiops" : { + "type" : "integer", + "format" : "int32", + "description" : "gp3 free piops" }, - "sourceAsyncReplicationRelationships" : { + "gp3FreeThroughput" : { + "type" : "integer", + "format" : "int32", + "description" : "gp3 free throughput" + }, + "azList" : { "type" : "array", - "description" : "Async replication relationships as the source universe", - "readOnly" : true, + "description" : "Azs", + "uniqueItems" : true, "items" : { - "$ref" : "#/definitions/AsyncReplicationConfig" + "type" : "string" } } }, - "description" : "Backup table params" + "description" : "Universe Resource" }, - "Configs entry" : { + "Metrics" : { "type" : "object", + "required" : [ "metrics", "start" ], "properties" : { - "inherited" : { - "type" : "boolean", - "description" : "Is config inherited" + "metrics" : { + "type" : "array", + "description" : "metrics", + "items" : { + "type" : "string" + } }, - "key" : { + "start" : { + "type" : "integer", + "format" : "int64", + "description" : "Start time" + }, + "end" : { + "type" : "integer", + "format" : "int64", + "description" : "End time" + }, + "nodePrefix" : { "type" : "string", - "description" : "Config key" + "description" : "Node prefix" }, - "value" : { + "nodeName" : { "type" : "string", - "description" : "Config value" + "description" : "Node name" } }, - "description" : "Configs entry" + "description" : "Metrics details" }, - "Runtime config data" : { + "FeatureUpdateFormData" : { "type" : "object", + "required" : [ "features" ], "properties" : { - "scopedConfigList" : { - "type" : "array", - "description" : "list of scoped config", - "items" : { - "$ref" : "#/definitions/Scoped config" - } + "features" : { + "$ref" : "#/definitions/JsonNode" } - }, - "description" : "Runtime config data" + } }, - "Scoped config" : { + "Alert Detail" : { "type" : "object", "properties" : { - "type" : { + "alertingEmail" : { "type" : "string", - "description" : "Scope type", - "enum" : [ "GLOBAL", "CUSTOMER", "UNIVERSE", "PROVIDER" ] + "example" : "test@gmail.com", + "description" : "Alert email id" }, - "uuid" : { - "type" : "string", - "format" : "uuid", - "description" : "Scope UIID" + "sendAlertsToYb" : { + "type" : "boolean", + "description" : "Is alert has sent to YB" }, - "mutableScope" : { + "checkIntervalMs" : { + "type" : "integer", + "format" : "int64", + "description" : "Alert interval" + }, + "statusUpdateIntervalMs" : { + "type" : "integer", + "format" : "int64", + "description" : "Status update of alert interval" + }, + "reportOnlyErrors" : { "type" : "boolean", - "description" : "Is scope mutable" + "description" : "Is alert is just for error" }, - "configEntries" : { - "type" : "array", - "description" : "List of configs", - "items" : { - "$ref" : "#/definitions/Configs entry" - } + "reportBackupFailures" : { + "type" : "boolean", + "description" : "Is alert needed for backup failure" + }, + "enableClockSkew" : { + "type" : "boolean", + "description" : "Is Clock skew is enabled" } }, - "description" : "Scoped config" + "description" : "Alerts associated with customers" }, - "Customer Config" : { + "Customer Detail" : { "type" : "object", - "required" : [ "data" ], + "required" : [ "code", "name" ], "properties" : { - "configUUID" : { + "uuid" : { "type" : "string", - "format" : "uuid", - "description" : "Config UUID", + "description" : "User uuid", "readOnly" : true }, - "configName" : { - "type" : "string", - "example" : "backup20-01-2021", - "description" : "Config name" - }, - "customerUUID" : { + "code" : { "type" : "string", - "format" : "uuid", - "description" : "Customer UUID", - "readOnly" : true + "example" : "admin", + "description" : "Customer code" }, - "type" : { + "name" : { "type" : "string", - "example" : "STORAGE", - "description" : "Config type", - "enum" : [ "STORAGE", "ALERTS", "CALLHOME", "PASSWORD_POLICY", "OTHER" ] + "example" : "sridhar", + "description" : "Name of customer" }, - "name" : { + "creationDate" : { "type" : "string", - "example" : "S3", - "description" : "Name" + "format" : "date-time", + "example" : "2021-06-17 15:00:05", + "description" : "Creation time", + "readOnly" : true }, - "data" : { - "example" : "{\"AWS_ACCESS_KEY_ID\": \"AK****************ZD\"}", - "description" : "Configuration data", + "features" : { + "description" : "Features", + "readOnly" : true, "$ref" : "#/definitions/JsonNode" }, - "universeDetails" : { - "example" : "{\"name\": \"jd-aws-21-6-21-test4\"}", - "description" : "Universe details", - "$ref" : "#/definitions/ArrayNode" - }, - "inUse" : { - "type" : "boolean", - "description" : "True if there is an in use reference to the object" - } - }, - "description" : "Customers Configuration" - }, - "InstanceType" : { - "type" : "object", - "required" : [ "idKey", "instanceTypeCode", "instanceTypeDetails", "provider", "providerCode", "providerUuid" ], - "properties" : { - "idKey" : { - "$ref" : "#/definitions/InstanceTypeKey" - }, - "provider" : { - "$ref" : "#/definitions/Provider" + "universeUUIDs" : { + "type" : "array", + "example" : "[\"c3595ca7-68a3-47f0-b1b2-1725886d5ed5\", \"9e0bb733-556c-4935-83dd-6b742a2c32e6\"]", + "description" : "Associated Universe Id's", + "readOnly" : true, + "items" : { + "type" : "string", + "format" : "uuid" + } }, - "active" : { - "type" : "boolean", - "description" : "indiacates whether this instance is active or not", + "customerId" : { + "type" : "integer", + "format" : "int32", + "description" : "Customer id", "readOnly" : true }, - "numCores" : { - "type" : "number", - "format" : "double", - "description" : "Number of cores in an instance" - }, - "memSizeGB" : { - "type" : "number", - "format" : "double", - "description" : "Memory size of an instance" - }, - "instanceTypeDetails" : { - "$ref" : "#/definitions/InstanceTypeDetails" - }, - "instanceTypeCode" : { - "type" : "string" - }, - "providerCode" : { - "type" : "string" + "alertingData" : { + "description" : "Alerts", + "readOnly" : true, + "$ref" : "#/definitions/Alert Detail" }, - "providerUuid" : { - "type" : "string", - "format" : "uuid" - } - }, - "description" : "Instance type model which holds the information about the instance." - }, - "InstanceTypeDetails" : { - "type" : "object", - "required" : [ "tenancy", "volumeDetailsList" ], - "properties" : { - "volumeDetailsList" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/VolumeDetails" - } + "smtpData" : { + "description" : "SMTP", + "readOnly" : true, + "$ref" : "#/definitions/Smtp Data" }, - "tenancy" : { + "callhomeLevel" : { "type" : "string", - "enum" : [ "Shared", "Dedicated", "Host" ] + "example" : "MEDIUM", + "description" : "Call home level", + "readOnly" : true } - } + }, + "description" : "Customers features and Universe UUID." }, - "InstanceTypeKey" : { + "Customer" : { "type" : "object", - "required" : [ "instanceTypeCode", "providerUuid" ], + "required" : [ "code", "name" ], "properties" : { - "providerUuid" : { + "uuid" : { "type" : "string", - "format" : "uuid" + "format" : "uuid", + "description" : "Customer uuid", + "readOnly" : true }, - "instanceTypeCode" : { - "type" : "string" - } - } - }, - "VolumeDetails" : { - "type" : "object", - "required" : [ "mountPath", "volumeSizeGB", "volumeType" ], - "properties" : { - "volumeSizeGB" : { - "type" : "integer", - "format" : "int32" + "code" : { + "type" : "string", + "example" : "admin", + "description" : "Customer code" }, - "volumeType" : { + "name" : { "type" : "string", - "enum" : [ "EBS", "SSD", "HDD", "NVME" ] + "example" : "sridhar", + "description" : "Name of customer" }, - "mountPath" : { - "type" : "string" + "creationDate" : { + "type" : "string", + "format" : "date-time", + "example" : "2021-06-17 15:00:05", + "description" : "Creation time", + "readOnly" : true + }, + "features" : { + "description" : "Features", + "readOnly" : true, + "$ref" : "#/definitions/JsonNode" + }, + "universeUUIDs" : { + "type" : "array", + "example" : "[\"c3595ca7-68a3-47f0-b1b2-1725886d5ed5\", \"9e0bb733-556c-4935-83dd-6b742a2c32e6\"]", + "description" : "Universe UUIDs", + "readOnly" : true, + "uniqueItems" : true, + "items" : { + "type" : "string", + "format" : "uuid" + } + }, + "customerId" : { + "type" : "integer", + "format" : "int64", + "example" : 1, + "description" : "Customer id", + "readOnly" : true } - } + }, + "description" : "Customers features and Universe UUID." }, - "ImportUniverseFormData" : { + "Alerts" : { "type" : "object", - "required" : [ "cloudName", "cloudProviderType", "currentState", "instanceType", "masterAddresses", "providerType", "regionCode", "regionName", "replicationFactor", "singleStep", "universeName", "universeUUID", "zoneCode", "zoneName" ], + "required" : [ "alertingData", "callhomeLevel", "smtpData" ], "properties" : { - "universeName" : { - "type" : "string" - }, - "masterAddresses" : { - "type" : "string" - }, - "cloudProviderType" : { - "type" : "string" - }, - "currentState" : { + "code" : { "type" : "string", - "enum" : [ "BEGIN", "IMPORTED_MASTERS", "IMPORTED_TSERVERS", "FINISHED" ] - }, - "singleStep" : { - "type" : "boolean" + "description" : "Alert code" }, - "universeUUID" : { + "email" : { "type" : "string", - "format" : "uuid" + "example" : "test@gmail.com", + "description" : "Alert email" }, - "cloudName" : { - "type" : "string" + "password" : { + "type" : "string", + "example" : "XurenRknsc", + "description" : "Email password" }, - "providerType" : { + "confirmPassword" : { "type" : "string", - "enum" : [ "unknown", "aws", "gcp", "azu", "docker", "onprem", "kubernetes", "local", "other" ] + "example" : "XurenRknsc", + "description" : "Email password" }, - "regionName" : { - "type" : "string" + "name" : { + "type" : "string", + "example" : "Test alert", + "description" : "Alert name" }, - "regionCode" : { - "type" : "string" + "features" : { + "type" : "object", + "description" : "Feature", + "additionalProperties" : { + "type" : "object" + } }, - "zoneName" : { - "type" : "string" + "alertingData" : { + "$ref" : "#/definitions/Alert Detail" }, - "zoneCode" : { - "type" : "string" + "smtpData" : { + "$ref" : "#/definitions/Smtp Data" }, - "instanceType" : { + "callhomeLevel" : { "type" : "string" - }, - "replicationFactor" : { - "type" : "integer", - "format" : "int32" } - } + }, + "description" : "Alerts associated with customers" }, - "Availability Zones" : { + "User Register" : { "type" : "object", - "required" : [ "code", "name" ], + "required" : [ "email", "role" ], "properties" : { - "code" : { + "email" : { "type" : "string", - "description" : "Az code" + "example" : "test@gmail.com", + "description" : "User email address" }, - "name" : { + "password" : { "type" : "string", - "description" : "Az name" + "example" : "Test@1234", + "description" : "User password" }, - "subnet" : { + "confirmPassword" : { "type" : "string", - "description" : "Az subnet" - } - }, - "description" : "Availability Zones." - }, - "AvailabilityZoneFormData" : { - "type" : "object", - "required" : [ "availabilityZones" ], - "properties" : { - "availabilityZones" : { - "type" : "array", - "description" : "Availability zones", - "items" : { - "$ref" : "#/definitions/Availability Zones" + "example" : "Test@1234", + "description" : "User password" + }, + "features" : { + "type" : "object", + "description" : "User Features", + "additionalProperties" : { + "type" : "object" } + }, + "role" : { + "type" : "string", + "example" : "Admin", + "description" : "User role", + "enum" : [ "Admin", "ReadOnly", "SuperAdmin", "BackupAdmin" ] } - } + }, + "description" : "User registration data" }, - "Customer Task Data" : { + "Users" : { "type" : "object", + "required" : [ "email" ], "properties" : { - "id" : { + "uuid" : { "type" : "string", "format" : "uuid", - "description" : "Customer Task UUID" + "description" : "User uuid", + "readOnly" : true }, - "title" : { + "customerUUID" : { "type" : "string", - "example" : "Deleted Universe : test-universe", - "description" : "Customer Task title" - }, - "percentComplete" : { - "type" : "integer", - "format" : "int32", - "example" : 100, - "description" : "Customer Task percentage completed" + "format" : "uuid", + "description" : "Customer uuid", + "readOnly" : true }, - "createTime" : { + "email" : { "type" : "string", - "format" : "date-time", - "example" : "1624295417405", - "description" : "Customer Task creation time" + "example" : "username1@email.com", + "description" : "User email id" }, - "completionTime" : { + "creationDate" : { "type" : "string", "format" : "date-time", - "example" : "1624295417405", - "description" : "Customer Task completion time" + "example" : "2021-06-17 15:00:05", + "description" : "Creation time", + "readOnly" : true }, - "target" : { + "authTokenIssueDate" : { "type" : "string", - "example" : "Universe", - "description" : "Customer Task target" + "format" : "date-time", + "example" : "1624255408795", + "description" : "Token issued date", + "readOnly" : true }, - "targetUUID" : { - "type" : "string", - "format" : "uuid", - "description" : "Customer Task target UUID" + "features" : { + "description" : "Features", + "readOnly" : true, + "$ref" : "#/definitions/JsonNode" }, - "type" : { + "role" : { "type" : "string", - "example" : "Delete", - "description" : "Customer Task type" + "description" : "User role", + "enum" : [ "Admin", "ReadOnly", "SuperAdmin", "BackupAdmin" ] }, - "status" : { - "type" : "string", - "example" : "Complete", - "description" : "Customer Task status" + "isPrimary" : { + "type" : "boolean", + "description" : "User is primary user or not" } }, - "description" : "Customer Task data" + "description" : "Users associated customers." } }, "externalDocs" : { diff --git a/managed/src/test/java/com/yugabyte/yw/ConfigTest.java b/managed/src/test/java/com/yugabyte/yw/ConfigTest.java index 69276431d760..e817de40aa1b 100644 --- a/managed/src/test/java/com/yugabyte/yw/ConfigTest.java +++ b/managed/src/test/java/com/yugabyte/yw/ConfigTest.java @@ -10,11 +10,23 @@ package com.yugabyte.yw; +import static java.util.stream.Collectors.joining; +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertSame; + import com.google.common.base.Strings; import com.google.common.collect.ImmutableSet; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import com.typesafe.config.ConfigRenderOptions; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import junitparams.JUnitParamsRunner; import junitparams.Parameters; import org.junit.Rule; @@ -26,19 +38,6 @@ import play.api.Configuration; import play.libs.Scala; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import static java.util.stream.Collectors.joining; -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertSame; - @RunWith(JUnitParamsRunner.class) public class ConfigTest { diff --git a/managed/src/test/java/com/yugabyte/yw/cloud/UniverseResourceDetailsTest.java b/managed/src/test/java/com/yugabyte/yw/cloud/UniverseResourceDetailsTest.java index 91c062e65e03..889129574d2e 100644 --- a/managed/src/test/java/com/yugabyte/yw/cloud/UniverseResourceDetailsTest.java +++ b/managed/src/test/java/com/yugabyte/yw/cloud/UniverseResourceDetailsTest.java @@ -2,31 +2,44 @@ package com.yugabyte.yw.cloud; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GP2_SIZE; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_PIOPS; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_SIZE; +import static com.yugabyte.yw.cloud.PublicCloudConstants.GP3_THROUGHPUT; +import static com.yugabyte.yw.cloud.PublicCloudConstants.IO1_PIOPS; +import static com.yugabyte.yw.cloud.PublicCloudConstants.IO1_SIZE; +import static com.yugabyte.yw.cloud.PublicCloudConstants.StorageType; +import static com.yugabyte.yw.common.ApiUtils.getDummyDeviceInfo; +import static com.yugabyte.yw.common.ApiUtils.getDummyUserIntent; +import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.ToBeRemoved; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.UserIntent; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.InstanceType; +import com.yugabyte.yw.models.PriceComponent; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; import com.yugabyte.yw.models.helpers.CloudSpecificInfo; import com.yugabyte.yw.models.helpers.DeviceInfo; import com.yugabyte.yw.models.helpers.NodeDetails; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; import org.junit.Before; import org.junit.Test; import org.mockito.stubbing.OngoingStubbing; import play.libs.Json; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import static com.yugabyte.yw.cloud.PublicCloudConstants.*; -import static com.yugabyte.yw.common.ApiUtils.getDummyDeviceInfo; -import static com.yugabyte.yw.common.ApiUtils.getDummyUserIntent; -import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.ToBeRemoved; -import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Mockito.*; - public class UniverseResourceDetailsTest extends FakeDBApplication { private Provider provider; diff --git a/managed/src/test/java/com/yugabyte/yw/common/AccessManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/AccessManagerTest.java index a673d73deec6..99834d031a18 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/AccessManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/AccessManagerTest.java @@ -2,6 +2,23 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static com.yugabyte.yw.common.TestHelper.createTempFile; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.anyList; +import static org.mockito.Matchers.anyMap; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableList; @@ -9,18 +26,6 @@ import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; -import org.apache.commons.io.FileUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; -import play.libs.Json; - import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -32,16 +37,17 @@ import java.util.List; import java.util.Map; import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.assertValue; -import static com.yugabyte.yw.common.TestHelper.createTempFile; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; -import static org.mockito.Matchers.anyList; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; +import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.runners.MockitoJUnitRunner; +import play.libs.Json; @RunWith(MockitoJUnitRunner.class) public class AccessManagerTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/AlertManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/AlertManagerTest.java index bde1cbb50187..023fb16614fc 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/AlertManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/AlertManagerTest.java @@ -2,14 +2,45 @@ package com.yugabyte.yw.common; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.google.common.collect.ImmutableList; -import com.yugabyte.yw.common.alerts.*; +import com.yugabyte.yw.common.alerts.AlertDefinitionGroupService; +import com.yugabyte.yw.common.alerts.AlertDefinitionService; +import com.yugabyte.yw.common.alerts.AlertNotificationReport; +import com.yugabyte.yw.common.alerts.AlertReceiverEmailParams; +import com.yugabyte.yw.common.alerts.AlertReceiverManager; +import com.yugabyte.yw.common.alerts.AlertRouteService; +import com.yugabyte.yw.common.alerts.AlertService; +import com.yugabyte.yw.common.alerts.AlertUtils; +import com.yugabyte.yw.common.alerts.YWNotificationException; import com.yugabyte.yw.common.alerts.impl.AlertReceiverEmail; import com.yugabyte.yw.common.config.impl.SettableRuntimeConfigFactory; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Alert; +import com.yugabyte.yw.models.AlertDefinition; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.AlertReceiver; +import com.yugabyte.yw.models.AlertRoute; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.filters.AlertFilter; import com.yugabyte.yw.models.helpers.KnownAlertCodes; import com.yugabyte.yw.models.helpers.KnownAlertLabels; +import java.util.Collections; +import java.util.List; +import java.util.UUID; +import javax.mail.MessagingException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -17,17 +48,6 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import javax.mail.MessagingException; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.*; - @RunWith(MockitoJUnitRunner.class) public class AlertManagerTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/ApiHelperTest.java b/managed/src/test/java/com/yugabyte/yw/common/ApiHelperTest.java index e604578444a9..f522d5c6fce1 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/ApiHelperTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/ApiHelperTest.java @@ -2,9 +2,26 @@ package com.yugabyte.yw.common; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; - +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; import org.hamcrest.CoreMatchers; import org.junit.Test; import org.junit.runner.RunWith; @@ -18,29 +35,6 @@ import play.libs.ws.WSRequest; import play.libs.ws.WSResponse; -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLConnection; -import java.net.URLStreamHandler; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionStage; - -import static org.hamcrest.CoreMatchers.allOf; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class ApiHelperTest { @Mock WSClient mockClient; diff --git a/managed/src/test/java/com/yugabyte/yw/common/ApiUtils.java b/managed/src/test/java/com/yugabyte/yw/common/ApiUtils.java index c98c1e9fc739..1a6bc48de8cd 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/ApiUtils.java +++ b/managed/src/test/java/com/yugabyte/yw/common/ApiUtils.java @@ -7,14 +7,28 @@ import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ClusterType; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.UserIntent; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.InstanceType; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.Universe.UniverseUpdater; -import com.yugabyte.yw.models.helpers.*; +import com.yugabyte.yw.models.helpers.CloudSpecificInfo; +import com.yugabyte.yw.models.helpers.ColumnDetails; +import com.yugabyte.yw.models.helpers.DeviceInfo; +import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.NodeDetails.NodeState; +import com.yugabyte.yw.models.helpers.PlacementInfo; +import com.yugabyte.yw.models.helpers.TableDetails; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.UUID; import org.yb.ColumnSchema.SortOrder; -import java.util.*; - public class ApiUtils { public static String UTIL_INST_TYPE = "m3.medium"; diff --git a/managed/src/test/java/com/yugabyte/yw/common/AssertHelper.java b/managed/src/test/java/com/yugabyte/yw/common/AssertHelper.java index f1a816804b78..8fe35ccce9ff 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/AssertHelper.java +++ b/managed/src/test/java/com/yugabyte/yw/common/AssertHelper.java @@ -2,23 +2,35 @@ package com.yugabyte.yw.common; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.StringContains.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.FORBIDDEN; +import static play.mvc.Http.Status.INTERNAL_SERVER_ERROR; +import static play.mvc.Http.Status.NOT_FOUND; +import static play.mvc.Http.Status.OK; +import static play.mvc.Http.Status.UNAUTHORIZED; +import static play.test.Helpers.contentAsString; + import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.forms.YWResults; import com.yugabyte.yw.models.Audit; +import java.util.List; +import java.util.UUID; import org.junit.function.ThrowingRunnable; import play.libs.Json; import play.mvc.Result; -import java.util.List; -import java.util.UUID; - -import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.StringContains.containsString; -import static org.junit.Assert.*; -import static play.mvc.Http.Status.*; -import static play.test.Helpers.contentAsString; - public class AssertHelper { public static void assertOk(Result result) { assertEquals(contentAsString(result), OK, result.status()); diff --git a/managed/src/test/java/com/yugabyte/yw/common/CallHomeManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/CallHomeManagerTest.java index c86f2a30ef3f..54d166dca902 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/CallHomeManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/CallHomeManagerTest.java @@ -2,13 +2,31 @@ package com.yugabyte.yw.common; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyMap; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableMap; import com.yugabyte.yw.common.CallHomeManager.CollectionLevel; import com.yugabyte.yw.forms.UniverseResp; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; +import java.time.Clock; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.asynchttpclient.util.Base64; import org.junit.Before; import org.junit.Test; @@ -19,16 +37,6 @@ import org.mockito.runners.MockitoJUnitRunner; import play.libs.Json; -import java.time.Clock; -import java.time.Instant; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.*; - @RunWith(MockitoJUnitRunner.class) public class CallHomeManagerTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/CertificateHelperTest.java b/managed/src/test/java/com/yugabyte/yw/common/CertificateHelperTest.java index 0f1ea1fd1941..2a93611a20b0 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/CertificateHelperTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/CertificateHelperTest.java @@ -2,7 +2,10 @@ package com.yugabyte.yw.common; -import com.fasterxml.jackson.databind.JsonNode; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + import com.yugabyte.yw.forms.CertificateParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.models.CertificateInfo; @@ -28,10 +31,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; @RunWith(MockitoJUnitRunner.class) public class CertificateHelperTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/CloudQueryHelperTest.java b/managed/src/test/java/com/yugabyte/yw/common/CloudQueryHelperTest.java index 683cf57dc38a..63f429eb2a65 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/CloudQueryHelperTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/CloudQueryHelperTest.java @@ -2,12 +2,22 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.common.AssertHelper.assertErrorNodeValue; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static org.mockito.Matchers.anyList; +import static org.mockito.Matchers.anyMap; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableList; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -16,17 +26,6 @@ import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.assertErrorNodeValue; -import static com.yugabyte.yw.common.AssertHelper.assertValue; -import static org.mockito.Matchers.anyList; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class CloudQueryHelperTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/ConfigHelperTest.java b/managed/src/test/java/com/yugabyte/yw/common/ConfigHelperTest.java index 5171cdb8695b..1ea151a0098c 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/ConfigHelperTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/ConfigHelperTest.java @@ -1,10 +1,26 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.common; -import com.yugabyte.yw.commissioner.Common; -import com.yugabyte.yw.models.YugawareProperty; +import static com.yugabyte.yw.common.ReleaseManagerTest.TMP_STORAGE_PATH; +import static com.yugabyte.yw.common.TestHelper.createTempFile; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableMap; +import com.yugabyte.yw.commissioner.Common; +import com.yugabyte.yw.models.YugawareProperty; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.Before; @@ -12,27 +28,12 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.error.YAMLException; import play.Application; import play.libs.Json; -import java.io.File; -import java.io.FileInputStream; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -import static com.yugabyte.yw.common.ReleaseManagerTest.TMP_STORAGE_PATH; -import static com.yugabyte.yw.common.TestHelper.createTempFile; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; - @RunWith(MockitoJUnitRunner.class) public class ConfigHelperTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/CustomerTaskManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/CustomerTaskManagerTest.java index 320550c2f172..16c3b7f449bb 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/CustomerTaskManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/CustomerTaskManagerTest.java @@ -1,27 +1,24 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.common; -import com.yugabyte.yw.common.CustomerTaskManager; -import com.yugabyte.yw.common.ModelFactory; +import static com.yugabyte.yw.models.CustomerTask.TaskType.Create; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.CustomerTask; -import static com.yugabyte.yw.models.CustomerTask.TaskType.Create; import com.yugabyte.yw.models.TaskInfo; -import com.yugabyte.yw.models.helpers.TaskType; import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.helpers.TaskType; import java.util.List; import java.util.UUID; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertTrue; import org.junit.runner.RunWith; -import static org.mockito.Mockito.spy; import org.mockito.runners.MockitoJUnitRunner; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import play.api.Play; import play.libs.Json; diff --git a/managed/src/test/java/com/yugabyte/yw/common/EmailHelperTest.java b/managed/src/test/java/com/yugabyte/yw/common/EmailHelperTest.java index 9dd8c2226e57..f383ef2610e0 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/EmailHelperTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/EmailHelperTest.java @@ -9,18 +9,25 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; +import com.icegreen.greenmail.util.GreenMail; +import com.yugabyte.yw.common.alerts.SmtpData; +import com.yugabyte.yw.common.config.RuntimeConfigFactory; +import com.yugabyte.yw.common.config.impl.RuntimeConfig; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Properties; - import javax.mail.MessagingException; import javax.mail.internet.AddressException; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; - +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import junitparams.converters.Nullable; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.validator.routines.EmailValidator; @@ -32,17 +39,6 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; - -import com.icegreen.greenmail.util.GreenMail; -import com.yugabyte.yw.common.config.impl.RuntimeConfig; -import com.yugabyte.yw.common.alerts.SmtpData; -import com.yugabyte.yw.common.config.RuntimeConfigFactory; -import com.yugabyte.yw.models.Customer; -import com.yugabyte.yw.models.CustomerConfig; - -import junitparams.JUnitParamsRunner; -import junitparams.Parameters; -import junitparams.converters.Nullable; import play.libs.Json; @RunWith(JUnitParamsRunner.class) diff --git a/managed/src/test/java/com/yugabyte/yw/common/FakeApi.java b/managed/src/test/java/com/yugabyte/yw/common/FakeApi.java index 6dda1652c849..0143507efea6 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/FakeApi.java +++ b/managed/src/test/java/com/yugabyte/yw/common/FakeApi.java @@ -19,14 +19,13 @@ import com.yugabyte.yw.models.Users; import io.ebean.Ebean; import io.ebean.EbeanServer; +import java.util.List; import play.Application; import play.libs.Files; import play.mvc.Http; import play.mvc.Result; import play.test.Helpers; -import java.util.List; - public class FakeApi { private final String authToken; private final Application app; diff --git a/managed/src/test/java/com/yugabyte/yw/common/FakeApiHelper.java b/managed/src/test/java/com/yugabyte/yw/common/FakeApiHelper.java index 08822742262e..1a2ba87f71c3 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/FakeApiHelper.java +++ b/managed/src/test/java/com/yugabyte/yw/common/FakeApiHelper.java @@ -2,6 +2,9 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.models.Users.Role; +import static play.test.Helpers.route; + import akka.stream.Materializer; import akka.stream.javadsl.Source; import akka.util.ByteString; @@ -9,19 +12,19 @@ import com.yugabyte.yw.controllers.HAAuthenticator; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Users; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.function.BiFunction; import play.Application; import play.libs.Files; import play.mvc.Http; import play.mvc.Result; import play.test.Helpers; -import java.util.List; -import java.util.concurrent.*; -import java.util.function.BiFunction; - -import static com.yugabyte.yw.models.Users.Role; -import static play.test.Helpers.route; - public class FakeApiHelper { private static String getAuthToken() { Customer customer = Customer.find.query().where().eq("code", "tc").findOne(); diff --git a/managed/src/test/java/com/yugabyte/yw/common/FakeDBApplication.java b/managed/src/test/java/com/yugabyte/yw/common/FakeDBApplication.java index 8ea2b616f87a..4556c32ceffd 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/FakeDBApplication.java +++ b/managed/src/test/java/com/yugabyte/yw/common/FakeDBApplication.java @@ -2,14 +2,26 @@ package com.yugabyte.yw.common; +import static org.mockito.Mockito.mock; +import static play.inject.Bindings.bind; + import com.google.common.collect.Maps; import com.yugabyte.yw.cloud.CloudAPI; -import com.yugabyte.yw.commissioner.*; +import com.yugabyte.yw.commissioner.CallHome; +import com.yugabyte.yw.commissioner.Commissioner; +import com.yugabyte.yw.commissioner.HealthChecker; +import com.yugabyte.yw.commissioner.QueryAlerts; +import com.yugabyte.yw.commissioner.SetUniverseKey; import com.yugabyte.yw.common.alerts.AlertConfigurationWriter; import com.yugabyte.yw.common.kms.EncryptionAtRestManager; import com.yugabyte.yw.common.services.YBClientService; import com.yugabyte.yw.metrics.MetricQueryHelper; import com.yugabyte.yw.scheduler.Scheduler; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeoutException; import org.pac4j.play.CallbackController; import org.pac4j.play.store.PlayCacheSessionStore; import org.pac4j.play.store.PlaySessionStore; @@ -21,15 +33,6 @@ import play.test.Helpers; import play.test.WithApplication; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeoutException; - -import static org.mockito.Mockito.mock; -import static play.inject.Bindings.bind; - public class FakeDBApplication extends WithApplication { public Commissioner mockCommissioner = mock(Commissioner.class); public CallHome mockCallHome = mock(CallHome.class); diff --git a/managed/src/test/java/com/yugabyte/yw/common/HealthManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/HealthManagerTest.java index 105c253e359d..d63bf6f40ef2 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/HealthManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/HealthManagerTest.java @@ -1,30 +1,26 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.common; -import com.yugabyte.yw.commissioner.Common; -import com.yugabyte.yw.models.Provider; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableList; +import com.yugabyte.yw.commissioner.Common; +import com.yugabyte.yw.models.Provider; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - import play.libs.Json; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; - -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class HealthManagerTest extends FakeDBApplication { @Mock private ShellProcessHandler shellProcessHandler; diff --git a/managed/src/test/java/com/yugabyte/yw/common/KubernetesManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/KubernetesManagerTest.java index 74231cd29613..8494b31de5fb 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/KubernetesManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/KubernetesManagerTest.java @@ -2,11 +2,21 @@ package com.yugabyte.yw.common; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.anyList; +import static org.mockito.Matchers.anyMap; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; + import com.google.common.collect.ImmutableList; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.commissioner.tasks.subtasks.KubernetesCommandExecutor; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Provider; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -16,21 +26,6 @@ import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.*; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.anyList; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; - -import static org.mockito.Mockito.when; -import static org.mockito.Mockito.description; -import static org.mockito.Mockito.times; - @RunWith(MockitoJUnitRunner.class) public class KubernetesManagerTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/ModelFactory.java b/managed/src/test/java/com/yugabyte/yw/common/ModelFactory.java index b60aef7170ad..ab646df44ae0 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/ModelFactory.java +++ b/managed/src/test/java/com/yugabyte/yw/common/ModelFactory.java @@ -2,6 +2,8 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.models.Users.Role; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableMap; @@ -14,13 +16,26 @@ import com.yugabyte.yw.forms.BackupTableParams; import com.yugabyte.yw.forms.CustomerRegisterFormData.AlertingData; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Alert; +import com.yugabyte.yw.models.AlertDefinition; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.AlertDefinitionGroupTarget; +import com.yugabyte.yw.models.AlertDefinitionGroupThreshold; +import com.yugabyte.yw.models.AlertLabel; +import com.yugabyte.yw.models.AlertReceiver; +import com.yugabyte.yw.models.AlertRoute; +import com.yugabyte.yw.models.Backup; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.KmsConfig; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Schedule; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; import com.yugabyte.yw.models.common.Unit; import com.yugabyte.yw.models.helpers.KnownAlertCodes; import com.yugabyte.yw.models.helpers.PlacementInfo; import com.yugabyte.yw.models.helpers.TaskType; -import play.libs.Json; - import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -28,8 +43,7 @@ import java.util.UUID; import java.util.function.Consumer; import java.util.stream.Collectors; - -import static com.yugabyte.yw.models.Users.Role; +import play.libs.Json; public class ModelFactory { diff --git a/managed/src/test/java/com/yugabyte/yw/common/NetworkManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/NetworkManagerTest.java index 56cf3b415b41..02a2479fdbfb 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/NetworkManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/NetworkManagerTest.java @@ -2,9 +2,21 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.anyList; +import static org.mockito.Matchers.anyMap; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Region; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -14,17 +26,6 @@ import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.assertValue; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.*; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class NetworkManagerTest extends FakeDBApplication { @InjectMocks NetworkManager networkManager; diff --git a/managed/src/test/java/com/yugabyte/yw/common/NodeActionTypeTest.java b/managed/src/test/java/com/yugabyte/yw/common/NodeActionTypeTest.java index e0f90b928766..068d991419c2 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/NodeActionTypeTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/NodeActionTypeTest.java @@ -2,18 +2,18 @@ package com.yugabyte.yw.common; -import com.yugabyte.yw.models.CustomerTask; -import org.junit.Test; - -import static com.yugabyte.yw.models.helpers.TaskType.DeleteNodeFromUniverse; -import static com.yugabyte.yw.models.helpers.TaskType.StartNodeInUniverse; -import static com.yugabyte.yw.models.helpers.TaskType.StopNodeInUniverse; import static com.yugabyte.yw.models.helpers.TaskType.AddNodeToUniverse; -import static com.yugabyte.yw.models.helpers.TaskType.RemoveNodeFromUniverse; +import static com.yugabyte.yw.models.helpers.TaskType.DeleteNodeFromUniverse; import static com.yugabyte.yw.models.helpers.TaskType.ReleaseInstanceFromUniverse; +import static com.yugabyte.yw.models.helpers.TaskType.RemoveNodeFromUniverse; import static com.yugabyte.yw.models.helpers.TaskType.StartMasterOnNode; +import static com.yugabyte.yw.models.helpers.TaskType.StartNodeInUniverse; +import static com.yugabyte.yw.models.helpers.TaskType.StopNodeInUniverse; import static org.junit.Assert.assertEquals; +import com.yugabyte.yw.models.CustomerTask; +import org.junit.Test; + public class NodeActionTypeTest { @Test public void testToString() { diff --git a/managed/src/test/java/com/yugabyte/yw/common/NodeManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/NodeManagerTest.java index 03c58e3e8ac1..9b1a4da07f64 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/NodeManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/NodeManagerTest.java @@ -1,6 +1,33 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.common; +import static com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase.ServerType.MASTER; +import static com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase.ServerType.TSERVER; +import static com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskSubType.Download; +import static com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskSubType.Install; +import static com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskType.Everything; +import static com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskType.GFlags; +import static com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskType.Software; +import static com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskType.ToggleTls; +import static com.yugabyte.yw.common.TestHelper.createTempFile; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.StringContains.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -11,15 +38,15 @@ import com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase.ServerType; import com.yugabyte.yw.commissioner.tasks.UpgradeUniverse; import com.yugabyte.yw.commissioner.tasks.params.NodeTaskParams; -import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleClusterServerCtl; import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleConfigureServers; import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleDestroyServer; import com.yugabyte.yw.commissioner.tasks.subtasks.AnsibleSetupServer; +import com.yugabyte.yw.commissioner.tasks.subtasks.ChangeInstanceType; import com.yugabyte.yw.commissioner.tasks.subtasks.CreateRootVolumes; import com.yugabyte.yw.commissioner.tasks.subtasks.InstanceActions; import com.yugabyte.yw.commissioner.tasks.subtasks.ReplaceRootVolume; -import com.yugabyte.yw.commissioner.tasks.subtasks.ChangeInstanceType; +import com.yugabyte.yw.common.config.RuntimeConfigFactory; import com.yugabyte.yw.forms.CertificateParams; import com.yugabyte.yw.forms.NodeInstanceFormData; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; @@ -37,6 +64,19 @@ import com.yugabyte.yw.models.helpers.CloudSpecificInfo; import com.yugabyte.yw.models.helpers.DeviceInfo; import com.yugabyte.yw.models.helpers.NodeDetails; +import java.io.File; +import java.io.IOException; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.function.Predicate; import junitparams.JUnitParamsRunner; import junitparams.Parameters; import junitparams.naming.TestCaseName; @@ -53,47 +93,6 @@ import org.mockito.junit.MockitoRule; import play.libs.Json; -import java.io.File; -import java.io.IOException; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.function.Predicate; - -import static com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase.ServerType.MASTER; -import static com.yugabyte.yw.commissioner.tasks.UniverseDefinitionTaskBase.ServerType.TSERVER; -import static com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskSubType.Download; -import static com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskSubType.Install; -import static com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskType.Everything; -import static com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskType.GFlags; -import static com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskType.Software; -import static com.yugabyte.yw.commissioner.tasks.UpgradeUniverse.UpgradeTaskType.ToggleTls; -import static com.yugabyte.yw.common.TestHelper.createTempFile; -import static org.hamcrest.CoreMatchers.allOf; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.StringContains.containsString; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - @RunWith(JUnitParamsRunner.class) public class NodeManagerTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/PlacementInfoUtilTest.java b/managed/src/test/java/com/yugabyte/yw/common/PlacementInfoUtilTest.java index 939cfe6ba8ad..b38b99b7c52d 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/PlacementInfoUtilTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/PlacementInfoUtilTest.java @@ -2,6 +2,30 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.commissioner.Common.CloudType.onprem; +import static com.yugabyte.yw.common.ApiUtils.getTestUserIntent; +import static com.yugabyte.yw.common.ModelFactory.createUniverse; +import static com.yugabyte.yw.common.PlacementInfoUtil.UNIVERSE_ALIVE_METRIC; +import static com.yugabyte.yw.common.PlacementInfoUtil.removeNodeByName; +import static com.yugabyte.yw.forms.UniverseConfigureTaskParams.ClusterOperationType.CREATE; +import static com.yugabyte.yw.forms.UniverseConfigureTaskParams.ClusterOperationType.EDIT; +import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.Live; +import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.Unreachable; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.anyList; +import static org.mockito.Matchers.anyMap; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -11,18 +35,34 @@ import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.commissioner.Common.CloudType; import com.yugabyte.yw.forms.NodeInstanceFormData; -import com.yugabyte.yw.forms.UniverseConfigureTaskParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Cluster; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.UserIntent; import com.yugabyte.yw.metrics.MetricQueryHelper; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.InstanceType; +import com.yugabyte.yw.models.NodeInstance; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.Universe.UniverseUpdater; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.PlacementInfo; import com.yugabyte.yw.models.helpers.PlacementInfo.PlacementAZ; import com.yugabyte.yw.models.helpers.PlacementInfo.PlacementCloud; import com.yugabyte.yw.models.helpers.PlacementInfo.PlacementRegion; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; import junitparams.JUnitParamsRunner; import junitparams.Parameters; import org.junit.Before; @@ -30,25 +70,6 @@ import org.junit.runner.RunWith; import play.libs.Json; -import java.util.*; -import java.util.stream.Collectors; - -import static com.yugabyte.yw.commissioner.Common.CloudType.onprem; -import static com.yugabyte.yw.common.ApiUtils.getTestUserIntent; -import static com.yugabyte.yw.common.ModelFactory.createUniverse; -import static com.yugabyte.yw.common.PlacementInfoUtil.UNIVERSE_ALIVE_METRIC; -import static com.yugabyte.yw.common.PlacementInfoUtil.removeNodeByName; -import static com.yugabyte.yw.forms.UniverseConfigureTaskParams.ClusterOperationType.CREATE; -import static com.yugabyte.yw.forms.UniverseConfigureTaskParams.ClusterOperationType.EDIT; -import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.Live; -import static com.yugabyte.yw.models.helpers.NodeDetails.NodeState.Unreachable; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; -import static org.mockito.Matchers.anyList; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - @RunWith(JUnitParamsRunner.class) public class PlacementInfoUtilTest extends FakeDBApplication { private static final int REPLICATION_FACTOR = 3; diff --git a/managed/src/test/java/com/yugabyte/yw/common/ReleaseManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/ReleaseManagerTest.java index 2135e90ad213..fa68633f3ea7 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/ReleaseManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/ReleaseManagerTest.java @@ -1,9 +1,30 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.common; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static com.yugabyte.yw.common.ConfigHelper.ConfigType.SoftwareReleases; +import static com.yugabyte.yw.common.TestHelper.createTempFile; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyMap; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import java.io.File; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.Before; @@ -17,24 +38,6 @@ import play.Configuration; import play.libs.Json; -import java.io.File; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.yugabyte.yw.common.AssertHelper.assertValue; -import static com.yugabyte.yw.common.ConfigHelper.ConfigType.SoftwareReleases; -import static com.yugabyte.yw.common.TestHelper.createTempFile; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.*; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; -import static org.hamcrest.CoreMatchers.*; - @RunWith(MockitoJUnitRunner.class) public class ReleaseManagerTest { static String TMP_STORAGE_PATH = "/tmp/yugaware_tests/releases"; diff --git a/managed/src/test/java/com/yugabyte/yw/common/ShellProcessHandlerTest.java b/managed/src/test/java/com/yugabyte/yw/common/ShellProcessHandlerTest.java index 20e92c4c6476..59dc15916eef 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/ShellProcessHandlerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/ShellProcessHandlerTest.java @@ -2,14 +2,13 @@ package com.yugabyte.yw.common; -import org.apache.commons.io.FileUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.when; import java.io.File; import java.io.IOException; @@ -19,11 +18,14 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; - -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.when; +import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class ShellProcessHandlerTest { diff --git a/managed/src/test/java/com/yugabyte/yw/common/SwamperHelperTest.java b/managed/src/test/java/com/yugabyte/yw/common/SwamperHelperTest.java index b1919a1a66eb..e2043aea7ad8 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/SwamperHelperTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/SwamperHelperTest.java @@ -2,10 +2,34 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.common.ModelFactory.createAlertDefinition; +import static com.yugabyte.yw.common.ModelFactory.createAlertDefinitionGroup; +import static com.yugabyte.yw.common.ModelFactory.createUniverse; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.UserIntent; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AlertDefinition; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Universe; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; import org.apache.commons.exec.OS; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; @@ -20,23 +44,6 @@ import play.Mode; import play.libs.Json; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; - -import static com.yugabyte.yw.common.ModelFactory.*; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class SwamperHelperTest extends FakeDBApplication { private Customer defaultCustomer; diff --git a/managed/src/test/java/com/yugabyte/yw/common/TableManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/TableManagerTest.java index 834917af7ab5..14dd7cb17c78 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/TableManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/TableManagerTest.java @@ -2,12 +2,34 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.common.ModelFactory.createUniverse; +import static com.yugabyte.yw.common.TableManager.CommandSubType.BACKUP; +import static com.yugabyte.yw.common.TableManager.CommandSubType.BULK_IMPORT; +import static com.yugabyte.yw.common.TableManager.PY_WRAPPER; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.yugabyte.yw.forms.BackupTableParams; import com.yugabyte.yw.forms.BulkImportParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.UserIntent; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AccessKey; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.Backup; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.PlacementInfo; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -16,15 +38,6 @@ import org.mockito.runners.MockitoJUnitRunner; import play.libs.Json; -import java.util.*; - -import static com.yugabyte.yw.common.ModelFactory.createUniverse; -import static com.yugabyte.yw.common.TableManager.CommandSubType.BACKUP; -import static com.yugabyte.yw.common.TableManager.CommandSubType.BULK_IMPORT; -import static com.yugabyte.yw.common.TableManager.PY_WRAPPER; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.*; - @RunWith(MockitoJUnitRunner.class) public class TableManagerTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/TemplateManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/TemplateManagerTest.java index bb523a4c88af..3fac03145091 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/TemplateManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/TemplateManagerTest.java @@ -2,9 +2,25 @@ package com.yugabyte.yw.common; +import static com.yugabyte.yw.commissioner.Common.CloudType.onprem; +import static com.yugabyte.yw.common.DevopsBase.YBCLOUD_SCRIPT; +import static com.yugabyte.yw.common.TemplateManager.PROVISION_SCRIPT; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.yugabyte.yw.models.AccessKey; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Provider; +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.Before; @@ -15,26 +31,6 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; -import org.yb.client.YBServerException; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; - -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; - -import static com.yugabyte.yw.commissioner.Common.CloudType.onprem; -import static com.yugabyte.yw.common.DevopsBase.YBCLOUD_SCRIPT; -import com.yugabyte.yw.common.ShellResponse; -import static com.yugabyte.yw.common.TemplateManager.PROVISION_SCRIPT; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class TemplateManagerTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/UtilTest.java b/managed/src/test/java/com/yugabyte/yw/common/UtilTest.java index 92079c59defa..dc97c007f7a0 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/UtilTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/UtilTest.java @@ -1,5 +1,13 @@ package com.yugabyte.yw.common; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + import com.google.common.collect.ImmutableMap; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Cluster; @@ -9,6 +17,10 @@ import com.yugabyte.yw.models.Universe; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.NodeDetails.NodeState; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import junitparams.JUnitParamsRunner; import junitparams.Parameters; import junitparams.converters.Nullable; @@ -19,15 +31,6 @@ import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; - @RunWith(JUnitParamsRunner.class) public class UtilTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertConfigurationWriterTest.java b/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertConfigurationWriterTest.java index 3d037a6fc643..86ffe1721be2 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertConfigurationWriterTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertConfigurationWriterTest.java @@ -9,6 +9,13 @@ */ package com.yugabyte.yw.common.alerts; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import akka.actor.ActorSystem; import akka.actor.Scheduler; import akka.dispatch.Dispatcher; @@ -23,6 +30,7 @@ import com.yugabyte.yw.models.AlertDefinitionGroup; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Universe; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,10 +38,6 @@ import org.mockito.junit.MockitoJUnitRunner; import scala.concurrent.ExecutionContext; -import java.util.UUID; - -import static org.mockito.Mockito.*; - @RunWith(MockitoJUnitRunner.Silent.class) public class AlertConfigurationWriterTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertReceiverEmailParamsTest.java b/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertReceiverEmailParamsTest.java index 73e370e2b8c2..e2a835bbd464 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertReceiverEmailParamsTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertReceiverEmailParamsTest.java @@ -5,17 +5,14 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThrows; +import com.yugabyte.yw.common.EmailHelper; import java.util.ArrayList; import java.util.Collections; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import com.yugabyte.yw.common.EmailHelper; - import junitparams.JUnitParamsRunner; import junitparams.Parameters; import junitparams.converters.Nullable; +import org.junit.Test; +import org.junit.runner.RunWith; @RunWith(JUnitParamsRunner.class) public class AlertReceiverEmailParamsTest { diff --git a/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertReceiverManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertReceiverManagerTest.java index 007122270fb8..f1be53c9d1fd 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertReceiverManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertReceiverManagerTest.java @@ -5,18 +5,16 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThrows; +import com.yugabyte.yw.common.FakeDBApplication; +import com.yugabyte.yw.common.alerts.impl.AlertReceiverEmail; +import com.yugabyte.yw.models.AlertReceiver.TargetType; import java.util.EnumSet; - import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import com.yugabyte.yw.common.FakeDBApplication; -import com.yugabyte.yw.common.alerts.impl.AlertReceiverEmail; -import com.yugabyte.yw.models.AlertReceiver.TargetType; - @RunWith(MockitoJUnitRunner.class) public class AlertReceiverManagerTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertReceiverSlackParamsTest.java b/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertReceiverSlackParamsTest.java index 8b758edfab70..08f5493f3403 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertReceiverSlackParamsTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertReceiverSlackParamsTest.java @@ -5,12 +5,11 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThrows; -import org.junit.Test; -import org.junit.runner.RunWith; - import junitparams.JUnitParamsRunner; import junitparams.Parameters; import junitparams.converters.Nullable; +import org.junit.Test; +import org.junit.runner.RunWith; @RunWith(JUnitParamsRunner.class) public class AlertReceiverSlackParamsTest { diff --git a/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertUtilsTest.java b/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertUtilsTest.java index ce0183276f20..2855b761bd98 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertUtilsTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/alerts/AlertUtilsTest.java @@ -2,22 +2,29 @@ package com.yugabyte.yw.common.alerts; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + import com.yugabyte.yw.common.EmailFixtures; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Alert; +import com.yugabyte.yw.models.AlertDefinition; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.AlertLabel; +import com.yugabyte.yw.models.AlertReceiver; import com.yugabyte.yw.models.AlertReceiver.TargetType; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.Universe; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.junit.Assert.*; - @RunWith(MockitoJUnitRunner.class) public class AlertUtilsTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/alerts/impl/AlertReceiverEmailTest.java b/managed/src/test/java/com/yugabyte/yw/common/alerts/impl/AlertReceiverEmailTest.java index 4bb91fcd203a..3481db7b517d 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/alerts/impl/AlertReceiverEmailTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/alerts/impl/AlertReceiverEmailTest.java @@ -2,6 +2,16 @@ package com.yugabyte.yw.common.alerts.impl; +import static org.junit.Assert.assertThrows; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.yugabyte.yw.common.EmailHelper; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; @@ -11,11 +21,12 @@ import com.yugabyte.yw.models.Alert; import com.yugabyte.yw.models.AlertReceiver; import com.yugabyte.yw.models.Customer; - +import java.util.Collections; +import java.util.List; +import javax.mail.MessagingException; import junitparams.JUnitParamsRunner; import junitparams.Parameters; import junitparams.naming.TestCaseName; - import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -25,14 +36,6 @@ import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; -import javax.mail.MessagingException; -import java.util.Collections; -import java.util.List; - -import static org.junit.Assert.assertThrows; -import static org.mockito.ArgumentMatchers.*; -import static org.mockito.Mockito.*; - @RunWith(JUnitParamsRunner.class) public class AlertReceiverEmailTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/config/impl/SettableRuntimeConfigFactoryTest.java b/managed/src/test/java/com/yugabyte/yw/common/config/impl/SettableRuntimeConfigFactoryTest.java index 6f47a3192a35..bef11e54a7b5 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/config/impl/SettableRuntimeConfigFactoryTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/config/impl/SettableRuntimeConfigFactoryTest.java @@ -10,6 +10,9 @@ package com.yugabyte.yw.common.config.impl; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.typesafe.config.Config; @@ -20,14 +23,10 @@ import com.yugabyte.yw.models.Provider; import com.yugabyte.yw.models.Universe; import io.ebean.Model; -import org.junit.Before; -import org.junit.Test; - import java.util.Map; import java.util.Set; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import org.junit.Before; +import org.junit.Test; public class SettableRuntimeConfigFactoryTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/ha/PlatformReplicationManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/ha/PlatformReplicationManagerTest.java index a0a818f64f20..fed9fea399ee 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/ha/PlatformReplicationManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/ha/PlatformReplicationManagerTest.java @@ -10,6 +10,18 @@ package com.yugabyte.yw.common.ha; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyBoolean; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.anyList; +import static org.mockito.Mockito.anyMap; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.doCallRealMethod; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import akka.actor.ActorSystem; import com.typesafe.config.Config; import com.yugabyte.yw.common.ShellProcessHandler; @@ -17,6 +29,13 @@ import com.yugabyte.yw.common.config.impl.RuntimeConfig; import com.yugabyte.yw.common.config.impl.SettableRuntimeConfigFactory; import io.ebean.Model; +import java.io.File; +import java.net.URL; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import junit.framework.TestCase; import junitparams.JUnitParamsRunner; import junitparams.Parameters; @@ -27,16 +46,6 @@ import org.mockito.MockitoAnnotations; import scala.concurrent.ExecutionContext; -import java.io.File; -import java.net.URL; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.mockito.Mockito.*; - @RunWith(JUnitParamsRunner.class) public class PlatformReplicationManagerTest extends TestCase { @Mock Config mockConfig; diff --git a/managed/src/test/java/com/yugabyte/yw/common/ha/PlatformTest.java b/managed/src/test/java/com/yugabyte/yw/common/ha/PlatformTest.java index 1c786c438718..e0edf3495454 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/ha/PlatformTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/ha/PlatformTest.java @@ -10,6 +10,17 @@ package com.yugabyte.yw.common.ha; +import static com.yugabyte.yw.common.AssertHelper.assertOk; +import static junit.framework.TestCase.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.when; +import static play.libs.Files.singletonTemporaryFileCreator; +import static play.test.Helpers.contentAsString; +import static play.test.Helpers.fakeRequest; + import akka.stream.javadsl.Source; import akka.util.ByteString; import com.fasterxml.jackson.databind.JsonNode; @@ -24,20 +35,6 @@ import com.yugabyte.yw.models.Users; import io.ebean.Ebean; import io.ebean.EbeanServer; -import org.apache.commons.io.FileUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; -import play.Application; -import play.libs.Json; -import play.mvc.Http; -import play.mvc.Result; -import play.test.Helpers; - import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -51,15 +48,19 @@ import java.util.Map; import java.util.Random; import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.assertOk; -import static junit.framework.TestCase.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.*; -import static org.mockito.Mockito.when; -import static play.libs.Files.singletonTemporaryFileCreator; -import static play.test.Helpers.contentAsString; -import static play.test.Helpers.fakeRequest; +import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; +import play.Application; +import play.libs.Json; +import play.mvc.Http; +import play.mvc.Result; +import play.test.Helpers; @RunWith(MockitoJUnitRunner.StrictStubs.class) public class PlatformTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/kms/EncryptionAtRestManagerTest.java b/managed/src/test/java/com/yugabyte/yw/common/kms/EncryptionAtRestManagerTest.java index e8e69b642ee6..11f967663293 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/kms/EncryptionAtRestManagerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/kms/EncryptionAtRestManagerTest.java @@ -1,30 +1,19 @@ package com.yugabyte.yw.common.kms; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.collect.ImmutableMap; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; -import com.yugabyte.yw.common.kms.EncryptionAtRestManager; import com.yugabyte.yw.common.kms.services.EncryptionAtRestService; -import com.yugabyte.yw.common.kms.util.KeyProvider; import com.yugabyte.yw.forms.UniverseTaskParams.EncryptionAtRestConfig; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Universe; -import java.util.Base64; -import java.util.Map; -import java.util.UUID; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertNotNull; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; import org.mockito.runners.MockitoJUnitRunner; import play.libs.Json; diff --git a/managed/src/test/java/com/yugabyte/yw/common/kms/services/AwsEARServiceTest.java b/managed/src/test/java/com/yugabyte/yw/common/kms/services/AwsEARServiceTest.java index e6623d40f1a1..19a506cb1322 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/kms/services/AwsEARServiceTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/kms/services/AwsEARServiceTest.java @@ -10,6 +10,14 @@ package com.yugabyte.yw.common.kms.services; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.amazonaws.services.kms.AWSKMS; import com.amazonaws.services.kms.model.AliasListEntry; import com.amazonaws.services.kms.model.CreateAliasRequest; @@ -23,33 +31,19 @@ import com.amazonaws.services.kms.model.ListAliasesRequest; import com.amazonaws.services.kms.model.ListAliasesResult; import com.amazonaws.services.kms.model.UpdateAliasRequest; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.collect.ImmutableMap; import com.yugabyte.yw.common.ApiHelper; import com.yugabyte.yw.common.FakeDBApplication; -import com.yugabyte.yw.common.kms.EncryptionAtRestManager; import com.yugabyte.yw.common.kms.util.KeyProvider; import com.yugabyte.yw.forms.UniverseTaskParams.EncryptionAtRestConfig; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertNotNull; -import org.junit.Before; -import org.junit.Test; -import org.junit.Ignore; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import static org.mockito.Mockito.*; -import org.mockito.runners.MockitoJUnitRunner; import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.UUID; -import play.api.Play; -import play.libs.Json; -import play.test.Helpers; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class AwsEARServiceTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/kms/services/EncryptionAtRestServiceTest.java b/managed/src/test/java/com/yugabyte/yw/common/kms/services/EncryptionAtRestServiceTest.java index 7241d328195e..4e0c2a1eb41a 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/kms/services/EncryptionAtRestServiceTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/kms/services/EncryptionAtRestServiceTest.java @@ -10,9 +10,10 @@ package com.yugabyte.yw.common.kms.services; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.collect.ImmutableMap; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + import com.yugabyte.yw.common.ApiHelper; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.kms.EncryptionAtRestManager; @@ -21,24 +22,12 @@ import com.yugabyte.yw.forms.UniverseTaskParams.EncryptionAtRestConfig; import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.UUID; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertNotNull; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import org.mockito.runners.MockitoJUnitRunner; -import play.Application; -import play.api.Play; import play.libs.Json; -import static play.inject.Bindings.bind; -import play.inject.guice.GuiceApplicationBuilder; -import play.test.WithApplication; enum TestAlgorithm implements SupportedAlgorithmInterface { TEST_ALGORITHM(Arrays.asList(1, 2, 3, 4)); diff --git a/managed/src/test/java/com/yugabyte/yw/common/kms/services/SmartKeyEARServiceTest.java b/managed/src/test/java/com/yugabyte/yw/common/kms/services/SmartKeyEARServiceTest.java index 605eb72ac72c..5fc5bae4b727 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/kms/services/SmartKeyEARServiceTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/kms/services/SmartKeyEARServiceTest.java @@ -10,30 +10,28 @@ package com.yugabyte.yw.common.kms.services; -import com.fasterxml.jackson.databind.JsonNode; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.Matchers.anyMap; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.collect.ImmutableMap; -import com.yugabyte.yw.common.ApiHelper; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.kms.EncryptionAtRestManager; import com.yugabyte.yw.common.kms.util.KeyProvider; import com.yugabyte.yw.forms.UniverseTaskParams.EncryptionAtRestConfig; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import java.util.Base64; +import java.util.Map; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import static org.mockito.Mockito.*; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.eq; import org.mockito.runners.MockitoJUnitRunner; -import java.util.Base64; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; import play.libs.Json; @RunWith(MockitoJUnitRunner.class) diff --git a/managed/src/test/java/com/yugabyte/yw/common/kms/util/AwsEARServiceUtilTest.java b/managed/src/test/java/com/yugabyte/yw/common/kms/util/AwsEARServiceUtilTest.java index 5cedcb3e821e..f5c509300b92 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/kms/util/AwsEARServiceUtilTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/kms/util/AwsEARServiceUtilTest.java @@ -1,13 +1,14 @@ package com.yugabyte.yw.common.kms.util; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.FakeDBApplication; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import org.mockito.runners.MockitoJUnitRunner; import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class AwsEARServiceUtilTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/common/kms/util/EncryptionAtRestUtilTest.java b/managed/src/test/java/com/yugabyte/yw/common/kms/util/EncryptionAtRestUtilTest.java index b2642c179be6..beab4a3f870b 100644 --- a/managed/src/test/java/com/yugabyte/yw/common/kms/util/EncryptionAtRestUtilTest.java +++ b/managed/src/test/java/com/yugabyte/yw/common/kms/util/EncryptionAtRestUtilTest.java @@ -1,25 +1,20 @@ package com.yugabyte.yw.common.kms.util; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; -import com.yugabyte.yw.common.kms.util.KeyProvider; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.KmsConfig; import com.yugabyte.yw.models.Universe; - import java.util.Base64; import java.util.UUID; - import org.junit.Before; import org.junit.Test; -import org.mockito.InjectMocks; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - import play.libs.Json; public class EncryptionAtRestUtilTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/AccessKeyControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/AccessKeyControllerTest.java index f9ebe4744c32..a8fb811cf62b 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/AccessKeyControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/AccessKeyControllerTest.java @@ -2,14 +2,56 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.AssertHelper.assertAuditEntry; +import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; +import static com.yugabyte.yw.common.AssertHelper.assertErrorNodeValue; +import static com.yugabyte.yw.common.AssertHelper.assertErrorResponse; +import static com.yugabyte.yw.common.AssertHelper.assertOk; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static com.yugabyte.yw.common.AssertHelper.assertYWSE; +import static com.yugabyte.yw.common.TestHelper.createTempFile; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.OK; +import static play.test.Helpers.INTERNAL_SERVER_ERROR; +import static play.test.Helpers.contentAsString; + import akka.stream.javadsl.FileIO; import akka.stream.javadsl.Source; import akka.util.ByteString; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.commissioner.Common; -import com.yugabyte.yw.common.*; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.common.AccessManager; +import com.yugabyte.yw.common.FakeApiHelper; +import com.yugabyte.yw.common.FakeDBApplication; +import com.yugabyte.yw.common.ModelFactory; +import com.yugabyte.yw.common.TestHelper; +import com.yugabyte.yw.common.YWServiceException; +import com.yugabyte.yw.models.AccessKey; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Users; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.Before; @@ -19,25 +61,6 @@ import play.mvc.Http; import play.mvc.Result; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.*; -import static com.yugabyte.yw.common.TestHelper.createTempFile; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.*; -import static play.mvc.Http.Status.BAD_REQUEST; -import static play.mvc.Http.Status.OK; -import static play.test.Helpers.INTERNAL_SERVER_ERROR; -import static play.test.Helpers.contentAsString; - public class AccessKeyControllerTest extends FakeDBApplication { Provider defaultProvider; Customer defaultCustomer; diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/AlertControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/AlertControllerTest.java index 7dfb8fcf2900..3f76b8366f94 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/AlertControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/AlertControllerTest.java @@ -2,27 +2,75 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; +import static com.yugabyte.yw.common.AssertHelper.assertYWSE; +import static com.yugabyte.yw.common.FakeApiHelper.doRequestWithAuthToken; +import static com.yugabyte.yw.common.FakeApiHelper.doRequestWithAuthTokenAndBody; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static play.mvc.Http.Status.OK; +import static play.test.Helpers.contentAsString; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import com.yugabyte.yw.common.*; -import com.yugabyte.yw.common.alerts.*; +import com.yugabyte.yw.common.AlertDefinitionTemplate; +import com.yugabyte.yw.common.AssertHelper; +import com.yugabyte.yw.common.EmailFixtures; +import com.yugabyte.yw.common.FakeDBApplication; +import com.yugabyte.yw.common.ModelFactory; +import com.yugabyte.yw.common.ValidatingFormFactory; +import com.yugabyte.yw.common.alerts.AlertDefinitionGroupService; +import com.yugabyte.yw.common.alerts.AlertDefinitionService; +import com.yugabyte.yw.common.alerts.AlertReceiverEmailParams; +import com.yugabyte.yw.common.alerts.AlertReceiverParams; +import com.yugabyte.yw.common.alerts.AlertReceiverSlackParams; +import com.yugabyte.yw.common.alerts.AlertRouteService; +import com.yugabyte.yw.common.alerts.AlertService; +import com.yugabyte.yw.common.alerts.AlertUtils; +import com.yugabyte.yw.common.alerts.SmtpData; import com.yugabyte.yw.common.config.impl.SettableRuntimeConfigFactory; import com.yugabyte.yw.forms.filters.AlertApiFilter; import com.yugabyte.yw.forms.filters.AlertDefinitionGroupApiFilter; import com.yugabyte.yw.forms.filters.AlertDefinitionTemplateApiFilter; import com.yugabyte.yw.forms.paging.AlertDefinitionGroupPagedApiQuery; import com.yugabyte.yw.forms.paging.AlertPagedApiQuery; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Alert; +import com.yugabyte.yw.models.AlertDefinition; +import com.yugabyte.yw.models.AlertDefinitionGroup; +import com.yugabyte.yw.models.AlertDefinitionGroupTarget; +import com.yugabyte.yw.models.AlertDefinitionGroupThreshold; +import com.yugabyte.yw.models.AlertReceiver; import com.yugabyte.yw.models.AlertReceiver.TargetType; +import com.yugabyte.yw.models.AlertRoute; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; import com.yugabyte.yw.models.common.Unit; import com.yugabyte.yw.models.filters.AlertFilter; import com.yugabyte.yw.models.paging.AlertDefinitionGroupPagedResponse; import com.yugabyte.yw.models.paging.AlertPagedResponse; import com.yugabyte.yw.models.paging.PagedQuery; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,20 +80,6 @@ import play.libs.Json; import play.mvc.Result; -import java.io.IOException; -import java.util.*; -import java.util.stream.Collectors; - -import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; -import static com.yugabyte.yw.common.AssertHelper.assertYWSE; -import static com.yugabyte.yw.common.FakeApiHelper.doRequestWithAuthToken; -import static com.yugabyte.yw.common.FakeApiHelper.doRequestWithAuthTokenAndBody; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; -import static play.mvc.Http.Status.OK; -import static play.test.Helpers.contentAsString; - @RunWith(MockitoJUnitRunner.class) public class AlertControllerTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/AuditControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/AuditControllerTest.java index 47480e4fb32e..2200f86fa4b5 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/AuditControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/AuditControllerTest.java @@ -2,6 +2,16 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.AssertHelper.assertYWSE; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.FORBIDDEN; +import static play.mvc.Http.Status.OK; +import static play.test.Helpers.contentAsString; +import static play.test.Helpers.fakeRequest; +import static play.test.Helpers.route; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.FakeDBApplication; @@ -9,21 +19,14 @@ import com.yugabyte.yw.models.Audit; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Users; +import java.io.IOException; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import play.libs.Json; import play.mvc.Http; import play.mvc.Result; -import java.io.IOException; -import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.assertYWSE; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static play.mvc.Http.Status.*; -import static play.test.Helpers.*; - public class AuditControllerTest extends FakeDBApplication { String baseRoute = "/api/customers/%s/"; diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/BackupsControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/BackupsControllerTest.java index 0007ce8946c0..f472523b51d3 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/BackupsControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/BackupsControllerTest.java @@ -2,6 +2,28 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.AssertHelper.assertAuditEntry; +import static com.yugabyte.yw.common.AssertHelper.assertErrorNodeValue; +import static com.yugabyte.yw.common.AssertHelper.assertOk; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static com.yugabyte.yw.common.AssertHelper.assertValues; +import static com.yugabyte.yw.common.AssertHelper.assertYWSE; +import static com.yugabyte.yw.forms.BackupTableParams.ActionType.RESTORE; +import static com.yugabyte.yw.models.CustomerTask.TaskType.Restore; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.FORBIDDEN; +import static play.test.Helpers.contentAsString; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -12,16 +34,16 @@ import com.yugabyte.yw.common.Util; import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.forms.BackupTableParams; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Backup; import com.yugabyte.yw.models.Backup.BackupState; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.TaskInfo; import com.yugabyte.yw.models.TaskInfo.State; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; import com.yugabyte.yw.models.helpers.TaskType; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import play.libs.Json; -import play.mvc.Result; - import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -31,16 +53,11 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; - -import static com.yugabyte.yw.common.AssertHelper.*; -import static com.yugabyte.yw.forms.BackupTableParams.ActionType.RESTORE; -import static com.yugabyte.yw.models.CustomerTask.TaskType.Restore; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; -import static org.junit.Assert.assertThrows; -import static play.mvc.Http.Status.BAD_REQUEST; -import static play.mvc.Http.Status.FORBIDDEN; -import static play.test.Helpers.contentAsString; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import play.libs.Json; +import play.mvc.Result; public class BackupsControllerTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/CustomerControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/CustomerControllerTest.java index 048f13ceca0f..c7d4b829d80e 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/CustomerControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/CustomerControllerTest.java @@ -2,16 +2,56 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.AssertHelper.assertAuditEntry; +import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static com.yugabyte.yw.common.ModelFactory.createUniverse; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.StringContains.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.anyList; +import static org.mockito.Matchers.anyMap; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static play.mvc.Http.Status.FORBIDDEN; +import static play.mvc.Http.Status.OK; +import static play.test.Helpers.BAD_REQUEST; +import static play.test.Helpers.contentAsString; +import static play.test.Helpers.fakeRequest; +import static play.test.Helpers.route; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.yugabyte.yw.commissioner.Common; -import com.yugabyte.yw.common.*; +import com.yugabyte.yw.common.ApiUtils; import com.yugabyte.yw.common.CallHomeManager.CollectionLevel; +import com.yugabyte.yw.common.FakeApiHelper; +import com.yugabyte.yw.common.FakeDBApplication; +import com.yugabyte.yw.common.ModelFactory; +import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.common.alerts.AlertService; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; +import java.util.ArrayList; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -22,26 +62,6 @@ import play.mvc.Http; import play.mvc.Result; -import java.util.ArrayList; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeoutException; - -import static com.yugabyte.yw.common.AssertHelper.*; -import static com.yugabyte.yw.common.ModelFactory.createUniverse; -import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.StringContains.containsString; -import static org.junit.Assert.*; -import static org.mockito.Matchers.anyList; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.*; -import static play.mvc.Http.Status.FORBIDDEN; -import static play.mvc.Http.Status.OK; -import static play.test.Helpers.*; - @RunWith(MockitoJUnitRunner.class) public class CustomerControllerTest extends FakeDBApplication { String rootRoute = "/api/customers"; diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/HAControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/HAControllerTest.java index b30da6c64188..b5a66b55e87e 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/HAControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/HAControllerTest.java @@ -10,26 +10,25 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; +import static com.yugabyte.yw.common.AssertHelper.assertNotFound; +import static com.yugabyte.yw.common.AssertHelper.assertOk; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static play.test.Helpers.contentAsString; + import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.common.FakeApiHelper; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Users; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import play.libs.Json; import play.mvc.Result; -import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; -import static com.yugabyte.yw.common.AssertHelper.assertNotFound; -import static com.yugabyte.yw.common.AssertHelper.assertOk; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static play.test.Helpers.contentAsString; - public class HAControllerTest extends FakeDBApplication { Customer customer; Users user; diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/ImportControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/ImportControllerTest.java index 6e621bd6bb6c..14a6bff1ea18 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/ImportControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/ImportControllerTest.java @@ -2,17 +2,48 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.AssertHelper.assertAuditEntry; +import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; +import static com.yugabyte.yw.common.AssertHelper.assertInternalServerError; +import static com.yugabyte.yw.common.AssertHelper.assertOk; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static com.yugabyte.yw.common.AssertHelper.assertValueAtPath; +import static com.yugabyte.yw.common.AssertHelper.assertYWSE; +import static com.yugabyte.yw.common.FakeApiHelper.doRequestWithAuthToken; +import static com.yugabyte.yw.common.FakeApiHelper.doRequestWithAuthTokenAndBody; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.core.StringContains.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyLong; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static play.test.Helpers.contentAsString; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.commissioner.Common.CloudType; import com.yugabyte.yw.commissioner.tasks.CommissionerBaseTest; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.common.NodeActionType; -import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.forms.ImportUniverseFormData; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Capability; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ImportedState; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.TaskInfo; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -23,23 +54,6 @@ import play.libs.Json; import play.mvc.Result; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.*; -import static com.yugabyte.yw.common.FakeApiHelper.doRequestWithAuthToken; -import static com.yugabyte.yw.common.FakeApiHelper.doRequestWithAuthTokenAndBody; -import static org.hamcrest.CoreMatchers.allOf; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.core.StringContains.containsString; -import static org.junit.Assert.*; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Mockito.*; -import static play.test.Helpers.contentAsString; - @RunWith(MockitoJUnitRunner.class) public class ImportControllerTest extends CommissionerBaseTest { private static final String MASTER_ADDRS = "127.0.0.1:7100,127.0.0.2:7100,127.0.0.3:7100"; diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/InternalHAControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/InternalHAControllerTest.java index 6305ac87ebd9..2e12a365e86f 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/InternalHAControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/InternalHAControllerTest.java @@ -11,6 +11,17 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; +import static com.yugabyte.yw.common.AssertHelper.assertInternalServerError; +import static com.yugabyte.yw.common.AssertHelper.assertOk; +import static junit.framework.TestCase.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static play.libs.Files.singletonTemporaryFileCreator; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.test.Helpers.contentAsString; +import static play.test.Helpers.fakeRequest; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.google.common.collect.ImmutableMap; @@ -23,16 +34,6 @@ import com.yugabyte.yw.models.HighAvailabilityConfig; import com.yugabyte.yw.models.PlatformInstance; import com.yugabyte.yw.models.Users; -import org.apache.commons.io.FileUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import play.libs.Json; -import play.mvc.Result; -import play.test.Helpers; - import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -46,15 +47,15 @@ import java.util.Optional; import java.util.Random; import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.*; -import static junit.framework.TestCase.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static play.libs.Files.singletonTemporaryFileCreator; -import static play.mvc.Http.Status.BAD_REQUEST; -import static play.test.Helpers.contentAsString; -import static play.test.Helpers.fakeRequest; +import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import play.libs.Json; +import play.mvc.Result; +import play.test.Helpers; public class InternalHAControllerTest extends FakeDBApplication { private static final String UPLOAD_ENDPOINT = "/api/settings/ha/internal/upload"; diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/RegionControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/RegionControllerTest.java index 8c7eecc1befe..f2ae4e3486c1 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/RegionControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/RegionControllerTest.java @@ -1,13 +1,37 @@ // Copyright (c) Yugabyte, Inc. package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.AssertHelper.assertAuditEntry; +import static com.yugabyte.yw.common.AssertHelper.assertErrorResponse; +import static com.yugabyte.yw.common.AssertHelper.assertInternalServerError; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static com.yugabyte.yw.common.AssertHelper.assertYWSE; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.OK; +import static play.test.Helpers.contentAsString; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.ConfigHelper; import com.yugabyte.yw.common.FakeApiHelper; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Users; +import com.yugabyte.yw.models.YugawareProperty; +import java.util.List; +import java.util.UUID; import org.hamcrest.CoreMatchers; import org.hamcrest.core.AllOf; import org.hamcrest.core.Is; @@ -18,17 +42,6 @@ import play.libs.Json; import play.mvc.Result; -import java.util.List; -import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.*; -import static org.junit.Assert.*; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; -import static play.mvc.Http.Status.BAD_REQUEST; -import static play.mvc.Http.Status.OK; -import static play.test.Helpers.contentAsString; - public class RegionControllerTest extends FakeDBApplication { Provider provider; Customer customer; diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/ReleaseControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/ReleaseControllerTest.java index 071b2f4fec3a..cd7a046c2b40 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/ReleaseControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/ReleaseControllerTest.java @@ -2,30 +2,43 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.AssertHelper.assertAuditEntry; +import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; +import static com.yugabyte.yw.common.AssertHelper.assertInternalServerError; +import static com.yugabyte.yw.common.AssertHelper.assertOk; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static com.yugabyte.yw.common.AssertHelper.assertYWSE; +import static com.yugabyte.yw.common.ReleaseManager.ReleaseState.DISABLED; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.FORBIDDEN; +import static play.mvc.Http.Status.OK; +import static play.test.Helpers.contentAsString; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableMap; -import com.yugabyte.yw.common.*; +import com.yugabyte.yw.common.FakeApiHelper; +import com.yugabyte.yw.common.FakeDBApplication; +import com.yugabyte.yw.common.ModelFactory; +import com.yugabyte.yw.common.ReleaseManager; +import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Users; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import play.libs.Json; import play.mvc.Result; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.*; -import static com.yugabyte.yw.common.ReleaseManager.ReleaseState.DISABLED; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.*; -import static play.mvc.Http.Status.*; -import static play.test.Helpers.contentAsString; - public class ReleaseControllerTest extends FakeDBApplication { private Customer customer; diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/ScheduleControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/ScheduleControllerTest.java index 2464572319a4..b320cd276e04 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/ScheduleControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/ScheduleControllerTest.java @@ -2,25 +2,31 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.AssertHelper.assertAuditEntry; +import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; +import static com.yugabyte.yw.common.AssertHelper.assertOk; +import static com.yugabyte.yw.common.AssertHelper.assertYWSE; +import static org.junit.Assert.assertEquals; +import static play.mvc.Http.Status.FORBIDDEN; +import static play.test.Helpers.contentAsString; + import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.common.FakeApiHelper; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.forms.BackupTableParams; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.Schedule; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; import com.yugabyte.yw.models.helpers.TaskType; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import play.libs.Json; import play.mvc.Result; -import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.*; -import static org.junit.Assert.assertEquals; -import static play.mvc.Http.Status.FORBIDDEN; -import static play.test.Helpers.contentAsString; - public class ScheduleControllerTest extends FakeDBApplication { private Universe defaultUniverse; diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/SessionControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/SessionControllerTest.java index 0d6cfc3b026c..dfdcd262b0a1 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/SessionControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/SessionControllerTest.java @@ -2,6 +2,33 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.ApiUtils.getTestUserIntent; +import static com.yugabyte.yw.common.AssertHelper.assertAuditEntry; +import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; +import static com.yugabyte.yw.common.AssertHelper.assertForbidden; +import static com.yugabyte.yw.common.AssertHelper.assertInternalServerError; +import static com.yugabyte.yw.common.AssertHelper.assertOk; +import static com.yugabyte.yw.common.AssertHelper.assertUnauthorized; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static com.yugabyte.yw.common.AssertHelper.assertYWSE; +import static com.yugabyte.yw.common.FakeApiHelper.doRequestWithAuthToken; +import static com.yugabyte.yw.models.Users.Role; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.mock; +import static play.inject.Bindings.bind; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.OK; +import static play.mvc.Http.Status.UNAUTHORIZED; +import static play.test.Helpers.contentAsString; +import static play.test.Helpers.fakeRequest; +import static play.test.Helpers.route; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableMap; @@ -18,9 +45,17 @@ import com.yugabyte.yw.common.alerts.AlertService; import com.yugabyte.yw.common.config.impl.SettableRuntimeConfigFactory; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.AvailabilityZone; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.InstanceType; +import com.yugabyte.yw.models.Provider; +import com.yugabyte.yw.models.Region; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.scheduler.Scheduler; +import java.util.Map; +import java.util.UUID; import org.junit.After; import org.junit.Test; import org.pac4j.play.CallbackController; @@ -32,20 +67,6 @@ import play.mvc.Result; import play.test.Helpers; -import java.util.Map; -import java.util.UUID; - -import static com.yugabyte.yw.common.ApiUtils.getTestUserIntent; -import static com.yugabyte.yw.common.AssertHelper.*; -import static com.yugabyte.yw.common.FakeApiHelper.doRequestWithAuthToken; -import static com.yugabyte.yw.models.Users.Role; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; -import static play.inject.Bindings.bind; -import static play.mvc.Http.Status.*; -import static play.test.Helpers.*; - public class SessionControllerTest { private HealthChecker mockHealthChecker; diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/SwaggerGenTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/SwaggerGenTest.java index 878e8540659e..ed22a0a797e9 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/SwaggerGenTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/SwaggerGenTest.java @@ -10,20 +10,23 @@ package com.yugabyte.yw.controllers; +import static junit.framework.TestCase.fail; +import static play.test.Helpers.contentAsString; +import static play.test.Helpers.route; + import com.yugabyte.yw.common.FakeDBApplication; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; import org.apache.commons.io.IOUtils; import org.junit.Test; import play.mvc.Result; import play.test.Helpers; -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; - -import static junit.framework.TestCase.fail; -import static play.test.Helpers.contentAsString; -import static play.test.Helpers.route; - /** * Unittest can be run like this: [yugaware] $ testOnly com.yugabyte.yw.controllers.SwaggerGenTest * This test will fail if swagger test has not been generated. diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/TablesControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/TablesControllerTest.java index 7c9b55b0cc20..65f76499df3c 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/TablesControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/TablesControllerTest.java @@ -2,6 +2,38 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.commissioner.Common.CloudType.aws; +import static com.yugabyte.yw.common.AssertHelper.assertAuditEntry; +import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; +import static com.yugabyte.yw.common.AssertHelper.assertErrorNodeValue; +import static com.yugabyte.yw.common.AssertHelper.assertForbidden; +import static com.yugabyte.yw.common.AssertHelper.assertOk; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static com.yugabyte.yw.common.AssertHelper.assertYWSE; +import static com.yugabyte.yw.common.ModelFactory.createUniverse; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.core.StringContains.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.OK; +import static play.test.Helpers.contentAsString; +import static play.test.Helpers.contextComponents; + import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -11,16 +43,37 @@ import com.google.common.collect.ImmutableSet; import com.google.protobuf.ByteString; import com.yugabyte.yw.commissioner.tasks.MultiTableBackup; -import com.yugabyte.yw.common.*; +import com.yugabyte.yw.common.ApiUtils; +import com.yugabyte.yw.common.FakeApiHelper; +import com.yugabyte.yw.common.FakeDBApplication; +import com.yugabyte.yw.common.ModelFactory; +import com.yugabyte.yw.common.RegexMatcher; +import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.common.audit.AuditService; import com.yugabyte.yw.common.services.YBClientService; import com.yugabyte.yw.forms.BackupTableParams; import com.yugabyte.yw.forms.BulkImportParams; import com.yugabyte.yw.forms.TableDefinitionTaskParams; -import com.yugabyte.yw.models.*; +import com.yugabyte.yw.models.Backup; +import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; +import com.yugabyte.yw.models.CustomerTask; +import com.yugabyte.yw.models.Schedule; +import com.yugabyte.yw.models.Universe; +import com.yugabyte.yw.models.Users; import com.yugabyte.yw.models.helpers.ColumnDetails; import com.yugabyte.yw.models.helpers.TaskType; import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -41,23 +94,6 @@ import play.mvc.Http; import play.mvc.Result; -import java.util.*; - -import static com.yugabyte.yw.commissioner.Common.CloudType.aws; -import static com.yugabyte.yw.common.AssertHelper.*; -import static com.yugabyte.yw.common.ModelFactory.createUniverse; -import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.core.StringContains.containsString; -import static org.junit.Assert.*; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.*; -import static play.mvc.Http.Status.BAD_REQUEST; -import static play.mvc.Http.Status.OK; -import static play.test.Helpers.contentAsString; -import static play.test.Helpers.contextComponents; - public class TablesControllerTest extends FakeDBApplication { public static final Logger LOG = LoggerFactory.getLogger(TablesControllerTest.class); private YBClientService mockService; diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/UniverseControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/UniverseControllerTest.java index 1979d3b26c13..8c330aac7bb7 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/UniverseControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/UniverseControllerTest.java @@ -10,6 +10,26 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.ApiUtils.getDefaultUserIntent; +import static com.yugabyte.yw.common.AssertHelper.assertAuditEntry; +import static com.yugabyte.yw.common.AssertHelper.assertBadRequest; +import static com.yugabyte.yw.common.AssertHelper.assertOk; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static com.yugabyte.yw.common.AssertHelper.assertYWSE; +import static com.yugabyte.yw.common.FakeApiHelper.doRequestWithAuthToken; +import static com.yugabyte.yw.common.ModelFactory.createUniverse; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; +import static play.mvc.Http.Status.FORBIDDEN; +import static play.test.Helpers.contentAsString; + import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.common.ApiUtils; @@ -19,6 +39,11 @@ import com.yugabyte.yw.models.Backup; import com.yugabyte.yw.models.CustomerTask; import com.yugabyte.yw.models.Universe; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; import junitparams.JUnitParamsRunner; import junitparams.Parameters; import org.junit.Test; @@ -26,24 +51,6 @@ import play.libs.Json; import play.mvc.Result; -import java.net.URLEncoder; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; - -import static com.yugabyte.yw.common.ApiUtils.getDefaultUserIntent; -import static com.yugabyte.yw.common.AssertHelper.*; -import static com.yugabyte.yw.common.FakeApiHelper.doRequestWithAuthToken; -import static com.yugabyte.yw.common.ModelFactory.createUniverse; -import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; -import static play.mvc.Http.Status.FORBIDDEN; -import static play.test.Helpers.contentAsString; - @RunWith(JUnitParamsRunner.class) public class UniverseControllerTest extends UniverseControllerTestBase { diff --git a/managed/src/test/java/com/yugabyte/yw/controllers/UsersControllerTest.java b/managed/src/test/java/com/yugabyte/yw/controllers/UsersControllerTest.java index 28620c10ba88..8c36921d5422 100644 --- a/managed/src/test/java/com/yugabyte/yw/controllers/UsersControllerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/controllers/UsersControllerTest.java @@ -2,16 +2,35 @@ package com.yugabyte.yw.controllers; +import static com.yugabyte.yw.common.AssertHelper.assertAuditEntry; +import static com.yugabyte.yw.common.AssertHelper.assertYWSE; +import static com.yugabyte.yw.models.Users.Role; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.mvc.Http.Status.FORBIDDEN; +import static play.mvc.Http.Status.OK; +import static play.test.Helpers.contentAsString; +import static play.test.Helpers.fakeRequest; +import static play.test.Helpers.route; + import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectReader; import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.FakeDBApplication; -import com.yugabyte.yw.common.YWServiceException; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.models.Customer; import com.yugabyte.yw.models.Users; +import java.io.IOException; +import java.util.List; import org.junit.Before; import org.junit.Test; import org.mindrot.jbcrypt.BCrypt; @@ -19,17 +38,6 @@ import play.mvc.Http; import play.mvc.Result; -import java.io.IOException; -import java.util.List; - -import static com.yugabyte.yw.common.AssertHelper.assertAuditEntry; -import static com.yugabyte.yw.common.AssertHelper.assertYWSE; -import static com.yugabyte.yw.models.Users.Role; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; -import static play.mvc.Http.Status.*; -import static play.test.Helpers.*; - public class UsersControllerTest extends FakeDBApplication { String baseRoute = "/api/customers/%s/users"; diff --git a/managed/src/test/java/com/yugabyte/yw/metrics/MetricQueryExecutorTest.java b/managed/src/test/java/com/yugabyte/yw/metrics/MetricQueryExecutorTest.java index 9ae3bff77e92..599dccadb927 100644 --- a/managed/src/test/java/com/yugabyte/yw/metrics/MetricQueryExecutorTest.java +++ b/managed/src/test/java/com/yugabyte/yw/metrics/MetricQueryExecutorTest.java @@ -2,11 +2,24 @@ package com.yugabyte.yw.metrics; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.anyMap; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.yugabyte.yw.common.ApiHelper; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.models.MetricConfig; +import java.util.HashMap; +import java.util.Map; +import org.hamcrest.core.AllOf; +import org.hamcrest.core.IsEqual; +import org.hamcrest.core.IsInstanceOf; +import org.hamcrest.core.IsNull; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -15,21 +28,6 @@ import org.mockito.runners.MockitoJUnitRunner; import play.libs.Json; -import java.util.HashMap; -import java.util.Map; - -import org.hamcrest.core.*; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; - -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.verify; - @RunWith(MockitoJUnitRunner.class) public class MetricQueryExecutorTest extends FakeDBApplication { @Mock play.Configuration mockAppConfig; diff --git a/managed/src/test/java/com/yugabyte/yw/metrics/MetricQueryHelperTest.java b/managed/src/test/java/com/yugabyte/yw/metrics/MetricQueryHelperTest.java index ad082e887749..bb418b239246 100644 --- a/managed/src/test/java/com/yugabyte/yw/metrics/MetricQueryHelperTest.java +++ b/managed/src/test/java/com/yugabyte/yw/metrics/MetricQueryHelperTest.java @@ -1,6 +1,21 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.metrics; +import static junit.framework.TestCase.assertTrue; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.AllOf.allOf; +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.anyMap; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static play.mvc.Http.Status.BAD_REQUEST; +import static play.test.Helpers.contentAsString; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -9,6 +24,15 @@ import com.yugabyte.yw.metrics.data.AlertData; import com.yugabyte.yw.metrics.data.AlertState; import com.yugabyte.yw.models.MetricConfig; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.io.IOUtils; import org.hamcrest.CoreMatchers; import org.hamcrest.Matchers; @@ -23,25 +47,6 @@ import org.mockito.runners.MockitoJUnitRunner; import play.libs.Json; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.util.*; - -import static junit.framework.TestCase.assertTrue; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.AllOf.allOf; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.*; -import static play.mvc.Http.Status.BAD_REQUEST; -import static play.test.Helpers.contentAsString; - @RunWith(MockitoJUnitRunner.class) public class MetricQueryHelperTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/metrics/MetricQueryResponseTest.java b/managed/src/test/java/com/yugabyte/yw/metrics/MetricQueryResponseTest.java index 9542d3af36ed..09a117feffb0 100644 --- a/managed/src/test/java/com/yugabyte/yw/metrics/MetricQueryResponseTest.java +++ b/managed/src/test/java/com/yugabyte/yw/metrics/MetricQueryResponseTest.java @@ -2,27 +2,26 @@ package com.yugabyte.yw.metrics; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.core.AllOf.allOf; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.google.common.collect.ImmutableMap; import com.yugabyte.yw.models.MetricConfig; +import java.util.ArrayList; +import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.runners.MockitoJUnitRunner; import play.libs.Json; -import java.util.ArrayList; -import java.util.List; - -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.core.AllOf.allOf; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - @RunWith(MockitoJUnitRunner.class) public class MetricQueryResponseTest { diff --git a/managed/src/test/java/com/yugabyte/yw/metrics/YBMetricQueryComponentTest.java b/managed/src/test/java/com/yugabyte/yw/metrics/YBMetricQueryComponentTest.java index fac8efe75760..579d0bb1da35 100644 --- a/managed/src/test/java/com/yugabyte/yw/metrics/YBMetricQueryComponentTest.java +++ b/managed/src/test/java/com/yugabyte/yw/metrics/YBMetricQueryComponentTest.java @@ -2,49 +2,27 @@ package com.yugabyte.yw.metrics; +import static com.yugabyte.yw.metrics.YBMetricQueryComponent.Function.Average; +import static com.yugabyte.yw.metrics.YBMetricQueryComponent.Function.Sum; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableMap; -import com.yugabyte.yw.common.ApiHelper; import com.yugabyte.yw.common.FakeDBApplication; -import com.yugabyte.yw.models.MetricConfig; -import org.junit.Before; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; +import org.mockito.InjectMocks; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; -import org.mockito.InjectMocks; import org.mockito.stubbing.OngoingStubbing; -import play.libs.Json; - -import java.util.HashMap; -import java.util.Map; -import java.util.List; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.Iterator; - -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.core.AllOf.allOf; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.verify; - -import static com.yugabyte.yw.metrics.YBMetricQueryComponent.Function.Sum; -import static com.yugabyte.yw.metrics.YBMetricQueryComponent.Function.Average; @RunWith(MockitoJUnitRunner.class) public class YBMetricQueryComponentTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/AccessKeyIdTest.java b/managed/src/test/java/com/yugabyte/yw/models/AccessKeyIdTest.java index 6459c7505def..6d9e17c72899 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/AccessKeyIdTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/AccessKeyIdTest.java @@ -2,16 +2,15 @@ package com.yugabyte.yw.models; -import org.junit.Test; - -import java.util.UUID; - import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.core.AllOf.allOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.core.AllOf.allOf; + +import java.util.UUID; +import org.junit.Test; public class AccessKeyIdTest { @Test diff --git a/managed/src/test/java/com/yugabyte/yw/models/AccessKeyTest.java b/managed/src/test/java/com/yugabyte/yw/models/AccessKeyTest.java index 3257b2bf3efa..2d429d326a49 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/AccessKeyTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/AccessKeyTest.java @@ -2,22 +2,25 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; + import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; +import java.util.List; +import java.util.UUID; +import javax.persistence.PersistenceException; import org.junit.Before; import org.junit.Test; import play.libs.Json; -import javax.persistence.PersistenceException; - -import java.util.List; -import java.util.UUID; - -import static com.yugabyte.yw.common.AssertHelper.assertValue; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; - public class AccessKeyTest extends FakeDBApplication { Provider defaultProvider; diff --git a/managed/src/test/java/com/yugabyte/yw/models/AlertDefinitionGroupTest.java b/managed/src/test/java/com/yugabyte/yw/models/AlertDefinitionGroupTest.java index 899cfce4607d..40685f8ab79d 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/AlertDefinitionGroupTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/AlertDefinitionGroupTest.java @@ -1,6 +1,12 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.models; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.notNullValue; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -13,6 +19,11 @@ import com.yugabyte.yw.common.config.impl.SettableRuntimeConfigFactory; import com.yugabyte.yw.models.filters.AlertDefinitionFilter; import com.yugabyte.yw.models.filters.AlertDefinitionGroupFilter; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Collections; +import java.util.List; +import java.util.Map; import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.Test; @@ -20,17 +31,6 @@ import org.mockito.junit.MockitoJUnitRunner; import play.libs.Json; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; - @RunWith(MockitoJUnitRunner.class) public class AlertDefinitionGroupTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/AlertDefinitionTest.java b/managed/src/test/java/com/yugabyte/yw/models/AlertDefinitionTest.java index faeac8c70f8c..9ee7c82a6523 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/AlertDefinitionTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/AlertDefinitionTest.java @@ -1,30 +1,31 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.models; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.hasSize; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThrows; + import com.google.common.collect.ImmutableList; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.common.alerts.AlertDefinitionService; import com.yugabyte.yw.models.filters.AlertDefinitionFilter; import com.yugabyte.yw.models.helpers.KnownAlertLabels; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import javax.persistence.OptimisticLockException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.junit.MockitoJUnitRunner; -import javax.persistence.OptimisticLockException; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThrows; - @RunWith(MockitoJUnitRunner.class) public class AlertDefinitionTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/AlertReceiverTest.java b/managed/src/test/java/com/yugabyte/yw/models/AlertReceiverTest.java index 9271e50e2c4d..055fb56d030f 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/AlertReceiverTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/AlertReceiverTest.java @@ -7,15 +7,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; - import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.common.YWServiceException; @@ -24,6 +15,12 @@ import com.yugabyte.yw.common.alerts.AlertReceiverSlackParams; import com.yugabyte.yw.common.alerts.AlertUtils; import com.yugabyte.yw.models.AlertReceiver.TargetType; +import java.util.List; +import java.util.UUID; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class AlertReceiverTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/AlertRouteServiceTest.java b/managed/src/test/java/com/yugabyte/yw/models/AlertRouteServiceTest.java index 3e3486135898..f8f99bee4461 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/AlertRouteServiceTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/AlertRouteServiceTest.java @@ -2,6 +2,13 @@ package com.yugabyte.yw.models; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.nullValue; +import static org.junit.Assert.assertThrows; + import com.yugabyte.yw.common.AlertDefinitionTemplate; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; @@ -11,21 +18,15 @@ import com.yugabyte.yw.common.alerts.AlertRouteService; import com.yugabyte.yw.common.alerts.AlertService; import com.yugabyte.yw.common.config.impl.SettableRuntimeConfigFactory; - import io.ebean.DataIntegrityException; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.UUID; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.assertThrows; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class AlertRouteServiceTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/AlertRouteTest.java b/managed/src/test/java/com/yugabyte/yw/models/AlertRouteTest.java index d243fe580c4b..fce85465160b 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/AlertRouteTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/AlertRouteTest.java @@ -2,17 +2,18 @@ package com.yugabyte.yw.models; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.notNullValue; +import static org.junit.Assert.fail; + import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; +import java.util.Collections; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; -import java.util.Collections; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.fail; @RunWith(MockitoJUnitRunner.class) public class AlertRouteTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/AlertTest.java b/managed/src/test/java/com/yugabyte/yw/models/AlertTest.java index ab545c6cd55d..d6d2daf3e55c 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/AlertTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/AlertTest.java @@ -1,6 +1,18 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.models; +import static com.yugabyte.yw.common.ModelFactory.createAlertDefinitionGroup; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.hasItems; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertTrue; + import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.common.alerts.AlertService; @@ -8,6 +20,9 @@ import com.yugabyte.yw.models.helpers.CommonUtils; import com.yugabyte.yw.models.helpers.KnownAlertCodes; import com.yugabyte.yw.models.helpers.KnownAlertLabels; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; import junitparams.JUnitParamsRunner; import org.hamcrest.Matchers; import org.junit.Before; @@ -18,15 +33,6 @@ import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static com.yugabyte.yw.common.ModelFactory.createAlertDefinitionGroup; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.assertTrue; - @RunWith(JUnitParamsRunner.class) public class AlertTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/AsyncReplicationRelationshipTest.java b/managed/src/test/java/com/yugabyte/yw/models/AsyncReplicationRelationshipTest.java index 0d448ba52629..8bfdd2a1b487 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/AsyncReplicationRelationshipTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/AsyncReplicationRelationshipTest.java @@ -1,19 +1,22 @@ package com.yugabyte.yw.models; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; +import java.util.List; +import java.util.UUID; import junitparams.JUnitParamsRunner; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import java.util.List; -import java.util.UUID; - -import static org.junit.Assert.*; - @RunWith(JUnitParamsRunner.class) public class AsyncReplicationRelationshipTest extends FakeDBApplication { private Customer defaultCustomer; diff --git a/managed/src/test/java/com/yugabyte/yw/models/AuditTest.java b/managed/src/test/java/com/yugabyte/yw/models/AuditTest.java index a9d1712fe49a..02a041a08d42 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/AuditTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/AuditTest.java @@ -2,12 +2,26 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.common.audit.AuditService.SECRET_REPLACEMENT; +import static com.yugabyte.yw.models.Users.Role; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static play.test.Helpers.contextComponents; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableMap; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.common.audit.AuditService; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -15,18 +29,6 @@ import play.libs.Json; import play.mvc.Http; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static com.yugabyte.yw.common.audit.AuditService.SECRET_REPLACEMENT; -import static com.yugabyte.yw.models.Users.Role; -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static play.test.Helpers.contextComponents; - @RunWith(MockitoJUnitRunner.class) public class AuditTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/AvailabilityZoneTest.java b/managed/src/test/java/com/yugabyte/yw/models/AvailabilityZoneTest.java index ea3352fe88fa..d3cdd35729ef 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/AvailabilityZoneTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/AvailabilityZoneTest.java @@ -2,17 +2,23 @@ package com.yugabyte.yw.models; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + import com.google.common.collect.ImmutableMap; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; +import java.util.Set; import org.junit.Before; import org.junit.Test; -import java.util.Set; - -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; - public class AvailabilityZoneTest extends FakeDBApplication { Region defaultRegion; Provider provider; diff --git a/managed/src/test/java/com/yugabyte/yw/models/BackupTest.java b/managed/src/test/java/com/yugabyte/yw/models/BackupTest.java index 135d83a96b16..edd61a3abdb2 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/BackupTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/BackupTest.java @@ -2,6 +2,16 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.models.Backup.BackupState.Failed; +import static com.yugabyte.yw.models.Backup.BackupState.InProgress; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; @@ -9,13 +19,6 @@ import com.yugabyte.yw.forms.BackupTableParams; import io.ebean.Ebean; import io.ebean.SqlUpdate; -import junitparams.JUnitParamsRunner; -import junitparams.Parameters; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import play.libs.Json; - import java.util.Date; import java.util.List; import java.util.Map; @@ -25,10 +28,12 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; - -import static com.yugabyte.yw.models.Backup.BackupState.Failed; -import static com.yugabyte.yw.models.Backup.BackupState.InProgress; -import static org.junit.Assert.*; +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import play.libs.Json; @RunWith(JUnitParamsRunner.class) public class BackupTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/CustomerConfigTest.java b/managed/src/test/java/com/yugabyte/yw/models/CustomerConfigTest.java index 0465acd9674e..3b9fa7f2ccf9 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/CustomerConfigTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/CustomerConfigTest.java @@ -2,23 +2,20 @@ package com.yugabyte.yw.models; -import com.fasterxml.jackson.databind.JsonNode; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableMap; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; - +import java.util.Map; import org.junit.Before; import org.junit.Test; import play.libs.Json; -import java.util.Map; - -import static com.yugabyte.yw.common.AssertHelper.assertValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - public class CustomerConfigTest extends FakeDBApplication { private Customer defaultCustomer; diff --git a/managed/src/test/java/com/yugabyte/yw/models/CustomerTaskTest.java b/managed/src/test/java/com/yugabyte/yw/models/CustomerTaskTest.java index 5ce71f88ff1b..7758be7be205 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/CustomerTaskTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/CustomerTaskTest.java @@ -2,23 +2,32 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.models.CustomerTask.TaskType.Create; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.models.helpers.TaskType; -import org.junit.Before; -import org.junit.Test; -import play.libs.Json; - import java.time.Duration; import java.time.Instant; import java.time.temporal.ChronoUnit; -import java.util.*; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.Random; +import java.util.UUID; import java.util.stream.Collectors; - -import static com.yugabyte.yw.models.CustomerTask.TaskType.Create; -import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import org.junit.Before; +import org.junit.Test; +import play.libs.Json; public class CustomerTaskTest extends FakeDBApplication { private Customer defaultCustomer; diff --git a/managed/src/test/java/com/yugabyte/yw/models/CustomerTest.java b/managed/src/test/java/com/yugabyte/yw/models/CustomerTest.java index 2879a220be42..c353b5cd04e7 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/CustomerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/CustomerTest.java @@ -2,26 +2,26 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.common.ModelFactory.createUniverse; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + import com.fasterxml.jackson.databind.JsonNode; import com.yugabyte.yw.common.ApiUtils; +import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; -import org.apache.commons.lang3.RandomStringUtils; -import org.junit.Test; -import org.mindrot.jbcrypt.BCrypt; -import play.libs.Json; - -import com.yugabyte.yw.common.FakeDBApplication; - -import javax.persistence.PersistenceException; - import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.UUID; - -import static com.yugabyte.yw.common.ModelFactory.createUniverse; -import static org.junit.Assert.*; +import javax.persistence.PersistenceException; +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.Test; +import play.libs.Json; public class CustomerTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/HealthCheckTest.java b/managed/src/test/java/com/yugabyte/yw/models/HealthCheckTest.java index ae999a81ba1f..a46bd0b74072 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/HealthCheckTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/HealthCheckTest.java @@ -2,20 +2,19 @@ package com.yugabyte.yw.models; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import com.yugabyte.yw.common.FakeDBApplication; +import com.yugabyte.yw.common.ModelFactory; import java.util.Date; import java.util.List; import java.util.UUID; - -import com.yugabyte.yw.common.ModelFactory; -import com.yugabyte.yw.models.HealthCheck; - import org.junit.Before; import org.junit.Test; -import com.yugabyte.yw.common.FakeDBApplication; - public class HealthCheckTest extends FakeDBApplication { private Customer defaultCustomer; diff --git a/managed/src/test/java/com/yugabyte/yw/models/InstanceTypeKeyTest.java b/managed/src/test/java/com/yugabyte/yw/models/InstanceTypeKeyTest.java index 2c0965095967..45cc4503d188 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/InstanceTypeKeyTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/InstanceTypeKeyTest.java @@ -1,11 +1,10 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.models; -import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.util.UUID; - -import static org.junit.Assert.assertEquals; +import org.junit.Test; public class InstanceTypeKeyTest { diff --git a/managed/src/test/java/com/yugabyte/yw/models/InstanceTypeTest.java b/managed/src/test/java/com/yugabyte/yw/models/InstanceTypeTest.java index 20cc344026e3..9c4cf61b006b 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/InstanceTypeTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/InstanceTypeTest.java @@ -2,12 +2,26 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.core.AllOf.allOf; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.typesafe.config.Config; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.models.InstanceType.VolumeType; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -15,18 +29,6 @@ import org.mockito.junit.MockitoJUnitRunner; import play.libs.Json; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.yugabyte.yw.common.AssertHelper.assertValue; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.core.AllOf.allOf; -import static org.junit.Assert.*; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class InstanceTypeTest extends FakeDBApplication { private Provider defaultProvider; diff --git a/managed/src/test/java/com/yugabyte/yw/models/KmsConfigTest.java b/managed/src/test/java/com/yugabyte/yw/models/KmsConfigTest.java index 379170a43f8e..fee104573e57 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/KmsConfigTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/KmsConfigTest.java @@ -10,12 +10,13 @@ package com.yugabyte.yw.models; +import static org.junit.Assert.assertEquals; + import com.yugabyte.yw.common.FakeDBApplication; +import com.yugabyte.yw.common.kms.util.KeyProvider; +import java.util.UUID; import org.junit.Test; import play.libs.Json; -import java.util.UUID; -import com.yugabyte.yw.common.kms.util.KeyProvider; -import static org.junit.Assert.assertEquals; public class KmsConfigTest extends FakeDBApplication { @Test diff --git a/managed/src/test/java/com/yugabyte/yw/models/KmsHistoryTest.java b/managed/src/test/java/com/yugabyte/yw/models/KmsHistoryTest.java index 5b4ab91d11e4..c7abe37d22ae 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/KmsHistoryTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/KmsHistoryTest.java @@ -10,21 +10,19 @@ package com.yugabyte.yw.models; -import com.yugabyte.yw.commissioner.tasks.CreateUniverse; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.common.kms.util.KeyProvider; import com.yugabyte.yw.models.KmsHistoryId.TargetType; -import org.junit.Before; -import org.junit.Test; -import play.libs.Json; - import java.util.List; import java.util.Set; import java.util.UUID; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import org.junit.Before; +import org.junit.Test; +import play.libs.Json; public class KmsHistoryTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/MetricConfigTest.java b/managed/src/test/java/com/yugabyte/yw/models/MetricConfigTest.java index d991ea7db916..bb67e7264e9f 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/MetricConfigTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/MetricConfigTest.java @@ -2,28 +2,25 @@ package com.yugabyte.yw.models; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableMap; import com.yugabyte.yw.common.FakeDBApplication; -import org.junit.Test; -import play.libs.Json; -import static org.mockito.Matchers.any; - import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.inject.Inject; - -import static org.mockito.Mockito.when; -import org.hamcrest.core.*; -import static org.hamcrest.CoreMatchers.allOf; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertEquals; +import org.hamcrest.core.IsInstanceOf; +import org.junit.Test; +import play.libs.Json; public class MetricConfigTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/NodeInstanceTest.java b/managed/src/test/java/com/yugabyte/yw/models/NodeInstanceTest.java index 886182451bc7..a16b1ecf9619 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/NodeInstanceTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/NodeInstanceTest.java @@ -4,16 +4,14 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import com.yugabyte.yw.common.FakeDBApplication; +import com.yugabyte.yw.common.ModelFactory; +import com.yugabyte.yw.forms.NodeInstanceFormData; import java.util.List; import java.util.UUID; - import org.junit.Before; import org.junit.Test; -import com.yugabyte.yw.common.FakeDBApplication; -import com.yugabyte.yw.common.ModelFactory; -import com.yugabyte.yw.forms.NodeInstanceFormData; - public class NodeInstanceTest extends FakeDBApplication { private Provider provider; private Region region; diff --git a/managed/src/test/java/com/yugabyte/yw/models/PriceComponentTest.java b/managed/src/test/java/com/yugabyte/yw/models/PriceComponentTest.java index d3e5481ac5e4..6b844bd7f410 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/PriceComponentTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/PriceComponentTest.java @@ -2,20 +2,19 @@ package com.yugabyte.yw.models; -import com.google.common.collect.ImmutableMap; -import com.yugabyte.yw.common.FakeDBApplication; -import com.yugabyte.yw.common.ModelFactory; -import org.junit.Before; -import org.junit.Test; - -import java.util.Map; - import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import com.google.common.collect.ImmutableMap; +import com.yugabyte.yw.common.FakeDBApplication; +import com.yugabyte.yw.common.ModelFactory; +import java.util.Map; +import org.junit.Before; +import org.junit.Test; + public class PriceComponentTest extends FakeDBApplication { private static final Map EXPECTED_UNIT_STRINGS = ImmutableMap.builder() diff --git a/managed/src/test/java/com/yugabyte/yw/models/ProviderTest.java b/managed/src/test/java/com/yugabyte/yw/models/ProviderTest.java index e38a4b81d7c6..c2945409233d 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/ProviderTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/ProviderTest.java @@ -2,20 +2,26 @@ package com.yugabyte.yw.models; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.core.StringContains.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + import com.google.common.collect.ImmutableMap; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.commissioner.tasks.CloudBootstrap; import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; -import org.junit.Before; -import org.junit.Test; - import java.util.Map; import java.util.UUID; - -import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.core.StringContains.containsString; -import static org.junit.Assert.*; +import org.junit.Before; +import org.junit.Test; public class ProviderTest extends FakeDBApplication { private Customer defaultCustomer; diff --git a/managed/src/test/java/com/yugabyte/yw/models/RegionTest.java b/managed/src/test/java/com/yugabyte/yw/models/RegionTest.java index 983df0863f8a..22faf08bbdf4 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/RegionTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/RegionTest.java @@ -3,27 +3,30 @@ package com.yugabyte.yw.models; import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.core.StringContains.containsString; -import static org.junit.Assert.*; -import static org.hamcrest.CoreMatchers.*; - -import com.google.common.collect.ImmutableMap; - -import java.util.Set; -import java.util.List; -import java.util.UUID; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.common.collect.ImmutableMap; +import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import javax.persistence.PersistenceException; import org.junit.Before; import org.junit.Test; - -import com.yugabyte.yw.common.FakeDBApplication; import play.libs.Json; -import javax.persistence.PersistenceException; - public class RegionTest extends FakeDBApplication { Provider defaultProvider; Customer defaultCustomer; diff --git a/managed/src/test/java/com/yugabyte/yw/models/RuntimeConfigEntryTest.java b/managed/src/test/java/com/yugabyte/yw/models/RuntimeConfigEntryTest.java index b98e957ca4a0..97974f40d309 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/RuntimeConfigEntryTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/RuntimeConfigEntryTest.java @@ -1,16 +1,20 @@ package com.yugabyte.yw.models; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; -import org.junit.Before; -import org.junit.Test; - import java.util.List; import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.Stream; - -import static org.junit.Assert.*; +import org.junit.Before; +import org.junit.Test; public class RuntimeConfigEntryTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/SaveNode.java b/managed/src/test/java/com/yugabyte/yw/models/SaveNode.java index 181973ba2d6b..1af44a37b653 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/SaveNode.java +++ b/managed/src/test/java/com/yugabyte/yw/models/SaveNode.java @@ -4,11 +4,7 @@ import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.models.helpers.NodeDetails; - -import java.lang.Runnable; import java.util.UUID; -import java.util.concurrent.*; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/managed/src/test/java/com/yugabyte/yw/models/ScheduleTaskTest.java b/managed/src/test/java/com/yugabyte/yw/models/ScheduleTaskTest.java index 05cd236d1f66..2f64b4764c0e 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/ScheduleTaskTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/ScheduleTaskTest.java @@ -2,28 +2,13 @@ package com.yugabyte.yw.models; -import com.fasterxml.jackson.databind.JsonNode; -import com.yugabyte.yw.common.FakeDBApplication; -import com.yugabyte.yw.common.ModelFactory; -import com.yugabyte.yw.common.RegexMatcher; -import com.yugabyte.yw.forms.BackupTableParams; -import com.yugabyte.yw.models.helpers.TaskType; -import org.junit.Before; -import org.junit.Test; -import play.libs.Json; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import com.yugabyte.yw.common.FakeDBApplication; import java.util.Date; -import java.util.List; import java.util.UUID; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; +import org.junit.Test; public class ScheduleTaskTest extends FakeDBApplication { diff --git a/managed/src/test/java/com/yugabyte/yw/models/ScheduleTest.java b/managed/src/test/java/com/yugabyte/yw/models/ScheduleTest.java index b9b8c8a6473b..29824b367c2b 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/ScheduleTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/ScheduleTest.java @@ -2,30 +2,19 @@ package com.yugabyte.yw.models; -import com.fasterxml.jackson.databind.JsonNode; +import static com.yugabyte.yw.models.Schedule.State.Active; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; -import com.yugabyte.yw.common.RegexMatcher; import com.yugabyte.yw.forms.BackupTableParams; -import com.yugabyte.yw.models.helpers.TaskType; +import java.util.List; +import java.util.UUID; import org.junit.Before; import org.junit.Test; import play.libs.Json; -import java.util.Date; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -import static com.yugabyte.yw.models.Schedule.State.Active; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; - public class ScheduleTest extends FakeDBApplication { private Customer defaultCustomer; private CustomerConfig s3StorageConfig; diff --git a/managed/src/test/java/com/yugabyte/yw/models/ScopedRuntimeConfigTest.java b/managed/src/test/java/com/yugabyte/yw/models/ScopedRuntimeConfigTest.java index cfdd2c80262f..751f77a4ac3d 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/ScopedRuntimeConfigTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/ScopedRuntimeConfigTest.java @@ -1,15 +1,16 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.models.ScopedRuntimeConfig.GLOBAL_SCOPE_UUID; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; +import java.util.UUID; import org.junit.Before; import org.junit.Test; -import java.util.UUID; - -import static com.yugabyte.yw.models.ScopedRuntimeConfig.GLOBAL_SCOPE_UUID; -import static org.junit.Assert.*; - public class ScopedRuntimeConfigTest extends FakeDBApplication { private Customer defaultCustomer; private Universe defaultUniverse; diff --git a/managed/src/test/java/com/yugabyte/yw/models/UniverseTest.java b/managed/src/test/java/com/yugabyte/yw/models/UniverseTest.java index fe25d0c08475..e06fe1efa8cb 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/UniverseTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/UniverseTest.java @@ -1,6 +1,23 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.models; +import static com.yugabyte.yw.common.ModelFactory.createUniverse; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.anyList; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -10,7 +27,12 @@ import com.yugabyte.yw.cloud.UniverseResourceDetails; import com.yugabyte.yw.commissioner.Common; import com.yugabyte.yw.commissioner.Common.CloudType; -import com.yugabyte.yw.common.*; +import com.yugabyte.yw.common.ApiUtils; +import com.yugabyte.yw.common.CertificateHelper; +import com.yugabyte.yw.common.FakeDBApplication; +import com.yugabyte.yw.common.ModelFactory; +import com.yugabyte.yw.common.NodeActionType; +import com.yugabyte.yw.common.Util; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.Cluster; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams.ClusterType; @@ -21,6 +43,18 @@ import com.yugabyte.yw.models.helpers.DeviceInfo; import com.yugabyte.yw.models.helpers.NodeDetails; import com.yugabyte.yw.models.helpers.NodeDetails.NodeState; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import junitparams.JUnitParamsRunner; import junitparams.Parameters; import org.apache.commons.lang3.StringUtils; @@ -29,18 +63,6 @@ import org.junit.runner.RunWith; import play.libs.Json; -import java.util.*; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -import static com.yugabyte.yw.common.ModelFactory.createUniverse; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; -import static org.mockito.Matchers.anyList; -import static org.mockito.Mockito.*; - @RunWith(JUnitParamsRunner.class) public class UniverseTest extends FakeDBApplication { private Provider defaultProvider; diff --git a/managed/src/test/java/com/yugabyte/yw/models/UsersTest.java b/managed/src/test/java/com/yugabyte/yw/models/UsersTest.java index 159e7db4e9a3..6cbe6bbc697c 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/UsersTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/UsersTest.java @@ -2,19 +2,19 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.models.Users.Role; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + import com.fasterxml.jackson.databind.JsonNode; +import com.yugabyte.yw.common.FakeDBApplication; import com.yugabyte.yw.common.ModelFactory; +import javax.persistence.PersistenceException; import org.junit.Before; import org.junit.Test; import play.libs.Json; -import com.yugabyte.yw.common.FakeDBApplication; - -import javax.persistence.PersistenceException; - -import static com.yugabyte.yw.models.Users.Role; -import static org.junit.Assert.*; - public class UsersTest extends FakeDBApplication { private Customer customer; diff --git a/managed/src/test/java/com/yugabyte/yw/models/YugawarePropertyTest.java b/managed/src/test/java/com/yugabyte/yw/models/YugawarePropertyTest.java index 26d00de46a66..52203e0613ad 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/YugawarePropertyTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/YugawarePropertyTest.java @@ -2,17 +2,17 @@ package com.yugabyte.yw.models; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + import com.google.common.collect.ImmutableMap; import com.yugabyte.yw.common.FakeDBApplication; import org.junit.Before; import org.junit.Test; import play.libs.Json; -import static com.yugabyte.yw.common.AssertHelper.assertValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - public class YugawarePropertyTest extends FakeDBApplication { @Before diff --git a/managed/src/test/java/com/yugabyte/yw/models/helpers/CommonUtilsTest.java b/managed/src/test/java/com/yugabyte/yw/models/helpers/CommonUtilsTest.java index 4b3e749043b9..b9661bdb3048 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/helpers/CommonUtilsTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/helpers/CommonUtilsTest.java @@ -2,15 +2,17 @@ package com.yugabyte.yw.models.helpers; +import static com.yugabyte.yw.common.AssertHelper.assertValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import org.junit.Test; import play.libs.Json; -import static com.yugabyte.yw.common.AssertHelper.assertValue; -import static org.junit.Assert.*; - public class CommonUtilsTest { @Test diff --git a/managed/src/test/java/com/yugabyte/yw/models/helpers/CustomerConfigValidatorTest.java b/managed/src/test/java/com/yugabyte/yw/models/helpers/CustomerConfigValidatorTest.java index c29058c6c515..16581b382309 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/helpers/CustomerConfigValidatorTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/helpers/CustomerConfigValidatorTest.java @@ -2,6 +2,8 @@ package com.yugabyte.yw.models.helpers; +import static org.junit.Assert.assertEquals; + import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import junitparams.JUnitParamsRunner; @@ -11,8 +13,6 @@ import org.junit.runner.RunWith; import play.libs.Json; -import static org.junit.Assert.assertEquals; - @RunWith(JUnitParamsRunner.class) public class CustomerConfigValidatorTest { diff --git a/managed/src/test/java/com/yugabyte/yw/models/helpers/NodeDetailsTest.java b/managed/src/test/java/com/yugabyte/yw/models/helpers/NodeDetailsTest.java index e3c7e0fb2083..f6dfdeecf5d3 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/helpers/NodeDetailsTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/helpers/NodeDetailsTest.java @@ -1,17 +1,18 @@ // Copyright (c) YugaByte, Inc. package com.yugabyte.yw.models.helpers; -import com.yugabyte.yw.common.ApiUtils; -import org.junit.Before; -import org.junit.Test; - -import java.util.HashSet; -import java.util.Set; - import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.core.AllOf.allOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +import com.yugabyte.yw.common.ApiUtils; +import java.util.HashSet; +import java.util.Set; +import org.junit.Before; +import org.junit.Test; public class NodeDetailsTest { private NodeDetails nd; diff --git a/managed/src/test/java/com/yugabyte/yw/models/helpers/TableDetailsTest.java b/managed/src/test/java/com/yugabyte/yw/models/helpers/TableDetailsTest.java index 1878ec09ada6..d689af23c552 100644 --- a/managed/src/test/java/com/yugabyte/yw/models/helpers/TableDetailsTest.java +++ b/managed/src/test/java/com/yugabyte/yw/models/helpers/TableDetailsTest.java @@ -2,12 +2,12 @@ package com.yugabyte.yw.models.helpers; +import static org.junit.Assert.assertEquals; + import com.yugabyte.yw.common.ApiUtils; import org.junit.Test; import org.yb.ColumnSchema; -import static org.junit.Assert.assertEquals; - public class TableDetailsTest { private static int oneKey = 1; diff --git a/managed/src/test/java/com/yugabyte/yw/scheduler/SchedulerTest.java b/managed/src/test/java/com/yugabyte/yw/scheduler/SchedulerTest.java index 066a021d965c..2cd4b72c117e 100644 --- a/managed/src/test/java/com/yugabyte/yw/scheduler/SchedulerTest.java +++ b/managed/src/test/java/com/yugabyte/yw/scheduler/SchedulerTest.java @@ -2,39 +2,34 @@ package com.yugabyte.yw.scheduler; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import akka.actor.ActorSystem; import akka.actor.Scheduler; import com.yugabyte.yw.commissioner.Commissioner; import com.yugabyte.yw.common.FakeDBApplication; -import com.yugabyte.yw.models.CustomerConfig; import com.yugabyte.yw.common.ModelFactory; import com.yugabyte.yw.forms.UniverseDefinitionTaskParams; +import com.yugabyte.yw.models.Backup; import com.yugabyte.yw.models.Customer; +import com.yugabyte.yw.models.CustomerConfig; import com.yugabyte.yw.models.CustomerTask; -import com.yugabyte.yw.models.helpers.TaskType; -import com.yugabyte.yw.models.Backup; import com.yugabyte.yw.models.Universe; - -import java.util.List; -import java.util.Map; import java.util.UUID; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Matchers; -import org.mockito.runners.MockitoJUnitRunner; import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import scala.concurrent.ExecutionContext; -import scala.concurrent.duration.Duration; -import scala.concurrent.duration.FiniteDuration; - -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; @RunWith(MockitoJUnitRunner.class) public class SchedulerTest extends FakeDBApplication {