Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

feat: Add v2.InternalAPISet that implements the v2.KeptnInterface #487

Merged
merged 3 commits into from
Jun 28, 2022

Conversation

arthurpitman
Copy link
Contributor

This PR

  • Adds a v2.InternalAPISet that implements the v2.KeptnInterface
  • Ensures api.InternalAPISet is constructed correctly by using api.NewAPIHandlerWithHTTPClient etc.

Signed-off-by: Arthur Pitman <[email protected]>
Signed-off-by: Arthur Pitman <[email protected]>
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
61.5% 61.5% Duplication

type InternalService int

const (
ConfigurationService InternalService = iota

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported const ConfigurationService should have comment (or a comment on this block) or be unexported

const (
ConfigurationService InternalService = iota
ShipyardController
ApiService

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
const ApiService should be APIService

// (unauthenticated) internal calls to the api-service at the moment. So this implementation
// will panic as soon as a client wants to call these methods
type InternalAPIHandler struct {
shipyardControllerApiHandler *APIHandler

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
struct field shipyardControllerApiHandler should be shipyardControllerAPIHandler

shipyardControllerApiHandler *APIHandler
}

func (i *InternalAPIHandler) SendEvent(_ context.Context, event models.KeptnContextExtendedCE, _ APISendEventOptions) (*models.EventContext, *models.Error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method InternalAPIHandler.SendEvent should have comment or be unexported

panic("SendEvent() is not not supported for internal usage")
}

func (i *InternalAPIHandler) TriggerEvaluation(ctx context.Context, project string, stage string, service string, evaluation models.Evaluation, opts APITriggerEvaluationOptions) (*models.EventContext, *models.Error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method InternalAPIHandler.TriggerEvaluation should have comment or be unexported

return i.shipyardControllerApiHandler.CreateProject(ctx, project, opts)
}

func (i *InternalAPIHandler) UpdateProject(ctx context.Context, project models.CreateProject, opts APIUpdateProjectOptions) (string, *models.Error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method InternalAPIHandler.UpdateProject should have comment or be unexported

return i.shipyardControllerApiHandler.UpdateProject(ctx, project, opts)
}

func (i *InternalAPIHandler) DeleteProject(ctx context.Context, project models.Project, opts APIDeleteProjectOptions) (*models.DeleteProjectResponse, *models.Error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method InternalAPIHandler.DeleteProject should have comment or be unexported

return i.shipyardControllerApiHandler.DeleteProject(ctx, project, opts)
}

func (i *InternalAPIHandler) CreateService(ctx context.Context, project string, service models.CreateService, opts APICreateServiceOptions) (string, *models.Error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method InternalAPIHandler.CreateService should have comment or be unexported

return i.shipyardControllerApiHandler.CreateService(ctx, project, service, opts)
}

func (i *InternalAPIHandler) DeleteService(ctx context.Context, project string, service string, opts APIDeleteServiceOptions) (*models.DeleteServiceResponse, *models.Error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method InternalAPIHandler.DeleteService should have comment or be unexported

return i.shipyardControllerApiHandler.DeleteService(ctx, project, service, opts)
}

func (i *InternalAPIHandler) GetMetadata(_ context.Context, _ APIGetMetadataOptions) (*models.Metadata, *models.Error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[golint] reported by reviewdog 🐶
exported method InternalAPIHandler.GetMetadata should have comment or be unexported

@arthurpitman arthurpitman merged commit eb5fb9b into master Jun 28, 2022
@arthurpitman arthurpitman deleted the feat/add-v2-internal branch June 28, 2022 14:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants