diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 440627d7e6b..ecadd5414e6 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -79306,6 +79306,321 @@ components: type: string x-enum-varnames: - SECRET + TransportWebhookLog: + description: A single email transport webhook log event. + properties: + attributes: + $ref: "#/components/schemas/TransportWebhookLogAttributes" + date: + description: The ISO 8601 timestamp of the event. + example: "2024-01-15T10:30:00Z" + format: date-time + type: string + log_id: + description: The unique log event identifier. + example: "AQAAAZPHnBT0TwJAdgAAAABBWlBIblVlNEFBQ0dFMmVkYTFDSnRR" + type: string + source: + description: The email transport provider. + example: "sendgrid" + type: string + status: + description: The log status level. + example: "info" + type: string + tags: + description: A list of tags associated with the event. + example: ["env:production"] + items: + description: A tag in key:value or key-only form (for example, env:production). + type: string + type: array + required: + - date + - log_id + - source + - status + - tags + - attributes + type: object + TransportWebhookLogAttributes: + description: Top-level attributes for the webhook log event, including delivery status, recipient details, and provider metadata. + properties: + category: + description: The event categories. + example: ["transactional"] + items: + description: An event category assigned by the transport provider. + type: string + type: array + email: + $ref: "#/components/schemas/TransportWebhookLogEmail" + email_id: + description: The unique email identifier. + example: "abc123-def456" + type: string + email_type_display_name: + description: The human-readable email type name. + example: "Monitor Alert" + type: string + message: + $ref: "#/components/schemas/TransportWebhookLogMessage" + network: + $ref: "#/components/schemas/TransportWebhookLogNetwork" + org: + description: The numeric organization identifier. + example: 1234 + format: int64 + type: integer + org_metadata: + $ref: "#/components/schemas/TransportWebhookLogOrgMetadata" + org_uuid: + description: The organization UUID. + example: "8dee7c38-00cb-11ea-a77b-8b5a08d3b091" + type: string + queue_time: + description: The timestamp when the email was queued. + example: "2024-01-15T10:29:00Z" + type: string + sg_machine_open: + description: Indicates whether the open event was triggered by automated machine activity rather than a human recipient (SendGrid-specific). + type: boolean + subject: + description: The email subject line. + example: "[Monitor Alert] CPU usage is high" + type: string + useragent: + description: The user agent string for open events. + example: "Mozilla/5.0" + type: string + type: object + TransportWebhookLogBatchRequest: + description: A batch of email transport webhook log events. + items: + $ref: "#/components/schemas/TransportWebhookLog" + type: array + TransportWebhookLogEmail: + description: The email address details. + properties: + address: + description: The recipient email address. + example: "user@example.com" + type: string + domain: + description: The recipient domain. + example: "example.com" + type: string + subject: + description: The email subject line. + example: "[Monitor Alert] CPU usage is high" + type: string + type: + description: Email categorization tags applied by the transport provider (for example, "transactional", "marketing"). + example: ["transactional"] + items: + description: An email type classification (for example, "transactional", "user"). + type: string + type: array + type: object + TransportWebhookLogIpAttribute: + description: An IP attribute with its sources. + properties: + ip: + description: The IP address. + example: "192.168.1.1" + type: string + source: + description: The transport providers or systems that reported this IP address. + example: ["sendgrid"] + items: + description: A transport provider or system that reported this IP address. + type: string + type: array + type: object + TransportWebhookLogMessage: + description: The message delivery event details. + properties: + auth: + $ref: "#/components/schemas/TransportWebhookLogMessageAuth" + custom_args: + $ref: "#/components/schemas/TransportWebhookLogMessageCustomArgs" + id: + $ref: "#/components/schemas/TransportWebhookLogMessageId" + name: + description: The delivery event type emitted by the transport provider (for example, "delivered", "dropped", "bounced"). + example: "delivered" + type: string + response: + $ref: "#/components/schemas/TransportWebhookLogMessageResponse" + sender_ip: + description: The IP address of the sending server. + example: "192.168.1.1" + type: string + timestamp: + $ref: "#/components/schemas/TransportWebhookLogMessageTimestamp" + type: object + TransportWebhookLogMessageAuth: + description: The message authentication details. + properties: + delivered_with_tls: + description: The TLS version or negotiation information. + example: "TLSv1.2" + type: string + type: object + TransportWebhookLogMessageCustomArgs: + description: Custom arguments passed through the email transport provider for tracking. + properties: + email_id: + description: The unique email identifier. + example: "abc123-def456" + type: string + email_type_display_name: + description: The human-readable email type name. + example: "Monitor Alert" + type: string + org_uuid: + description: The organization UUID. + example: "8dee7c38-00cb-11ea-a77b-8b5a08d3b091" + type: string + queue_time: + description: The timestamp when the email was queued. + example: "2024-01-15T10:29:00Z" + type: string + subject: + description: The email subject line. + example: "[Monitor Alert] CPU usage is high" + type: string + type: object + TransportWebhookLogMessageId: + description: The message identifiers. + properties: + message_id: + description: The RFC 5322 Message-ID. + example: "" + type: string + smtp_id: + description: The SMTP transaction identifier. + example: "" + type: string + transport_event_id: + description: The transport provider event identifier. + example: "evt_abc123" + type: string + type: object + TransportWebhookLogMessageResponse: + description: The SMTP response information. + properties: + enhanced_smtp_code: + description: The enhanced SMTP status code. + example: "2.0.0" + type: string + reason: + description: The SMTP response message. + example: "250 2.0.0 OK" + type: string + smtp_code: + description: The SMTP status code. + example: "250" + type: string + type: object + TransportWebhookLogMessageTimestamp: + description: The message delivery timing information. + properties: + event_timestamp: + description: The Unix timestamp of the event. + example: 1705312200.0 + format: double + type: number + lifetime: + description: The total delivery time in seconds. + example: 3.2 + format: double + type: number + queue_time: + description: Number of seconds the message spent in the delivery queue. + example: 1.5 + format: double + type: number + scheduled_time: + description: The scheduled delivery time as a Unix timestamp. + example: 1705312190.0 + format: double + type: number + type: object + TransportWebhookLogNetwork: + description: The network information for the event. + properties: + ip: + $ref: "#/components/schemas/TransportWebhookLogNetworkIp" + type: object + TransportWebhookLogNetworkIp: + description: The IP address information. + properties: + attributes: + description: Per-IP attribute records, each pairing an IP address with the providers that observed it. + items: + $ref: "#/components/schemas/TransportWebhookLogIpAttribute" + type: array + list: + description: The list of IP addresses. + example: ["192.168.1.1"] + items: + description: An IP address observed during message delivery. + type: string + type: array + type: object + TransportWebhookLogOrgMetadata: + description: Metadata about the organization that sent the email. + properties: + billing_country: + description: Country code or name used for billing purposes. + type: string + billing_plan: + description: The Datadog billing plan for the organization (for example, "pro", "enterprise"). + type: string + customer_tier: + description: Support or account tier assigned to the organization (for example, "tier-1"). + type: string + domain: + description: Primary email domain associated with the organization (for example, "example.com"). + type: string + industry: + description: Industry classification of the organization (for example, "technology", "finance"). + type: string + is_bugbounty: + description: Whether the organization is enrolled in the Datadog bug bounty program. + type: string + is_msp: + description: Whether the organization operates as a Managed Service Provider managing child orgs. + type: string + name: + description: Display name of the organization as configured in Datadog account settings. + type: string + org_uuid: + description: Globally unique identifier for the Datadog organization (UUID v1 format). + type: string + parent_org_id: + description: Identifier of the immediate parent organization, if this is a child org. + type: string + premium_support: + description: Whether the organization has a premium support plan with Datadog. + type: string + root_org_id: + description: Identifier of the top-level parent organization in a multi-org account hierarchy. + type: string + root_org_name: + description: Display name of the top-level parent organization in a multi-org account hierarchy. + type: string + shipping_country: + description: Country code or name used for shipping or regional assignment. + type: string + website: + description: Website URL provided during organization registration. + type: string + when_created: + description: ISO 8601 timestamp of when the Datadog organization was created. + type: string + type: object Trigger: description: "One of the triggers that can start the execution of a workflow." oneOf: @@ -99657,6 +99972,70 @@ paths: operator: OR permissions: - monitors_downtime + /api/v2/email/transport/webhook_intake: + post: + description: |- + Receives a batch of email transport webhook log events and emits an audit trail entry + for each event with a final delivery status (delivered, dropped, or bounced). + Only authorized organizations can submit events. + operationId: CreateEmailTransportWebhookIntake + requestBody: + content: + application/json: + examples: + default: + value: + - attributes: + email: + address: "user@example.com" + domain: "example.com" + email_id: "abc123-def456" + email_type_display_name: "Monitor Alert" + message: + id: + message_id: "" + smtp_id: "" + name: "delivered" + response: + reason: "250 2.0.0 OK" + smtp_code: "250" + timestamp: + event_timestamp: 1705312200.0 + org: 1234 + org_uuid: "8dee7c38-00cb-11ea-a77b-8b5a08d3b091" + subject: "[Monitor Alert] CPU usage is high" + date: "2024-01-15T10:30:00Z" + log_id: "AQAAAZPHnBT0TwJAdgAAAABBWlBIblVlNEFBQ0dFMmVkYTFDSnRR" + source: "sendgrid" + status: "info" + tags: + - "env:production" + schema: + $ref: "#/components/schemas/TransportWebhookLogBatchRequest" + required: true + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Ingest email transport webhook events + tags: + - Email Transport + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/error-tracking/issues/search: post: description: Search issues endpoint allows you to programmatically search for issues within your organization. This endpoint returns a list of issues that match a given search query, following the event search syntax. The search results are limited to a maximum of 100 issues per request. @@ -145653,6 +146032,8 @@ tags: scopes from alerting. Downtime settings, which can be scheduled with start and end times, prevent all alerting related to specified Datadog tags. name: Downtimes + - description: Endpoints for receiving email transport webhook events for audit trail processing. + name: Email Transport - description: Retrieves security risk scores for entities in your organization. name: Entity Risk Scores - description: View and manage issues within Error Tracking. See the [Error Tracking page](https://docs.datadoghq.com/error_tracking/) for more information. diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 99b01bb325f..466fdc5572d 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -782,6 +782,7 @@ func NewConfiguration() *Configuration { "v2.TriggerDeploymentGatesEvaluation": false, "v2.UpdateDeploymentGate": false, "v2.UpdateDeploymentRule": false, + "v2.CreateEmailTransportWebhookIntake": false, "v2.CreateHamrOrgConnection": false, "v2.GetHamrOrgConnection": false, "v2.CreateGlobalIncidentHandle": false, diff --git a/api/datadogV2/api_email_transport.go b/api/datadogV2/api_email_transport.go new file mode 100644 index 00000000000..5917f132b29 --- /dev/null +++ b/api/datadogV2/api_email_transport.go @@ -0,0 +1,115 @@ +// 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 ( + _context "context" + _fmt "fmt" + _log "log" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// EmailTransportApi service type +type EmailTransportApi datadog.Service + +// CreateEmailTransportWebhookIntake Ingest email transport webhook events. +// Receives a batch of email transport webhook log events and emits an audit trail entry +// for each event with a final delivery status (delivered, dropped, or bounced). +// Only authorized organizations can submit events. +func (a *EmailTransportApi) CreateEmailTransportWebhookIntake(ctx _context.Context, body []TransportWebhookLog) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + ) + + operationId := "v2.CreateEmailTransportWebhookIntake" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.EmailTransportApi.CreateEmailTransportWebhookIntake") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/email/transport/webhook_intake" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// NewEmailTransportApi Returns NewEmailTransportApi. +func NewEmailTransportApi(client *datadog.APIClient) *EmailTransportApi { + return &EmailTransportApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 3697d4dafda..b34eeb42a85 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -282,6 +282,7 @@ // - [DowntimesApi.ListDowntimes] // - [DowntimesApi.ListMonitorDowntimes] // - [DowntimesApi.UpdateDowntime] +// - [EmailTransportApi.CreateEmailTransportWebhookIntake] // - [EntityRiskScoresApi.ListEntityRiskScores] // - [ErrorTrackingApi.DeleteIssueAssignee] // - [ErrorTrackingApi.GetIssue] diff --git a/api/datadogV2/model_transport_webhook_log.go b/api/datadogV2/model_transport_webhook_log.go new file mode 100644 index 00000000000..7342e148703 --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log.go @@ -0,0 +1,275 @@ +// 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" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TransportWebhookLog A single email transport webhook log event. +type TransportWebhookLog struct { + // Top-level attributes for the webhook log event, including delivery status, recipient details, and provider metadata. + Attributes TransportWebhookLogAttributes `json:"attributes"` + // The ISO 8601 timestamp of the event. + Date time.Time `json:"date"` + // The unique log event identifier. + LogId string `json:"log_id"` + // The email transport provider. + Source string `json:"source"` + // The log status level. + Status string `json:"status"` + // A list of tags associated with the event. + Tags []string `json:"tags"` + // 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:"-"` +} + +// NewTransportWebhookLog instantiates a new TransportWebhookLog 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 NewTransportWebhookLog(attributes TransportWebhookLogAttributes, date time.Time, logId string, source string, status string, tags []string) *TransportWebhookLog { + this := TransportWebhookLog{} + this.Attributes = attributes + this.Date = date + this.LogId = logId + this.Source = source + this.Status = status + this.Tags = tags + return &this +} + +// NewTransportWebhookLogWithDefaults instantiates a new TransportWebhookLog 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 NewTransportWebhookLogWithDefaults() *TransportWebhookLog { + this := TransportWebhookLog{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *TransportWebhookLog) GetAttributes() TransportWebhookLogAttributes { + if o == nil { + var ret TransportWebhookLogAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *TransportWebhookLog) GetAttributesOk() (*TransportWebhookLogAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *TransportWebhookLog) SetAttributes(v TransportWebhookLogAttributes) { + o.Attributes = v +} + +// GetDate returns the Date field value. +func (o *TransportWebhookLog) GetDate() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.Date +} + +// GetDateOk returns a tuple with the Date field value +// and a boolean to check if the value has been set. +func (o *TransportWebhookLog) GetDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Date, true +} + +// SetDate sets field value. +func (o *TransportWebhookLog) SetDate(v time.Time) { + o.Date = v +} + +// GetLogId returns the LogId field value. +func (o *TransportWebhookLog) GetLogId() string { + if o == nil { + var ret string + return ret + } + return o.LogId +} + +// GetLogIdOk returns a tuple with the LogId field value +// and a boolean to check if the value has been set. +func (o *TransportWebhookLog) GetLogIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.LogId, true +} + +// SetLogId sets field value. +func (o *TransportWebhookLog) SetLogId(v string) { + o.LogId = v +} + +// GetSource returns the Source field value. +func (o *TransportWebhookLog) GetSource() string { + if o == nil { + var ret string + return ret + } + return o.Source +} + +// GetSourceOk returns a tuple with the Source field value +// and a boolean to check if the value has been set. +func (o *TransportWebhookLog) GetSourceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Source, true +} + +// SetSource sets field value. +func (o *TransportWebhookLog) SetSource(v string) { + o.Source = v +} + +// GetStatus returns the Status field value. +func (o *TransportWebhookLog) GetStatus() string { + if o == nil { + var ret string + return ret + } + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *TransportWebhookLog) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value. +func (o *TransportWebhookLog) SetStatus(v string) { + o.Status = v +} + +// GetTags returns the Tags field value. +func (o *TransportWebhookLog) GetTags() []string { + if o == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *TransportWebhookLog) GetTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Tags, true +} + +// SetTags sets field value. +func (o *TransportWebhookLog) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLog) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + if o.Date.Nanosecond() == 0 { + toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["date"] = o.Date.Format("2006-01-02T15:04:05.000Z07:00") + } + toSerialize["log_id"] = o.LogId + toSerialize["source"] = o.Source + toSerialize["status"] = o.Status + toSerialize["tags"] = o.Tags + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLog) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *TransportWebhookLogAttributes `json:"attributes"` + Date *time.Time `json:"date"` + LogId *string `json:"log_id"` + Source *string `json:"source"` + Status *string `json:"status"` + Tags *[]string `json:"tags"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Date == nil { + return fmt.Errorf("required field date missing") + } + if all.LogId == nil { + return fmt.Errorf("required field log_id missing") + } + if all.Source == nil { + return fmt.Errorf("required field source missing") + } + if all.Status == nil { + return fmt.Errorf("required field status missing") + } + if all.Tags == nil { + return fmt.Errorf("required field tags missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "date", "log_id", "source", "status", "tags"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Date = *all.Date + o.LogId = *all.LogId + o.Source = *all.Source + o.Status = *all.Status + o.Tags = *all.Tags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_transport_webhook_log_attributes.go b/api/datadogV2/model_transport_webhook_log_attributes.go new file mode 100644 index 00000000000..6aa7d8295d7 --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log_attributes.go @@ -0,0 +1,540 @@ +// 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" +) + +// TransportWebhookLogAttributes Top-level attributes for the webhook log event, including delivery status, recipient details, and provider metadata. +type TransportWebhookLogAttributes struct { + // The event categories. + Category []string `json:"category,omitempty"` + // The email address details. + Email *TransportWebhookLogEmail `json:"email,omitempty"` + // The unique email identifier. + EmailId *string `json:"email_id,omitempty"` + // The human-readable email type name. + EmailTypeDisplayName *string `json:"email_type_display_name,omitempty"` + // The message delivery event details. + Message *TransportWebhookLogMessage `json:"message,omitempty"` + // The network information for the event. + Network *TransportWebhookLogNetwork `json:"network,omitempty"` + // The numeric organization identifier. + Org *int64 `json:"org,omitempty"` + // Metadata about the organization that sent the email. + OrgMetadata *TransportWebhookLogOrgMetadata `json:"org_metadata,omitempty"` + // The organization UUID. + OrgUuid *string `json:"org_uuid,omitempty"` + // The timestamp when the email was queued. + QueueTime *string `json:"queue_time,omitempty"` + // Indicates whether the open event was triggered by automated machine activity rather than a human recipient (SendGrid-specific). + SgMachineOpen *bool `json:"sg_machine_open,omitempty"` + // The email subject line. + Subject *string `json:"subject,omitempty"` + // The user agent string for open events. + Useragent *string `json:"useragent,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:"-"` +} + +// NewTransportWebhookLogAttributes instantiates a new TransportWebhookLogAttributes 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 NewTransportWebhookLogAttributes() *TransportWebhookLogAttributes { + this := TransportWebhookLogAttributes{} + return &this +} + +// NewTransportWebhookLogAttributesWithDefaults instantiates a new TransportWebhookLogAttributes 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 NewTransportWebhookLogAttributesWithDefaults() *TransportWebhookLogAttributes { + this := TransportWebhookLogAttributes{} + return &this +} + +// GetCategory returns the Category field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetCategory() []string { + if o == nil || o.Category == nil { + var ret []string + return ret + } + return o.Category +} + +// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetCategoryOk() (*[]string, bool) { + if o == nil || o.Category == nil { + return nil, false + } + return &o.Category, true +} + +// HasCategory returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasCategory() bool { + return o != nil && o.Category != nil +} + +// SetCategory gets a reference to the given []string and assigns it to the Category field. +func (o *TransportWebhookLogAttributes) SetCategory(v []string) { + o.Category = v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetEmail() TransportWebhookLogEmail { + if o == nil || o.Email == nil { + var ret TransportWebhookLogEmail + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetEmailOk() (*TransportWebhookLogEmail, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasEmail() bool { + return o != nil && o.Email != nil +} + +// SetEmail gets a reference to the given TransportWebhookLogEmail and assigns it to the Email field. +func (o *TransportWebhookLogAttributes) SetEmail(v TransportWebhookLogEmail) { + o.Email = &v +} + +// GetEmailId returns the EmailId field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetEmailId() string { + if o == nil || o.EmailId == nil { + var ret string + return ret + } + return *o.EmailId +} + +// GetEmailIdOk returns a tuple with the EmailId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetEmailIdOk() (*string, bool) { + if o == nil || o.EmailId == nil { + return nil, false + } + return o.EmailId, true +} + +// HasEmailId returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasEmailId() bool { + return o != nil && o.EmailId != nil +} + +// SetEmailId gets a reference to the given string and assigns it to the EmailId field. +func (o *TransportWebhookLogAttributes) SetEmailId(v string) { + o.EmailId = &v +} + +// GetEmailTypeDisplayName returns the EmailTypeDisplayName field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetEmailTypeDisplayName() string { + if o == nil || o.EmailTypeDisplayName == nil { + var ret string + return ret + } + return *o.EmailTypeDisplayName +} + +// GetEmailTypeDisplayNameOk returns a tuple with the EmailTypeDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetEmailTypeDisplayNameOk() (*string, bool) { + if o == nil || o.EmailTypeDisplayName == nil { + return nil, false + } + return o.EmailTypeDisplayName, true +} + +// HasEmailTypeDisplayName returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasEmailTypeDisplayName() bool { + return o != nil && o.EmailTypeDisplayName != nil +} + +// SetEmailTypeDisplayName gets a reference to the given string and assigns it to the EmailTypeDisplayName field. +func (o *TransportWebhookLogAttributes) SetEmailTypeDisplayName(v string) { + o.EmailTypeDisplayName = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetMessage() TransportWebhookLogMessage { + if o == nil || o.Message == nil { + var ret TransportWebhookLogMessage + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetMessageOk() (*TransportWebhookLogMessage, bool) { + if o == nil || o.Message == nil { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasMessage() bool { + return o != nil && o.Message != nil +} + +// SetMessage gets a reference to the given TransportWebhookLogMessage and assigns it to the Message field. +func (o *TransportWebhookLogAttributes) SetMessage(v TransportWebhookLogMessage) { + o.Message = &v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetNetwork() TransportWebhookLogNetwork { + if o == nil || o.Network == nil { + var ret TransportWebhookLogNetwork + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetNetworkOk() (*TransportWebhookLogNetwork, bool) { + if o == nil || o.Network == nil { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasNetwork() bool { + return o != nil && o.Network != nil +} + +// SetNetwork gets a reference to the given TransportWebhookLogNetwork and assigns it to the Network field. +func (o *TransportWebhookLogAttributes) SetNetwork(v TransportWebhookLogNetwork) { + o.Network = &v +} + +// GetOrg returns the Org field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetOrg() int64 { + if o == nil || o.Org == nil { + var ret int64 + return ret + } + return *o.Org +} + +// GetOrgOk returns a tuple with the Org field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetOrgOk() (*int64, bool) { + if o == nil || o.Org == nil { + return nil, false + } + return o.Org, true +} + +// HasOrg returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasOrg() bool { + return o != nil && o.Org != nil +} + +// SetOrg gets a reference to the given int64 and assigns it to the Org field. +func (o *TransportWebhookLogAttributes) SetOrg(v int64) { + o.Org = &v +} + +// GetOrgMetadata returns the OrgMetadata field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetOrgMetadata() TransportWebhookLogOrgMetadata { + if o == nil || o.OrgMetadata == nil { + var ret TransportWebhookLogOrgMetadata + return ret + } + return *o.OrgMetadata +} + +// GetOrgMetadataOk returns a tuple with the OrgMetadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetOrgMetadataOk() (*TransportWebhookLogOrgMetadata, bool) { + if o == nil || o.OrgMetadata == nil { + return nil, false + } + return o.OrgMetadata, true +} + +// HasOrgMetadata returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasOrgMetadata() bool { + return o != nil && o.OrgMetadata != nil +} + +// SetOrgMetadata gets a reference to the given TransportWebhookLogOrgMetadata and assigns it to the OrgMetadata field. +func (o *TransportWebhookLogAttributes) SetOrgMetadata(v TransportWebhookLogOrgMetadata) { + o.OrgMetadata = &v +} + +// GetOrgUuid returns the OrgUuid field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetOrgUuid() string { + if o == nil || o.OrgUuid == nil { + var ret string + return ret + } + return *o.OrgUuid +} + +// GetOrgUuidOk returns a tuple with the OrgUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetOrgUuidOk() (*string, bool) { + if o == nil || o.OrgUuid == nil { + return nil, false + } + return o.OrgUuid, true +} + +// HasOrgUuid returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasOrgUuid() bool { + return o != nil && o.OrgUuid != nil +} + +// SetOrgUuid gets a reference to the given string and assigns it to the OrgUuid field. +func (o *TransportWebhookLogAttributes) SetOrgUuid(v string) { + o.OrgUuid = &v +} + +// GetQueueTime returns the QueueTime field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetQueueTime() string { + if o == nil || o.QueueTime == nil { + var ret string + return ret + } + return *o.QueueTime +} + +// GetQueueTimeOk returns a tuple with the QueueTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetQueueTimeOk() (*string, bool) { + if o == nil || o.QueueTime == nil { + return nil, false + } + return o.QueueTime, true +} + +// HasQueueTime returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasQueueTime() bool { + return o != nil && o.QueueTime != nil +} + +// SetQueueTime gets a reference to the given string and assigns it to the QueueTime field. +func (o *TransportWebhookLogAttributes) SetQueueTime(v string) { + o.QueueTime = &v +} + +// GetSgMachineOpen returns the SgMachineOpen field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetSgMachineOpen() bool { + if o == nil || o.SgMachineOpen == nil { + var ret bool + return ret + } + return *o.SgMachineOpen +} + +// GetSgMachineOpenOk returns a tuple with the SgMachineOpen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetSgMachineOpenOk() (*bool, bool) { + if o == nil || o.SgMachineOpen == nil { + return nil, false + } + return o.SgMachineOpen, true +} + +// HasSgMachineOpen returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasSgMachineOpen() bool { + return o != nil && o.SgMachineOpen != nil +} + +// SetSgMachineOpen gets a reference to the given bool and assigns it to the SgMachineOpen field. +func (o *TransportWebhookLogAttributes) SetSgMachineOpen(v bool) { + o.SgMachineOpen = &v +} + +// GetSubject returns the Subject field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetSubject() string { + if o == nil || o.Subject == nil { + var ret string + return ret + } + return *o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetSubjectOk() (*string, bool) { + if o == nil || o.Subject == nil { + return nil, false + } + return o.Subject, true +} + +// HasSubject returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasSubject() bool { + return o != nil && o.Subject != nil +} + +// SetSubject gets a reference to the given string and assigns it to the Subject field. +func (o *TransportWebhookLogAttributes) SetSubject(v string) { + o.Subject = &v +} + +// GetUseragent returns the Useragent field value if set, zero value otherwise. +func (o *TransportWebhookLogAttributes) GetUseragent() string { + if o == nil || o.Useragent == nil { + var ret string + return ret + } + return *o.Useragent +} + +// GetUseragentOk returns a tuple with the Useragent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogAttributes) GetUseragentOk() (*string, bool) { + if o == nil || o.Useragent == nil { + return nil, false + } + return o.Useragent, true +} + +// HasUseragent returns a boolean if a field has been set. +func (o *TransportWebhookLogAttributes) HasUseragent() bool { + return o != nil && o.Useragent != nil +} + +// SetUseragent gets a reference to the given string and assigns it to the Useragent field. +func (o *TransportWebhookLogAttributes) SetUseragent(v string) { + o.Useragent = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLogAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Category != nil { + toSerialize["category"] = o.Category + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.EmailId != nil { + toSerialize["email_id"] = o.EmailId + } + if o.EmailTypeDisplayName != nil { + toSerialize["email_type_display_name"] = o.EmailTypeDisplayName + } + if o.Message != nil { + toSerialize["message"] = o.Message + } + if o.Network != nil { + toSerialize["network"] = o.Network + } + if o.Org != nil { + toSerialize["org"] = o.Org + } + if o.OrgMetadata != nil { + toSerialize["org_metadata"] = o.OrgMetadata + } + if o.OrgUuid != nil { + toSerialize["org_uuid"] = o.OrgUuid + } + if o.QueueTime != nil { + toSerialize["queue_time"] = o.QueueTime + } + if o.SgMachineOpen != nil { + toSerialize["sg_machine_open"] = o.SgMachineOpen + } + if o.Subject != nil { + toSerialize["subject"] = o.Subject + } + if o.Useragent != nil { + toSerialize["useragent"] = o.Useragent + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLogAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Category []string `json:"category,omitempty"` + Email *TransportWebhookLogEmail `json:"email,omitempty"` + EmailId *string `json:"email_id,omitempty"` + EmailTypeDisplayName *string `json:"email_type_display_name,omitempty"` + Message *TransportWebhookLogMessage `json:"message,omitempty"` + Network *TransportWebhookLogNetwork `json:"network,omitempty"` + Org *int64 `json:"org,omitempty"` + OrgMetadata *TransportWebhookLogOrgMetadata `json:"org_metadata,omitempty"` + OrgUuid *string `json:"org_uuid,omitempty"` + QueueTime *string `json:"queue_time,omitempty"` + SgMachineOpen *bool `json:"sg_machine_open,omitempty"` + Subject *string `json:"subject,omitempty"` + Useragent *string `json:"useragent,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"category", "email", "email_id", "email_type_display_name", "message", "network", "org", "org_metadata", "org_uuid", "queue_time", "sg_machine_open", "subject", "useragent"}) + } else { + return err + } + + hasInvalidField := false + o.Category = all.Category + if all.Email != nil && all.Email.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Email = all.Email + o.EmailId = all.EmailId + o.EmailTypeDisplayName = all.EmailTypeDisplayName + if all.Message != nil && all.Message.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Message = all.Message + if all.Network != nil && all.Network.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Network = all.Network + o.Org = all.Org + if all.OrgMetadata != nil && all.OrgMetadata.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.OrgMetadata = all.OrgMetadata + o.OrgUuid = all.OrgUuid + o.QueueTime = all.QueueTime + o.SgMachineOpen = all.SgMachineOpen + o.Subject = all.Subject + o.Useragent = all.Useragent + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_transport_webhook_log_email.go b/api/datadogV2/model_transport_webhook_log_email.go new file mode 100644 index 00000000000..c7540861afd --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log_email.go @@ -0,0 +1,207 @@ +// 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" +) + +// TransportWebhookLogEmail The email address details. +type TransportWebhookLogEmail struct { + // The recipient email address. + Address *string `json:"address,omitempty"` + // The recipient domain. + Domain *string `json:"domain,omitempty"` + // The email subject line. + Subject *string `json:"subject,omitempty"` + // Email categorization tags applied by the transport provider (for example, "transactional", "marketing"). + Type []string `json:"type,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:"-"` +} + +// NewTransportWebhookLogEmail instantiates a new TransportWebhookLogEmail 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 NewTransportWebhookLogEmail() *TransportWebhookLogEmail { + this := TransportWebhookLogEmail{} + return &this +} + +// NewTransportWebhookLogEmailWithDefaults instantiates a new TransportWebhookLogEmail 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 NewTransportWebhookLogEmailWithDefaults() *TransportWebhookLogEmail { + this := TransportWebhookLogEmail{} + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *TransportWebhookLogEmail) GetAddress() string { + if o == nil || o.Address == nil { + var ret string + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogEmail) GetAddressOk() (*string, bool) { + if o == nil || o.Address == nil { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *TransportWebhookLogEmail) HasAddress() bool { + return o != nil && o.Address != nil +} + +// SetAddress gets a reference to the given string and assigns it to the Address field. +func (o *TransportWebhookLogEmail) SetAddress(v string) { + o.Address = &v +} + +// GetDomain returns the Domain field value if set, zero value otherwise. +func (o *TransportWebhookLogEmail) GetDomain() string { + if o == nil || o.Domain == nil { + var ret string + return ret + } + return *o.Domain +} + +// GetDomainOk returns a tuple with the Domain field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogEmail) GetDomainOk() (*string, bool) { + if o == nil || o.Domain == nil { + return nil, false + } + return o.Domain, true +} + +// HasDomain returns a boolean if a field has been set. +func (o *TransportWebhookLogEmail) HasDomain() bool { + return o != nil && o.Domain != nil +} + +// SetDomain gets a reference to the given string and assigns it to the Domain field. +func (o *TransportWebhookLogEmail) SetDomain(v string) { + o.Domain = &v +} + +// GetSubject returns the Subject field value if set, zero value otherwise. +func (o *TransportWebhookLogEmail) GetSubject() string { + if o == nil || o.Subject == nil { + var ret string + return ret + } + return *o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogEmail) GetSubjectOk() (*string, bool) { + if o == nil || o.Subject == nil { + return nil, false + } + return o.Subject, true +} + +// HasSubject returns a boolean if a field has been set. +func (o *TransportWebhookLogEmail) HasSubject() bool { + return o != nil && o.Subject != nil +} + +// SetSubject gets a reference to the given string and assigns it to the Subject field. +func (o *TransportWebhookLogEmail) SetSubject(v string) { + o.Subject = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *TransportWebhookLogEmail) GetType() []string { + if o == nil || o.Type == nil { + var ret []string + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogEmail) GetTypeOk() (*[]string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return &o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *TransportWebhookLogEmail) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given []string and assigns it to the Type field. +func (o *TransportWebhookLogEmail) SetType(v []string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLogEmail) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Address != nil { + toSerialize["address"] = o.Address + } + if o.Domain != nil { + toSerialize["domain"] = o.Domain + } + if o.Subject != nil { + toSerialize["subject"] = o.Subject + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLogEmail) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Address *string `json:"address,omitempty"` + Domain *string `json:"domain,omitempty"` + Subject *string `json:"subject,omitempty"` + Type []string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"address", "domain", "subject", "type"}) + } else { + return err + } + o.Address = all.Address + o.Domain = all.Domain + o.Subject = all.Subject + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_transport_webhook_log_ip_attribute.go b/api/datadogV2/model_transport_webhook_log_ip_attribute.go new file mode 100644 index 00000000000..973b5982426 --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log_ip_attribute.go @@ -0,0 +1,137 @@ +// 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" +) + +// TransportWebhookLogIpAttribute An IP attribute with its sources. +type TransportWebhookLogIpAttribute struct { + // The IP address. + Ip *string `json:"ip,omitempty"` + // The transport providers or systems that reported this IP address. + Source []string `json:"source,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:"-"` +} + +// NewTransportWebhookLogIpAttribute instantiates a new TransportWebhookLogIpAttribute 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 NewTransportWebhookLogIpAttribute() *TransportWebhookLogIpAttribute { + this := TransportWebhookLogIpAttribute{} + return &this +} + +// NewTransportWebhookLogIpAttributeWithDefaults instantiates a new TransportWebhookLogIpAttribute 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 NewTransportWebhookLogIpAttributeWithDefaults() *TransportWebhookLogIpAttribute { + this := TransportWebhookLogIpAttribute{} + return &this +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *TransportWebhookLogIpAttribute) GetIp() string { + if o == nil || o.Ip == nil { + var ret string + return ret + } + return *o.Ip +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogIpAttribute) GetIpOk() (*string, bool) { + if o == nil || o.Ip == nil { + return nil, false + } + return o.Ip, true +} + +// HasIp returns a boolean if a field has been set. +func (o *TransportWebhookLogIpAttribute) HasIp() bool { + return o != nil && o.Ip != nil +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *TransportWebhookLogIpAttribute) SetIp(v string) { + o.Ip = &v +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *TransportWebhookLogIpAttribute) GetSource() []string { + if o == nil || o.Source == nil { + var ret []string + return ret + } + return o.Source +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogIpAttribute) GetSourceOk() (*[]string, bool) { + if o == nil || o.Source == nil { + return nil, false + } + return &o.Source, true +} + +// HasSource returns a boolean if a field has been set. +func (o *TransportWebhookLogIpAttribute) HasSource() bool { + return o != nil && o.Source != nil +} + +// SetSource gets a reference to the given []string and assigns it to the Source field. +func (o *TransportWebhookLogIpAttribute) SetSource(v []string) { + o.Source = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLogIpAttribute) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Ip != nil { + toSerialize["ip"] = o.Ip + } + if o.Source != nil { + toSerialize["source"] = o.Source + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLogIpAttribute) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Ip *string `json:"ip,omitempty"` + Source []string `json:"source,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"ip", "source"}) + } else { + return err + } + o.Ip = all.Ip + o.Source = all.Source + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_transport_webhook_log_message.go b/api/datadogV2/model_transport_webhook_log_message.go new file mode 100644 index 00000000000..28fd1fe219c --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log_message.go @@ -0,0 +1,333 @@ +// 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" +) + +// TransportWebhookLogMessage The message delivery event details. +type TransportWebhookLogMessage struct { + // The message authentication details. + Auth *TransportWebhookLogMessageAuth `json:"auth,omitempty"` + // Custom arguments passed through the email transport provider for tracking. + CustomArgs *TransportWebhookLogMessageCustomArgs `json:"custom_args,omitempty"` + // The message identifiers. + Id *TransportWebhookLogMessageId `json:"id,omitempty"` + // The delivery event type emitted by the transport provider (for example, "delivered", "dropped", "bounced"). + Name *string `json:"name,omitempty"` + // The SMTP response information. + Response *TransportWebhookLogMessageResponse `json:"response,omitempty"` + // The IP address of the sending server. + SenderIp *string `json:"sender_ip,omitempty"` + // The message delivery timing information. + Timestamp *TransportWebhookLogMessageTimestamp `json:"timestamp,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:"-"` +} + +// NewTransportWebhookLogMessage instantiates a new TransportWebhookLogMessage 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 NewTransportWebhookLogMessage() *TransportWebhookLogMessage { + this := TransportWebhookLogMessage{} + return &this +} + +// NewTransportWebhookLogMessageWithDefaults instantiates a new TransportWebhookLogMessage 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 NewTransportWebhookLogMessageWithDefaults() *TransportWebhookLogMessage { + this := TransportWebhookLogMessage{} + return &this +} + +// GetAuth returns the Auth field value if set, zero value otherwise. +func (o *TransportWebhookLogMessage) GetAuth() TransportWebhookLogMessageAuth { + if o == nil || o.Auth == nil { + var ret TransportWebhookLogMessageAuth + return ret + } + return *o.Auth +} + +// GetAuthOk returns a tuple with the Auth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessage) GetAuthOk() (*TransportWebhookLogMessageAuth, bool) { + if o == nil || o.Auth == nil { + return nil, false + } + return o.Auth, true +} + +// HasAuth returns a boolean if a field has been set. +func (o *TransportWebhookLogMessage) HasAuth() bool { + return o != nil && o.Auth != nil +} + +// SetAuth gets a reference to the given TransportWebhookLogMessageAuth and assigns it to the Auth field. +func (o *TransportWebhookLogMessage) SetAuth(v TransportWebhookLogMessageAuth) { + o.Auth = &v +} + +// GetCustomArgs returns the CustomArgs field value if set, zero value otherwise. +func (o *TransportWebhookLogMessage) GetCustomArgs() TransportWebhookLogMessageCustomArgs { + if o == nil || o.CustomArgs == nil { + var ret TransportWebhookLogMessageCustomArgs + return ret + } + return *o.CustomArgs +} + +// GetCustomArgsOk returns a tuple with the CustomArgs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessage) GetCustomArgsOk() (*TransportWebhookLogMessageCustomArgs, bool) { + if o == nil || o.CustomArgs == nil { + return nil, false + } + return o.CustomArgs, true +} + +// HasCustomArgs returns a boolean if a field has been set. +func (o *TransportWebhookLogMessage) HasCustomArgs() bool { + return o != nil && o.CustomArgs != nil +} + +// SetCustomArgs gets a reference to the given TransportWebhookLogMessageCustomArgs and assigns it to the CustomArgs field. +func (o *TransportWebhookLogMessage) SetCustomArgs(v TransportWebhookLogMessageCustomArgs) { + o.CustomArgs = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *TransportWebhookLogMessage) GetId() TransportWebhookLogMessageId { + if o == nil || o.Id == nil { + var ret TransportWebhookLogMessageId + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessage) GetIdOk() (*TransportWebhookLogMessageId, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *TransportWebhookLogMessage) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given TransportWebhookLogMessageId and assigns it to the Id field. +func (o *TransportWebhookLogMessage) SetId(v TransportWebhookLogMessageId) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *TransportWebhookLogMessage) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessage) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *TransportWebhookLogMessage) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *TransportWebhookLogMessage) SetName(v string) { + o.Name = &v +} + +// GetResponse returns the Response field value if set, zero value otherwise. +func (o *TransportWebhookLogMessage) GetResponse() TransportWebhookLogMessageResponse { + if o == nil || o.Response == nil { + var ret TransportWebhookLogMessageResponse + return ret + } + return *o.Response +} + +// GetResponseOk returns a tuple with the Response field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessage) GetResponseOk() (*TransportWebhookLogMessageResponse, bool) { + if o == nil || o.Response == nil { + return nil, false + } + return o.Response, true +} + +// HasResponse returns a boolean if a field has been set. +func (o *TransportWebhookLogMessage) HasResponse() bool { + return o != nil && o.Response != nil +} + +// SetResponse gets a reference to the given TransportWebhookLogMessageResponse and assigns it to the Response field. +func (o *TransportWebhookLogMessage) SetResponse(v TransportWebhookLogMessageResponse) { + o.Response = &v +} + +// GetSenderIp returns the SenderIp field value if set, zero value otherwise. +func (o *TransportWebhookLogMessage) GetSenderIp() string { + if o == nil || o.SenderIp == nil { + var ret string + return ret + } + return *o.SenderIp +} + +// GetSenderIpOk returns a tuple with the SenderIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessage) GetSenderIpOk() (*string, bool) { + if o == nil || o.SenderIp == nil { + return nil, false + } + return o.SenderIp, true +} + +// HasSenderIp returns a boolean if a field has been set. +func (o *TransportWebhookLogMessage) HasSenderIp() bool { + return o != nil && o.SenderIp != nil +} + +// SetSenderIp gets a reference to the given string and assigns it to the SenderIp field. +func (o *TransportWebhookLogMessage) SetSenderIp(v string) { + o.SenderIp = &v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *TransportWebhookLogMessage) GetTimestamp() TransportWebhookLogMessageTimestamp { + if o == nil || o.Timestamp == nil { + var ret TransportWebhookLogMessageTimestamp + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessage) GetTimestampOk() (*TransportWebhookLogMessageTimestamp, bool) { + if o == nil || o.Timestamp == nil { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *TransportWebhookLogMessage) HasTimestamp() bool { + return o != nil && o.Timestamp != nil +} + +// SetTimestamp gets a reference to the given TransportWebhookLogMessageTimestamp and assigns it to the Timestamp field. +func (o *TransportWebhookLogMessage) SetTimestamp(v TransportWebhookLogMessageTimestamp) { + o.Timestamp = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLogMessage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Auth != nil { + toSerialize["auth"] = o.Auth + } + if o.CustomArgs != nil { + toSerialize["custom_args"] = o.CustomArgs + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Response != nil { + toSerialize["response"] = o.Response + } + if o.SenderIp != nil { + toSerialize["sender_ip"] = o.SenderIp + } + if o.Timestamp != nil { + toSerialize["timestamp"] = o.Timestamp + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLogMessage) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Auth *TransportWebhookLogMessageAuth `json:"auth,omitempty"` + CustomArgs *TransportWebhookLogMessageCustomArgs `json:"custom_args,omitempty"` + Id *TransportWebhookLogMessageId `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Response *TransportWebhookLogMessageResponse `json:"response,omitempty"` + SenderIp *string `json:"sender_ip,omitempty"` + Timestamp *TransportWebhookLogMessageTimestamp `json:"timestamp,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"auth", "custom_args", "id", "name", "response", "sender_ip", "timestamp"}) + } else { + return err + } + + hasInvalidField := false + if all.Auth != nil && all.Auth.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Auth = all.Auth + if all.CustomArgs != nil && all.CustomArgs.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CustomArgs = all.CustomArgs + if all.Id != nil && all.Id.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Id = all.Id + o.Name = all.Name + if all.Response != nil && all.Response.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Response = all.Response + o.SenderIp = all.SenderIp + if all.Timestamp != nil && all.Timestamp.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Timestamp = all.Timestamp + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_transport_webhook_log_message_auth.go b/api/datadogV2/model_transport_webhook_log_message_auth.go new file mode 100644 index 00000000000..d279f32b2b2 --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log_message_auth.go @@ -0,0 +1,102 @@ +// 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" +) + +// TransportWebhookLogMessageAuth The message authentication details. +type TransportWebhookLogMessageAuth struct { + // The TLS version or negotiation information. + DeliveredWithTls *string `json:"delivered_with_tls,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:"-"` +} + +// NewTransportWebhookLogMessageAuth instantiates a new TransportWebhookLogMessageAuth 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 NewTransportWebhookLogMessageAuth() *TransportWebhookLogMessageAuth { + this := TransportWebhookLogMessageAuth{} + return &this +} + +// NewTransportWebhookLogMessageAuthWithDefaults instantiates a new TransportWebhookLogMessageAuth 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 NewTransportWebhookLogMessageAuthWithDefaults() *TransportWebhookLogMessageAuth { + this := TransportWebhookLogMessageAuth{} + return &this +} + +// GetDeliveredWithTls returns the DeliveredWithTls field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageAuth) GetDeliveredWithTls() string { + if o == nil || o.DeliveredWithTls == nil { + var ret string + return ret + } + return *o.DeliveredWithTls +} + +// GetDeliveredWithTlsOk returns a tuple with the DeliveredWithTls field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageAuth) GetDeliveredWithTlsOk() (*string, bool) { + if o == nil || o.DeliveredWithTls == nil { + return nil, false + } + return o.DeliveredWithTls, true +} + +// HasDeliveredWithTls returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageAuth) HasDeliveredWithTls() bool { + return o != nil && o.DeliveredWithTls != nil +} + +// SetDeliveredWithTls gets a reference to the given string and assigns it to the DeliveredWithTls field. +func (o *TransportWebhookLogMessageAuth) SetDeliveredWithTls(v string) { + o.DeliveredWithTls = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLogMessageAuth) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DeliveredWithTls != nil { + toSerialize["delivered_with_tls"] = o.DeliveredWithTls + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLogMessageAuth) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DeliveredWithTls *string `json:"delivered_with_tls,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"delivered_with_tls"}) + } else { + return err + } + o.DeliveredWithTls = all.DeliveredWithTls + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_transport_webhook_log_message_custom_args.go b/api/datadogV2/model_transport_webhook_log_message_custom_args.go new file mode 100644 index 00000000000..81f7165560c --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log_message_custom_args.go @@ -0,0 +1,242 @@ +// 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" +) + +// TransportWebhookLogMessageCustomArgs Custom arguments passed through the email transport provider for tracking. +type TransportWebhookLogMessageCustomArgs struct { + // The unique email identifier. + EmailId *string `json:"email_id,omitempty"` + // The human-readable email type name. + EmailTypeDisplayName *string `json:"email_type_display_name,omitempty"` + // The organization UUID. + OrgUuid *string `json:"org_uuid,omitempty"` + // The timestamp when the email was queued. + QueueTime *string `json:"queue_time,omitempty"` + // The email subject line. + Subject *string `json:"subject,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:"-"` +} + +// NewTransportWebhookLogMessageCustomArgs instantiates a new TransportWebhookLogMessageCustomArgs 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 NewTransportWebhookLogMessageCustomArgs() *TransportWebhookLogMessageCustomArgs { + this := TransportWebhookLogMessageCustomArgs{} + return &this +} + +// NewTransportWebhookLogMessageCustomArgsWithDefaults instantiates a new TransportWebhookLogMessageCustomArgs 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 NewTransportWebhookLogMessageCustomArgsWithDefaults() *TransportWebhookLogMessageCustomArgs { + this := TransportWebhookLogMessageCustomArgs{} + return &this +} + +// GetEmailId returns the EmailId field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageCustomArgs) GetEmailId() string { + if o == nil || o.EmailId == nil { + var ret string + return ret + } + return *o.EmailId +} + +// GetEmailIdOk returns a tuple with the EmailId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageCustomArgs) GetEmailIdOk() (*string, bool) { + if o == nil || o.EmailId == nil { + return nil, false + } + return o.EmailId, true +} + +// HasEmailId returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageCustomArgs) HasEmailId() bool { + return o != nil && o.EmailId != nil +} + +// SetEmailId gets a reference to the given string and assigns it to the EmailId field. +func (o *TransportWebhookLogMessageCustomArgs) SetEmailId(v string) { + o.EmailId = &v +} + +// GetEmailTypeDisplayName returns the EmailTypeDisplayName field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageCustomArgs) GetEmailTypeDisplayName() string { + if o == nil || o.EmailTypeDisplayName == nil { + var ret string + return ret + } + return *o.EmailTypeDisplayName +} + +// GetEmailTypeDisplayNameOk returns a tuple with the EmailTypeDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageCustomArgs) GetEmailTypeDisplayNameOk() (*string, bool) { + if o == nil || o.EmailTypeDisplayName == nil { + return nil, false + } + return o.EmailTypeDisplayName, true +} + +// HasEmailTypeDisplayName returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageCustomArgs) HasEmailTypeDisplayName() bool { + return o != nil && o.EmailTypeDisplayName != nil +} + +// SetEmailTypeDisplayName gets a reference to the given string and assigns it to the EmailTypeDisplayName field. +func (o *TransportWebhookLogMessageCustomArgs) SetEmailTypeDisplayName(v string) { + o.EmailTypeDisplayName = &v +} + +// GetOrgUuid returns the OrgUuid field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageCustomArgs) GetOrgUuid() string { + if o == nil || o.OrgUuid == nil { + var ret string + return ret + } + return *o.OrgUuid +} + +// GetOrgUuidOk returns a tuple with the OrgUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageCustomArgs) GetOrgUuidOk() (*string, bool) { + if o == nil || o.OrgUuid == nil { + return nil, false + } + return o.OrgUuid, true +} + +// HasOrgUuid returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageCustomArgs) HasOrgUuid() bool { + return o != nil && o.OrgUuid != nil +} + +// SetOrgUuid gets a reference to the given string and assigns it to the OrgUuid field. +func (o *TransportWebhookLogMessageCustomArgs) SetOrgUuid(v string) { + o.OrgUuid = &v +} + +// GetQueueTime returns the QueueTime field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageCustomArgs) GetQueueTime() string { + if o == nil || o.QueueTime == nil { + var ret string + return ret + } + return *o.QueueTime +} + +// GetQueueTimeOk returns a tuple with the QueueTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageCustomArgs) GetQueueTimeOk() (*string, bool) { + if o == nil || o.QueueTime == nil { + return nil, false + } + return o.QueueTime, true +} + +// HasQueueTime returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageCustomArgs) HasQueueTime() bool { + return o != nil && o.QueueTime != nil +} + +// SetQueueTime gets a reference to the given string and assigns it to the QueueTime field. +func (o *TransportWebhookLogMessageCustomArgs) SetQueueTime(v string) { + o.QueueTime = &v +} + +// GetSubject returns the Subject field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageCustomArgs) GetSubject() string { + if o == nil || o.Subject == nil { + var ret string + return ret + } + return *o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageCustomArgs) GetSubjectOk() (*string, bool) { + if o == nil || o.Subject == nil { + return nil, false + } + return o.Subject, true +} + +// HasSubject returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageCustomArgs) HasSubject() bool { + return o != nil && o.Subject != nil +} + +// SetSubject gets a reference to the given string and assigns it to the Subject field. +func (o *TransportWebhookLogMessageCustomArgs) SetSubject(v string) { + o.Subject = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLogMessageCustomArgs) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.EmailId != nil { + toSerialize["email_id"] = o.EmailId + } + if o.EmailTypeDisplayName != nil { + toSerialize["email_type_display_name"] = o.EmailTypeDisplayName + } + if o.OrgUuid != nil { + toSerialize["org_uuid"] = o.OrgUuid + } + if o.QueueTime != nil { + toSerialize["queue_time"] = o.QueueTime + } + if o.Subject != nil { + toSerialize["subject"] = o.Subject + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLogMessageCustomArgs) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + EmailId *string `json:"email_id,omitempty"` + EmailTypeDisplayName *string `json:"email_type_display_name,omitempty"` + OrgUuid *string `json:"org_uuid,omitempty"` + QueueTime *string `json:"queue_time,omitempty"` + Subject *string `json:"subject,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"email_id", "email_type_display_name", "org_uuid", "queue_time", "subject"}) + } else { + return err + } + o.EmailId = all.EmailId + o.EmailTypeDisplayName = all.EmailTypeDisplayName + o.OrgUuid = all.OrgUuid + o.QueueTime = all.QueueTime + o.Subject = all.Subject + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_transport_webhook_log_message_id.go b/api/datadogV2/model_transport_webhook_log_message_id.go new file mode 100644 index 00000000000..93b96e385b7 --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log_message_id.go @@ -0,0 +1,172 @@ +// 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" +) + +// TransportWebhookLogMessageId The message identifiers. +type TransportWebhookLogMessageId struct { + // The RFC 5322 Message-ID. + MessageId *string `json:"message_id,omitempty"` + // The SMTP transaction identifier. + SmtpId *string `json:"smtp_id,omitempty"` + // The transport provider event identifier. + TransportEventId *string `json:"transport_event_id,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:"-"` +} + +// NewTransportWebhookLogMessageId instantiates a new TransportWebhookLogMessageId 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 NewTransportWebhookLogMessageId() *TransportWebhookLogMessageId { + this := TransportWebhookLogMessageId{} + return &this +} + +// NewTransportWebhookLogMessageIdWithDefaults instantiates a new TransportWebhookLogMessageId 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 NewTransportWebhookLogMessageIdWithDefaults() *TransportWebhookLogMessageId { + this := TransportWebhookLogMessageId{} + return &this +} + +// GetMessageId returns the MessageId field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageId) GetMessageId() string { + if o == nil || o.MessageId == nil { + var ret string + return ret + } + return *o.MessageId +} + +// GetMessageIdOk returns a tuple with the MessageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageId) GetMessageIdOk() (*string, bool) { + if o == nil || o.MessageId == nil { + return nil, false + } + return o.MessageId, true +} + +// HasMessageId returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageId) HasMessageId() bool { + return o != nil && o.MessageId != nil +} + +// SetMessageId gets a reference to the given string and assigns it to the MessageId field. +func (o *TransportWebhookLogMessageId) SetMessageId(v string) { + o.MessageId = &v +} + +// GetSmtpId returns the SmtpId field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageId) GetSmtpId() string { + if o == nil || o.SmtpId == nil { + var ret string + return ret + } + return *o.SmtpId +} + +// GetSmtpIdOk returns a tuple with the SmtpId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageId) GetSmtpIdOk() (*string, bool) { + if o == nil || o.SmtpId == nil { + return nil, false + } + return o.SmtpId, true +} + +// HasSmtpId returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageId) HasSmtpId() bool { + return o != nil && o.SmtpId != nil +} + +// SetSmtpId gets a reference to the given string and assigns it to the SmtpId field. +func (o *TransportWebhookLogMessageId) SetSmtpId(v string) { + o.SmtpId = &v +} + +// GetTransportEventId returns the TransportEventId field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageId) GetTransportEventId() string { + if o == nil || o.TransportEventId == nil { + var ret string + return ret + } + return *o.TransportEventId +} + +// GetTransportEventIdOk returns a tuple with the TransportEventId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageId) GetTransportEventIdOk() (*string, bool) { + if o == nil || o.TransportEventId == nil { + return nil, false + } + return o.TransportEventId, true +} + +// HasTransportEventId returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageId) HasTransportEventId() bool { + return o != nil && o.TransportEventId != nil +} + +// SetTransportEventId gets a reference to the given string and assigns it to the TransportEventId field. +func (o *TransportWebhookLogMessageId) SetTransportEventId(v string) { + o.TransportEventId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLogMessageId) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.MessageId != nil { + toSerialize["message_id"] = o.MessageId + } + if o.SmtpId != nil { + toSerialize["smtp_id"] = o.SmtpId + } + if o.TransportEventId != nil { + toSerialize["transport_event_id"] = o.TransportEventId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLogMessageId) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + MessageId *string `json:"message_id,omitempty"` + SmtpId *string `json:"smtp_id,omitempty"` + TransportEventId *string `json:"transport_event_id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"message_id", "smtp_id", "transport_event_id"}) + } else { + return err + } + o.MessageId = all.MessageId + o.SmtpId = all.SmtpId + o.TransportEventId = all.TransportEventId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_transport_webhook_log_message_response.go b/api/datadogV2/model_transport_webhook_log_message_response.go new file mode 100644 index 00000000000..97e1f71ebc9 --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log_message_response.go @@ -0,0 +1,172 @@ +// 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" +) + +// TransportWebhookLogMessageResponse The SMTP response information. +type TransportWebhookLogMessageResponse struct { + // The enhanced SMTP status code. + EnhancedSmtpCode *string `json:"enhanced_smtp_code,omitempty"` + // The SMTP response message. + Reason *string `json:"reason,omitempty"` + // The SMTP status code. + SmtpCode *string `json:"smtp_code,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:"-"` +} + +// NewTransportWebhookLogMessageResponse instantiates a new TransportWebhookLogMessageResponse 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 NewTransportWebhookLogMessageResponse() *TransportWebhookLogMessageResponse { + this := TransportWebhookLogMessageResponse{} + return &this +} + +// NewTransportWebhookLogMessageResponseWithDefaults instantiates a new TransportWebhookLogMessageResponse 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 NewTransportWebhookLogMessageResponseWithDefaults() *TransportWebhookLogMessageResponse { + this := TransportWebhookLogMessageResponse{} + return &this +} + +// GetEnhancedSmtpCode returns the EnhancedSmtpCode field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageResponse) GetEnhancedSmtpCode() string { + if o == nil || o.EnhancedSmtpCode == nil { + var ret string + return ret + } + return *o.EnhancedSmtpCode +} + +// GetEnhancedSmtpCodeOk returns a tuple with the EnhancedSmtpCode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageResponse) GetEnhancedSmtpCodeOk() (*string, bool) { + if o == nil || o.EnhancedSmtpCode == nil { + return nil, false + } + return o.EnhancedSmtpCode, true +} + +// HasEnhancedSmtpCode returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageResponse) HasEnhancedSmtpCode() bool { + return o != nil && o.EnhancedSmtpCode != nil +} + +// SetEnhancedSmtpCode gets a reference to the given string and assigns it to the EnhancedSmtpCode field. +func (o *TransportWebhookLogMessageResponse) SetEnhancedSmtpCode(v string) { + o.EnhancedSmtpCode = &v +} + +// GetReason returns the Reason field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageResponse) GetReason() string { + if o == nil || o.Reason == nil { + var ret string + return ret + } + return *o.Reason +} + +// GetReasonOk returns a tuple with the Reason field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageResponse) GetReasonOk() (*string, bool) { + if o == nil || o.Reason == nil { + return nil, false + } + return o.Reason, true +} + +// HasReason returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageResponse) HasReason() bool { + return o != nil && o.Reason != nil +} + +// SetReason gets a reference to the given string and assigns it to the Reason field. +func (o *TransportWebhookLogMessageResponse) SetReason(v string) { + o.Reason = &v +} + +// GetSmtpCode returns the SmtpCode field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageResponse) GetSmtpCode() string { + if o == nil || o.SmtpCode == nil { + var ret string + return ret + } + return *o.SmtpCode +} + +// GetSmtpCodeOk returns a tuple with the SmtpCode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageResponse) GetSmtpCodeOk() (*string, bool) { + if o == nil || o.SmtpCode == nil { + return nil, false + } + return o.SmtpCode, true +} + +// HasSmtpCode returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageResponse) HasSmtpCode() bool { + return o != nil && o.SmtpCode != nil +} + +// SetSmtpCode gets a reference to the given string and assigns it to the SmtpCode field. +func (o *TransportWebhookLogMessageResponse) SetSmtpCode(v string) { + o.SmtpCode = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLogMessageResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.EnhancedSmtpCode != nil { + toSerialize["enhanced_smtp_code"] = o.EnhancedSmtpCode + } + if o.Reason != nil { + toSerialize["reason"] = o.Reason + } + if o.SmtpCode != nil { + toSerialize["smtp_code"] = o.SmtpCode + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLogMessageResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + EnhancedSmtpCode *string `json:"enhanced_smtp_code,omitempty"` + Reason *string `json:"reason,omitempty"` + SmtpCode *string `json:"smtp_code,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"enhanced_smtp_code", "reason", "smtp_code"}) + } else { + return err + } + o.EnhancedSmtpCode = all.EnhancedSmtpCode + o.Reason = all.Reason + o.SmtpCode = all.SmtpCode + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_transport_webhook_log_message_timestamp.go b/api/datadogV2/model_transport_webhook_log_message_timestamp.go new file mode 100644 index 00000000000..21ff171fb84 --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log_message_timestamp.go @@ -0,0 +1,207 @@ +// 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" +) + +// TransportWebhookLogMessageTimestamp The message delivery timing information. +type TransportWebhookLogMessageTimestamp struct { + // The Unix timestamp of the event. + EventTimestamp *float64 `json:"event_timestamp,omitempty"` + // The total delivery time in seconds. + Lifetime *float64 `json:"lifetime,omitempty"` + // Number of seconds the message spent in the delivery queue. + QueueTime *float64 `json:"queue_time,omitempty"` + // The scheduled delivery time as a Unix timestamp. + ScheduledTime *float64 `json:"scheduled_time,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:"-"` +} + +// NewTransportWebhookLogMessageTimestamp instantiates a new TransportWebhookLogMessageTimestamp 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 NewTransportWebhookLogMessageTimestamp() *TransportWebhookLogMessageTimestamp { + this := TransportWebhookLogMessageTimestamp{} + return &this +} + +// NewTransportWebhookLogMessageTimestampWithDefaults instantiates a new TransportWebhookLogMessageTimestamp 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 NewTransportWebhookLogMessageTimestampWithDefaults() *TransportWebhookLogMessageTimestamp { + this := TransportWebhookLogMessageTimestamp{} + return &this +} + +// GetEventTimestamp returns the EventTimestamp field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageTimestamp) GetEventTimestamp() float64 { + if o == nil || o.EventTimestamp == nil { + var ret float64 + return ret + } + return *o.EventTimestamp +} + +// GetEventTimestampOk returns a tuple with the EventTimestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageTimestamp) GetEventTimestampOk() (*float64, bool) { + if o == nil || o.EventTimestamp == nil { + return nil, false + } + return o.EventTimestamp, true +} + +// HasEventTimestamp returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageTimestamp) HasEventTimestamp() bool { + return o != nil && o.EventTimestamp != nil +} + +// SetEventTimestamp gets a reference to the given float64 and assigns it to the EventTimestamp field. +func (o *TransportWebhookLogMessageTimestamp) SetEventTimestamp(v float64) { + o.EventTimestamp = &v +} + +// GetLifetime returns the Lifetime field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageTimestamp) GetLifetime() float64 { + if o == nil || o.Lifetime == nil { + var ret float64 + return ret + } + return *o.Lifetime +} + +// GetLifetimeOk returns a tuple with the Lifetime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageTimestamp) GetLifetimeOk() (*float64, bool) { + if o == nil || o.Lifetime == nil { + return nil, false + } + return o.Lifetime, true +} + +// HasLifetime returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageTimestamp) HasLifetime() bool { + return o != nil && o.Lifetime != nil +} + +// SetLifetime gets a reference to the given float64 and assigns it to the Lifetime field. +func (o *TransportWebhookLogMessageTimestamp) SetLifetime(v float64) { + o.Lifetime = &v +} + +// GetQueueTime returns the QueueTime field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageTimestamp) GetQueueTime() float64 { + if o == nil || o.QueueTime == nil { + var ret float64 + return ret + } + return *o.QueueTime +} + +// GetQueueTimeOk returns a tuple with the QueueTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageTimestamp) GetQueueTimeOk() (*float64, bool) { + if o == nil || o.QueueTime == nil { + return nil, false + } + return o.QueueTime, true +} + +// HasQueueTime returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageTimestamp) HasQueueTime() bool { + return o != nil && o.QueueTime != nil +} + +// SetQueueTime gets a reference to the given float64 and assigns it to the QueueTime field. +func (o *TransportWebhookLogMessageTimestamp) SetQueueTime(v float64) { + o.QueueTime = &v +} + +// GetScheduledTime returns the ScheduledTime field value if set, zero value otherwise. +func (o *TransportWebhookLogMessageTimestamp) GetScheduledTime() float64 { + if o == nil || o.ScheduledTime == nil { + var ret float64 + return ret + } + return *o.ScheduledTime +} + +// GetScheduledTimeOk returns a tuple with the ScheduledTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogMessageTimestamp) GetScheduledTimeOk() (*float64, bool) { + if o == nil || o.ScheduledTime == nil { + return nil, false + } + return o.ScheduledTime, true +} + +// HasScheduledTime returns a boolean if a field has been set. +func (o *TransportWebhookLogMessageTimestamp) HasScheduledTime() bool { + return o != nil && o.ScheduledTime != nil +} + +// SetScheduledTime gets a reference to the given float64 and assigns it to the ScheduledTime field. +func (o *TransportWebhookLogMessageTimestamp) SetScheduledTime(v float64) { + o.ScheduledTime = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLogMessageTimestamp) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.EventTimestamp != nil { + toSerialize["event_timestamp"] = o.EventTimestamp + } + if o.Lifetime != nil { + toSerialize["lifetime"] = o.Lifetime + } + if o.QueueTime != nil { + toSerialize["queue_time"] = o.QueueTime + } + if o.ScheduledTime != nil { + toSerialize["scheduled_time"] = o.ScheduledTime + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLogMessageTimestamp) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + EventTimestamp *float64 `json:"event_timestamp,omitempty"` + Lifetime *float64 `json:"lifetime,omitempty"` + QueueTime *float64 `json:"queue_time,omitempty"` + ScheduledTime *float64 `json:"scheduled_time,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"event_timestamp", "lifetime", "queue_time", "scheduled_time"}) + } else { + return err + } + o.EventTimestamp = all.EventTimestamp + o.Lifetime = all.Lifetime + o.QueueTime = all.QueueTime + o.ScheduledTime = all.ScheduledTime + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_transport_webhook_log_network.go b/api/datadogV2/model_transport_webhook_log_network.go new file mode 100644 index 00000000000..4564361d395 --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log_network.go @@ -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" +) + +// TransportWebhookLogNetwork The network information for the event. +type TransportWebhookLogNetwork struct { + // The IP address information. + Ip *TransportWebhookLogNetworkIp `json:"ip,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:"-"` +} + +// NewTransportWebhookLogNetwork instantiates a new TransportWebhookLogNetwork 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 NewTransportWebhookLogNetwork() *TransportWebhookLogNetwork { + this := TransportWebhookLogNetwork{} + return &this +} + +// NewTransportWebhookLogNetworkWithDefaults instantiates a new TransportWebhookLogNetwork 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 NewTransportWebhookLogNetworkWithDefaults() *TransportWebhookLogNetwork { + this := TransportWebhookLogNetwork{} + return &this +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *TransportWebhookLogNetwork) GetIp() TransportWebhookLogNetworkIp { + if o == nil || o.Ip == nil { + var ret TransportWebhookLogNetworkIp + return ret + } + return *o.Ip +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogNetwork) GetIpOk() (*TransportWebhookLogNetworkIp, bool) { + if o == nil || o.Ip == nil { + return nil, false + } + return o.Ip, true +} + +// HasIp returns a boolean if a field has been set. +func (o *TransportWebhookLogNetwork) HasIp() bool { + return o != nil && o.Ip != nil +} + +// SetIp gets a reference to the given TransportWebhookLogNetworkIp and assigns it to the Ip field. +func (o *TransportWebhookLogNetwork) SetIp(v TransportWebhookLogNetworkIp) { + o.Ip = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLogNetwork) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Ip != nil { + toSerialize["ip"] = o.Ip + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLogNetwork) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Ip *TransportWebhookLogNetworkIp `json:"ip,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"ip"}) + } else { + return err + } + + hasInvalidField := false + if all.Ip != nil && all.Ip.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Ip = all.Ip + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_transport_webhook_log_network_ip.go b/api/datadogV2/model_transport_webhook_log_network_ip.go new file mode 100644 index 00000000000..82f39bed60f --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log_network_ip.go @@ -0,0 +1,137 @@ +// 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" +) + +// TransportWebhookLogNetworkIp The IP address information. +type TransportWebhookLogNetworkIp struct { + // Per-IP attribute records, each pairing an IP address with the providers that observed it. + Attributes []TransportWebhookLogIpAttribute `json:"attributes,omitempty"` + // The list of IP addresses. + List []string `json:"list,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:"-"` +} + +// NewTransportWebhookLogNetworkIp instantiates a new TransportWebhookLogNetworkIp 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 NewTransportWebhookLogNetworkIp() *TransportWebhookLogNetworkIp { + this := TransportWebhookLogNetworkIp{} + return &this +} + +// NewTransportWebhookLogNetworkIpWithDefaults instantiates a new TransportWebhookLogNetworkIp 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 NewTransportWebhookLogNetworkIpWithDefaults() *TransportWebhookLogNetworkIp { + this := TransportWebhookLogNetworkIp{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *TransportWebhookLogNetworkIp) GetAttributes() []TransportWebhookLogIpAttribute { + if o == nil || o.Attributes == nil { + var ret []TransportWebhookLogIpAttribute + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogNetworkIp) GetAttributesOk() (*[]TransportWebhookLogIpAttribute, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return &o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *TransportWebhookLogNetworkIp) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given []TransportWebhookLogIpAttribute and assigns it to the Attributes field. +func (o *TransportWebhookLogNetworkIp) SetAttributes(v []TransportWebhookLogIpAttribute) { + o.Attributes = v +} + +// GetList returns the List field value if set, zero value otherwise. +func (o *TransportWebhookLogNetworkIp) GetList() []string { + if o == nil || o.List == nil { + var ret []string + return ret + } + return o.List +} + +// GetListOk returns a tuple with the List field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogNetworkIp) GetListOk() (*[]string, bool) { + if o == nil || o.List == nil { + return nil, false + } + return &o.List, true +} + +// HasList returns a boolean if a field has been set. +func (o *TransportWebhookLogNetworkIp) HasList() bool { + return o != nil && o.List != nil +} + +// SetList gets a reference to the given []string and assigns it to the List field. +func (o *TransportWebhookLogNetworkIp) SetList(v []string) { + o.List = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLogNetworkIp) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.List != nil { + toSerialize["list"] = o.List + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLogNetworkIp) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes []TransportWebhookLogIpAttribute `json:"attributes,omitempty"` + List []string `json:"list,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "list"}) + } else { + return err + } + o.Attributes = all.Attributes + o.List = all.List + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_transport_webhook_log_org_metadata.go b/api/datadogV2/model_transport_webhook_log_org_metadata.go new file mode 100644 index 00000000000..fd4dd171ee2 --- /dev/null +++ b/api/datadogV2/model_transport_webhook_log_org_metadata.go @@ -0,0 +1,627 @@ +// 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" +) + +// TransportWebhookLogOrgMetadata Metadata about the organization that sent the email. +type TransportWebhookLogOrgMetadata struct { + // Country code or name used for billing purposes. + BillingCountry *string `json:"billing_country,omitempty"` + // The Datadog billing plan for the organization (for example, "pro", "enterprise"). + BillingPlan *string `json:"billing_plan,omitempty"` + // Support or account tier assigned to the organization (for example, "tier-1"). + CustomerTier *string `json:"customer_tier,omitempty"` + // Primary email domain associated with the organization (for example, "example.com"). + Domain *string `json:"domain,omitempty"` + // Industry classification of the organization (for example, "technology", "finance"). + Industry *string `json:"industry,omitempty"` + // Whether the organization is enrolled in the Datadog bug bounty program. + IsBugbounty *string `json:"is_bugbounty,omitempty"` + // Whether the organization operates as a Managed Service Provider managing child orgs. + IsMsp *string `json:"is_msp,omitempty"` + // Display name of the organization as configured in Datadog account settings. + Name *string `json:"name,omitempty"` + // Globally unique identifier for the Datadog organization (UUID v1 format). + OrgUuid *string `json:"org_uuid,omitempty"` + // Identifier of the immediate parent organization, if this is a child org. + ParentOrgId *string `json:"parent_org_id,omitempty"` + // Whether the organization has a premium support plan with Datadog. + PremiumSupport *string `json:"premium_support,omitempty"` + // Identifier of the top-level parent organization in a multi-org account hierarchy. + RootOrgId *string `json:"root_org_id,omitempty"` + // Display name of the top-level parent organization in a multi-org account hierarchy. + RootOrgName *string `json:"root_org_name,omitempty"` + // Country code or name used for shipping or regional assignment. + ShippingCountry *string `json:"shipping_country,omitempty"` + // Website URL provided during organization registration. + Website *string `json:"website,omitempty"` + // ISO 8601 timestamp of when the Datadog organization was created. + WhenCreated *string `json:"when_created,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:"-"` +} + +// NewTransportWebhookLogOrgMetadata instantiates a new TransportWebhookLogOrgMetadata 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 NewTransportWebhookLogOrgMetadata() *TransportWebhookLogOrgMetadata { + this := TransportWebhookLogOrgMetadata{} + return &this +} + +// NewTransportWebhookLogOrgMetadataWithDefaults instantiates a new TransportWebhookLogOrgMetadata 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 NewTransportWebhookLogOrgMetadataWithDefaults() *TransportWebhookLogOrgMetadata { + this := TransportWebhookLogOrgMetadata{} + return &this +} + +// GetBillingCountry returns the BillingCountry field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetBillingCountry() string { + if o == nil || o.BillingCountry == nil { + var ret string + return ret + } + return *o.BillingCountry +} + +// GetBillingCountryOk returns a tuple with the BillingCountry field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetBillingCountryOk() (*string, bool) { + if o == nil || o.BillingCountry == nil { + return nil, false + } + return o.BillingCountry, true +} + +// HasBillingCountry returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasBillingCountry() bool { + return o != nil && o.BillingCountry != nil +} + +// SetBillingCountry gets a reference to the given string and assigns it to the BillingCountry field. +func (o *TransportWebhookLogOrgMetadata) SetBillingCountry(v string) { + o.BillingCountry = &v +} + +// GetBillingPlan returns the BillingPlan field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetBillingPlan() string { + if o == nil || o.BillingPlan == nil { + var ret string + return ret + } + return *o.BillingPlan +} + +// GetBillingPlanOk returns a tuple with the BillingPlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetBillingPlanOk() (*string, bool) { + if o == nil || o.BillingPlan == nil { + return nil, false + } + return o.BillingPlan, true +} + +// HasBillingPlan returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasBillingPlan() bool { + return o != nil && o.BillingPlan != nil +} + +// SetBillingPlan gets a reference to the given string and assigns it to the BillingPlan field. +func (o *TransportWebhookLogOrgMetadata) SetBillingPlan(v string) { + o.BillingPlan = &v +} + +// GetCustomerTier returns the CustomerTier field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetCustomerTier() string { + if o == nil || o.CustomerTier == nil { + var ret string + return ret + } + return *o.CustomerTier +} + +// GetCustomerTierOk returns a tuple with the CustomerTier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetCustomerTierOk() (*string, bool) { + if o == nil || o.CustomerTier == nil { + return nil, false + } + return o.CustomerTier, true +} + +// HasCustomerTier returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasCustomerTier() bool { + return o != nil && o.CustomerTier != nil +} + +// SetCustomerTier gets a reference to the given string and assigns it to the CustomerTier field. +func (o *TransportWebhookLogOrgMetadata) SetCustomerTier(v string) { + o.CustomerTier = &v +} + +// GetDomain returns the Domain field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetDomain() string { + if o == nil || o.Domain == nil { + var ret string + return ret + } + return *o.Domain +} + +// GetDomainOk returns a tuple with the Domain field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetDomainOk() (*string, bool) { + if o == nil || o.Domain == nil { + return nil, false + } + return o.Domain, true +} + +// HasDomain returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasDomain() bool { + return o != nil && o.Domain != nil +} + +// SetDomain gets a reference to the given string and assigns it to the Domain field. +func (o *TransportWebhookLogOrgMetadata) SetDomain(v string) { + o.Domain = &v +} + +// GetIndustry returns the Industry field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetIndustry() string { + if o == nil || o.Industry == nil { + var ret string + return ret + } + return *o.Industry +} + +// GetIndustryOk returns a tuple with the Industry field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetIndustryOk() (*string, bool) { + if o == nil || o.Industry == nil { + return nil, false + } + return o.Industry, true +} + +// HasIndustry returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasIndustry() bool { + return o != nil && o.Industry != nil +} + +// SetIndustry gets a reference to the given string and assigns it to the Industry field. +func (o *TransportWebhookLogOrgMetadata) SetIndustry(v string) { + o.Industry = &v +} + +// GetIsBugbounty returns the IsBugbounty field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetIsBugbounty() string { + if o == nil || o.IsBugbounty == nil { + var ret string + return ret + } + return *o.IsBugbounty +} + +// GetIsBugbountyOk returns a tuple with the IsBugbounty field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetIsBugbountyOk() (*string, bool) { + if o == nil || o.IsBugbounty == nil { + return nil, false + } + return o.IsBugbounty, true +} + +// HasIsBugbounty returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasIsBugbounty() bool { + return o != nil && o.IsBugbounty != nil +} + +// SetIsBugbounty gets a reference to the given string and assigns it to the IsBugbounty field. +func (o *TransportWebhookLogOrgMetadata) SetIsBugbounty(v string) { + o.IsBugbounty = &v +} + +// GetIsMsp returns the IsMsp field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetIsMsp() string { + if o == nil || o.IsMsp == nil { + var ret string + return ret + } + return *o.IsMsp +} + +// GetIsMspOk returns a tuple with the IsMsp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetIsMspOk() (*string, bool) { + if o == nil || o.IsMsp == nil { + return nil, false + } + return o.IsMsp, true +} + +// HasIsMsp returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasIsMsp() bool { + return o != nil && o.IsMsp != nil +} + +// SetIsMsp gets a reference to the given string and assigns it to the IsMsp field. +func (o *TransportWebhookLogOrgMetadata) SetIsMsp(v string) { + o.IsMsp = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *TransportWebhookLogOrgMetadata) SetName(v string) { + o.Name = &v +} + +// GetOrgUuid returns the OrgUuid field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetOrgUuid() string { + if o == nil || o.OrgUuid == nil { + var ret string + return ret + } + return *o.OrgUuid +} + +// GetOrgUuidOk returns a tuple with the OrgUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetOrgUuidOk() (*string, bool) { + if o == nil || o.OrgUuid == nil { + return nil, false + } + return o.OrgUuid, true +} + +// HasOrgUuid returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasOrgUuid() bool { + return o != nil && o.OrgUuid != nil +} + +// SetOrgUuid gets a reference to the given string and assigns it to the OrgUuid field. +func (o *TransportWebhookLogOrgMetadata) SetOrgUuid(v string) { + o.OrgUuid = &v +} + +// GetParentOrgId returns the ParentOrgId field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetParentOrgId() string { + if o == nil || o.ParentOrgId == nil { + var ret string + return ret + } + return *o.ParentOrgId +} + +// GetParentOrgIdOk returns a tuple with the ParentOrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetParentOrgIdOk() (*string, bool) { + if o == nil || o.ParentOrgId == nil { + return nil, false + } + return o.ParentOrgId, true +} + +// HasParentOrgId returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasParentOrgId() bool { + return o != nil && o.ParentOrgId != nil +} + +// SetParentOrgId gets a reference to the given string and assigns it to the ParentOrgId field. +func (o *TransportWebhookLogOrgMetadata) SetParentOrgId(v string) { + o.ParentOrgId = &v +} + +// GetPremiumSupport returns the PremiumSupport field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetPremiumSupport() string { + if o == nil || o.PremiumSupport == nil { + var ret string + return ret + } + return *o.PremiumSupport +} + +// GetPremiumSupportOk returns a tuple with the PremiumSupport field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetPremiumSupportOk() (*string, bool) { + if o == nil || o.PremiumSupport == nil { + return nil, false + } + return o.PremiumSupport, true +} + +// HasPremiumSupport returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasPremiumSupport() bool { + return o != nil && o.PremiumSupport != nil +} + +// SetPremiumSupport gets a reference to the given string and assigns it to the PremiumSupport field. +func (o *TransportWebhookLogOrgMetadata) SetPremiumSupport(v string) { + o.PremiumSupport = &v +} + +// GetRootOrgId returns the RootOrgId field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetRootOrgId() string { + if o == nil || o.RootOrgId == nil { + var ret string + return ret + } + return *o.RootOrgId +} + +// GetRootOrgIdOk returns a tuple with the RootOrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetRootOrgIdOk() (*string, bool) { + if o == nil || o.RootOrgId == nil { + return nil, false + } + return o.RootOrgId, true +} + +// HasRootOrgId returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasRootOrgId() bool { + return o != nil && o.RootOrgId != nil +} + +// SetRootOrgId gets a reference to the given string and assigns it to the RootOrgId field. +func (o *TransportWebhookLogOrgMetadata) SetRootOrgId(v string) { + o.RootOrgId = &v +} + +// GetRootOrgName returns the RootOrgName field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetRootOrgName() string { + if o == nil || o.RootOrgName == nil { + var ret string + return ret + } + return *o.RootOrgName +} + +// GetRootOrgNameOk returns a tuple with the RootOrgName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetRootOrgNameOk() (*string, bool) { + if o == nil || o.RootOrgName == nil { + return nil, false + } + return o.RootOrgName, true +} + +// HasRootOrgName returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasRootOrgName() bool { + return o != nil && o.RootOrgName != nil +} + +// SetRootOrgName gets a reference to the given string and assigns it to the RootOrgName field. +func (o *TransportWebhookLogOrgMetadata) SetRootOrgName(v string) { + o.RootOrgName = &v +} + +// GetShippingCountry returns the ShippingCountry field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetShippingCountry() string { + if o == nil || o.ShippingCountry == nil { + var ret string + return ret + } + return *o.ShippingCountry +} + +// GetShippingCountryOk returns a tuple with the ShippingCountry field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetShippingCountryOk() (*string, bool) { + if o == nil || o.ShippingCountry == nil { + return nil, false + } + return o.ShippingCountry, true +} + +// HasShippingCountry returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasShippingCountry() bool { + return o != nil && o.ShippingCountry != nil +} + +// SetShippingCountry gets a reference to the given string and assigns it to the ShippingCountry field. +func (o *TransportWebhookLogOrgMetadata) SetShippingCountry(v string) { + o.ShippingCountry = &v +} + +// GetWebsite returns the Website field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetWebsite() string { + if o == nil || o.Website == nil { + var ret string + return ret + } + return *o.Website +} + +// GetWebsiteOk returns a tuple with the Website field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetWebsiteOk() (*string, bool) { + if o == nil || o.Website == nil { + return nil, false + } + return o.Website, true +} + +// HasWebsite returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasWebsite() bool { + return o != nil && o.Website != nil +} + +// SetWebsite gets a reference to the given string and assigns it to the Website field. +func (o *TransportWebhookLogOrgMetadata) SetWebsite(v string) { + o.Website = &v +} + +// GetWhenCreated returns the WhenCreated field value if set, zero value otherwise. +func (o *TransportWebhookLogOrgMetadata) GetWhenCreated() string { + if o == nil || o.WhenCreated == nil { + var ret string + return ret + } + return *o.WhenCreated +} + +// GetWhenCreatedOk returns a tuple with the WhenCreated field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TransportWebhookLogOrgMetadata) GetWhenCreatedOk() (*string, bool) { + if o == nil || o.WhenCreated == nil { + return nil, false + } + return o.WhenCreated, true +} + +// HasWhenCreated returns a boolean if a field has been set. +func (o *TransportWebhookLogOrgMetadata) HasWhenCreated() bool { + return o != nil && o.WhenCreated != nil +} + +// SetWhenCreated gets a reference to the given string and assigns it to the WhenCreated field. +func (o *TransportWebhookLogOrgMetadata) SetWhenCreated(v string) { + o.WhenCreated = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TransportWebhookLogOrgMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.BillingCountry != nil { + toSerialize["billing_country"] = o.BillingCountry + } + if o.BillingPlan != nil { + toSerialize["billing_plan"] = o.BillingPlan + } + if o.CustomerTier != nil { + toSerialize["customer_tier"] = o.CustomerTier + } + if o.Domain != nil { + toSerialize["domain"] = o.Domain + } + if o.Industry != nil { + toSerialize["industry"] = o.Industry + } + if o.IsBugbounty != nil { + toSerialize["is_bugbounty"] = o.IsBugbounty + } + if o.IsMsp != nil { + toSerialize["is_msp"] = o.IsMsp + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.OrgUuid != nil { + toSerialize["org_uuid"] = o.OrgUuid + } + if o.ParentOrgId != nil { + toSerialize["parent_org_id"] = o.ParentOrgId + } + if o.PremiumSupport != nil { + toSerialize["premium_support"] = o.PremiumSupport + } + if o.RootOrgId != nil { + toSerialize["root_org_id"] = o.RootOrgId + } + if o.RootOrgName != nil { + toSerialize["root_org_name"] = o.RootOrgName + } + if o.ShippingCountry != nil { + toSerialize["shipping_country"] = o.ShippingCountry + } + if o.Website != nil { + toSerialize["website"] = o.Website + } + if o.WhenCreated != nil { + toSerialize["when_created"] = o.WhenCreated + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TransportWebhookLogOrgMetadata) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + BillingCountry *string `json:"billing_country,omitempty"` + BillingPlan *string `json:"billing_plan,omitempty"` + CustomerTier *string `json:"customer_tier,omitempty"` + Domain *string `json:"domain,omitempty"` + Industry *string `json:"industry,omitempty"` + IsBugbounty *string `json:"is_bugbounty,omitempty"` + IsMsp *string `json:"is_msp,omitempty"` + Name *string `json:"name,omitempty"` + OrgUuid *string `json:"org_uuid,omitempty"` + ParentOrgId *string `json:"parent_org_id,omitempty"` + PremiumSupport *string `json:"premium_support,omitempty"` + RootOrgId *string `json:"root_org_id,omitempty"` + RootOrgName *string `json:"root_org_name,omitempty"` + ShippingCountry *string `json:"shipping_country,omitempty"` + Website *string `json:"website,omitempty"` + WhenCreated *string `json:"when_created,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"billing_country", "billing_plan", "customer_tier", "domain", "industry", "is_bugbounty", "is_msp", "name", "org_uuid", "parent_org_id", "premium_support", "root_org_id", "root_org_name", "shipping_country", "website", "when_created"}) + } else { + return err + } + o.BillingCountry = all.BillingCountry + o.BillingPlan = all.BillingPlan + o.CustomerTier = all.CustomerTier + o.Domain = all.Domain + o.Industry = all.Industry + o.IsBugbounty = all.IsBugbounty + o.IsMsp = all.IsMsp + o.Name = all.Name + o.OrgUuid = all.OrgUuid + o.ParentOrgId = all.ParentOrgId + o.PremiumSupport = all.PremiumSupport + o.RootOrgId = all.RootOrgId + o.RootOrgName = all.RootOrgName + o.ShippingCountry = all.ShippingCountry + o.Website = all.Website + o.WhenCreated = all.WhenCreated + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/email-transport/CreateEmailTransportWebhookIntake.go b/examples/v2/email-transport/CreateEmailTransportWebhookIntake.go new file mode 100644 index 00000000000..2a59368eca1 --- /dev/null +++ b/examples/v2/email-transport/CreateEmailTransportWebhookIntake.go @@ -0,0 +1,104 @@ +// Ingest email transport webhook events returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := []datadogV2.TransportWebhookLog{ + { + Attributes: datadogV2.TransportWebhookLogAttributes{ + Category: []string{ + "transactional", + }, + Email: &datadogV2.TransportWebhookLogEmail{ + Address: datadog.PtrString("user@example.com"), + Domain: datadog.PtrString("example.com"), + Subject: datadog.PtrString("[Monitor Alert] CPU usage is high"), + Type: []string{ + "transactional", + }, + }, + EmailId: datadog.PtrString("abc123-def456"), + EmailTypeDisplayName: datadog.PtrString("Monitor Alert"), + Message: &datadogV2.TransportWebhookLogMessage{ + Auth: &datadogV2.TransportWebhookLogMessageAuth{ + DeliveredWithTls: datadog.PtrString("TLSv1.2"), + }, + CustomArgs: &datadogV2.TransportWebhookLogMessageCustomArgs{ + EmailId: datadog.PtrString("abc123-def456"), + EmailTypeDisplayName: datadog.PtrString("Monitor Alert"), + OrgUuid: datadog.PtrString("8dee7c38-00cb-11ea-a77b-8b5a08d3b091"), + QueueTime: datadog.PtrString("2024-01-15T10:29:00Z"), + Subject: datadog.PtrString("[Monitor Alert] CPU usage is high"), + }, + Id: &datadogV2.TransportWebhookLogMessageId{ + MessageId: datadog.PtrString(""), + SmtpId: datadog.PtrString(""), + TransportEventId: datadog.PtrString("evt_abc123"), + }, + Name: datadog.PtrString("delivered"), + Response: &datadogV2.TransportWebhookLogMessageResponse{ + EnhancedSmtpCode: datadog.PtrString("2.0.0"), + Reason: datadog.PtrString("250 2.0.0 OK"), + SmtpCode: datadog.PtrString("250"), + }, + SenderIp: datadog.PtrString("192.168.1.1"), + Timestamp: &datadogV2.TransportWebhookLogMessageTimestamp{ + EventTimestamp: datadog.PtrFloat64(1705312200.0), + Lifetime: datadog.PtrFloat64(3.2), + QueueTime: datadog.PtrFloat64(1.5), + ScheduledTime: datadog.PtrFloat64(1705312190.0), + }, + }, + Network: &datadogV2.TransportWebhookLogNetwork{ + Ip: &datadogV2.TransportWebhookLogNetworkIp{ + Attributes: []datadogV2.TransportWebhookLogIpAttribute{ + { + Ip: datadog.PtrString("192.168.1.1"), + Source: []string{ + "sendgrid", + }, + }, + }, + List: []string{ + "192.168.1.1", + }, + }, + }, + Org: datadog.PtrInt64(1234), + OrgMetadata: &datadogV2.TransportWebhookLogOrgMetadata{}, + OrgUuid: datadog.PtrString("8dee7c38-00cb-11ea-a77b-8b5a08d3b091"), + QueueTime: datadog.PtrString("2024-01-15T10:29:00Z"), + Subject: datadog.PtrString("[Monitor Alert] CPU usage is high"), + Useragent: datadog.PtrString("Mozilla/5.0"), + }, + Date: time.Date(2024, 1, 15, 10, 30, 0, 0, time.UTC), + LogId: "AQAAAZPHnBT0TwJAdgAAAABBWlBIblVlNEFBQ0dFMmVkYTFDSnRR", + Source: "sendgrid", + Status: "info", + Tags: []string{ + "env:production", + }, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.CreateEmailTransportWebhookIntake", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewEmailTransportApi(apiClient) + r, err := api.CreateEmailTransportWebhookIntake(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `EmailTransportApi.CreateEmailTransportWebhookIntake`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 7ef68dcdbb0..2cc9df83dc9 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -85,6 +85,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "DomainAllowlistApi": reflect.ValueOf(datadogV2.NewDomainAllowlistApi), "DORAMetricsApi": reflect.ValueOf(datadogV2.NewDORAMetricsApi), "DowntimesApi": reflect.ValueOf(datadogV2.NewDowntimesApi), + "EmailTransportApi": reflect.ValueOf(datadogV2.NewEmailTransportApi), "ErrorTrackingApi": reflect.ValueOf(datadogV2.NewErrorTrackingApi), "EventsApi": reflect.ValueOf(datadogV2.NewEventsApi), "FeatureFlagsApi": reflect.ValueOf(datadogV2.NewFeatureFlagsApi), diff --git a/tests/scenarios/features/v2/email_transport.feature b/tests/scenarios/features/v2/email_transport.feature new file mode 100644 index 00000000000..f2b014905ed --- /dev/null +++ b/tests/scenarios/features/v2/email_transport.feature @@ -0,0 +1,22 @@ +@endpoint(email-transport) @endpoint(email-transport-v2) +Feature: Email Transport + Endpoints for receiving email transport webhook events for audit trail + processing. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "EmailTransport" API + And operation "CreateEmailTransportWebhookIntake" enabled + And new "CreateEmailTransportWebhookIntake" request + And body with value [{"attributes": {"category": ["transactional"], "email": {"address": "user@example.com", "domain": "example.com", "subject": "[Monitor Alert] CPU usage is high", "type": ["transactional"]}, "email_id": "abc123-def456", "email_type_display_name": "Monitor Alert", "message": {"auth": {"delivered_with_tls": "TLSv1.2"}, "custom_args": {"email_id": "abc123-def456", "email_type_display_name": "Monitor Alert", "org_uuid": "8dee7c38-00cb-11ea-a77b-8b5a08d3b091", "queue_time": "2024-01-15T10:29:00Z", "subject": "[Monitor Alert] CPU usage is high"}, "id": {"message_id": "", "smtp_id": "", "transport_event_id": "evt_abc123"}, "name": "delivered", "response": {"enhanced_smtp_code": "2.0.0", "reason": "250 2.0.0 OK", "smtp_code": "250"}, "sender_ip": "192.168.1.1", "timestamp": {"event_timestamp": 1705312200.0, "lifetime": 3.2, "queue_time": 1.5, "scheduled_time": 1705312190.0}}, "network": {"ip": {"attributes": [{"ip": "192.168.1.1", "source": ["sendgrid"]}], "list": ["192.168.1.1"]}}, "org": 1234, "org_metadata": {}, "org_uuid": "8dee7c38-00cb-11ea-a77b-8b5a08d3b091", "queue_time": "2024-01-15T10:29:00Z", "subject": "[Monitor Alert] CPU usage is high", "useragent": "Mozilla/5.0"}, "date": "2024-01-15T10:30:00Z", "log_id": "AQAAAZPHnBT0TwJAdgAAAABBWlBIblVlNEFBQ0dFMmVkYTFDSnRR", "source": "sendgrid", "status": "info", "tags": ["env:production"]}] + + @generated @skip @team:DataDog/dogmail + Scenario: Ingest email transport webhook events returns "Bad Request" response + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/dogmail + Scenario: Ingest email transport webhook events returns "No Content" response + When the request is sent + Then the response status is 204 No Content diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index d5a8323e270..96d9f3eb5d1 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -1863,6 +1863,12 @@ "type": "idempotent" } }, + "CreateEmailTransportWebhookIntake": { + "tag": "Email Transport", + "undo": { + "type": "safe" + } + }, "SearchIssues": { "tag": "Error Tracking", "undo": {