Files
authentik/packages/client-go/model_device_user_binding.go
T
Simonyi Gergő 2b8313ee91 core: fix policy binding objects not being nullable (#21421)
* fix policy binding objects not being nullable

* `make gen-clients`

* fix schema

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

* tidy

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

* fix test

* `make gen`

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
2026-04-08 16:39:00 +02:00

711 lines
19 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 DeviceUserBinding type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &DeviceUserBinding{}
// DeviceUserBinding PolicyBinding Serializer
type DeviceUserBinding struct {
Pk string `json:"pk"`
Policy NullableString `json:"policy,omitempty"`
Group NullableString `json:"group,omitempty"`
User NullableInt32 `json:"user,omitempty"`
PolicyObj NullablePolicy `json:"policy_obj"`
GroupObj NullablePartialGroup `json:"group_obj"`
UserObj NullablePartialUser `json:"user_obj"`
Target string `json:"target"`
// Negates the outcome of the policy. Messages are unaffected.
Negate *bool `json:"negate,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Order int32 `json:"order"`
// Timeout after which Policy execution is terminated.
Timeout *int32 `json:"timeout,omitempty"`
// Result if the Policy execution fails.
FailureResult *bool `json:"failure_result,omitempty"`
IsPrimary *bool `json:"is_primary,omitempty"`
Connector NullableString `json:"connector"`
ConnectorObj Connector `json:"connector_obj"`
AdditionalProperties map[string]interface{}
}
type _DeviceUserBinding DeviceUserBinding
// NewDeviceUserBinding instantiates a new DeviceUserBinding 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 NewDeviceUserBinding(pk string, policyObj NullablePolicy, groupObj NullablePartialGroup, userObj NullablePartialUser, target string, order int32, connector NullableString, connectorObj Connector) *DeviceUserBinding {
this := DeviceUserBinding{}
this.Pk = pk
this.PolicyObj = policyObj
this.GroupObj = groupObj
this.UserObj = userObj
this.Target = target
this.Order = order
this.Connector = connector
this.ConnectorObj = connectorObj
return &this
}
// NewDeviceUserBindingWithDefaults instantiates a new DeviceUserBinding 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 NewDeviceUserBindingWithDefaults() *DeviceUserBinding {
this := DeviceUserBinding{}
return &this
}
// GetPk returns the Pk field value
func (o *DeviceUserBinding) 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 *DeviceUserBinding) GetPkOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Pk, true
}
// SetPk sets field value
func (o *DeviceUserBinding) SetPk(v string) {
o.Pk = v
}
// GetPolicy returns the Policy field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *DeviceUserBinding) GetPolicy() string {
if o == nil || IsNil(o.Policy.Get()) {
var ret string
return ret
}
return *o.Policy.Get()
}
// GetPolicyOk returns a tuple with the Policy 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 *DeviceUserBinding) GetPolicyOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.Policy.Get(), o.Policy.IsSet()
}
// HasPolicy returns a boolean if a field has been set.
func (o *DeviceUserBinding) HasPolicy() bool {
if o != nil && o.Policy.IsSet() {
return true
}
return false
}
// SetPolicy gets a reference to the given NullableString and assigns it to the Policy field.
func (o *DeviceUserBinding) SetPolicy(v string) {
o.Policy.Set(&v)
}
// SetPolicyNil sets the value for Policy to be an explicit nil
func (o *DeviceUserBinding) SetPolicyNil() {
o.Policy.Set(nil)
}
// UnsetPolicy ensures that no value is present for Policy, not even an explicit nil
func (o *DeviceUserBinding) UnsetPolicy() {
o.Policy.Unset()
}
// GetGroup returns the Group field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *DeviceUserBinding) GetGroup() string {
if o == nil || IsNil(o.Group.Get()) {
var ret string
return ret
}
return *o.Group.Get()
}
// GetGroupOk returns a tuple with the Group 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 *DeviceUserBinding) GetGroupOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.Group.Get(), o.Group.IsSet()
}
// HasGroup returns a boolean if a field has been set.
func (o *DeviceUserBinding) HasGroup() bool {
if o != nil && o.Group.IsSet() {
return true
}
return false
}
// SetGroup gets a reference to the given NullableString and assigns it to the Group field.
func (o *DeviceUserBinding) SetGroup(v string) {
o.Group.Set(&v)
}
// SetGroupNil sets the value for Group to be an explicit nil
func (o *DeviceUserBinding) SetGroupNil() {
o.Group.Set(nil)
}
// UnsetGroup ensures that no value is present for Group, not even an explicit nil
func (o *DeviceUserBinding) UnsetGroup() {
o.Group.Unset()
}
// GetUser returns the User field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *DeviceUserBinding) GetUser() int32 {
if o == nil || IsNil(o.User.Get()) {
var ret int32
return ret
}
return *o.User.Get()
}
// GetUserOk returns a tuple with the User 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 *DeviceUserBinding) GetUserOk() (*int32, bool) {
if o == nil {
return nil, false
}
return o.User.Get(), o.User.IsSet()
}
// HasUser returns a boolean if a field has been set.
func (o *DeviceUserBinding) HasUser() bool {
if o != nil && o.User.IsSet() {
return true
}
return false
}
// SetUser gets a reference to the given NullableInt32 and assigns it to the User field.
func (o *DeviceUserBinding) SetUser(v int32) {
o.User.Set(&v)
}
// SetUserNil sets the value for User to be an explicit nil
func (o *DeviceUserBinding) SetUserNil() {
o.User.Set(nil)
}
// UnsetUser ensures that no value is present for User, not even an explicit nil
func (o *DeviceUserBinding) UnsetUser() {
o.User.Unset()
}
// GetPolicyObj returns the PolicyObj field value
// If the value is explicit nil, the zero value for Policy will be returned
func (o *DeviceUserBinding) GetPolicyObj() Policy {
if o == nil || o.PolicyObj.Get() == nil {
var ret Policy
return ret
}
return *o.PolicyObj.Get()
}
// GetPolicyObjOk returns a tuple with the PolicyObj field value
// 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 *DeviceUserBinding) GetPolicyObjOk() (*Policy, bool) {
if o == nil {
return nil, false
}
return o.PolicyObj.Get(), o.PolicyObj.IsSet()
}
// SetPolicyObj sets field value
func (o *DeviceUserBinding) SetPolicyObj(v Policy) {
o.PolicyObj.Set(&v)
}
// GetGroupObj returns the GroupObj field value
// If the value is explicit nil, the zero value for PartialGroup will be returned
func (o *DeviceUserBinding) GetGroupObj() PartialGroup {
if o == nil || o.GroupObj.Get() == nil {
var ret PartialGroup
return ret
}
return *o.GroupObj.Get()
}
// GetGroupObjOk returns a tuple with the GroupObj field value
// 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 *DeviceUserBinding) GetGroupObjOk() (*PartialGroup, bool) {
if o == nil {
return nil, false
}
return o.GroupObj.Get(), o.GroupObj.IsSet()
}
// SetGroupObj sets field value
func (o *DeviceUserBinding) SetGroupObj(v PartialGroup) {
o.GroupObj.Set(&v)
}
// GetUserObj returns the UserObj field value
// If the value is explicit nil, the zero value for PartialUser will be returned
func (o *DeviceUserBinding) GetUserObj() PartialUser {
if o == nil || o.UserObj.Get() == nil {
var ret PartialUser
return ret
}
return *o.UserObj.Get()
}
// GetUserObjOk returns a tuple with the UserObj field value
// 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 *DeviceUserBinding) GetUserObjOk() (*PartialUser, bool) {
if o == nil {
return nil, false
}
return o.UserObj.Get(), o.UserObj.IsSet()
}
// SetUserObj sets field value
func (o *DeviceUserBinding) SetUserObj(v PartialUser) {
o.UserObj.Set(&v)
}
// GetTarget returns the Target field value
func (o *DeviceUserBinding) GetTarget() string {
if o == nil {
var ret string
return ret
}
return o.Target
}
// GetTargetOk returns a tuple with the Target field value
// and a boolean to check if the value has been set.
func (o *DeviceUserBinding) GetTargetOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Target, true
}
// SetTarget sets field value
func (o *DeviceUserBinding) SetTarget(v string) {
o.Target = v
}
// GetNegate returns the Negate field value if set, zero value otherwise.
func (o *DeviceUserBinding) GetNegate() bool {
if o == nil || IsNil(o.Negate) {
var ret bool
return ret
}
return *o.Negate
}
// GetNegateOk returns a tuple with the Negate field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeviceUserBinding) GetNegateOk() (*bool, bool) {
if o == nil || IsNil(o.Negate) {
return nil, false
}
return o.Negate, true
}
// HasNegate returns a boolean if a field has been set.
func (o *DeviceUserBinding) HasNegate() bool {
if o != nil && !IsNil(o.Negate) {
return true
}
return false
}
// SetNegate gets a reference to the given bool and assigns it to the Negate field.
func (o *DeviceUserBinding) SetNegate(v bool) {
o.Negate = &v
}
// GetEnabled returns the Enabled field value if set, zero value otherwise.
func (o *DeviceUserBinding) GetEnabled() bool {
if o == nil || IsNil(o.Enabled) {
var ret bool
return ret
}
return *o.Enabled
}
// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeviceUserBinding) GetEnabledOk() (*bool, bool) {
if o == nil || IsNil(o.Enabled) {
return nil, false
}
return o.Enabled, true
}
// HasEnabled returns a boolean if a field has been set.
func (o *DeviceUserBinding) HasEnabled() bool {
if o != nil && !IsNil(o.Enabled) {
return true
}
return false
}
// SetEnabled gets a reference to the given bool and assigns it to the Enabled field.
func (o *DeviceUserBinding) SetEnabled(v bool) {
o.Enabled = &v
}
// GetOrder returns the Order field value
func (o *DeviceUserBinding) GetOrder() int32 {
if o == nil {
var ret int32
return ret
}
return o.Order
}
// GetOrderOk returns a tuple with the Order field value
// and a boolean to check if the value has been set.
func (o *DeviceUserBinding) GetOrderOk() (*int32, bool) {
if o == nil {
return nil, false
}
return &o.Order, true
}
// SetOrder sets field value
func (o *DeviceUserBinding) SetOrder(v int32) {
o.Order = v
}
// GetTimeout returns the Timeout field value if set, zero value otherwise.
func (o *DeviceUserBinding) GetTimeout() int32 {
if o == nil || IsNil(o.Timeout) {
var ret int32
return ret
}
return *o.Timeout
}
// GetTimeoutOk returns a tuple with the Timeout field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeviceUserBinding) GetTimeoutOk() (*int32, bool) {
if o == nil || IsNil(o.Timeout) {
return nil, false
}
return o.Timeout, true
}
// HasTimeout returns a boolean if a field has been set.
func (o *DeviceUserBinding) HasTimeout() bool {
if o != nil && !IsNil(o.Timeout) {
return true
}
return false
}
// SetTimeout gets a reference to the given int32 and assigns it to the Timeout field.
func (o *DeviceUserBinding) SetTimeout(v int32) {
o.Timeout = &v
}
// GetFailureResult returns the FailureResult field value if set, zero value otherwise.
func (o *DeviceUserBinding) GetFailureResult() bool {
if o == nil || IsNil(o.FailureResult) {
var ret bool
return ret
}
return *o.FailureResult
}
// GetFailureResultOk returns a tuple with the FailureResult field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeviceUserBinding) GetFailureResultOk() (*bool, bool) {
if o == nil || IsNil(o.FailureResult) {
return nil, false
}
return o.FailureResult, true
}
// HasFailureResult returns a boolean if a field has been set.
func (o *DeviceUserBinding) HasFailureResult() bool {
if o != nil && !IsNil(o.FailureResult) {
return true
}
return false
}
// SetFailureResult gets a reference to the given bool and assigns it to the FailureResult field.
func (o *DeviceUserBinding) SetFailureResult(v bool) {
o.FailureResult = &v
}
// GetIsPrimary returns the IsPrimary field value if set, zero value otherwise.
func (o *DeviceUserBinding) GetIsPrimary() bool {
if o == nil || IsNil(o.IsPrimary) {
var ret bool
return ret
}
return *o.IsPrimary
}
// GetIsPrimaryOk returns a tuple with the IsPrimary field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeviceUserBinding) GetIsPrimaryOk() (*bool, bool) {
if o == nil || IsNil(o.IsPrimary) {
return nil, false
}
return o.IsPrimary, true
}
// HasIsPrimary returns a boolean if a field has been set.
func (o *DeviceUserBinding) HasIsPrimary() bool {
if o != nil && !IsNil(o.IsPrimary) {
return true
}
return false
}
// SetIsPrimary gets a reference to the given bool and assigns it to the IsPrimary field.
func (o *DeviceUserBinding) SetIsPrimary(v bool) {
o.IsPrimary = &v
}
// GetConnector returns the Connector field value
// If the value is explicit nil, the zero value for string will be returned
func (o *DeviceUserBinding) GetConnector() string {
if o == nil || o.Connector.Get() == nil {
var ret string
return ret
}
return *o.Connector.Get()
}
// GetConnectorOk returns a tuple with the Connector field value
// 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 *DeviceUserBinding) GetConnectorOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.Connector.Get(), o.Connector.IsSet()
}
// SetConnector sets field value
func (o *DeviceUserBinding) SetConnector(v string) {
o.Connector.Set(&v)
}
// GetConnectorObj returns the ConnectorObj field value
func (o *DeviceUserBinding) GetConnectorObj() Connector {
if o == nil {
var ret Connector
return ret
}
return o.ConnectorObj
}
// GetConnectorObjOk returns a tuple with the ConnectorObj field value
// and a boolean to check if the value has been set.
func (o *DeviceUserBinding) GetConnectorObjOk() (*Connector, bool) {
if o == nil {
return nil, false
}
return &o.ConnectorObj, true
}
// SetConnectorObj sets field value
func (o *DeviceUserBinding) SetConnectorObj(v Connector) {
o.ConnectorObj = v
}
func (o DeviceUserBinding) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o DeviceUserBinding) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["pk"] = o.Pk
if o.Policy.IsSet() {
toSerialize["policy"] = o.Policy.Get()
}
if o.Group.IsSet() {
toSerialize["group"] = o.Group.Get()
}
if o.User.IsSet() {
toSerialize["user"] = o.User.Get()
}
toSerialize["policy_obj"] = o.PolicyObj.Get()
toSerialize["group_obj"] = o.GroupObj.Get()
toSerialize["user_obj"] = o.UserObj.Get()
toSerialize["target"] = o.Target
if !IsNil(o.Negate) {
toSerialize["negate"] = o.Negate
}
if !IsNil(o.Enabled) {
toSerialize["enabled"] = o.Enabled
}
toSerialize["order"] = o.Order
if !IsNil(o.Timeout) {
toSerialize["timeout"] = o.Timeout
}
if !IsNil(o.FailureResult) {
toSerialize["failure_result"] = o.FailureResult
}
if !IsNil(o.IsPrimary) {
toSerialize["is_primary"] = o.IsPrimary
}
toSerialize["connector"] = o.Connector.Get()
toSerialize["connector_obj"] = o.ConnectorObj
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *DeviceUserBinding) 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",
"policy_obj",
"group_obj",
"user_obj",
"target",
"order",
"connector",
"connector_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)
}
}
varDeviceUserBinding := _DeviceUserBinding{}
err = json.Unmarshal(data, &varDeviceUserBinding)
if err != nil {
return err
}
*o = DeviceUserBinding(varDeviceUserBinding)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "pk")
delete(additionalProperties, "policy")
delete(additionalProperties, "group")
delete(additionalProperties, "user")
delete(additionalProperties, "policy_obj")
delete(additionalProperties, "group_obj")
delete(additionalProperties, "user_obj")
delete(additionalProperties, "target")
delete(additionalProperties, "negate")
delete(additionalProperties, "enabled")
delete(additionalProperties, "order")
delete(additionalProperties, "timeout")
delete(additionalProperties, "failure_result")
delete(additionalProperties, "is_primary")
delete(additionalProperties, "connector")
delete(additionalProperties, "connector_obj")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableDeviceUserBinding struct {
value *DeviceUserBinding
isSet bool
}
func (v NullableDeviceUserBinding) Get() *DeviceUserBinding {
return v.value
}
func (v *NullableDeviceUserBinding) Set(val *DeviceUserBinding) {
v.value = val
v.isSet = true
}
func (v NullableDeviceUserBinding) IsSet() bool {
return v.isSet
}
func (v *NullableDeviceUserBinding) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDeviceUserBinding(val *DeviceUserBinding) *NullableDeviceUserBinding {
return &NullableDeviceUserBinding{value: val, isSet: true}
}
func (v NullableDeviceUserBinding) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDeviceUserBinding) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}