Skip to content

Commit

Permalink
Merge pull request #322 from openinfradev/snr_fixes
Browse files Browse the repository at this point in the history
trivial. add TargetUsers to GetSystemNotificationRule API
  • Loading branch information
ktkfree authored Apr 2, 2024
2 parents 67c43c0 + 164fc55 commit 53c727f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 16 deletions.
6 changes: 6 additions & 0 deletions api/swagger/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10430,6 +10430,12 @@ const docTemplate = `{
"name": {
"type": "string"
},
"policyIds": {
"type": "array",
"items": {
"type": "string"
}
},
"stackTemplateId": {
"type": "string"
},
Expand Down
6 changes: 6 additions & 0 deletions api/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -10424,6 +10424,12 @@
"name": {
"type": "string"
},
"policyIds": {
"type": "array",
"items": {
"type": "string"
}
},
"stackTemplateId": {
"type": "string"
},
Expand Down
4 changes: 4 additions & 0 deletions api/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,10 @@ definitions:
type: string
name:
type: string
policyIds:
items:
type: string
type: array
stackTemplateId:
type: string
tksCpNode:
Expand Down
7 changes: 7 additions & 0 deletions internal/delivery/http/system-notification-rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ func (h *SystemNotificationRuleHandler) GetSystemNotificationRule(w http.Respons
log.Info(r.Context(), err)
}

out.SystemNotificationRule.TargetUsers = make([]domain.SimpleUserResponse, len(systemNotificationRule.TargetUsers))
for i, targetUser := range systemNotificationRule.TargetUsers {
if err := serializer.Map(r.Context(), targetUser, &out.SystemNotificationRule.TargetUsers[i]); err != nil {
log.Info(r.Context(), err)
}
}

out.SystemNotificationRule.SystemNotificationConditions = make([]domain.SystemNotificationConditionResponse, len(systemNotificationRule.SystemNotificationConditions))
for i, condition := range systemNotificationRule.SystemNotificationConditions {
if err := serializer.Map(r.Context(), condition, &out.SystemNotificationRule.SystemNotificationConditions[i]); err != nil {
Expand Down
33 changes: 17 additions & 16 deletions pkg/domain/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,23 @@ type StackStepStatus struct {
}

type CreateStackRequest struct {
Name string `json:"name" validate:"required,name,rfc1123"`
Description string `json:"description"`
ClusterId string `json:"clusterId"`
CloudService string `json:"cloudService" validate:"required,oneof=AWS BYOH"`
StackTemplateId string `json:"stackTemplateId" validate:"required"`
CloudAccountId string `json:"cloudAccountId"`
ClusterEndpoint string `json:"userClusterEndpoint,omitempty"`
TksCpNode int `json:"tksCpNode"`
TksCpNodeMax int `json:"tksCpNodeMax,omitempty"`
TksCpNodeType string `json:"tksCpNodeType,omitempty"`
TksInfraNode int `json:"tksInfraNode"`
TksInfraNodeMax int `json:"tksInfraNodeMax,omitempty"`
TksInfraNodeType string `json:"tksInfraNodeType,omitempty"`
TksUserNode int `json:"tksUserNode"`
TksUserNodeMax int `json:"tksUserNodeMax,omitempty"`
TksUserNodeType string `json:"tksUserNodeType,omitempty"`
Name string `json:"name" validate:"required,name,rfc1123"`
Description string `json:"description"`
ClusterId string `json:"clusterId"`
CloudService string `json:"cloudService" validate:"required,oneof=AWS BYOH"`
StackTemplateId string `json:"stackTemplateId" validate:"required"`
CloudAccountId string `json:"cloudAccountId"`
ClusterEndpoint string `json:"userClusterEndpoint,omitempty"`
PolicyIds []string `json:"policyIds,omitempty"`
TksCpNode int `json:"tksCpNode"`
TksCpNodeMax int `json:"tksCpNodeMax,omitempty"`
TksCpNodeType string `json:"tksCpNodeType,omitempty"`
TksInfraNode int `json:"tksInfraNode"`
TksInfraNodeMax int `json:"tksInfraNodeMax,omitempty"`
TksInfraNodeType string `json:"tksInfraNodeType,omitempty"`
TksUserNode int `json:"tksUserNode"`
TksUserNodeMax int `json:"tksUserNodeMax,omitempty"`
TksUserNodeType string `json:"tksUserNodeType,omitempty"`
}

type CreateStackResponse struct {
Expand Down

0 comments on commit 53c727f

Please sign in to comment.