Skip to content

Commit 80433cc

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 3943f77 of spec repo
1 parent 75f4cf7 commit 80433cc

30 files changed

Lines changed: 4001 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 509 additions & 0 deletions
Large diffs are not rendered by default.

api/datadogV2/api_webhooks_integration.go

Lines changed: 437 additions & 0 deletions
Large diffs are not rendered by default.

api/datadogV2/doc.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,11 @@
12271227
// - [WebIntegrationsApi.GetWebIntegrationAccount]
12281228
// - [WebIntegrationsApi.ListWebIntegrationAccounts]
12291229
// - [WebIntegrationsApi.UpdateWebIntegrationAccount]
1230+
// - [WebhooksIntegrationApi.CreateOAuth2ClientCredentials]
1231+
// - [WebhooksIntegrationApi.DeleteOAuth2ClientCredentials]
1232+
// - [WebhooksIntegrationApi.GetAllAuthMethods]
1233+
// - [WebhooksIntegrationApi.GetOAuth2ClientCredentials]
1234+
// - [WebhooksIntegrationApi.UpdateOAuth2ClientCredentials]
12301235
// - [WidgetsApi.CreateWidget]
12311236
// - [WidgetsApi.DeleteWidget]
12321237
// - [WidgetsApi.GetWidget]
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
9+
)
10+
11+
// WebhooksAuthMethodAttributes Attributes of a webhooks auth method.
12+
type WebhooksAuthMethodAttributes struct {
13+
// Authentication protocol used by the auth method.
14+
Protocol *WebhooksAuthMethodProtocol `json:"protocol,omitempty"`
15+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
16+
UnparsedObject map[string]interface{} `json:"-"`
17+
AdditionalProperties map[string]interface{} `json:"-"`
18+
}
19+
20+
// NewWebhooksAuthMethodAttributes instantiates a new WebhooksAuthMethodAttributes object.
21+
// This constructor will assign default values to properties that have it defined,
22+
// and makes sure properties required by API are set, but the set of arguments
23+
// will change when the set of required properties is changed.
24+
func NewWebhooksAuthMethodAttributes() *WebhooksAuthMethodAttributes {
25+
this := WebhooksAuthMethodAttributes{}
26+
return &this
27+
}
28+
29+
// NewWebhooksAuthMethodAttributesWithDefaults instantiates a new WebhooksAuthMethodAttributes object.
30+
// This constructor will only assign default values to properties that have it defined,
31+
// but it doesn't guarantee that properties required by API are set.
32+
func NewWebhooksAuthMethodAttributesWithDefaults() *WebhooksAuthMethodAttributes {
33+
this := WebhooksAuthMethodAttributes{}
34+
return &this
35+
}
36+
37+
// GetProtocol returns the Protocol field value if set, zero value otherwise.
38+
func (o *WebhooksAuthMethodAttributes) GetProtocol() WebhooksAuthMethodProtocol {
39+
if o == nil || o.Protocol == nil {
40+
var ret WebhooksAuthMethodProtocol
41+
return ret
42+
}
43+
return *o.Protocol
44+
}
45+
46+
// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise
47+
// and a boolean to check if the value has been set.
48+
func (o *WebhooksAuthMethodAttributes) GetProtocolOk() (*WebhooksAuthMethodProtocol, bool) {
49+
if o == nil || o.Protocol == nil {
50+
return nil, false
51+
}
52+
return o.Protocol, true
53+
}
54+
55+
// HasProtocol returns a boolean if a field has been set.
56+
func (o *WebhooksAuthMethodAttributes) HasProtocol() bool {
57+
return o != nil && o.Protocol != nil
58+
}
59+
60+
// SetProtocol gets a reference to the given WebhooksAuthMethodProtocol and assigns it to the Protocol field.
61+
func (o *WebhooksAuthMethodAttributes) SetProtocol(v WebhooksAuthMethodProtocol) {
62+
o.Protocol = &v
63+
}
64+
65+
// MarshalJSON serializes the struct using spec logic.
66+
func (o WebhooksAuthMethodAttributes) MarshalJSON() ([]byte, error) {
67+
toSerialize := map[string]interface{}{}
68+
if o.UnparsedObject != nil {
69+
return datadog.Marshal(o.UnparsedObject)
70+
}
71+
if o.Protocol != nil {
72+
toSerialize["protocol"] = o.Protocol
73+
}
74+
75+
for key, value := range o.AdditionalProperties {
76+
toSerialize[key] = value
77+
}
78+
return datadog.Marshal(toSerialize)
79+
}
80+
81+
// UnmarshalJSON deserializes the given payload.
82+
func (o *WebhooksAuthMethodAttributes) UnmarshalJSON(bytes []byte) (err error) {
83+
all := struct {
84+
Protocol *WebhooksAuthMethodProtocol `json:"protocol,omitempty"`
85+
}{}
86+
if err = datadog.Unmarshal(bytes, &all); err != nil {
87+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
88+
}
89+
additionalProperties := make(map[string]interface{})
90+
if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil {
91+
datadog.DeleteKeys(additionalProperties, &[]string{"protocol"})
92+
} else {
93+
return err
94+
}
95+
96+
hasInvalidField := false
97+
if all.Protocol != nil && !all.Protocol.IsValid() {
98+
hasInvalidField = true
99+
} else {
100+
o.Protocol = all.Protocol
101+
}
102+
103+
if len(additionalProperties) > 0 {
104+
o.AdditionalProperties = additionalProperties
105+
}
106+
107+
if hasInvalidField {
108+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
109+
}
110+
111+
return nil
112+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// WebhooksAuthMethodProtocol Authentication protocol used by the auth method.
14+
type WebhooksAuthMethodProtocol string
15+
16+
// List of WebhooksAuthMethodProtocol.
17+
const (
18+
WEBHOOKSAUTHMETHODPROTOCOL_OAUTH2_CLIENT_CREDENTIALS WebhooksAuthMethodProtocol = "oauth2-client-credentials"
19+
)
20+
21+
var allowedWebhooksAuthMethodProtocolEnumValues = []WebhooksAuthMethodProtocol{
22+
WEBHOOKSAUTHMETHODPROTOCOL_OAUTH2_CLIENT_CREDENTIALS,
23+
}
24+
25+
// GetAllowedValues reeturns the list of possible values.
26+
func (v *WebhooksAuthMethodProtocol) GetAllowedValues() []WebhooksAuthMethodProtocol {
27+
return allowedWebhooksAuthMethodProtocolEnumValues
28+
}
29+
30+
// UnmarshalJSON deserializes the given payload.
31+
func (v *WebhooksAuthMethodProtocol) UnmarshalJSON(src []byte) error {
32+
var value string
33+
err := datadog.Unmarshal(src, &value)
34+
if err != nil {
35+
return err
36+
}
37+
*v = WebhooksAuthMethodProtocol(value)
38+
return nil
39+
}
40+
41+
// NewWebhooksAuthMethodProtocolFromValue returns a pointer to a valid WebhooksAuthMethodProtocol
42+
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
43+
func NewWebhooksAuthMethodProtocolFromValue(v string) (*WebhooksAuthMethodProtocol, error) {
44+
ev := WebhooksAuthMethodProtocol(v)
45+
if ev.IsValid() {
46+
return &ev, nil
47+
}
48+
return nil, fmt.Errorf("invalid value '%v' for WebhooksAuthMethodProtocol: valid values are %v", v, allowedWebhooksAuthMethodProtocolEnumValues)
49+
}
50+
51+
// IsValid return true if the value is valid for the enum, false otherwise.
52+
func (v WebhooksAuthMethodProtocol) IsValid() bool {
53+
for _, existing := range allowedWebhooksAuthMethodProtocolEnumValues {
54+
if existing == v {
55+
return true
56+
}
57+
}
58+
return false
59+
}
60+
61+
// Ptr returns reference to WebhooksAuthMethodProtocol value.
62+
func (v WebhooksAuthMethodProtocol) Ptr() *WebhooksAuthMethodProtocol {
63+
return &v
64+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
9+
)
10+
11+
// WebhooksAuthMethodRelationships Relationships of a webhooks auth method to its protocol-specific resource.
12+
type WebhooksAuthMethodRelationships struct {
13+
// Relationship pointing to the OAuth2 client credentials resource for this auth method.
14+
Oauth2ClientCredentials *WebhooksOAuth2ClientCredentialsRelationship `json:"oauth2-client-credentials,omitempty"`
15+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
16+
UnparsedObject map[string]interface{} `json:"-"`
17+
AdditionalProperties map[string]interface{} `json:"-"`
18+
}
19+
20+
// NewWebhooksAuthMethodRelationships instantiates a new WebhooksAuthMethodRelationships object.
21+
// This constructor will assign default values to properties that have it defined,
22+
// and makes sure properties required by API are set, but the set of arguments
23+
// will change when the set of required properties is changed.
24+
func NewWebhooksAuthMethodRelationships() *WebhooksAuthMethodRelationships {
25+
this := WebhooksAuthMethodRelationships{}
26+
return &this
27+
}
28+
29+
// NewWebhooksAuthMethodRelationshipsWithDefaults instantiates a new WebhooksAuthMethodRelationships object.
30+
// This constructor will only assign default values to properties that have it defined,
31+
// but it doesn't guarantee that properties required by API are set.
32+
func NewWebhooksAuthMethodRelationshipsWithDefaults() *WebhooksAuthMethodRelationships {
33+
this := WebhooksAuthMethodRelationships{}
34+
return &this
35+
}
36+
37+
// GetOauth2ClientCredentials returns the Oauth2ClientCredentials field value if set, zero value otherwise.
38+
func (o *WebhooksAuthMethodRelationships) GetOauth2ClientCredentials() WebhooksOAuth2ClientCredentialsRelationship {
39+
if o == nil || o.Oauth2ClientCredentials == nil {
40+
var ret WebhooksOAuth2ClientCredentialsRelationship
41+
return ret
42+
}
43+
return *o.Oauth2ClientCredentials
44+
}
45+
46+
// GetOauth2ClientCredentialsOk returns a tuple with the Oauth2ClientCredentials field value if set, nil otherwise
47+
// and a boolean to check if the value has been set.
48+
func (o *WebhooksAuthMethodRelationships) GetOauth2ClientCredentialsOk() (*WebhooksOAuth2ClientCredentialsRelationship, bool) {
49+
if o == nil || o.Oauth2ClientCredentials == nil {
50+
return nil, false
51+
}
52+
return o.Oauth2ClientCredentials, true
53+
}
54+
55+
// HasOauth2ClientCredentials returns a boolean if a field has been set.
56+
func (o *WebhooksAuthMethodRelationships) HasOauth2ClientCredentials() bool {
57+
return o != nil && o.Oauth2ClientCredentials != nil
58+
}
59+
60+
// SetOauth2ClientCredentials gets a reference to the given WebhooksOAuth2ClientCredentialsRelationship and assigns it to the Oauth2ClientCredentials field.
61+
func (o *WebhooksAuthMethodRelationships) SetOauth2ClientCredentials(v WebhooksOAuth2ClientCredentialsRelationship) {
62+
o.Oauth2ClientCredentials = &v
63+
}
64+
65+
// MarshalJSON serializes the struct using spec logic.
66+
func (o WebhooksAuthMethodRelationships) MarshalJSON() ([]byte, error) {
67+
toSerialize := map[string]interface{}{}
68+
if o.UnparsedObject != nil {
69+
return datadog.Marshal(o.UnparsedObject)
70+
}
71+
if o.Oauth2ClientCredentials != nil {
72+
toSerialize["oauth2-client-credentials"] = o.Oauth2ClientCredentials
73+
}
74+
75+
for key, value := range o.AdditionalProperties {
76+
toSerialize[key] = value
77+
}
78+
return datadog.Marshal(toSerialize)
79+
}
80+
81+
// UnmarshalJSON deserializes the given payload.
82+
func (o *WebhooksAuthMethodRelationships) UnmarshalJSON(bytes []byte) (err error) {
83+
all := struct {
84+
Oauth2ClientCredentials *WebhooksOAuth2ClientCredentialsRelationship `json:"oauth2-client-credentials,omitempty"`
85+
}{}
86+
if err = datadog.Unmarshal(bytes, &all); err != nil {
87+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
88+
}
89+
additionalProperties := make(map[string]interface{})
90+
if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil {
91+
datadog.DeleteKeys(additionalProperties, &[]string{"oauth2-client-credentials"})
92+
} else {
93+
return err
94+
}
95+
96+
hasInvalidField := false
97+
if all.Oauth2ClientCredentials != nil && all.Oauth2ClientCredentials.UnparsedObject != nil && o.UnparsedObject == nil {
98+
hasInvalidField = true
99+
}
100+
o.Oauth2ClientCredentials = all.Oauth2ClientCredentials
101+
102+
if len(additionalProperties) > 0 {
103+
o.AdditionalProperties = additionalProperties
104+
}
105+
106+
if hasInvalidField {
107+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
108+
}
109+
110+
return nil
111+
}

0 commit comments

Comments
 (0)