Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,34 @@ spec:
ProviderID is the identifier returned by the underlying contact provider
(e.g. Resend) when the membership is created in the associated audience. It is usually
used to track the contact-group membership creation status (e.g. provider webhooks).
Deprecated: Use Providers instead.
type: string
providers:
description: |-
Providers contains the per-provider status for this contact group membership.
This enables tracking multiple provider backends simultaneously.
items:
description: |-
ContactProviderStatus represents status information for a single contact provider.
It allows tracking the provider name and the provider-specific identifier.
properties:
id:
description: ID is the identifier returned by the specific contact
provider for this contact.
type: string
name:
description: |-
Name is the provider handling this contact.
Allowed values are Resend and Loops.
enum:
- Resend
- Loops
type: string
required:
- id
- name
type: object
type: array
username:
description: |-
Username is the username of the user that owns the ContactGroupMembership.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,36 @@ spec:
displayName:
description: DisplayName is the display name of the contact group.
type: string
providers:
description: Providers defines the providers this group should be
synced to.
items:
description: ContactGroupProviderSpec defines the desired state
of a contact group in a specific provider.
properties:
id:
description: |-
ID is the identifier of the contact group in the external provider.
This field is used when a provider does not expose an API for creating mailing lists,
requiring an existing ContactList ID to be provided for synchronization purposes (e.g. Loops).
If not provided, a new group will be created if supported by the provider.
type: string
name:
description: |-
Name is the provider handling this contact group.
Allowed values is Loops.
enum:
- Loops
type: string
required:
- id
- name
type: object
maxItems: 1
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
visibility:
description: |-
Visibility determines whether members are allowed opt-in or opt-out of the contactgroup.
Expand All @@ -70,6 +100,13 @@ spec:
- displayName
- visibility
type: object
x-kubernetes-validations:
- message: providers can only be added, not removed, and their IDs are
immutable. In order to update or remove, delete the ContactGroup and
create a new one.
rule: '!has(oldSelf.providers) || (has(self.providers) && oldSelf.providers.all(o,
self.providers.exists(n, n.name == o.name)) && !self.providers.exists(n,
oldSelf.providers.exists(o, o.name == n.name && o.id != n.id)))'
status:
properties:
conditions:
Expand Down Expand Up @@ -142,7 +179,34 @@ spec:
ProviderID is the identifier returned by the underlying contact groupprovider
(e.g. Resend) when the contact groupis created. It is usually
used to track the contact creation status (e.g. provider webhooks).
Deprecated: Use Providers instead.
type: string
providers:
description: |-
Providers contains the per-provider status for this contact group.
This enables tracking multiple provider backends simultaneously.
items:
description: |-
ContactProviderStatus represents status information for a single contact provider.
It allows tracking the provider name and the provider-specific identifier.
properties:
id:
description: ID is the identifier returned by the specific contact
provider for this contact.
type: string
name:
description: |-
Name is the provider handling this contact.
Allowed values are Resend and Loops.
enum:
- Resend
- Loops
type: string
required:
- id
- name
type: object
type: array
type: object
type: object
served: true
Expand Down
147 changes: 145 additions & 2 deletions docs/api/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,16 @@ Standard condition is "Ready" which tracks contact group membership creation sta
<td>
ProviderID is the identifier returned by the underlying contact provider
(e.g. Resend) when the membership is created in the associated audience. It is usually
used to track the contact-group membership creation status (e.g. provider webhooks).<br/>
used to track the contact-group membership creation status (e.g. provider webhooks).
Deprecated: Use Providers instead.<br/>
</td>
<td>false</td>
</tr><tr>
<td><b><a href="#contactgroupmembershipstatusprovidersindex">providers</a></b></td>
<td>[]object</td>
<td>
Providers contains the per-provider status for this contact group membership.
This enables tracking multiple provider backends simultaneously.<br/>
</td>
<td>false</td>
</tr><tr>
Expand Down Expand Up @@ -582,6 +591,44 @@ with respect to the current state of the instance.<br/>
</tr></tbody>
</table>


