Skip to content
Open
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
6 changes: 3 additions & 3 deletions client/chatbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ type ChatbotService struct {
func (c *ChatbotService) SendChatMessage(ctx context.Context, scope dto.Scope, request *dto.ChatRequest) (string, error) {
path := chatPath
params := make(map[string]string)

// Only add non-empty scope parameters
if scope.AccountID != "" {
params["accountIdentifier"] = scope.AccountID
}

if scope.OrgID != "" {
params["orgIdentifier"] = scope.OrgID
}

if scope.ProjectID != "" {
params["projectIdentifier"] = scope.ProjectID
}
Expand Down
6 changes: 3 additions & 3 deletions client/cloudcostmanagement.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
)

const (
ccmBasePath = "ccm/api"
ccmGetOverviewPath = ccmBasePath + "/overview?accountIdentifier=%s&startTime=%d&endTime=%d&groupBy=%s"
ccmCostCategoryListPath = ccmBasePath + "/business-mapping/filter-panel?accountIdentifier=%s"
ccmBasePath = "ccm/api"
ccmGetOverviewPath = ccmBasePath + "/overview?accountIdentifier=%s&startTime=%d&endTime=%d&groupBy=%s"
ccmCostCategoryListPath = ccmBasePath + "/business-mapping/filter-panel?accountIdentifier=%s"
ccmCostCategoryDetailListPath = ccmBasePath + "/business-mapping?accountIdentifier=%s" // This endpoint lists cost categories
)

Expand Down
4 changes: 2 additions & 2 deletions client/connectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/harness/harness-mcp/client/dto" // Corrected import path for Scope
"github.com/harness/harness-mcp/client/dto" // Corrected import path for Scope
pkgDTO "github.com/harness/harness-mcp/pkg/harness/dto" // Alias for the other DTOs
)

Expand Down Expand Up @@ -34,7 +34,7 @@ func (c *ConnectorService) ListConnectorCatalogue(ctx context.Context, scope dto
Connectors []string `json:"connectors"`
} `json:"catalogue"`
} `json:"data"`
MetaData interface{} `json:"metaData"`
MetaData interface{} `json:"metaData"`
CorrelationID string `json:"correlationId"`
}

Expand Down
4 changes: 2 additions & 2 deletions client/dto/chatbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ type ChatHistoryItem struct {
}

type ChatRequest struct {
Question string `json:"question"`
ChatHistory []ChatHistoryItem `json:"chat_history,omitempty"`
Question string `json:"question"`
ChatHistory []ChatHistoryItem `json:"chat_history,omitempty"`
}
84 changes: 42 additions & 42 deletions client/dto/cloudcostmanagement.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@ const (
)

const (
SortTypeName string = "NAME"
SortTypeLastEdit string = "LAST_EDIT"
SortTypeName string = "NAME"
SortTypeLastEdit string = "LAST_EDIT"
)

const (
SortOrderAsc string = "ASCENDING"
SortOrderDesc string = "DESCENDING"
SortOrderAsc string = "ASCENDING"
SortOrderDesc string = "DESCENDING"
)

// CEView represents a basic ccm response.
// The `data` field contains the response data.
type CCMBaseResponse struct {
Status string `json:"state,omitempty"`
Message string `json:"message,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
Error []CCMError `json:"error,omitempty"`
Status string `json:"state,omitempty"`
Message string `json:"message,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
Error []CCMError `json:"error,omitempty"`
}

// Response error
type CCMError struct {
FieldId string `json:"fieldId,omitempty"`
Error string `json:"error,omitempty"`
FieldId string `json:"fieldId,omitempty"`
Error string `json:"error,omitempty"`
}

type CEView struct {
CCMBaseResponse
Data CCMOverview `json:"data,omitempty"`
Data CCMOverview `json:"data,omitempty"`
}

