Files
authentik/packages/client-go/model_notification_rule.go
T
Marc 'risson' Schmitt 2f70351c90 packages/client-go: init (#21139)
* packages/client-go: init

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* format

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* remove mod/sum

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* fix translate

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* no go replace

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* update rust makefile with pwd

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>

* fix build

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* fix docs

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* don't need a version ig?

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* exclude go client from cspell

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

* fix main docker build

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
2026-03-25 15:26:50 +01:00

389 lines
11 KiB
Go
Generated

/*
authentik
Making authentication simple.
API version: 2026.5.0-rc1
Contact: hello@goauthentik.io
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"encoding/json"
"fmt"
)
// checks if the NotificationRule type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &NotificationRule{}
// NotificationRule NotificationRule Serializer
type NotificationRule struct {
Pk string `json:"pk"`
Name string `json:"name"`
// Select which transports should be used to notify the user. If none are selected, the notification will only be shown in the authentik UI.
Transports []string `json:"transports,omitempty"`
// Controls which severity level the created notifications will have.
Severity *SeverityEnum `json:"severity,omitempty"`
// Define which group of users this notification should be sent and shown to. If left empty, Notification won't ben sent.
DestinationGroup NullableString `json:"destination_group,omitempty"`
DestinationGroupObj Group `json:"destination_group_obj"`
// When enabled, notification will be sent to user the user that triggered the event.When destination_group is configured, notification is sent to both.
DestinationEventUser *bool `json:"destination_event_user,omitempty"`
AdditionalProperties map[string]interface{}
}
type _NotificationRule NotificationRule
// NewNotificationRule instantiates a new NotificationRule object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewNotificationRule(pk string, name string, destinationGroupObj Group) *NotificationRule {
this := NotificationRule{}
this.Pk = pk
this.Name = name
this.DestinationGroupObj = destinationGroupObj
return &this
}
// NewNotificationRuleWithDefaults instantiates a new NotificationRule object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewNotificationRuleWithDefaults() *NotificationRule {
this := NotificationRule{}
return &this
}
// GetPk returns the Pk field value
func (o *NotificationRule) GetPk() string {
if o == nil {
var ret string
return ret
}
return o.Pk
}
// GetPkOk returns a tuple with the Pk field value
// and a boolean to check if the value has been set.
func (o *NotificationRule) GetPkOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Pk, true
}
// SetPk sets field value
func (o *NotificationRule) SetPk(v string) {
o.Pk = v
}
// GetName returns the Name field value
func (o *NotificationRule) GetName() string {
if o == nil {
var ret string
return ret
}
return o.Name
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *NotificationRule) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *NotificationRule) SetName(v string) {
o.Name = v
}
// GetTransports returns the Transports field value if set, zero value otherwise.
func (o *NotificationRule) GetTransports() []string {
if o == nil || IsNil(o.Transports) {
var ret []string
return ret
}
return o.Transports
}
// GetTransportsOk returns a tuple with the Transports field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *NotificationRule) GetTransportsOk() ([]string, bool) {
if o == nil || IsNil(o.Transports) {
return nil, false
}
return o.Transports, true
}
// HasTransports returns a boolean if a field has been set.
func (o *NotificationRule) HasTransports() bool {
if o != nil && !IsNil(o.Transports) {
return true
}
return false
}
// SetTransports gets a reference to the given []string and assigns it to the Transports field.
func (o *NotificationRule) SetTransports(v []string) {
o.Transports = v
}
// GetSeverity returns the Severity field value if set, zero value otherwise.
func (o *NotificationRule) GetSeverity() SeverityEnum {
if o == nil || IsNil(o.Severity) {
var ret SeverityEnum
return ret
}
return *o.Severity
}
// GetSeverityOk returns a tuple with the Severity field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *NotificationRule) GetSeverityOk() (*SeverityEnum, bool) {
if o == nil || IsNil(o.Severity) {
return nil, false
}
return o.Severity, true
}
// HasSeverity returns a boolean if a field has been set.
func (o *NotificationRule) HasSeverity() bool {
if o != nil && !IsNil(o.Severity) {
return true
}
return false
}
// SetSeverity gets a reference to the given SeverityEnum and assigns it to the Severity field.
func (o *NotificationRule) SetSeverity(v SeverityEnum) {
o.Severity = &v
}
// GetDestinationGroup returns the DestinationGroup field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *NotificationRule) GetDestinationGroup() string {
if o == nil || IsNil(o.DestinationGroup.Get()) {
var ret string
return ret
}
return *o.DestinationGroup.Get()
}
// GetDestinationGroupOk returns a tuple with the DestinationGroup field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *NotificationRule) GetDestinationGroupOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.DestinationGroup.Get(), o.DestinationGroup.IsSet()
}
// HasDestinationGroup returns a boolean if a field has been set.
func (o *NotificationRule) HasDestinationGroup() bool {
if o != nil && o.DestinationGroup.IsSet() {
return true
}
return false
}
// SetDestinationGroup gets a reference to the given NullableString and assigns it to the DestinationGroup field.
func (o *NotificationRule) SetDestinationGroup(v string) {
o.DestinationGroup.Set(&v)
}
// SetDestinationGroupNil sets the value for DestinationGroup to be an explicit nil
func (o *NotificationRule) SetDestinationGroupNil() {
o.DestinationGroup.Set(nil)
}
// UnsetDestinationGroup ensures that no value is present for DestinationGroup, not even an explicit nil
func (o *NotificationRule) UnsetDestinationGroup() {
o.DestinationGroup.Unset()
}
// GetDestinationGroupObj returns the DestinationGroupObj field value
func (o *NotificationRule) GetDestinationGroupObj() Group {
if o == nil {
var ret Group
return ret
}
return o.DestinationGroupObj
}
// GetDestinationGroupObjOk returns a tuple with the DestinationGroupObj field value
// and a boolean to check if the value has been set.
func (o *NotificationRule) GetDestinationGroupObjOk() (*Group, bool) {
if o == nil {
return nil, false
}
return &o.DestinationGroupObj, true
}
// SetDestinationGroupObj sets field value
func (o *NotificationRule) SetDestinationGroupObj(v Group) {
o.DestinationGroupObj = v
}
// GetDestinationEventUser returns the DestinationEventUser field value if set, zero value otherwise.
func (o *NotificationRule) GetDestinationEventUser() bool {
if o == nil || IsNil(o.DestinationEventUser) {
var ret bool
return ret
}
return *o.DestinationEventUser
}
// GetDestinationEventUserOk returns a tuple with the DestinationEventUser field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *NotificationRule) GetDestinationEventUserOk() (*bool, bool) {
if o == nil || IsNil(o.DestinationEventUser) {
return nil, false
}
return o.DestinationEventUser, true
}
// HasDestinationEventUser returns a boolean if a field has been set.
func (o *NotificationRule) HasDestinationEventUser() bool {
if o != nil && !IsNil(o.DestinationEventUser) {
return true
}
return false
}
// SetDestinationEventUser gets a reference to the given bool and assigns it to the DestinationEventUser field.
func (o *NotificationRule) SetDestinationEventUser(v bool) {
o.DestinationEventUser = &v
}
func (o NotificationRule) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o NotificationRule) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["pk"] = o.Pk
toSerialize["name"] = o.Name
if !IsNil(o.Transports) {
toSerialize["transports"] = o.Transports
}
if !IsNil(o.Severity) {
toSerialize["severity"] = o.Severity
}
if o.DestinationGroup.IsSet() {
toSerialize["destination_group"] = o.DestinationGroup.Get()
}
toSerialize["destination_group_obj"] = o.DestinationGroupObj
if !IsNil(o.DestinationEventUser) {
toSerialize["destination_event_user"] = o.DestinationEventUser
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *NotificationRule) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"pk",
"name",
"destination_group_obj",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err
}
for _, requiredProperty := range requiredProperties {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varNotificationRule := _NotificationRule{}
err = json.Unmarshal(data, &varNotificationRule)
if err != nil {
return err
}
*o = NotificationRule(varNotificationRule)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "pk")
delete(additionalProperties, "name")
delete(additionalProperties, "transports")
delete(additionalProperties, "severity")
delete(additionalProperties, "destination_group")
delete(additionalProperties, "destination_group_obj")
delete(additionalProperties, "destination_event_user")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableNotificationRule struct {
value *NotificationRule
isSet bool
}
func (v NullableNotificationRule) Get() *NotificationRule {
return v.value
}
func (v *NullableNotificationRule) Set(val *NotificationRule) {
v.value = val
v.isSet = true
}
func (v NullableNotificationRule) IsSet() bool {
return v.isSet
}
func (v *NullableNotificationRule) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableNotificationRule(val *NotificationRule) *NullableNotificationRule {
return &NullableNotificationRule{value: val, isSet: true}
}
func (v NullableNotificationRule) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableNotificationRule) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}