Skip to content
This repository was archived by the owner on Apr 27, 2022. It is now read-only.
This repository was archived by the owner on Apr 27, 2022. It is now read-only.

Refactor custom wrapper structs into types #94

@elmiko

Description

@elmiko

There are several helper structs that are thin wrappers around kubernetes primitives. These structs don't add any members and are being used to create methods that extend the original kubernetes structs. This behavior could be made simpler by removing the extra struct declarations and instead making these types.

For example, in core/deploymentconfigs/deploymentconfigs.go this:

type ODeploymentConfig struct {
    api.DeploymentConfig
}

would be refactored into

type ODeploymentConfig api.DeploymentConfig

To make this change we will need to adjust how some of the methods that operate on the underlying struct work. Primarily, we should rename methods that have the same name as underlying members. These methods should change their names to reflect their status as setters.

For example, in helpers/containers/containers.go this:

func (c *OContainer) Command(args ...string) *OContainer {
    c.Container.Command = args
    return c
}

would be refactored into

func (c *OContainer) SetCommand(args ...string) *OContainer {
    c.Command = args
    return c
}

This would make the code more explicit in its functionality and allow access to the kubernetes primitives in a cleaner manner.

migrated from radanalyticsio/oshinko-rest#65

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions