Skip to content
Merged
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
509 changes: 509 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

437 changes: 437 additions & 0 deletions api/datadogV2/api_webhooks_integration.go

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions api/datadogV2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,11 @@
// - [WebIntegrationsApi.GetWebIntegrationAccount]
// - [WebIntegrationsApi.ListWebIntegrationAccounts]
// - [WebIntegrationsApi.UpdateWebIntegrationAccount]
// - [WebhooksIntegrationApi.CreateOAuth2ClientCredentials]
// - [WebhooksIntegrationApi.DeleteOAuth2ClientCredentials]
// - [WebhooksIntegrationApi.GetAllAuthMethods]
// - [WebhooksIntegrationApi.GetOAuth2ClientCredentials]
// - [WebhooksIntegrationApi.UpdateOAuth2ClientCredentials]
// - [WidgetsApi.CreateWidget]
// - [WidgetsApi.DeleteWidget]
// - [WidgetsApi.GetWidget]
Expand Down
112 changes: 112 additions & 0 deletions api/datadogV2/model_webhooks_auth_method_attributes.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV2

import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// WebhooksAuthMethodAttributes Attributes of a webhooks auth method.
type WebhooksAuthMethodAttributes struct {
// Authentication protocol used by the auth method.
Protocol *WebhooksAuthMethodProtocol `json:"protocol,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
}

// NewWebhooksAuthMethodAttributes instantiates a new WebhooksAuthMethodAttributes 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 NewWebhooksAuthMethodAttributes() *WebhooksAuthMethodAttributes {
this := WebhooksAuthMethodAttributes{}
return &this
}

// NewWebhooksAuthMethodAttributesWithDefaults instantiates a new WebhooksAuthMethodAttributes 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 NewWebhooksAuthMethodAttributesWithDefaults() *WebhooksAuthMethodAttributes {
this := WebhooksAuthMethodAttributes{}
return &this
}

// GetProtocol returns the Protocol field value if set, zero value otherwise.
func (o *WebhooksAuthMethodAttributes) GetProtocol() WebhooksAuthMethodProtocol {
if o == nil || o.Protocol == nil {
var ret WebhooksAuthMethodProtocol
return ret
}
return *o.Protocol
}

// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhooksAuthMethodAttributes) GetProtocolOk() (*WebhooksAuthMethodProtocol, bool) {
if o == nil || o.Protocol == nil {
return nil, false
}
return o.Protocol, true
}

// HasProtocol returns a boolean if a field has been set.
func (o *WebhooksAuthMethodAttributes) HasProtocol() bool {
return o != nil && o.Protocol != nil
}

// SetProtocol gets a reference to the given WebhooksAuthMethodProtocol and assigns it to the Protocol field.
func (o *WebhooksAuthMethodAttributes) SetProtocol(v WebhooksAuthMethodProtocol) {
o.Protocol = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o WebhooksAuthMethodAttributes) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.Protocol != nil {
toSerialize["protocol"] = o.Protocol
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *WebhooksAuthMethodAttributes) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Protocol *WebhooksAuthMethodProtocol `json:"protocol,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"protocol"})
} else {
return err
}

hasInvalidField := false
if all.Protocol != nil && !all.Protocol.IsValid() {
hasInvalidField = true
} else {
o.Protocol = all.Protocol
}

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}

return nil
}
64 changes: 64 additions & 0 deletions api/datadogV2/model_webhooks_auth_method_protocol.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV2

