From 7c5f22a0078a0d3ea9f1e430cb06e7b4c96713a7 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Wed, 17 Apr 2024 13:12:08 -0500 Subject: [PATCH] chore(contact): `friendlyName` -> `name` --- api/v1/contact_types.go | 6 +++--- config/crd/bases/uptime-robot.clevyr.com_contacts.yaml | 9 ++++----- config/samples/uptime-robot_v1_contact.yaml | 2 +- internal/controller/contact_controller.go | 2 +- internal/controller/contact_controller_test.go | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/api/v1/contact_types.go b/api/v1/contact_types.go index 8a9ba18..1477792 100644 --- a/api/v1/contact_types.go +++ b/api/v1/contact_types.go @@ -44,7 +44,7 @@ type ContactStatus struct { //+kubebuilder:resource:scope=Cluster //+kubebuilder:printcolumn:name="Ready",type="boolean",JSONPath=".status.ready" //+kubebuilder:printcolumn:name="Default",type="boolean",JSONPath=".spec.isDefault" -//+kubebuilder:printcolumn:name="Friendly Name",type="string",JSONPath=".spec.contact.friendlyName" +//+kubebuilder:printcolumn:name="Friendly Name",type="string",JSONPath=".spec.contact.name" //+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" // Contact is the Schema for the contacts API @@ -66,8 +66,8 @@ type ContactList struct { } type ContactValues struct { - // FriendlyName sets the name that is shown in Uptime Robot. - FriendlyName string `json:"friendlyName"` + // Name sets the name that is shown in Uptime Robot. + Name string `json:"name"` } func init() { diff --git a/config/crd/bases/uptime-robot.clevyr.com_contacts.yaml b/config/crd/bases/uptime-robot.clevyr.com_contacts.yaml index 5df1495..b884f63 100644 --- a/config/crd/bases/uptime-robot.clevyr.com_contacts.yaml +++ b/config/crd/bases/uptime-robot.clevyr.com_contacts.yaml @@ -21,7 +21,7 @@ spec: - jsonPath: .spec.isDefault name: Default type: boolean - - jsonPath: .spec.contact.friendlyName + - jsonPath: .spec.contact.name name: Friendly Name type: string - jsonPath: .metadata.creationTimestamp @@ -67,12 +67,11 @@ spec: contact: description: Contact configures the Uptime Robot monitor. properties: - friendlyName: - description: FriendlyName sets the name that is shown in Uptime - Robot. + name: + description: Name sets the name that is shown in Uptime Robot. type: string required: - - friendlyName + - name type: object isDefault: default: false diff --git a/config/samples/uptime-robot_v1_contact.yaml b/config/samples/uptime-robot_v1_contact.yaml index c120103..ae6ee55 100644 --- a/config/samples/uptime-robot_v1_contact.yaml +++ b/config/samples/uptime-robot_v1_contact.yaml @@ -8,4 +8,4 @@ metadata: spec: isDefault: true contact: - friendlyName: "Slack #outages" + name: "Slack #outages" diff --git a/internal/controller/contact_controller.go b/internal/controller/contact_controller.go index 2f39562..e5aaf32 100644 --- a/internal/controller/contact_controller.go +++ b/internal/controller/contact_controller.go @@ -68,7 +68,7 @@ func (r *ContactReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct urclient := uptimerobot.NewClient(apiKey) if contact.Status.ID == "" { - id, err := urclient.FindContactID(ctx, contact.Spec.Contact.FriendlyName) + id, err := urclient.FindContactID(ctx, contact.Spec.Contact.Name) if err != nil { return ctrl.Result{}, err } diff --git a/internal/controller/contact_controller_test.go b/internal/controller/contact_controller_test.go index 8dc2741..a494bdb 100644 --- a/internal/controller/contact_controller_test.go +++ b/internal/controller/contact_controller_test.go @@ -80,7 +80,7 @@ func CreateContact(ctx context.Context, accountName string) *uptimerobotv1.Conta Name: accountName, }, Contact: uptimerobotv1.ContactValues{ - FriendlyName: "John Doe", + Name: "John Doe", }, }, }