// CCMOverview represents the Overview data from a CCM Overview
Expand Down Expand Up @@ -73,8 +73,8 @@ type CCMReference struct {
// CcmCostCategoriesOptions represents options for listing cost categories
type CCMListCostCategoriesOptions struct {
AccountIdentifier string `json:"accountIdentifier,omitempty"`
CostCategory string `json:"costCategory,omitempty"`
SearchTerm string `json:"search,omitempty"`
CostCategory string `json:"costCategory,omitempty"`
SearchTerm string `json:"search,omitempty"`
}

// CcmCostCategoryList represents a list of cost categories in CCM
Expand All @@ -88,22 +88,22 @@ type CCMCostCategoryList struct {
// ***************************

type CCMPaginationOptions struct {
Limit int32 `json:"limit,omitempty"`
Offset int32 `json:"offset,omitempty"`
Limit int32 `json:"limit,omitempty"`
Offset int32 `json:"offset,omitempty"`
}

type CCMListCostCategoriesDetailOptions struct {
AccountIdentifier string `json:"accountIdentifier,omitempty"`
SearchKey string `json:"searchKey,omitempty"`
SortType string `json:"sortType,omitempty"` // Enum: "NAME", "LAST_EDIT"
SortType string `json:"sortType,omitempty"` // Enum: "NAME", "LAST_EDIT"
SortOrder string `json:"sortOrder,omitempty"` // Enum: "ASCENDING", "DESCENDING"
CCMPaginationOptions
}

type CCMCostCategoryDetailList struct {
MetaData map[string]interface{} `json:"metaData"`
Resource CCMCostCategoryResource `json:"resource"`
ResponseMessages []CCMResponseMessage `json:"responseMessages"`
MetaData map[string]interface{} `json:"metaData"`
Resource CCMCostCategoryResource `json:"resource"`
ResponseMessages []CCMResponseMessage `json:"responseMessages"`
}

type CCMCostCategoryResource struct {
Expand All @@ -112,29 +112,29 @@ type CCMCostCategoryResource struct {
}

type CCMBusinessMapping struct {
UUID string `json:"uuid"`
Name string `json:"name"`
AccountID string `json:"accountId"`
CostTargets []CCMCostTarget `json:"costTargets"`
SharedCosts []CCMSharedCost `json:"sharedCosts"`
UUID string `json:"uuid"`
Name string `json:"name"`
AccountID string `json:"accountId"`
CostTargets []CCMCostTarget `json:"costTargets"`
SharedCosts []CCMSharedCost `json:"sharedCosts"`
UnallocatedCost CCMUnallocatedCost `json:"unallocatedCost"`
DataSources []string `json:"dataSources"`
CreatedAt int64 `json:"createdAt"`
LastUpdatedAt int64 `json:"lastUpdatedAt"`
CreatedBy CCMUser `json:"createdBy"`
LastUpdatedBy CCMUser `json:"lastUpdatedBy"`
DataSources []string `json:"dataSources"`
CreatedAt int64 `json:"createdAt"`
LastUpdatedAt int64 `json:"lastUpdatedAt"`
CreatedBy CCMUser `json:"createdBy"`
LastUpdatedBy CCMUser `json:"lastUpdatedBy"`
}

type CCMCostTarget struct {
Name string `json:"name"`
Rules []CCMRule `json:"rules"`
Name string `json:"name"`
Rules []CCMRule `json:"rules"`
}

type CCMSharedCost struct {
Name string `json:"name"`
Rules []CCMRule `json:"rules"`
Strategy string `json:"strategy"`
Splits []CCMSplit `json:"splits"`
Name string `json:"name"`
Rules []CCMRule `json:"rules"`
Strategy string `json:"strategy"`
Splits []CCMSplit `json:"splits"`
}

type CCMUnallocatedCost struct {
Expand All @@ -145,7 +145,7 @@ type CCMUnallocatedCost struct {
}

type CCMSplit struct {
CostTargetName *string `json:"costTargetName"`
CostTargetName *string `json:"costTargetName"`
PercentageContribution *float64 `json:"percentageContribution"`
}

Expand All @@ -161,12 +161,12 @@ type CCMUser struct {
}

type CCMResponseMessage struct {
Code string `json:"code"`
Level string `json:"level"`
Message string `json:"message"`
Exception *CCMException `json:"exception"`
FailureTypes []string `json:"failureTypes"`
AdditionalInfo map[string]string `json:"additionalInfo"`
Code string `json:"code"`
Level string `json:"level"`
Message string `json:"message"`
Exception *CCMException `json:"exception"`
FailureTypes []string `json:"failureTypes"`
AdditionalInfo map[string]string `json:"additionalInfo"`
}

type CCMException struct {
Expand Down
54 changes: 27 additions & 27 deletions client/dto/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,56 +20,56 @@ type Infrastructure struct {

// InfrastructureItem represents an item in the response list
type InfrastructureItem struct {
Infrastructure Infrastructure `json:"infrastructure"`
CreatedAt int64 `json:"createdAt,omitempty"`
LastModifiedAt int64 `json:"lastModifiedAt,omitempty"`
EntityValidityDetails interface{} `json:"entityValidityDetails"`
GovernanceMetadata interface{} `json:"governanceMetadata"`
Infrastructure Infrastructure `json:"infrastructure"`
CreatedAt int64 `json:"createdAt,omitempty"`
LastModifiedAt int64 `json:"lastModifiedAt,omitempty"`
EntityValidityDetails interface{} `json:"entityValidityDetails"`
GovernanceMetadata interface{} `json:"governanceMetadata"`
}

// InfrastructureListResponse represents the response from the list infrastructures API
type InfrastructureListResponse struct {
Status string `json:"status,omitempty"`
MetaData interface{} `json:"metaData"`
CorrelationID string `json:"correlationId,omitempty"`
Data struct {
Data struct {
Content []InfrastructureItem `json:"content"`
TotalPages int `json:"totalPages"`
TotalItems int `json:"totalItems"`
PageItemCount int `json:"pageItemCount"`
PageSize int `json:"pageSize"`
PageIndex int `json:"pageIndex"`
Empty bool `json:"empty"`
PageToken interface{} `json:"pageToken"`
PageToken interface{} `json:"pageToken"`
} `json:"data"`
}

// InfrastructureOptions represents the options for listing infrastructures
type InfrastructureOptions struct {
Page int `json:"page,omitempty"`
Limit int `json:"limit,omitempty"`
Sort string `json:"sort,omitempty"`
Order string `json:"order,omitempty"`
DeploymentType string `json:"deploymentType,omitempty"` // Filter by deployment type
EnvironmentIdentifier string `json:"environmentIdentifier,omitempty"` // Filter by environment
Page int `json:"page,omitempty"`
Limit int `json:"limit,omitempty"`
Sort string `json:"sort,omitempty"`
Order string `json:"order,omitempty"`
DeploymentType string `json:"deploymentType,omitempty"` // Filter by deployment type
EnvironmentIdentifier string `json:"environmentIdentifier,omitempty"` // Filter by environment
}

// MoveInfraConfigsRequest represents the request to move infrastructure configurations
type MoveInfraConfigsRequest struct {
InfraIdentifier string `json:"-"` // Required - from path parameter
EnvironmentIdentifier string `json:"-"` // Required
AccountIdentifier string `json:"-"` // Required
OrgIdentifier string `json:"-"`
ProjectIdentifier string `json:"-"`
ConnectorRef string `json:"-"`
RepoName string `json:"-"`
Branch string `json:"-"`
FilePath string `json:"-"`
CommitMsg string `json:"-"`
IsNewBranch *bool `json:"-"`
BaseBranch string `json:"-"`
IsHarnessCodeRepo *bool `json:"-"`
MoveConfigType MoveConfigType `json:"-"` // Required - enum: "INLINE_TO_REMOTE" "REMOTE_TO_INLINE"
InfraIdentifier string `json:"-"` // Required - from path parameter
EnvironmentIdentifier string `json:"-"` // Required
AccountIdentifier string `json:"-"` // Required
OrgIdentifier string `json:"-"`
ProjectIdentifier string `json:"-"`
ConnectorRef string `json:"-"`
RepoName string `json:"-"`
Branch string `json:"-"`
FilePath string `json:"-"`
CommitMsg string `json:"-"`
IsNewBranch *bool `json:"-"`
BaseBranch string `json:"-"`
IsHarnessCodeRepo *bool `json:"-"`
MoveConfigType MoveConfigType `json:"-"` // Required - enum: "INLINE_TO_REMOTE" "REMOTE_TO_INLINE"
}

// MoveInfraConfigsResponse represents the response from the move infrastructure configs API
Expand Down
62 changes: 31 additions & 31 deletions client/dto/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@ package dto

// Repository represents a repository in the system
type Repository struct {
Archived bool `json:"archived,omitempty"`
Created int64 `json:"created,omitempty"`
CreatedBy int `json:"created_by,omitempty"`
DefaultBranch string `json:"default_branch,omitempty"`
Deleted int64 `json:"deleted,omitempty"`
Description string `json:"description,omitempty"`
ForkID int `json:"fork_id,omitempty"`
GitSSHURL string `json:"git_ssh_url,omitempty"`
GitURL string `json:"git_url,omitempty"`
ID int `json:"id,omitempty"`
Identifier string `json:"identifier,omitempty"`
Importing bool `json:"importing,omitempty"`
IsEmpty bool `json:"is_empty,omitempty"`
IsPublic bool `json:"is_public,omitempty"`
LastGitPush int64 `json:"last_git_push,omitempty"`
NumClosedPulls int `json:"num_closed_pulls,omitempty"`
NumForks int `json:"num_forks,omitempty"`
NumMergedPulls int `json:"num_merged_pulls,omitempty"`
NumOpenPulls int `json:"num_open_pulls,omitempty"`
NumPulls int `json:"num_pulls,omitempty"`
ParentID int `json:"parent_id,omitempty"`
Path string `json:"path,omitempty"`
Size int64 `json:"size,omitempty"`
SizeUpdated int64 `json:"size_updated,omitempty"`
State int `json:"state,omitempty"`
Updated int64 `json:"updated,omitempty"`
Archived bool `json:"archived,omitempty"`
Created int64 `json:"created,omitempty"`
CreatedBy int `json:"created_by,omitempty"`
DefaultBranch string `json:"default_branch,omitempty"`
Deleted int64 `json:"deleted,omitempty"`
Description string `json:"description,omitempty"`
ForkID int `json:"fork_id,omitempty"`
GitSSHURL string `json:"git_ssh_url,omitempty"`
GitURL string `json:"git_url,omitempty"`
ID int `json:"id,omitempty"`
Identifier string `json:"identifier,omitempty"`
Importing bool `json:"importing,omitempty"`
IsEmpty bool `json:"is_empty,omitempty"`
IsPublic bool `json:"is_public,omitempty"`
LastGitPush int64 `json:"last_git_push,omitempty"`
NumClosedPulls int `json:"num_closed_pulls,omitempty"`
NumForks int `json:"num_forks,omitempty"`
NumMergedPulls int `json:"num_merged_pulls,omitempty"`
NumOpenPulls int `json:"num_open_pulls,omitempty"`
NumPulls int `json:"num_pulls,omitempty"`
ParentID int `json:"parent_id,omitempty"`
Path string `json:"path,omitempty"`
Size int64 `json:"size,omitempty"`
SizeUpdated int64 `json:"size_updated,omitempty"`
State int `json:"state,omitempty"`
Updated int64 `json:"updated,omitempty"`
}

// RepositoryOptions represents the options for listing repositories
type RepositoryOptions struct {
Query string `json:"query,omitempty"`
Sort string `json:"sort,omitempty"`
Order string `json:"order,omitempty"`
Page int `json:"page,omitempty"`
Limit int `json:"limit,omitempty"`
Query string `json:"query,omitempty"`
Sort string `json:"sort,omitempty"`
Order string `json:"order,omitempty"`
Page int `json:"page,omitempty"`
Limit int `json:"limit,omitempty"`
}
Loading