Skip to content

Commit

Permalink
ci: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fredmaggiowski committed Nov 20, 2024
1 parent b0cfcb7 commit b15ff8e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
16 changes: 8 additions & 8 deletions internal/cmd/company/rules/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ type IRulesClient interface {
ListTenantRules(ctx context.Context, companyID string) ([]*rulesentities.SaveChangesRules, error)
ListProjectRules(ctx context.Context, projectID string) ([]*rulesentities.ProjectSaveChangesRules, error)
UpdateTenantRules(ctx context.Context, companyID string, rules []*rulesentities.SaveChangesRules) error
UpdateProjectRules(ctx context.Context, projectId string, rules []*rulesentities.SaveChangesRules) error
UpdateProjectRules(ctx context.Context, projectID string, rules []*rulesentities.SaveChangesRules) error
}

type RulesClient struct {
type rulesClient struct {
c *client.APIClient
}

func New(c *client.APIClient) IRulesClient {
return &RulesClient{c: c}
return &rulesClient{c: c}
}

func (e *RulesClient) ListTenantRules(ctx context.Context, companyID string) ([]*rulesentities.SaveChangesRules, error) {
func (e *rulesClient) ListTenantRules(ctx context.Context, companyID string) ([]*rulesentities.SaveChangesRules, error) {
request := e.c.Get().APIPath(tenantsAPIPrefix)
request.SetParam("search", companyID)

Expand Down Expand Up @@ -85,7 +85,7 @@ func (e *RulesClient) ListTenantRules(ctx context.Context, companyID string) ([]
return tenant.ConfigurationManagement.SaveChangesRules, nil
}

func (e *RulesClient) ListProjectRules(ctx context.Context, projectID string) ([]*rulesentities.ProjectSaveChangesRules, error) {
func (e *rulesClient) ListProjectRules(ctx context.Context, projectID string) ([]*rulesentities.ProjectSaveChangesRules, error) {
request := e.c.Get().APIPath(fmt.Sprintf(getProjectAPIFmt, projectID))
request.SetParam("withTenant", "true")

Expand Down Expand Up @@ -113,7 +113,7 @@ type UpdateRequestBody struct {
ConfigurationManagement *resources.ConfigurationManagement `json:"configurationManagement"`
}

func (e *RulesClient) UpdateTenantRules(ctx context.Context, companyID string, rules []*rulesentities.SaveChangesRules) error {
func (e *rulesClient) UpdateTenantRules(ctx context.Context, companyID string, rules []*rulesentities.SaveChangesRules) error {
requestBody := UpdateRequestBody{
ConfigurationManagement: &resources.ConfigurationManagement{
SaveChangesRules: rules,
Expand Down Expand Up @@ -141,7 +141,7 @@ func (e *RulesClient) UpdateTenantRules(ctx context.Context, companyID string, r
return nil
}

func (e *RulesClient) UpdateProjectRules(ctx context.Context, projectID string, rules []*rulesentities.SaveChangesRules) error {
func (e *rulesClient) UpdateProjectRules(ctx context.Context, projectID string, rules []*rulesentities.SaveChangesRules) error {
requestBody := UpdateRequestBody{
ConfigurationManagement: &resources.ConfigurationManagement{
SaveChangesRules: rules,
Expand Down Expand Up @@ -169,7 +169,7 @@ func (e *RulesClient) UpdateProjectRules(ctx context.Context, projectID string,
return nil
}

func (e *RulesClient) assertSuccessResponse(resp *client.Response) error {
func (e *rulesClient) assertSuccessResponse(resp *client.Response) error {
if resp.StatusCode() >= http.StatusBadRequest {
return resp.Error()
}
Expand Down
1 change: 0 additions & 1 deletion internal/cmd/company/rules/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ func printProjectList(rules []*rulesentities.ProjectSaveChangesRules, p printer.

p.Keys(tableColumnLabel...)
for i, rule := range rules {

ruleInfo := createRecord(rule.DisallowedRuleSet)
p.Record(
strconv.Itoa(i),
Expand Down
15 changes: 15 additions & 0 deletions internal/cmd/company/rules/update.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// Copyright Mia srl
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package rules

import (
Expand Down
8 changes: 4 additions & 4 deletions internal/resources/rules/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
package rules

type SaveChangesRules struct {
RoleIDs []string `yaml:"roleIds,omitempty" json:"roleIds,omitempty"`
RoleIDs []string `yaml:"roleIds,omitempty" json:"roleIds,omitempty"` //nolint:tagliatelle
DisallowedRuleSet []RuleSet `yaml:"disallowedRuleSet,omitempty" json:"disallowedRuleSet,omitempty"`
}

type ProjectSaveChangesRules struct {
RoleIDs []string `yaml:"roleIds,omitempty" json:"roleIds,omitempty"`
RoleIDs []string `yaml:"roleIds,omitempty" json:"roleIds,omitempty"` //nolint:tagliatelle
DisallowedRuleSet []RuleSet `yaml:"disallowedRuleSet,omitempty" json:"disallowedRuleSet,omitempty"`
IsInheritedFromTenant bool `yaml:"isInheritedFromTenant,omitempty" json:"isInheritedFromTenant,omitempty"`
}

type RuleSet struct {
JSONPath string `yaml:"jsonPath,omitempty" json:"jsonPath,omitempty"`
Options *RuleOptions `yaml:"processingOptions,omitempty" json:"processingOptions,omitempty"`
RuleID string `yaml:"ruleId,omitempty" json:"ruleId,omitempty"`
Options *RuleOptions `yaml:"processingOptions,omitempty" json:"processingOptions,omitempty"` //nolint:tagliatelle
RuleID string `yaml:"ruleId,omitempty" json:"ruleId,omitempty"` //nolint:tagliatelle
}

type RuleOptions struct {
Expand Down

0 comments on commit b15ff8e

Please sign in to comment.