Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
}
119 changes: 73 additions & 46 deletions apps/customer-portal/backend/modules/entity/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -848,38 +848,10 @@ public type ProductUpdate record {|
public type DeployedProductSearchPayload record {|
# Deployment ID
IdString deploymentId;
# Filters
record {
# Consumption based filters
ConsumptionFilter consumption?;
} 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 +880,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 +971,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?;
|};
Comment thread
coderabbitai[bot] marked this conversation as resolved.

# 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...;
|};
Comment thread
Rashmika998 marked this conversation as resolved.

# Deployment data.
Expand All @@ -1038,10 +1069,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