Skip to content

Commit

Permalink
Revise KubeDB UI APIs (#874)
Browse files Browse the repository at this point in the history
Why this PR?
- Some non pointer types are converted into pointer types with `omitempty` to eliminate default value when the field is `not-set or unknown`

Signed-off-by: Pulak Kanti Bhowmick <pulak@appscode.com>
  • Loading branch information
pkbhowmick committed Mar 14, 2022
1 parent a4fb055 commit 1a6317f
Show file tree
Hide file tree
Showing 27 changed files with 838 additions and 372 deletions.
28 changes: 14 additions & 14 deletions apis/ui/v1alpha1/elasticsearch_insight_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ type ElasticsearchInsightSpec struct {
}

type ElasticsearchClusterHealth struct {
ActivePrimaryShards int32 `json:"activePrimaryShards,omitempty"`
ActiveShards int32 `json:"activeShards,omitempty"`
ActiveShardsPercentAsNumber int32 `json:"activeShardsPercentAsNumber,omitempty"`
ClusterName string `json:"clusterName,omitempty"`
DelayedUnassignedShards int32 `json:"delayedUnassignedShards,omitempty"`
InitializingShards int32 `json:"initializingShards,omitempty"`
NumberOfDataNodes int32 `json:"numberOfDataNodes,omitempty"`
NumberOfInFlightFetch int32 `json:"numberOfInFlightFetch,omitempty"`
NumberOfNodes int32 `json:"numberOfNodes,omitempty"`
NumberOfPendingTasks int32 `json:"numberOfPendingTasks,omitempty"`
RelocatingShards int32 `json:"relocatingShards,omitempty"`
ClusterStatus string `json:"clusterStatus,omitempty"`
UnassignedShards int32 `json:"unassignedShards,omitempty"`
TaskMaxWaitingInQueueMilliSeconds int32 `json:"taskMaxWaitingInQueueMilliSeconds,omitempty"`
ActivePrimaryShards *float64 `json:"activePrimaryShards,omitempty"`
ActiveShards *float64 `json:"activeShards,omitempty"`
ActiveShardsPercentAsNumber *float64 `json:"activeShardsPercentAsNumber,omitempty"`
ClusterName string `json:"clusterName,omitempty"`
DelayedUnassignedShards *float64 `json:"delayedUnassignedShards,omitempty"`
InitializingShards *float64 `json:"initializingShards,omitempty"`
NumberOfDataNodes *float64 `json:"numberOfDataNodes,omitempty"`
NumberOfInFlightFetch *float64 `json:"numberOfInFlightFetch,omitempty"`
NumberOfNodes *float64 `json:"numberOfNodes,omitempty"`
NumberOfPendingTasks *float64 `json:"numberOfPendingTasks,omitempty"`
RelocatingShards *float64 `json:"relocatingShards,omitempty"`
ClusterStatus string `json:"clusterStatus,omitempty"`
UnassignedShards *float64 `json:"unassignedShards,omitempty"`
TaskMaxWaitingInQueueMilliSeconds *float64 `json:"taskMaxWaitingInQueueMilliSeconds,omitempty"`
}

// ElasticsearchInsight is the Schema for the elasticsearchinsights API
Expand Down
6 changes: 3 additions & 3 deletions apis/ui/v1alpha1/elasticsearch_schema_overview_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ type ElasticsearchSchemaOverviewSpec struct {
}

type ElasticsearchIndexSpec struct {
IndexName string `json:"indexName"`
PrimaryStoreSizeBytes string `json:"primaryStoreSizeBytes"`
TotalStoreSizeBytes string `json:"totalStoreSizeBytes"`
IndexName *string `json:"indexName,omitempty"`
PrimaryStoreSizeBytes *string `json:"primaryStoreSizeBytes,omitempty"`
TotalStoreSizeBytes *string `json:"totalStoreSizeBytes,omitempty"`
}

// ElasticsearchSchemaOverview is the Schema for the elasticsearchindices API
Expand Down
6 changes: 3 additions & 3 deletions apis/ui/v1alpha1/generic_schema_overview_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type GenericSchemaOverviewSpec struct {
}

type GenericDatabaseSpec struct {
DatabaseName string `json:"databaseName,omitempty"`
TableName string `json:"tableName,omitempty"`
TableSizeBytes string `json:"tableSizeBytes,omitempty"`
DatabaseName *string `json:"databaseName,omitempty"`
TableName *string `json:"tableName,omitempty"`
TableSizeBytes *string `json:"tableSizeBytes,omitempty"`
}
28 changes: 14 additions & 14 deletions apis/ui/v1alpha1/mariadb_insight_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ const (

// MariaDBInsightSpec defines the desired state of MariaDBInsight
type MariaDBInsightSpec struct {
Version string `json:"version"`
Status string `json:"status"`
Mode string `json:"mode"`
MaxConnections int32 `json:"maxConnections"`
MaxUsedConnections int32 `json:"maxUsedConnections"`
Questions int32 `json:"questions"`
LongQueryTimeThresholdSeconds float64 `json:"longQueryTimeThresholdSeconds,omitempty"`
NumberOfSlowQueries int32 `json:"numberOfSlowQueries,omitempty"`
AbortedClients int32 `json:"abortedClients,omitempty"`
AbortedConnections int32 `json:"abortedConnections,omitempty"`
ThreadsCached int32 `json:"threadsCached,omitempty"`
ThreadsConnected int32 `json:"threadsConnected,omitempty"`
ThreadsCreated int32 `json:"threadsCreated,omitempty"`
ThreadsRunning int32 `json:"threadsRunning,omitempty"`
Version string `json:"version"`
Status string `json:"status"`
Mode string `json:"mode"`
MaxConnections *int32 `json:"maxConnections,omitempty"`
MaxUsedConnections *int32 `json:"maxUsedConnections,omitempty"`
Questions *int32 `json:"questions,omitempty"`
LongQueryTimeThresholdSeconds *float64 `json:"longQueryTimeThresholdSeconds,omitempty"`
NumberOfSlowQueries *int32 `json:"numberOfSlowQueries,omitempty"`
AbortedClients *int32 `json:"abortedClients,omitempty"`
AbortedConnections *int32 `json:"abortedConnections,omitempty"`
ThreadsCached *int32 `json:"threadsCached,omitempty"`
ThreadsConnected *int32 `json:"threadsConnected,omitempty"`
ThreadsCreated *int32 `json:"threadsCreated,omitempty"`
ThreadsRunning *int32 `json:"threadsRunning,omitempty"`
}

// MariaDBInsight is the Schema for the mariaDBinsights API
Expand Down
14 changes: 7 additions & 7 deletions apis/ui/v1alpha1/mariadb_queries_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ type MariaDBQuerySpec struct {
UserHost string `json:"userHost"`
QueryTimeMilliSeconds string `json:"queryTimeMilliSeconds"`
LockTimeMilliSeconds string `json:"lockTimeMilliSeconds"`
RowsSent int64 `json:"rowsSent"`
RowsExamined int64 `json:"rowsExamined"`
RowsSent *int64 `json:"rowsSent,omitempty"`
RowsExamined *int64 `json:"rowsExamined,omitempty"`
DB string `json:"db"`
LastInsertId int64 `json:"lastInsertId,omitempty"`
InsertId int64 `json:"insertId,omitempty"`
ServerId int64 `json:"serverId,omitempty"`
LastInsertId *int64 `json:"lastInsertId,omitempty"`
InsertId *int64 `json:"insertId,omitempty"`
ServerId *int64 `json:"serverId,omitempty"`
SQLText string `json:"sqlText,omitempty"`
ThreadId int64 `json:"threadId,omitempty"`
RowsAffected int64 `json:"rowsAffected,omitempty"`
ThreadId *int64 `json:"threadId,omitempty"`
RowsAffected *int64 `json:"rowsAffected,omitempty"`
}

// MariaDBQueries is the Schema for the mariadbslowqueries API
Expand Down
28 changes: 14 additions & 14 deletions apis/ui/v1alpha1/mongodb_insight_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,29 @@ type MongoDBInsightSpec struct {
}

type MongoDBDatabaseStats struct {
TotalCollections int32 `json:"totalCollections"`
DataSize int64 `json:"dataSize"`
TotalIndexes int32 `json:"totalIndexes"`
IndexSize int64 `json:"indexSize"`
TotalCollections *int32 `json:"totalCollections,omitempty"`
DataSize *int64 `json:"dataSize,omitempty"`
TotalIndexes *int32 `json:"totalIndexes,omitempty"`
IndexSize *int64 `json:"indexSize,omitempty"`
}

type MongoDBConnectionsInfo struct {
CurrentConnections int32 `json:"currentConnections"`
TotalConnections int32 `json:"totalConnections"`
AvailableConnections int32 `json:"availableConnections"`
ActiveConnections int32 `json:"activeConnections"`
CurrentConnections *int32 `json:"currentConnections,omitempty"`
TotalConnections *int32 `json:"totalConnections,omitempty"`
AvailableConnections *int32 `json:"availableConnections,omitempty"`
ActiveConnections *int32 `json:"activeConnections,omitempty"`
}

type MongoDBReplicaSetInfo struct {
NumberOfReplicas int32 `json:"numberOfReplicas"`
NumberOfReplicas *int32 `json:"numberOfReplicas,omitempty"`
}

type MongoDBShardsInfo struct {
NumberOfShards int32 `json:"numberOfShards"`
ReplicasPerShards int32 `json:"replicasPerShards"`
NumberOfChunks int32 `json:"numberOfChunks"`
BalancerEnabled bool `json:"balancerEnabled,omitempty"`
ChunksBalanced bool `json:"chunksBalanced,omitempty"`
NumberOfShards *int32 `json:"numberOfShards,omitempty"`
ReplicasPerShards *int32 `json:"replicasPerShards,omitempty"`
NumberOfChunks *int32 `json:"numberOfChunks,omitempty"`
BalancerEnabled *bool `json:"balancerEnabled,omitempty"`
ChunksBalanced *bool `json:"chunksBalanced,omitempty"`
}

// MongoDBInsight is the Schema for the MongoDBInsights API
Expand Down
8 changes: 4 additions & 4 deletions apis/ui/v1alpha1/mongodb_queries_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ type MongoDBQuerySpec struct {
DatabaseName string `json:"databaseName"`
CollectionName string `json:"collectionName"`
Command string `json:"command"`
Count int64 `json:"count"`
AvgExecutionTimeMilliSeconds int64 `json:"avgExecutionTimeMilliSeconds,omitempty"`
MinExecutionTimeMilliSeconds int64 `json:"minExecutionTimeMilliSeconds,omitempty"`
MaxExecutionTimeMilliSeconds int64 `json:"maxExecutionTimeMilliSeconds,omitempty"`
Count *int64 `json:"count,omitempty"`
AvgExecutionTimeMilliSeconds *int64 `json:"avgExecutionTimeMilliSeconds,omitempty"`
MinExecutionTimeMilliSeconds *int64 `json:"minExecutionTimeMilliSeconds,omitempty"`
MaxExecutionTimeMilliSeconds *int64 `json:"maxExecutionTimeMilliSeconds,omitempty"`
}

// MongoDBQueries is the Schema for the MongoDBQueriess API
Expand Down
28 changes: 14 additions & 14 deletions apis/ui/v1alpha1/mysql_insight_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ const (

// MySQLInsightSpec defines the desired state of MySQLInsight
type MySQLInsightSpec struct {
Version string `json:"version"`
Status string `json:"status"`
Mode string `json:"mode"`
MaxConnections int32 `json:"maxConnections"`
MaxUsedConnections int32 `json:"maxUsedConnections"`
Questions int32 `json:"questions"`
LongQueryTimeThresholdSeconds float64 `json:"longQueryTimeThresholdSeconds,omitempty"`
NumberOfSlowQueries int32 `json:"numberOfSlowQueries,omitempty"`
AbortedClients int32 `json:"abortedClients,omitempty"`
AbortedConnections int32 `json:"abortedConnections,omitempty"`
ThreadsCached int32 `json:"threadsCached,omitempty"`
ThreadsConnected int32 `json:"threadsConnected,omitempty"`
ThreadsCreated int32 `json:"threadsCreated,omitempty"`
ThreadsRunning int32 `json:"threadsRunning,omitempty"`
Version string `json:"version"`
Status string `json:"status"`
Mode string `json:"mode"`
MaxConnections *int32 `json:"maxConnections,omitempty"`
MaxUsedConnections *int32 `json:"maxUsedConnections,omitempty"`
Questions *int32 `json:"questions,omitempty"`
LongQueryTimeThresholdSeconds *float64 `json:"longQueryTimeThresholdSeconds,omitempty"`
NumberOfSlowQueries *int32 `json:"numberOfSlowQueries,omitempty"`
AbortedClients *int32 `json:"abortedClients,omitempty"`
AbortedConnections *int32 `json:"abortedConnections,omitempty"`
ThreadsCached *int32 `json:"threadsCached,omitempty"`
ThreadsConnected *int32 `json:"threadsConnected,omitempty"`
ThreadsCreated *int32 `json:"threadsCreated,omitempty"`
ThreadsRunning *int32 `json:"threadsRunning,omitempty"`
}

// MySQLInsight is the Schema for the mysqlinsights API
Expand Down
12 changes: 6 additions & 6 deletions apis/ui/v1alpha1/mysql_queries_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ type MySQLQuerySpec struct {
UserHost string `json:"userHost"`
QueryTimeMilliSeconds string `json:"queryTimeMilliSeconds"`
LockTimeMilliSeconds string `json:"lockTimeMilliSeconds"`
RowsSent int64 `json:"rowsSent"`
RowsExamined int64 `json:"rowsExamined"`
RowsSent *int64 `json:"rowsSent,omitempty"`
RowsExamined *int64 `json:"rowsExamined,omitempty"`
DB string `json:"db"`
LastInsertId int64 `json:"lastInsertId,omitempty"`
InsertId int64 `json:"insertId,omitempty"`
ServerId int64 `json:"serverId,omitempty"`
LastInsertId *int64 `json:"lastInsertId,omitempty"`
InsertId *int64 `json:"insertId,omitempty"`
ServerId *int64 `json:"serverId,omitempty"`
SQLText string `json:"sqlText,omitempty"`
ThreadId int64 `json:"threadId,omitempty"`
ThreadId *int64 `json:"threadId,omitempty"`
}

// MySQLQueries is the Schema for the MySQLQueries API
Expand Down
Loading

0 comments on commit 1a6317f

Please sign in to comment.