Skip to content
2 changes: 1 addition & 1 deletion apps/customer-portal/backend/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
org = "wso2"
name = "customer_portal"
version = "1.0.0-rc.2"
version = "1.0.0-rc.3"
distribution = "2201.12.10"

[build-options]
Expand Down
4 changes: 0 additions & 4 deletions apps/customer-portal/backend/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ dependencies = [
{org = "ballerina", name = "task"},
{org = "ballerina", name = "time"}
]
modules = [
{org = "ballerina", packageName = "cache", moduleName = "cache"}
]

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -350,7 +347,6 @@ org = "wso2"
name = "customer_portal"
version = "1.0.0-rc.2"
dependencies = [
{org = "ballerina", name = "cache"},
{org = "ballerina", name = "constraint"},
{org = "ballerina", name = "http"},
{org = "ballerina", name = "jwt"},
Expand Down
11 changes: 11 additions & 0 deletions apps/customer-portal/backend/modules/entity/entity.bal
Original file line number Diff line number Diff line change
Expand Up @@ -554,3 +554,14 @@ public isolated function getProjectChangeRequestStats(string idToken, string pro

return csEntityClient->/projects/[projectId]/change\-requests/stats.get(generateHeaders(idToken));
}

# Search instances by criteria.
#
# + idToken - ID token for authorization
# + payload - Instance search payload containing search criteria for instances
# + return - Instances response containing matching instances or error
public isolated function searchInstances(string idToken, InstanceSearchPayload payload)
returns InstancesResponse|error {

return csEntityClient->/instances/search.post(payload, generateHeaders(idToken));
}
128 changes: 80 additions & 48 deletions apps/customer-portal/backend/modules/entity/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -846,40 +846,17 @@ public type ProductUpdate record {|

# Deployed product search payload
public type DeployedProductSearchPayload record {|
# Deployment ID
IdString deploymentId;
# Filters
record {
# Consumption based filters
ConsumptionFilter consumption?;
} filters?;
# Filter criteria
record {|
# List of project IDs to filter
IdString[] projectIds?;
# List of deployment IDs to filter
IdString[] deploymentIds?;
|} filters?;
# Pagination details
Pagination pagination?;
|};

# Instance information.
public type Instance record {|
# ID of the instance
IdString id;
# Instance identifier
string instance;
# Core usage count
int? coreUsageCount;
# Update count
int? updates;
# JDK version
string? jdkVersion;
# Created date and time
string? createdOn;
# Updated date and time
string? updatedOn;
# Custom created date and time
string? customCreatedOn;
# Custom updated date and time
string? customUpdatedOn;
json...;
|};

# Deployed product data.
public type DeployedProduct record {|
# ID
Expand Down Expand Up @@ -908,10 +885,6 @@ public type DeployedProduct record {|
string? releasedOn;
# End of life date of the product
string? endOfLifeOn;
# Instances of the deployed product
int instanceCount?;
# Details of the instances
Instance[]? instances?;
json...;
|};

Expand Down Expand Up @@ -1003,21 +976,84 @@ public type DeploymentSearchPayload record {|
record {|
# Project IDs
IdString[] projectIds?;
# Consumption based filters
ConsumptionFilter consumption?;
|} filters?;
# Pagination details
Pagination pagination?;
|};

# Consumption filter.
public type ConsumptionFilter record {|
# Indicates whether to filter based on consumption (true to filter)
boolean include?;
# Start date of consumption
Date startDate?;
# End date of consumption
Date endDate?;
# Instance search filters.
public type InstanceSearchPayload record {|
# Filter criteria
record {|
# Start date of consumption
Date startDate?;
# End date of consumption
Date endDate?;
# List of project IDs (mutually exclusive with deploymentIds and deployedProductIds)
IdString[] projectIds?;
# List of deployment IDs (mutually exclusive with projectIds and deployedProductIds)
IdString[] deploymentIds?;
# List of deployed product IDs (mutually exclusive with projectIds and deploymentIds)
IdString[] deployedProductIds?;
|} filters?;
# Pagination details
Pagination pagination?;
|};

# Instance metadata.
public type InstanceMetadata record {|
# ID
IdString id;
# Core count
int? coreCount;
# Number of updates
int? updates;
# JDK version
string? jdkVersion;
# Deployment-specific metadata
map<json>? deploymentMetadata;
# Created date and time
string createdOn;
# Updated date and time
string updatedOn;
# Custom created date and time
string? customCreatedOn;
# Custom updated date and time
string? customUpdatedOn;
json...;
|};

# Instance data.
public type Instance record {|
# ID
IdString id;
# Instance name
string instance;
# Associated project information
ReferenceTableItem? project;
# Associated deployment information
ReferenceTableItem? deployment;
# Associated product information
ReferenceTableItem? product;
# Associated deployed product information
ReferenceTableItem? deployedProduct;
# Created date and time
string createdOn;
# Updated date and time
string updatedOn;
# Instance metadata
InstanceMetadata? metadata;
json...;
|};

# Instances response.
public type InstancesResponse record {|
# List of instances
Instance[] instances;
# Total records count
int totalRecords;
*Pagination;
json...;
|};

# Deployment data.
Expand All @@ -1038,10 +1074,6 @@ public type Deployment record {|
ReferenceTableItem? project;
# Type
ChoiceListItem? 'type;
# Count of deployed products associated with the deployment
int deployedProductCount?;
# Count of instances associated with the deployment
int instanceCount?;
json...;
|};

Expand Down
63 changes: 45 additions & 18 deletions apps/customer-portal/backend/modules/types/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,6 @@ public type AttachmentUpdatePayload record {|

# Request payload for searching deployments.
public type DeploymentSearchPayload record {|
# Filter criteria
record {|
# Consumtion based filters
entity:ConsumptionFilter consumption?;
|} filters?;
# Pagination details
entity:Pagination pagination?;
|};
Expand All @@ -596,10 +591,6 @@ public type Deployment record {|
ReferenceItem? project;
# Type
ReferenceItem? 'type;
# Count of deployed products associated with the deployment
int deployedProductCount?;
# Count of instances associated with the deployment
int instanceCount?;
|};

# Deployments response.
Expand All @@ -613,11 +604,6 @@ public type DeploymentsResponse record {|

# Deployed product search payload
public type DeployedProductSearchPayload record {|
# Filters
record {
# Consumtion based filters
entity:ConsumptionFilter consumption?;
} filters?;
# Pagination details
entity:Pagination pagination?;
|};
Expand Down Expand Up @@ -650,10 +636,51 @@ public type DeployedProduct record {|
string? releasedOn;
# End of life date of the product
string? endOfLifeOn;
# Instances of the deployed product
int instanceCount?;
# Details of the instances
entity:Instance[]? instances?;
|};

# Instance search filters.
public type InstanceSearchPayload record {|
# Filter criteria
record {|
# Start date of consumption
entity:Date startDate?;
# End date of consumption
entity:Date endDate?;
|} filters?;
# Pagination details
entity:Pagination pagination?;
|};

# Instance data.
public type Instance record {|
# ID
entity:IdString id;
# Instance name
string instance;
# Associated project information
ReferenceItem? project;
# Associated deployment information
ReferenceItem? deployment;
# Associated product information
ReferenceItem? product;
# Associated deployed product information
ReferenceItem? deployedProduct;
# Created date and time
string createdOn;
# Updated date and time
string updatedOn;
# Instance metadata
entity:InstanceMetadata? metadata;
json...;
|};

# Instances response.
public type InstancesResponse record {|
# List of instances
Instance[] instances;
# Total records count
int totalRecords;
*entity:Pagination;
|};

# Deployed products response.
Expand Down
Loading