diff --git a/.apigentools-info b/.apigentools-info index 5055abec4b9..79e2c2e3da3 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-04 10:38:19.185228", - "spec_repo_commit": "7a63d530" + "regenerated": "2024-10-04 15:31:50.458429", + "spec_repo_commit": "f28ad048" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-04 10:38:19.200021", - "spec_repo_commit": "7a63d530" + "regenerated": "2024-10-04 15:31:50.473143", + "spec_repo_commit": "f28ad048" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5233ad64ba8..e24460a1bda 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -10640,6 +10640,7 @@ components: oneOf: - $ref: '#/components/schemas/SlackIntegrationMetadata' - $ref: '#/components/schemas/JiraIntegrationMetadata' + - $ref: '#/components/schemas/MSTeamsIntegrationMetadata' IncidentIntegrationMetadataPatchData: description: Incident integration metadata data for a patch request. properties: @@ -13634,6 +13635,43 @@ components: from the other indexes type: string type: object + MSTeamsIntegrationMetadata: + description: Incident integration metadata for the Microsoft Teams integration. + properties: + teams: + description: Array of Microsoft Teams in this integration metadata. + example: [] + items: + $ref: '#/components/schemas/MSTeamsIntegrationMetadataTeamsItem' + type: array + required: + - teams + type: object + MSTeamsIntegrationMetadataTeamsItem: + description: Item in the Microsoft Teams integration metadata teams array. + properties: + ms_channel_id: + description: Microsoft Teams channel ID. + example: 19:abc00abcdef00a0abcdef0abcdef0a@thread.tacv2 + type: string + ms_channel_name: + description: Microsoft Teams channel name. + example: incident-0001-example + type: string + ms_tenant_id: + description: Microsoft Teams tenant ID. + example: 00000000-abcd-0005-0000-000000000000 + type: string + redirect_url: + description: URL redirecting to the Microsoft Teams channel. + example: https://teams.microsoft.com/l/channel/19%3Aabc00abcdef00a0abcdef0abcdef0a%40thread.tacv2/conversations?groupId=12345678-abcd-dcba-abcd-1234567890ab&tenantId=00000000-abcd-0005-0000-000000000000 + type: string + required: + - ms_tenant_id + - ms_channel_id + - ms_channel_name + - redirect_url + type: object Metric: description: Object for a single metric tag configuration. example: diff --git a/api/datadogV2/model_incident_integration_metadata_metadata.go b/api/datadogV2/model_incident_integration_metadata_metadata.go index c81d925df6e..4990a3669fc 100644 --- a/api/datadogV2/model_incident_integration_metadata_metadata.go +++ b/api/datadogV2/model_incident_integration_metadata_metadata.go @@ -10,8 +10,9 @@ import ( // IncidentIntegrationMetadataMetadata - Incident integration metadata's metadata attribute. type IncidentIntegrationMetadataMetadata struct { - SlackIntegrationMetadata *SlackIntegrationMetadata - JiraIntegrationMetadata *JiraIntegrationMetadata + SlackIntegrationMetadata *SlackIntegrationMetadata + JiraIntegrationMetadata *JiraIntegrationMetadata + MSTeamsIntegrationMetadata *MSTeamsIntegrationMetadata // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject interface{} @@ -27,6 +28,11 @@ func JiraIntegrationMetadataAsIncidentIntegrationMetadataMetadata(v *JiraIntegra return IncidentIntegrationMetadataMetadata{JiraIntegrationMetadata: v} } +// MSTeamsIntegrationMetadataAsIncidentIntegrationMetadataMetadata is a convenience function that returns MSTeamsIntegrationMetadata wrapped in IncidentIntegrationMetadataMetadata. +func MSTeamsIntegrationMetadataAsIncidentIntegrationMetadataMetadata(v *MSTeamsIntegrationMetadata) IncidentIntegrationMetadataMetadata { + return IncidentIntegrationMetadataMetadata{MSTeamsIntegrationMetadata: v} +} + // UnmarshalJSON turns data into one of the pointers in the struct. func (obj *IncidentIntegrationMetadataMetadata) UnmarshalJSON(data []byte) error { var err error @@ -65,10 +71,28 @@ func (obj *IncidentIntegrationMetadataMetadata) UnmarshalJSON(data []byte) error obj.JiraIntegrationMetadata = nil } + // try to unmarshal data into MSTeamsIntegrationMetadata + err = datadog.Unmarshal(data, &obj.MSTeamsIntegrationMetadata) + if err == nil { + if obj.MSTeamsIntegrationMetadata != nil && obj.MSTeamsIntegrationMetadata.UnparsedObject == nil { + jsonMSTeamsIntegrationMetadata, _ := datadog.Marshal(obj.MSTeamsIntegrationMetadata) + if string(jsonMSTeamsIntegrationMetadata) == "{}" { // empty struct + obj.MSTeamsIntegrationMetadata = nil + } else { + match++ + } + } else { + obj.MSTeamsIntegrationMetadata = nil + } + } else { + obj.MSTeamsIntegrationMetadata = nil + } + if match != 1 { // more than 1 match // reset to nil obj.SlackIntegrationMetadata = nil obj.JiraIntegrationMetadata = nil + obj.MSTeamsIntegrationMetadata = nil return datadog.Unmarshal(data, &obj.UnparsedObject) } return nil // exactly one match @@ -84,6 +108,10 @@ func (obj IncidentIntegrationMetadataMetadata) MarshalJSON() ([]byte, error) { return datadog.Marshal(&obj.JiraIntegrationMetadata) } + if obj.MSTeamsIntegrationMetadata != nil { + return datadog.Marshal(&obj.MSTeamsIntegrationMetadata) + } + if obj.UnparsedObject != nil { return datadog.Marshal(obj.UnparsedObject) } @@ -100,6 +128,10 @@ func (obj *IncidentIntegrationMetadataMetadata) GetActualInstance() interface{} return obj.JiraIntegrationMetadata } + if obj.MSTeamsIntegrationMetadata != nil { + return obj.MSTeamsIntegrationMetadata + } + // all schemas are nil return nil } diff --git a/api/datadogV2/model_ms_teams_integration_metadata.go b/api/datadogV2/model_ms_teams_integration_metadata.go new file mode 100644 index 00000000000..958241781a2 --- /dev/null +++ b/api/datadogV2/model_ms_teams_integration_metadata.go @@ -0,0 +1,101 @@ +// 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" +) + +// MSTeamsIntegrationMetadata Incident integration metadata for the Microsoft Teams integration. +type MSTeamsIntegrationMetadata struct { + // Array of Microsoft Teams in this integration metadata. + Teams []MSTeamsIntegrationMetadataTeamsItem `json:"teams"` + // 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:"-"` +} + +// NewMSTeamsIntegrationMetadata instantiates a new MSTeamsIntegrationMetadata 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 NewMSTeamsIntegrationMetadata(teams []MSTeamsIntegrationMetadataTeamsItem) *MSTeamsIntegrationMetadata { + this := MSTeamsIntegrationMetadata{} + this.Teams = teams + return &this +} + +// NewMSTeamsIntegrationMetadataWithDefaults instantiates a new MSTeamsIntegrationMetadata 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 NewMSTeamsIntegrationMetadataWithDefaults() *MSTeamsIntegrationMetadata { + this := MSTeamsIntegrationMetadata{} + return &this +} + +// GetTeams returns the Teams field value. +func (o *MSTeamsIntegrationMetadata) GetTeams() []MSTeamsIntegrationMetadataTeamsItem { + if o == nil { + var ret []MSTeamsIntegrationMetadataTeamsItem + return ret + } + return o.Teams +} + +// GetTeamsOk returns a tuple with the Teams field value +// and a boolean to check if the value has been set. +func (o *MSTeamsIntegrationMetadata) GetTeamsOk() (*[]MSTeamsIntegrationMetadataTeamsItem, bool) { + if o == nil { + return nil, false + } + return &o.Teams, true +} + +// SetTeams sets field value. +func (o *MSTeamsIntegrationMetadata) SetTeams(v []MSTeamsIntegrationMetadataTeamsItem) { + o.Teams = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MSTeamsIntegrationMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["teams"] = o.Teams + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MSTeamsIntegrationMetadata) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Teams *[]MSTeamsIntegrationMetadataTeamsItem `json:"teams"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Teams == nil { + return fmt.Errorf("required field teams missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"teams"}) + } else { + return err + } + o.Teams = *all.Teams + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_ms_teams_integration_metadata_teams_item.go b/api/datadogV2/model_ms_teams_integration_metadata_teams_item.go new file mode 100644 index 00000000000..282f031fef0 --- /dev/null +++ b/api/datadogV2/model_ms_teams_integration_metadata_teams_item.go @@ -0,0 +1,197 @@ +// 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" +) + +// MSTeamsIntegrationMetadataTeamsItem Item in the Microsoft Teams integration metadata teams array. +type MSTeamsIntegrationMetadataTeamsItem struct { + // Microsoft Teams channel ID. + MsChannelId string `json:"ms_channel_id"` + // Microsoft Teams channel name. + MsChannelName string `json:"ms_channel_name"` + // Microsoft Teams tenant ID. + MsTenantId string `json:"ms_tenant_id"` + // URL redirecting to the Microsoft Teams channel. + RedirectUrl string `json:"redirect_url"` + // 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:"-"` +} + +// NewMSTeamsIntegrationMetadataTeamsItem instantiates a new MSTeamsIntegrationMetadataTeamsItem 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 NewMSTeamsIntegrationMetadataTeamsItem(msChannelId string, msChannelName string, msTenantId string, redirectUrl string) *MSTeamsIntegrationMetadataTeamsItem { + this := MSTeamsIntegrationMetadataTeamsItem{} + this.MsChannelId = msChannelId + this.MsChannelName = msChannelName + this.MsTenantId = msTenantId + this.RedirectUrl = redirectUrl + return &this +} + +// NewMSTeamsIntegrationMetadataTeamsItemWithDefaults instantiates a new MSTeamsIntegrationMetadataTeamsItem 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 NewMSTeamsIntegrationMetadataTeamsItemWithDefaults() *MSTeamsIntegrationMetadataTeamsItem { + this := MSTeamsIntegrationMetadataTeamsItem{} + return &this +} + +// GetMsChannelId returns the MsChannelId field value. +func (o *MSTeamsIntegrationMetadataTeamsItem) GetMsChannelId() string { + if o == nil { + var ret string + return ret + } + return o.MsChannelId +} + +// GetMsChannelIdOk returns a tuple with the MsChannelId field value +// and a boolean to check if the value has been set. +func (o *MSTeamsIntegrationMetadataTeamsItem) GetMsChannelIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MsChannelId, true +} + +// SetMsChannelId sets field value. +func (o *MSTeamsIntegrationMetadataTeamsItem) SetMsChannelId(v string) { + o.MsChannelId = v +} + +// GetMsChannelName returns the MsChannelName field value. +func (o *MSTeamsIntegrationMetadataTeamsItem) GetMsChannelName() string { + if o == nil { + var ret string + return ret + } + return o.MsChannelName +} + +// GetMsChannelNameOk returns a tuple with the MsChannelName field value +// and a boolean to check if the value has been set. +func (o *MSTeamsIntegrationMetadataTeamsItem) GetMsChannelNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MsChannelName, true +} + +// SetMsChannelName sets field value. +func (o *MSTeamsIntegrationMetadataTeamsItem) SetMsChannelName(v string) { + o.MsChannelName = v +} + +// GetMsTenantId returns the MsTenantId field value. +func (o *MSTeamsIntegrationMetadataTeamsItem) GetMsTenantId() string { + if o == nil { + var ret string + return ret + } + return o.MsTenantId +} + +// GetMsTenantIdOk returns a tuple with the MsTenantId field value +// and a boolean to check if the value has been set. +func (o *MSTeamsIntegrationMetadataTeamsItem) GetMsTenantIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MsTenantId, true +} + +// SetMsTenantId sets field value. +func (o *MSTeamsIntegrationMetadataTeamsItem) SetMsTenantId(v string) { + o.MsTenantId = v +} + +// GetRedirectUrl returns the RedirectUrl field value. +func (o *MSTeamsIntegrationMetadataTeamsItem) GetRedirectUrl() string { + if o == nil { + var ret string + return ret + } + return o.RedirectUrl +} + +// GetRedirectUrlOk returns a tuple with the RedirectUrl field value +// and a boolean to check if the value has been set. +func (o *MSTeamsIntegrationMetadataTeamsItem) GetRedirectUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RedirectUrl, true +} + +// SetRedirectUrl sets field value. +func (o *MSTeamsIntegrationMetadataTeamsItem) SetRedirectUrl(v string) { + o.RedirectUrl = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MSTeamsIntegrationMetadataTeamsItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["ms_channel_id"] = o.MsChannelId + toSerialize["ms_channel_name"] = o.MsChannelName + toSerialize["ms_tenant_id"] = o.MsTenantId + toSerialize["redirect_url"] = o.RedirectUrl + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MSTeamsIntegrationMetadataTeamsItem) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + MsChannelId *string `json:"ms_channel_id"` + MsChannelName *string `json:"ms_channel_name"` + MsTenantId *string `json:"ms_tenant_id"` + RedirectUrl *string `json:"redirect_url"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.MsChannelId == nil { + return fmt.Errorf("required field ms_channel_id missing") + } + if all.MsChannelName == nil { + return fmt.Errorf("required field ms_channel_name missing") + } + if all.MsTenantId == nil { + return fmt.Errorf("required field ms_tenant_id missing") + } + if all.RedirectUrl == nil { + return fmt.Errorf("required field redirect_url missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"ms_channel_id", "ms_channel_name", "ms_tenant_id", "redirect_url"}) + } else { + return err + } + o.MsChannelId = *all.MsChannelId + o.MsChannelName = *all.MsChannelName + o.MsTenantId = *all.MsTenantId + o.RedirectUrl = *all.RedirectUrl + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +}