Files
authentik/packages/client-go/model_saml_metadata.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

216 lines
5.4 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 SAMLMetadata type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &SAMLMetadata{}
// SAMLMetadata SAML Provider Metadata serializer
type SAMLMetadata struct {
Metadata string `json:"metadata"`
DownloadUrl NullableString `json:"download_url,omitempty"`
AdditionalProperties map[string]interface{}
}
type _SAMLMetadata SAMLMetadata
// NewSAMLMetadata instantiates a new SAMLMetadata 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 NewSAMLMetadata(metadata string) *SAMLMetadata {
this := SAMLMetadata{}
this.Metadata = metadata
return &this
}
// NewSAMLMetadataWithDefaults instantiates a new SAMLMetadata 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 NewSAMLMetadataWithDefaults() *SAMLMetadata {
this := SAMLMetadata{}
return &this
}
// GetMetadata returns the Metadata field value
func (o *SAMLMetadata) GetMetadata() string {
if o == nil {
var ret string
return ret
}
return o.Metadata
}
// GetMetadataOk returns a tuple with the Metadata field value
// and a boolean to check if the value has been set.
func (o *SAMLMetadata) GetMetadataOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Metadata, true
}
// SetMetadata sets field value
func (o *SAMLMetadata) SetMetadata(v string) {
o.Metadata = v
}
// GetDownloadUrl returns the DownloadUrl field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *SAMLMetadata) GetDownloadUrl() string {
if o == nil || IsNil(o.DownloadUrl.Get()) {
var ret string
return ret
}
return *o.DownloadUrl.Get()
}
// GetDownloadUrlOk returns a tuple with the DownloadUrl 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 *SAMLMetadata) GetDownloadUrlOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.DownloadUrl.Get(), o.DownloadUrl.IsSet()
}
// HasDownloadUrl returns a boolean if a field has been set.
func (o *SAMLMetadata) HasDownloadUrl() bool {
if o != nil && o.DownloadUrl.IsSet() {
return true
}
return false
}
// SetDownloadUrl gets a reference to the given NullableString and assigns it to the DownloadUrl field.
func (o *SAMLMetadata) SetDownloadUrl(v string) {
o.DownloadUrl.Set(&v)
}
// SetDownloadUrlNil sets the value for DownloadUrl to be an explicit nil
func (o *SAMLMetadata) SetDownloadUrlNil() {
o.DownloadUrl.Set(nil)
}
// UnsetDownloadUrl ensures that no value is present for DownloadUrl, not even an explicit nil
func (o *SAMLMetadata) UnsetDownloadUrl() {
o.DownloadUrl.Unset()
}
func (o SAMLMetadata) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o SAMLMetadata) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["metadata"] = o.Metadata
if o.DownloadUrl.IsSet() {
toSerialize["download_url"] = o.DownloadUrl.Get()
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *SAMLMetadata) 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{
"metadata",
}
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)
}
}
varSAMLMetadata := _SAMLMetadata{}
err = json.Unmarshal(data, &varSAMLMetadata)
if err != nil {
return err
}
*o = SAMLMetadata(varSAMLMetadata)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "metadata")
delete(additionalProperties, "download_url")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableSAMLMetadata struct {
value *SAMLMetadata
isSet bool
}
func (v NullableSAMLMetadata) Get() *SAMLMetadata {
return v.value
}
func (v *NullableSAMLMetadata) Set(val *SAMLMetadata) {
v.value = val
v.isSet = true
}
func (v NullableSAMLMetadata) IsSet() bool {
return v.isSet
}
func (v *NullableSAMLMetadata) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableSAMLMetadata(val *SAMLMetadata) *NullableSAMLMetadata {
return &NullableSAMLMetadata{value: val, isSet: true}
}
func (v NullableSAMLMetadata) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableSAMLMetadata) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}