Skip to content

Commit

Permalink
chore(rn): add resource name to additional entities (#291)
Browse files Browse the repository at this point in the history
* chore(refactor): update servicename to serviceccrn throughout repo

* chore(refactor): update component to use ccrn throughout repo

* chore(refactor): update supportgroup to use ccrn throughout repo

* chore(refactor): added ccrn field to component version

* chore(refactor): revert changes to component version with ccrn

This reverts commit 0b4b386.

* Update tests.yaml (#323)

* Update codeql.yaml (#325)

* chore: add sleeps to suppress potential racing conditions which make tests fail. (#327)

* chore: increase license location threshold (#329)

* fix: Resolve the double port expose for Prometheus metrics (#333)

* chore(doc):uploaded images for Prod. design doc. (#311)

Co-authored-by: David Rochow <[email protected]>

* chore: create setup job in codeql.yaml (#335)

* chore: remove generated code (#324)

* chore: remove generated code

* Automatic application of license header

* chore: remove bot license header

* Automatic application of license header

---------

Co-authored-by: License Bot <[email protected]>

* chore: update build_query in codeql.yaml (#336)

* chore(deps): bump github.com/brianvoe/gofakeit/v7 from 7.0.4 to 7.1.1 (#330)

Bumps [github.com/brianvoe/gofakeit/v7](https://github.com/brianvoe/gofakeit) from 7.0.4 to 7.1.1.
- [Release notes](https://github.com/brianvoe/gofakeit/releases)
- [Commits](brianvoe/gofakeit@v7.0.4...v7.1.1)

---
updated-dependencies:
- dependency-name: github.com/brianvoe/gofakeit/v7
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Reimsbach <[email protected]>

* fix(test): added additonal readiness checks for DB (#334)

Co-authored-by: Michael Reimsbach <[email protected]>

* merge

* chore(refactor): update supportgroup to use ccrn throughout repo

* chore(refactor): added ccrn field to component version

* chore(refactor): revert changes to component version with ccrn

This reverts commit 0b4b386.

* fix wrong function name

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Michael Reimsbach <[email protected]>
Co-authored-by: copyonwrite <[email protected]>
Co-authored-by: Dimitrios Tassopoulos <[email protected]>
Co-authored-by: Lola <[email protected]>
Co-authored-by: David Rochow <[email protected]>
Co-authored-by: License Bot <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
8 people authored Oct 29, 2024
1 parent 45390c4 commit da6debe
Show file tree
Hide file tree
Showing 137 changed files with 846 additions and 816 deletions.
14 changes: 7 additions & 7 deletions internal/api/graphql/gqlgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,29 +203,29 @@ models:
resolver: true
affectedService:
resolver: true
componentName:
componentCcrn:
resolver: true
supportGroupName:
supportGroupCcrn:
resolver: true
ServiceFilterValue:
fields:
serviceName:
serviceCcrn:
resolver: true
uniqueUserId:
resolver: true
userName:
resolver: true
supportGroupName:
supportGroupCcrn:
resolver: true
ComponentInstanceFilterValue:
fields:
serviceName:
serviceCcrn:
resolver: true
supportGroupName:
supportGroupCcrn:
resolver: true
ccrn:
resolver: true
ComponentFilterValue:
fields:
componentName:
componentCcrn:
resolver: true
2 changes: 1 addition & 1 deletion internal/api/graphql/graph/baseResolver/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func ActivityBaseResolver(app app.Heureka, ctx context.Context, filter *model.Ac

f := &entity.ActivityFilter{
Paginated: entity.Paginated{First: first, After: afterId},
ServiceName: filter.ServiceName,
ServiceCCRN: filter.ServiceCcrn,
ServiceId: sId,
IssueId: issueId,
}
Expand Down
16 changes: 8 additions & 8 deletions internal/api/graphql/graph/baseResolver/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,33 @@ import (
)

var (
FilterDisplayServiceName string = "Service Name"
FilterDisplaySupportGroupName string = "Support Group Name"
FilterDisplayServiceCcrn string = "Service CCRN"
FilterDisplaySupportGroupCcrn string = "Support Group CCRN"
FilterDisplayUserName string = "User Name"
FilterDisplayUniqueUserId string = "Unique User ID"
FilterDisplayComponentName string = "Component Name"
FilterDisplayComponentCcrn string = "Component CCRN"
FilterDisplayIssueType string = "Issue Type"
FilterDisplayIssueMatchStatus string = "Issue Match Status"
FilterDisplayIssueMatchID string = "Issue Match ID"
FilterDisplayIssuePrimaryName string = "Issue Name"
FilterDisplayIssueSeverity string = "Severity"
FilterDisplayCcrn string = "CCRN"

ServiceFilterServiceName string = "serviceName"
ServiceFilterServiceCcrn string = "serviceCcrn"
ServiceFilterUniqueUserId string = "uniqueUserId"
ServiceFilterType string = "type"
ServiceFilterUserName string = "userName"
ServiceFilterSupportGroupName string = "supportGroupName"
ServiceFilterSupportGroupCcrn string = "supportGroupCcrn"

IssueMatchFilterPrimaryName string = "primaryName"
IssueMatchFilterComponentName string = "componentName"
IssueMatchFilterComponentCcrn string = "componentCcrn"
IssueMatchFilterIssueType string = "issueType"
IssueMatchFilterStatus string = "status"
IssueMatchFilterSeverity string = "severity"
IssueMatchFilterAffectedService string = "affectedService"
IssueMatchFilterSupportGroupName string = "supportGroupName"
IssueMatchFilterSupportGroupCcrn string = "supportGroupCcrn"

ComponentFilterComponentName string = "componentName"
ComponentFilterComponentCcrn string = "componentCcrn"
)

type ResolverError struct {
Expand Down
14 changes: 7 additions & 7 deletions internal/api/graphql/graph/baseResolver/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func ComponentBaseResolver(app app.Heureka, ctx context.Context, filter *model.C

f := &entity.ComponentFilter{
Paginated: entity.Paginated{First: first, After: afterId},
Name: filter.ComponentName,
CCRN: filter.ComponentCcrn,
}

opt := GetListOptions(requestedFields)
Expand Down Expand Up @@ -107,27 +107,27 @@ func ComponentBaseResolver(app app.Heureka, ctx context.Context, filter *model.C

}

func ComponentNameBaseResolver(app app.Heureka, ctx context.Context, filter *model.ComponentFilter) (*model.FilterItem, error) {
func ComponentCcrnBaseResolver(app app.Heureka, ctx context.Context, filter *model.ComponentFilter) (*model.FilterItem, error) {
requestedFields := GetPreloads(ctx)
logrus.WithFields(logrus.Fields{
"requestedFields": requestedFields,
}).Debug("Called ComponentNameBaseResolver")
}).Debug("Called ComponentCcrnBaseResolver")

if filter == nil {
filter = &model.ComponentFilter{}
}

f := &entity.ComponentFilter{
Paginated: entity.Paginated{},
Name: filter.ComponentName,
CCRN: filter.ComponentCcrn,
}

opt := GetListOptions(requestedFields)

names, err := app.ListComponentNames(f, opt)
names, err := app.ListComponentCcrns(f, opt)

if err != nil {
return nil, NewResolverError("ComponentNameBaseReolver", err.Error())
return nil, NewResolverError("ComponentCcrnBaseReolver", err.Error())
}

var pointerNames []*string
Expand All @@ -137,7 +137,7 @@ func ComponentNameBaseResolver(app app.Heureka, ctx context.Context, filter *mod
}

filterItem := model.FilterItem{
DisplayName: &FilterDisplayComponentName,
DisplayName: &FilterDisplayComponentCcrn,
Values: pointerNames,
}

Expand Down
3 changes: 2 additions & 1 deletion internal/api/graphql/graph/baseResolver/component_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package baseResolver

import (
"context"

"github.com/cloudoperators/heureka/internal/api/graphql/graph/model"
"github.com/cloudoperators/heureka/internal/app"
"github.com/cloudoperators/heureka/internal/entity"
Expand Down Expand Up @@ -97,7 +98,7 @@ func ComponentVersionBaseResolver(app app.Heureka, ctx context.Context, filter *
Paginated: entity.Paginated{First: first, After: afterId},
IssueId: issueId,
ComponentId: componentId,
ComponentName: filter.ComponentName,
ComponentCCRN: filter.ComponentCcrn,
Version: filter.Version,
}

Expand Down
4 changes: 2 additions & 2 deletions internal/api/graphql/graph/baseResolver/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func IssueBaseResolver(app app.Heureka, ctx context.Context, filter *model.Issue

f := &entity.IssueFilter{
Paginated: entity.Paginated{First: first, After: afterId},
ServiceName: filter.AffectedService,
ServiceCCRN: filter.AffectedService,
ActivityId: activityId,
ComponentVersionId: cvId,
PrimaryName: filter.PrimaryName,
Expand Down Expand Up @@ -170,7 +170,7 @@ func IssueNameBaseResolver(app app.Heureka, ctx context.Context, filter *model.I

f := &entity.IssueFilter{
Paginated: entity.Paginated{},
ServiceName: filter.AffectedService,
ServiceCCRN: filter.AffectedService,
PrimaryName: filter.PrimaryName,
Type: lo.Map(filter.IssueType, func(item *model.IssueTypes, _ int) *string { return pointer.String(item.String()) }),
Search: filter.Search,
Expand Down
6 changes: 3 additions & 3 deletions internal/api/graphql/graph/baseResolver/issue_match.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ func IssueMatchBaseResolver(app app.Heureka, ctx context.Context, filter *model.
f := &entity.IssueMatchFilter{
Id: issue_match_ids,
Paginated: entity.Paginated{First: first, After: afterId},
AffectedServiceName: filter.AffectedService,
AffectedServiceCCRN: filter.AffectedService,
Status: lo.Map(filter.Status, func(item *model.IssueMatchStatusValues, _ int) *string { return pointer.String(item.String()) }),
SeverityValue: lo.Map(filter.Severity, func(item *model.SeverityValues, _ int) *string { return pointer.String(item.String()) }),
SupportGroupName: filter.SupportGroupName,
SupportGroupCCRN: filter.SupportGroupCcrn,
IssueId: issueId,
EvidenceId: eId,
ComponentInstanceId: ciId,
Search: filter.Search,
ComponentName: filter.ComponentName,
ComponentCCRN: filter.ComponentCcrn,
PrimaryName: filter.PrimaryName,
IssueType: lo.Map(filter.IssueType, func(item *model.IssueTypes, _ int) *string { return pointer.String(item.String()) }),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func IssueRepositoryBaseResolver(app app.Heureka, ctx context.Context, filter *m
Paginated: entity.Paginated{First: first, After: afterId},
ServiceId: serviceId,
Name: filter.Name,
ServiceName: filter.ServiceName,
ServiceCCRN: filter.ServiceCcrn,
}

opt := GetListOptions(requestedFields)
Expand Down
18 changes: 9 additions & 9 deletions internal/api/graphql/graph/baseResolver/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func ServiceBaseResolver(app app.Heureka, ctx context.Context, filter *model.Ser

f := &entity.ServiceFilter{
Paginated: entity.Paginated{First: first, After: afterId},
SupportGroupName: filter.SupportGroupName,
Name: filter.ServiceName,
SupportGroupCCRN: filter.SupportGroupCcrn,
CCRN: filter.ServiceCcrn,
OwnerName: filter.UserName,
OwnerId: ownerId,
ActivityId: activityId,
Expand Down Expand Up @@ -144,29 +144,29 @@ func ServiceBaseResolver(app app.Heureka, ctx context.Context, filter *model.Ser
return &connection, nil

}
func ServiceNameBaseResolver(app app.Heureka, ctx context.Context, filter *model.ServiceFilter) (*model.FilterItem, error) {
func ServiceCcrnBaseResolver(app app.Heureka, ctx context.Context, filter *model.ServiceFilter) (*model.FilterItem, error) {
requestedFields := GetPreloads(ctx)
logrus.WithFields(logrus.Fields{
"requestedFields": requestedFields,
}).Debug("Called ServiceNameBaseResolver")
}).Debug("Called ServiceCcrnBaseResolver")

if filter == nil {
filter = &model.ServiceFilter{}
}

f := &entity.ServiceFilter{
Paginated: entity.Paginated{},
SupportGroupName: filter.SupportGroupName,
Name: filter.ServiceName,
SupportGroupCCRN: filter.SupportGroupCcrn,
CCRN: filter.ServiceCcrn,
OwnerName: filter.UserName,
}

opt := GetListOptions(requestedFields)

names, err := app.ListServiceNames(f, opt)
names, err := app.ListServiceCcrns(f, opt)

if err != nil {
return nil, NewResolverError("ServiceNameBaseResolver", err.Error())
return nil, NewResolverError("ServiceCcrnBaseResolver", err.Error())
}

var pointerNames []*string
Expand All @@ -176,7 +176,7 @@ func ServiceNameBaseResolver(app app.Heureka, ctx context.Context, filter *model
}

filterItem := model.FilterItem{
DisplayName: &FilterDisplayServiceName,
DisplayName: &FilterDisplayServiceCcrn,
Values: pointerNames,
}

Expand Down
18 changes: 9 additions & 9 deletions internal/api/graphql/graph/baseResolver/support_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func SupportGroupBaseResolver(app app.Heureka, ctx context.Context, filter *mode
Paginated: entity.Paginated{First: first, After: afterId},
ServiceId: serviceId,
UserId: userId,
Name: filter.SupportGroupName,
CCRN: filter.SupportGroupCcrn,
}

opt := GetListOptions(requestedFields)
Expand Down Expand Up @@ -87,11 +87,11 @@ func SupportGroupBaseResolver(app app.Heureka, ctx context.Context, filter *mode
return &connection, nil
}

func SupportGroupNameBaseResolver(app app.Heureka, ctx context.Context, filter *model.SupportGroupFilter) (*model.FilterItem, error) {
func SupportGroupCcrnBaseResolver(app app.Heureka, ctx context.Context, filter *model.SupportGroupFilter) (*model.FilterItem, error) {
requestedFields := GetPreloads(ctx)
logrus.WithFields(logrus.Fields{
"requestedFields": requestedFields,
}).Debug("Called SupportGroupNameBaseResolver")
}).Debug("Called SupportGroupCcrnBaseResolver")
var err error

if filter == nil {
Expand All @@ -103,23 +103,23 @@ func SupportGroupNameBaseResolver(app app.Heureka, ctx context.Context, filter *
userIds, err = util.ConvertStrToIntSlice(filter.UserIds)

if err != nil {
logrus.WithField("Filter", filter).Error("SupportGroupNameBaseResolver: Error while parsing 'UserIds'")
return nil, NewResolverError("SupportGroupNameBaseResolver", "Bad Request - unable to parse 'UserIds'")
logrus.WithField("Filter", filter).Error("SupportGroupCcrnBaseResolver: Error while parsing 'UserIds'")
return nil, NewResolverError("SupportGroupCcrnBaseResolver", "Bad Request - unable to parse 'UserIds'")
}
}

f := &entity.SupportGroupFilter{
Paginated: entity.Paginated{},
UserId: userIds,
Name: filter.SupportGroupName,
CCRN: filter.SupportGroupCcrn,
}

opt := GetListOptions(requestedFields)

names, err := app.ListSupportGroupNames(f, opt)
names, err := app.ListSupportGroupCcrns(f, opt)

if err != nil {
return nil, NewResolverError("SupportGroupNameBaseResolver", err.Error())
return nil, NewResolverError("SupportGroupCcrnBaseResolver", err.Error())
}

var pointerNames []*string
Expand All @@ -129,7 +129,7 @@ func SupportGroupNameBaseResolver(app app.Heureka, ctx context.Context, filter *
}

filterItem := model.FilterItem{
DisplayName: &FilterDisplaySupportGroupName,
DisplayName: &FilterDisplaySupportGroupCcrn,
Values: pointerNames,
}

Expand Down
14 changes: 7 additions & 7 deletions internal/api/graphql/graph/model/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func NewUserEntity(user *UserInput) entity.User {
func NewService(s *entity.Service) Service {
return Service{
ID: fmt.Sprintf("%d", s.Id),
Name: &s.Name,
Ccrn: &s.CCRN,
}
}

Expand All @@ -371,29 +371,29 @@ func NewServiceWithAggregations(service *entity.ServiceResult) Service {

return Service{
ID: fmt.Sprintf("%d", service.Id),
Name: &service.Name,
Ccrn: &service.CCRN,
Metadata: &metadata,
}
}

func NewServiceEntity(service *ServiceInput) entity.Service {
return entity.Service{
BaseService: entity.BaseService{
Name: lo.FromPtr(service.Name),
CCRN: lo.FromPtr(service.Ccrn),
},
}
}

func NewSupportGroup(supportGroup *entity.SupportGroup) SupportGroup {
return SupportGroup{
ID: fmt.Sprintf("%d", supportGroup.Id),
Name: &supportGroup.Name,
Ccrn: &supportGroup.CCRN,
}
}

func NewSupportGroupEntity(supportGroup *SupportGroupInput) entity.SupportGroup {
return entity.SupportGroup{
Name: lo.FromPtr(supportGroup.Name),
CCRN: lo.FromPtr(supportGroup.Ccrn),
}
}

Expand Down Expand Up @@ -452,7 +452,7 @@ func NewComponent(component *entity.Component) Component {
componentType, _ := ComponentTypeValue(component.Type)
return Component{
ID: fmt.Sprintf("%d", component.Id),
Name: &component.Name,
Ccrn: &component.CCRN,
Type: &componentType,
}
}
Expand All @@ -463,7 +463,7 @@ func NewComponentEntity(component *ComponentInput) entity.Component {
componentType = component.Type.String()
}
return entity.Component{
Name: lo.FromPtr(component.Name),
CCRN: lo.FromPtr(component.Ccrn),
Type: componentType,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mutation ($activityId: ID!, $serviceId: ID!) {
edges {
node {
id
name
ccrn
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ query ($filter: ActivityFilter, $first: Int, $after: String) {
edges {
node {
id
name
ccrn
}
cursor
}
Expand Down
Loading

0 comments on commit da6debe

Please sign in to comment.