Skip to content

Commit

Permalink
add stringers
Browse files Browse the repository at this point in the history
  • Loading branch information
henderiw committed May 18, 2024
1 parent 4c3a5c2 commit 5635084
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions apis/backend/infra/v1alpha1/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ limitations under the License.

package v1alpha1

import "fmt"

type SiteID struct {
// Region defines the region this sites belongs to
Region string `json:"region" yaml:"region" protobuf:"bytes,1,opt,name=region"`
Expand All @@ -40,3 +42,35 @@ type EndpointID struct {
// Endpoint defines the name of the endpoint
Endpoint string `json:"endpoint" yaml:"endpoint" protobuf:"bytes,5,opt,name=endpoint"`
}

func (r SiteID) KuidString() string {
return fmt.Sprintf(
"%s.%s.",
r.Region,
r.Site,
)
}

func (r NodeGroupID) KuidString() string {
return fmt.Sprintf(
"%s.%s",
r.NodeGroup,
r.SiteID.KuidString(),
)
}

func (r NodeID) KuidString() string {
return fmt.Sprintf(
"%s.%s",
r.NodeGroupID.KuidString(),
r.Node,
)
}

func (r EndpointID) KuidString() string {
return fmt.Sprintf(
"%s.%s",
r.NodeID.KuidString(),
r.Endpoint,
)
}

0 comments on commit 5635084

Please sign in to comment.