Files
sdk/model_o11y_webhook_config.go

342 lines
9.5 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the O11yWebhookConfig type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &O11yWebhookConfig{}
// O11yWebhookConfig struct for O11yWebhookConfig
type O11yWebhookConfig struct {
NotifierConfig *O11yNotifierConfig `json:"NotifierConfig,omitempty"`
HttpConfig *O11yHTTPClientConfig `json:"http_config,omitempty"`
// MaxAlerts is the maximum number of alerts to be sent per webhook message. Alerts exceeding this threshold will be truncated. Setting this to 0 allows an unlimited number of alerts.
MaxAlerts *int32 `json:"max_alerts,omitempty"`
// Timeout is the maximum time allowed to invoke the webhook. Setting this to 0 does not impose a timeout.
Timeout *int64 `json:"timeout,omitempty"`
Url interface{} `json:"url,omitempty"`
UrlFile *string `json:"url_file,omitempty"`
AdditionalProperties map[string]interface{}
}
type _O11yWebhookConfig O11yWebhookConfig
// NewO11yWebhookConfig instantiates a new O11yWebhookConfig 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 NewO11yWebhookConfig() *O11yWebhookConfig {
this := O11yWebhookConfig{}
return &this
}
// NewO11yWebhookConfigWithDefaults instantiates a new O11yWebhookConfig 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 NewO11yWebhookConfigWithDefaults() *O11yWebhookConfig {
this := O11yWebhookConfig{}
return &this
}
// GetNotifierConfig returns the NotifierConfig field value if set, zero value otherwise.
func (o *O11yWebhookConfig) GetNotifierConfig() O11yNotifierConfig {
if o == nil || IsNil(o.NotifierConfig) {
var ret O11yNotifierConfig
return ret
}
return *o.NotifierConfig
}
// GetNotifierConfigOk returns a tuple with the NotifierConfig field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *O11yWebhookConfig) GetNotifierConfigOk() (*O11yNotifierConfig, bool) {
if o == nil || IsNil(o.NotifierConfig) {
return nil, false
}
return o.NotifierConfig, true
}
// HasNotifierConfig returns a boolean if a field has been set.
func (o *O11yWebhookConfig) HasNotifierConfig() bool {
if o != nil && !IsNil(o.NotifierConfig) {
return true
}
return false
}
// SetNotifierConfig gets a reference to the given O11yNotifierConfig and assigns it to the NotifierConfig field.
func (o *O11yWebhookConfig) SetNotifierConfig(v O11yNotifierConfig) {
o.NotifierConfig = &v
}
// GetHttpConfig returns the HttpConfig field value if set, zero value otherwise.
func (o *O11yWebhookConfig) GetHttpConfig() O11yHTTPClientConfig {
if o == nil || IsNil(o.HttpConfig) {
var ret O11yHTTPClientConfig
return ret
}
return *o.HttpConfig
}
// GetHttpConfigOk returns a tuple with the HttpConfig field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *O11yWebhookConfig) GetHttpConfigOk() (*O11yHTTPClientConfig, bool) {
if o == nil || IsNil(o.HttpConfig) {
return nil, false
}
return o.HttpConfig, true
}
// HasHttpConfig returns a boolean if a field has been set.
func (o *O11yWebhookConfig) HasHttpConfig() bool {
if o != nil && !IsNil(o.HttpConfig) {
return true
}
return false
}
// SetHttpConfig gets a reference to the given O11yHTTPClientConfig and assigns it to the HttpConfig field.
func (o *O11yWebhookConfig) SetHttpConfig(v O11yHTTPClientConfig) {
o.HttpConfig = &v
}
// GetMaxAlerts returns the MaxAlerts field value if set, zero value otherwise.
func (o *O11yWebhookConfig) GetMaxAlerts() int32 {
if o == nil || IsNil(o.MaxAlerts) {
var ret int32
return ret
}
return *o.MaxAlerts
}
// GetMaxAlertsOk returns a tuple with the MaxAlerts field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *O11yWebhookConfig) GetMaxAlertsOk() (*int32, bool) {
if o == nil || IsNil(o.MaxAlerts) {
return nil, false
}
return o.MaxAlerts, true
}
// HasMaxAlerts returns a boolean if a field has been set.
func (o *O11yWebhookConfig) HasMaxAlerts() bool {
if o != nil && !IsNil(o.MaxAlerts) {
return true
}
return false
}
// SetMaxAlerts gets a reference to the given int32 and assigns it to the MaxAlerts field.
func (o *O11yWebhookConfig) SetMaxAlerts(v int32) {
o.MaxAlerts = &v
}
// GetTimeout returns the Timeout field value if set, zero value otherwise.
func (o *O11yWebhookConfig) GetTimeout() int64 {
if o == nil || IsNil(o.Timeout) {
var ret int64
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 *O11yWebhookConfig) GetTimeoutOk() (*int64, 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 *O11yWebhookConfig) HasTimeout() bool {
if o != nil && !IsNil(o.Timeout) {
return true
}
return false
}
// SetTimeout gets a reference to the given int64 and assigns it to the Timeout field.
func (o *O11yWebhookConfig) SetTimeout(v int64) {
o.Timeout = &v
}
// GetUrl returns the Url field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *O11yWebhookConfig) GetUrl() interface{} {
if o == nil {
var ret interface{}
return ret
}
return o.Url
}
// GetUrlOk returns a tuple with the Url 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 *O11yWebhookConfig) GetUrlOk() (*interface{}, bool) {
if o == nil || IsNil(o.Url) {
return nil, false
}
return &o.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (o *O11yWebhookConfig) HasUrl() bool {
if o != nil && !IsNil(o.Url) {
return true
}
return false
}
// SetUrl gets a reference to the given interface{} and assigns it to the Url field.
func (o *O11yWebhookConfig) SetUrl(v interface{}) {
o.Url = v
}
// GetUrlFile returns the UrlFile field value if set, zero value otherwise.
func (o *O11yWebhookConfig) GetUrlFile() string {
if o == nil || IsNil(o.UrlFile) {
var ret string
return ret
}
return *o.UrlFile
}
// GetUrlFileOk returns a tuple with the UrlFile field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *O11yWebhookConfig) GetUrlFileOk() (*string, bool) {
if o == nil || IsNil(o.UrlFile) {
return nil, false
}
return o.UrlFile, true
}
// HasUrlFile returns a boolean if a field has been set.
func (o *O11yWebhookConfig) HasUrlFile() bool {
if o != nil && !IsNil(o.UrlFile) {
return true
}
return false
}
// SetUrlFile gets a reference to the given string and assigns it to the UrlFile field.
func (o *O11yWebhookConfig) SetUrlFile(v string) {
o.UrlFile = &v
}
func (o O11yWebhookConfig) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o O11yWebhookConfig) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.NotifierConfig) {
toSerialize["NotifierConfig"] = o.NotifierConfig
}
if !IsNil(o.HttpConfig) {
toSerialize["http_config"] = o.HttpConfig
}
if !IsNil(o.MaxAlerts) {
toSerialize["max_alerts"] = o.MaxAlerts
}
if !IsNil(o.Timeout) {
toSerialize["timeout"] = o.Timeout
}
if o.Url != nil {
toSerialize["url"] = o.Url
}
if !IsNil(o.UrlFile) {
toSerialize["url_file"] = o.UrlFile
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *O11yWebhookConfig) UnmarshalJSON(data []byte) (err error) {
varO11yWebhookConfig := _O11yWebhookConfig{}
err = json.Unmarshal(data, &varO11yWebhookConfig)
if err != nil {
return err
}
*o = O11yWebhookConfig(varO11yWebhookConfig)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "NotifierConfig")
delete(additionalProperties, "http_config")
delete(additionalProperties, "max_alerts")
delete(additionalProperties, "timeout")
delete(additionalProperties, "url")
delete(additionalProperties, "url_file")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableO11yWebhookConfig struct {
value *O11yWebhookConfig
isSet bool
}
func (v NullableO11yWebhookConfig) Get() *O11yWebhookConfig {
return v.value
}
func (v *NullableO11yWebhookConfig) Set(val *O11yWebhookConfig) {
v.value = val
v.isSet = true
}
func (v NullableO11yWebhookConfig) IsSet() bool {
return v.isSet
}
func (v *NullableO11yWebhookConfig) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableO11yWebhookConfig(val *O11yWebhookConfig) *NullableO11yWebhookConfig {
return &NullableO11yWebhookConfig{value: val, isSet: true}
}
func (v NullableO11yWebhookConfig) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableO11yWebhookConfig) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}