import (
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// WebhooksAuthMethodProtocol Authentication protocol used by the auth method.
type WebhooksAuthMethodProtocol string

// List of WebhooksAuthMethodProtocol.
const (
WEBHOOKSAUTHMETHODPROTOCOL_OAUTH2_CLIENT_CREDENTIALS WebhooksAuthMethodProtocol = "oauth2-client-credentials"
)

var allowedWebhooksAuthMethodProtocolEnumValues = []WebhooksAuthMethodProtocol{
WEBHOOKSAUTHMETHODPROTOCOL_OAUTH2_CLIENT_CREDENTIALS,
}

// GetAllowedValues reeturns the list of possible values.
func (v *WebhooksAuthMethodProtocol) GetAllowedValues() []WebhooksAuthMethodProtocol {
return allowedWebhooksAuthMethodProtocolEnumValues
}

// UnmarshalJSON deserializes the given payload.
func (v *WebhooksAuthMethodProtocol) UnmarshalJSON(src []byte) error {
var value string
err := datadog.Unmarshal(src, &value)
if err != nil {
return err
}
*v = WebhooksAuthMethodProtocol(value)
return nil
}

// NewWebhooksAuthMethodProtocolFromValue returns a pointer to a valid WebhooksAuthMethodProtocol
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
func NewWebhooksAuthMethodProtocolFromValue(v string) (*WebhooksAuthMethodProtocol, error) {
ev := WebhooksAuthMethodProtocol(v)
if ev.IsValid() {
return &ev, nil
}
return nil, fmt.Errorf("invalid value '%v' for WebhooksAuthMethodProtocol: valid values are %v", v, allowedWebhooksAuthMethodProtocolEnumValues)
}

// IsValid return true if the value is valid for the enum, false otherwise.
func (v WebhooksAuthMethodProtocol) IsValid() bool {
for _, existing := range allowedWebhooksAuthMethodProtocolEnumValues {
if existing == v {
return true
}
}
return false
}

// Ptr returns reference to WebhooksAuthMethodProtocol value.
func (v WebhooksAuthMethodProtocol) Ptr() *WebhooksAuthMethodProtocol {
return &v
}
111 changes: 111 additions & 0 deletions api/datadogV2/model_webhooks_auth_method_relationships.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV2

import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// WebhooksAuthMethodRelationships Relationships of a webhooks auth method to its protocol-specific resource.
type WebhooksAuthMethodRelationships struct {
// Relationship pointing to the OAuth2 client credentials resource for this auth method.
Oauth2ClientCredentials *WebhooksOAuth2ClientCredentialsRelationship `json:"oauth2-client-credentials,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
}

// NewWebhooksAuthMethodRelationships instantiates a new WebhooksAuthMethodRelationships 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 NewWebhooksAuthMethodRelationships() *WebhooksAuthMethodRelationships {
this := WebhooksAuthMethodRelationships{}
return &this
}

// NewWebhooksAuthMethodRelationshipsWithDefaults instantiates a new WebhooksAuthMethodRelationships 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 NewWebhooksAuthMethodRelationshipsWithDefaults() *WebhooksAuthMethodRelationships {
this := WebhooksAuthMethodRelationships{}
return &this
}

// GetOauth2ClientCredentials returns the Oauth2ClientCredentials field value if set, zero value otherwise.
func (o *WebhooksAuthMethodRelationships) GetOauth2ClientCredentials() WebhooksOAuth2ClientCredentialsRelationship {
if o == nil || o.Oauth2ClientCredentials == nil {
var ret WebhooksOAuth2ClientCredentialsRelationship
return ret
}
return *o.Oauth2ClientCredentials
}

// GetOauth2ClientCredentialsOk returns a tuple with the Oauth2ClientCredentials field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhooksAuthMethodRelationships) GetOauth2ClientCredentialsOk() (*WebhooksOAuth2ClientCredentialsRelationship, bool) {
if o == nil || o.Oauth2ClientCredentials == nil {
return nil, false
}
return o.Oauth2ClientCredentials, true
}

// HasOauth2ClientCredentials returns a boolean if a field has been set.
func (o *WebhooksAuthMethodRelationships) HasOauth2ClientCredentials() bool {
return o != nil && o.Oauth2ClientCredentials != nil
}

// SetOauth2ClientCredentials gets a reference to the given WebhooksOAuth2ClientCredentialsRelationship and assigns it to the Oauth2ClientCredentials field.
func (o *WebhooksAuthMethodRelationships) SetOauth2ClientCredentials(v WebhooksOAuth2ClientCredentialsRelationship) {
o.Oauth2ClientCredentials = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o WebhooksAuthMethodRelationships) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.Oauth2ClientCredentials != nil {
toSerialize["oauth2-client-credentials"] = o.Oauth2ClientCredentials
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *WebhooksAuthMethodRelationships) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Oauth2ClientCredentials *WebhooksOAuth2ClientCredentialsRelationship `json:"oauth2-client-credentials,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"oauth2-client-credentials"})
} else {
return err
}

hasInvalidField := false
if all.Oauth2ClientCredentials != nil && all.Oauth2ClientCredentials.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Oauth2ClientCredentials = all.Oauth2ClientCredentials

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}

return nil
}
Loading
Loading