### ContactGroupMembership.status.providers[index]
<sup><sup>[↩ Parent](#contactgroupmembershipstatus)</sup></sup>



ContactProviderStatus represents status information for a single contact provider.
It allows tracking the provider name and the provider-specific identifier.

<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead>
<tbody><tr>
<td><b>id</b></td>
<td>string</td>
<td>
ID is the identifier returned by the specific contact provider for this contact.<br/>
</td>
<td>true</td>
</tr><tr>
<td><b>name</b></td>
<td>enum</td>
<td>
Name is the provider handling this contact.
Allowed values are Resend and Loops.<br/>
<br/>
<i>Enum</i>: Resend, Loops<br/>
</td>
<td>true</td>
</tr></tbody>
</table>

## ContactGroup
<sup><sup>[↩ Parent](#notificationmiloapiscomv1alpha1 )</sup></sup>

Expand Down Expand Up @@ -624,6 +671,8 @@ It represents a logical grouping of Contacts.
<td>object</td>
<td>
ContactGroupSpec defines the desired state of ContactGroup.<br/>
<br/>
<i>Validations</i>:<li>!has(oldSelf.providers) || (has(self.providers) && oldSelf.providers.all(o, self.providers.exists(n, n.name == o.name)) && !self.providers.exists(n, oldSelf.providers.exists(o, o.name == n.name && o.id != n.id))): providers can only be added, not removed, and their IDs are immutable. In order to update or remove, delete the ContactGroup and create a new one.</li>
</td>
<td>false</td>
</tr><tr>
Expand Down Expand Up @@ -672,6 +721,53 @@ ContactGroupSpec defines the desired state of ContactGroup.
<i>Enum</i>: public, private<br/>
</td>
<td>true</td>
</tr><tr>
<td><b><a href="#contactgroupspecprovidersindex">providers</a></b></td>
<td>[]object</td>
<td>
Providers defines the providers this group should be synced to.<br/>
</td>
<td>false</td>
</tr></tbody>
</table>


### ContactGroup.spec.providers[index]
<sup><sup>[↩ Parent](#contactgroupspec)</sup></sup>



ContactGroupProviderSpec defines the desired state of a contact group in a specific provider.

<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead>
<tbody><tr>
<td><b>id</b></td>
<td>string</td>
<td>
ID is the identifier of the contact group in the external provider.
This field is used when a provider does not expose an API for creating mailing lists,
requiring an existing ContactList ID to be provided for synchronization purposes (e.g. Loops).
If not provided, a new group will be created if supported by the provider.<br/>
</td>
<td>true</td>
</tr><tr>
<td><b>name</b></td>
<td>enum</td>
<td>
Name is the provider handling this contact group.
Allowed values is Loops.<br/>
<br/>
<i>Enum</i>: Loops<br/>
</td>
<td>true</td>
</tr></tbody>
</table>

Expand Down Expand Up @@ -708,7 +804,16 @@ Standard condition is "Ready" which tracks contact group creation status and syn
<td>
ProviderID is the identifier returned by the underlying contact groupprovider
(e.g. Resend) when the contact groupis created. It is usually
used to track the contact creation status (e.g. provider webhooks).<br/>
used to track the contact creation status (e.g. provider webhooks).
Deprecated: Use Providers instead.<br/>
</td>
<td>false</td>
</tr><tr>
<td><b><a href="#contactgroupstatusprovidersindex">providers</a></b></td>
<td>[]object</td>
<td>
Providers contains the per-provider status for this contact group.
This enables tracking multiple provider backends simultaneously.<br/>
</td>
<td>false</td>
</tr></tbody>
Expand Down Expand Up @@ -791,6 +896,44 @@ with respect to the current state of the instance.<br/>
</tr></tbody>
</table>


### ContactGroup.status.providers[index]
<sup><sup>[↩ Parent](#contactgroupstatus)</sup></sup>



ContactProviderStatus represents status information for a single contact provider.
It allows tracking the provider name and the provider-specific identifier.

<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead>
<tbody><tr>
<td><b>id</b></td>
<td>string</td>
<td>
ID is the identifier returned by the specific contact provider for this contact.<br/>
</td>
<td>true</td>
</tr><tr>
<td><b>name</b></td>
<td>enum</td>
<td>
Name is the provider handling this contact.
Allowed values are Resend and Loops.<br/>
<br/>
<i>Enum</i>: Resend, Loops<br/>
</td>
<td>true</td>
</tr></tbody>
</table>

## Contact
<sup><sup>[↩ Parent](#notificationmiloapiscomv1alpha1 )</sup></sup>

Expand Down
29 changes: 29 additions & 0 deletions pkg/apis/notification/v1alpha1/contactgroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,24 @@ type ContactGroup struct {
Status ContactGroupStatus `json:"status,omitempty"`
}

// ContactGroupProviderSpec defines the desired state of a contact group in a specific provider.
type ContactGroupProviderSpec struct {
// Name is the provider handling this contact group.
// Allowed values is Loops.
// +kubebuilder:validation:Enum=Loops
Name string `json:"name"`

// ID is the identifier of the contact group in the external provider.
// This field is used when a provider does not expose an API for creating mailing lists,
// requiring an existing ContactList ID to be provided for synchronization purposes (e.g. Loops).
// If not provided, a new group will be created if supported by the provider.
// +kubebuilder:validation:Required
ID string `json:"id,omitempty"`
}

// ContactGroupSpec defines the desired state of ContactGroup.
// +kubebuilder:validation:Type=object
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.providers) || (has(self.providers) && oldSelf.providers.all(o, self.providers.exists(n, n.name == o.name)) && !self.providers.exists(n, oldSelf.providers.exists(o, o.name == n.name && o.id != n.id)))",message="providers can only be added, not removed, and their IDs are immutable. In order to update or remove, delete the ContactGroup and create a new one."
type ContactGroupSpec struct {
// DisplayName is the display name of the contact group.
// +kubebuilder:validation:Required
Expand All @@ -74,6 +90,13 @@ type ContactGroupSpec struct {
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="type(oldSelf) == null_type || self == oldSelf",message="visibility type is immutable"
Visibility ContactGroupVisibility `json:"visibility,omitempty"`

// Providers defines the providers this group should be synced to.
// +listType=map
// +listMapKey=name
// +kubebuilder:validation:MaxItems=1
// +optional
Providers []ContactGroupProviderSpec `json:"providers,omitempty"`
}

// +kubebuilder:object:root=true
Expand All @@ -95,9 +118,15 @@ type ContactGroupStatus struct {
// +patchStrategy=merge
Conditions []metav1.Condition `json:"conditions,omitempty"`

// Providers contains the per-provider status for this contact group.
// This enables tracking multiple provider backends simultaneously.
// +kubebuilder:validation:Optional
Providers []ContactProviderStatus `json:"providers,omitempty"`

// ProviderID is the identifier returned by the underlying contact groupprovider
// (e.g. Resend) when the contact groupis created. It is usually
// used to track the contact creation status (e.g. provider webhooks).
// Deprecated: Use Providers instead.
// +optional
ProviderID string `json:"providerID,omitempty"`
}
6 changes: 6 additions & 0 deletions pkg/apis/notification/v1alpha1/contactgroupmembership.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,15 @@ type ContactGroupMembershipStatus struct {
// +patchStrategy=merge
Conditions []metav1.Condition `json:"conditions,omitempty"`

// Providers contains the per-provider status for this contact group membership.
// This enables tracking multiple provider backends simultaneously.
// +kubebuilder:validation:Optional
Providers []ContactProviderStatus `json:"providers,omitempty"`

// ProviderID is the identifier returned by the underlying contact provider
// (e.g. Resend) when the membership is created in the associated audience. It is usually
// used to track the contact-group membership creation status (e.g. provider webhooks).
// Deprecated: Use Providers instead.
// +optional
ProviderID string `json:"providerID,omitempty"`

Expand Down
Loading
Loading