Skip to content

Commit

Permalink
chore(contact): friendlyName -> name
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Apr 17, 2024
1 parent 78f0329 commit 7c5f22a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions api/v1/contact_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand Down
9 changes: 4 additions & 5 deletions config/crd/bases/uptime-robot.clevyr.com_contacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/samples/uptime-robot_v1_contact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ metadata:
spec:
isDefault: true
contact:
friendlyName: "Slack #outages"
name: "Slack #outages"
2 changes: 1 addition & 1 deletion internal/controller/contact_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/contact_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func CreateContact(ctx context.Context, accountName string) *uptimerobotv1.Conta
Name: accountName,
},
Contact: uptimerobotv1.ContactValues{
FriendlyName: "John Doe",
Name: "John Doe",
},
},
}
Expand Down

0 comments on commit 7c5f22a

Please sign in to comment.