Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

템플릿 업데이트 시 동일한 네임 중복체크 에러 수정 등 #449

Merged
merged 1 commit into from
Apr 30, 2024
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
3 changes: 2 additions & 1 deletion internal/usecase/policy-template.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ func (u *PolicyTemplateUsecase) Update(ctx context.Context, organizationId *stri

updateMap := make(map[string]interface{})

if templateName != nil {
// 기존 이름과 같은 경우면 체크 필요없으므로 다른 경우에만 처리하도록 추가
if templateName != nil && *templateName != policyTemplate.TemplateName {
if policyTemplate.IsTksTemplate() {
exists, err := u.repo.ExistByName(ctx, *templateName)
if err == nil && exists {
Expand Down
2 changes: 1 addition & 1 deletion pkg/domain/admin/policy-template.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type CreateOrganizationPolicyTemplateReponse struct {
type UpdatePolicyTemplateRequest struct {
TemplateName *string `json:"templateName,omitempty" validate:"required,name" example:"필수 Label 검사"`
Description *string `json:"description,omitempty"`
Severity *string `json:"severity,omitempty" validate:"oneof=low medium high" enums:"low,medium,high" example:"medium"`
Severity *string `json:"severity,omitempty" validate:"omitempty,oneof=low medium high" enums:"low,medium,high" example:"medium"`
Deprecated *bool `json:"deprecated,omitempty" example:"false"`
PermittedOrganizationIds *[]string `json:"permittedOrganizationIds,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/domain/policy-template.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type CreatePolicyTemplateReponse struct {
type UpdatePolicyTemplateRequest struct {
TemplateName *string `json:"templateName,omitempty" validate:"required,name" example:"필수 Label 검사"`
Description *string `json:"description,omitempty"`
Severity *string `json:"severity,omitempty" validate:"oneof=low medium high" enums:"low,medium,high" example:"medium"`
Severity *string `json:"severity,omitempty" validate:"omitempty,oneof=low medium high" enums:"low,medium,high" example:"medium"`
Deprecated *bool `json:"deprecated,omitempty" example:"false"`
PermittedOrganizationIds *[]string `json:"permittedOrganizationIds,omitempty"`
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/domain/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ type UpdatePolicyRequest struct {
TargetClusterIds *[]string `json:"targetClusterIds,omitempty" example:"83bf8081-f0c5-4b31-826d-23f6f366ec90,83bf8081-f0c5-4b31-826d-23f6f366ec90"`
Mandatory *bool `json:"mandatory,omitempty"`

PolicyName *string `json:"policyName,omitempty" validate:"required,name" example:"label 정책"`
Description *string `json:"description"`
PolicyName *string `json:"policyName,omitempty" validate:"name" example:"label 정책"`
Description *string `json:"description,omitempty"`
TemplateId *string `json:"templateId,omitempty" example:"d98ef5f1-4a68-4047-a446-2207787ce3ff"`
EnforcementAction *string `json:"enforcementAction" validate:"required,oneof=deny dryrun warn" enum:"warn,deny,dryrun" example:"deny"`
Parameters *string `json:"parameters" example:"{\"labels\":{\"key\":\"owner\",\"allowedRegex\":\"test*\"}"`
EnforcementAction *string `json:"enforcementAction" validate:"omitempty,oneof=deny dryrun warn" enum:"warn,deny,dryrun" example:"deny"`
Parameters *string `json:"parameters,omitempty" example:"{\"labels\":{\"key\":\"owner\",\"allowedRegex\":\"test*\"}"`
Match *Match `json:"match,omitempty"`
MatchYaml *string `json:"matchYaml,omitempty"`
//Tags []string `json:"tags,omitempty" example:"k8s,label"`
Expand Down
Loading