From e0298df03e900c39635f7531e5a0e9c971619aa0 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 6 Feb 2026 10:18:50 +0000 Subject: [PATCH] Regenerate client from commit f1b97e5 of spec repo --- .generator/schemas/v2/openapi.yaml | 472 +++++++++++++++++ api/datadog/configuration.go | 4 + api/datadogV2/api_incidents.go | 476 ++++++++++++++++++ api/datadogV2/doc.go | 4 + ..._incident_timestamp_override_attributes.go | 288 +++++++++++ ...nt_timestamp_override_create_attributes.go | 148 ++++++ ...incident_timestamp_override_create_data.go | 148 ++++++ ...ident_timestamp_override_create_request.go | 110 ++++ .../model_incident_timestamp_override_data.go | 217 ++++++++ ...ent_timestamp_override_patch_attributes.go | 106 ++++ ..._incident_timestamp_override_patch_data.go | 148 ++++++ ...cident_timestamp_override_patch_request.go | 110 ++++ ...cident_timestamp_override_relationships.go | 145 ++++++ ...el_incident_timestamp_override_response.go | 145 ++++++ ...l_incident_timestamp_overrides_response.go | 136 +++++ ...odel_incidents_timestamp_overrides_type.go | 64 +++ ...el_timestamp_override_user_relationship.go | 110 ++++ ...mestamp_override_user_relationship_data.go | 135 +++++ api/datadogV2/model_timestamp_type.go | 70 +++ api/datadogV2/model_user_included.go | 176 +++++++ .../model_user_included_attributes.go | 231 +++++++++ .../CreateIncidentTimestampOverride.go | 41 ++ .../DeleteIncidentTimestampOverride.go | 27 + .../ListIncidentTimestampOverrides.go | 31 ++ .../UpdateIncidentTimestampOverride.go | 40 ++ tests/scenarios/features/v2/incidents.feature | 91 ++++ tests/scenarios/features/v2/undo.json | 24 + 27 files changed, 3697 insertions(+) create mode 100644 api/datadogV2/model_incident_timestamp_override_attributes.go create mode 100644 api/datadogV2/model_incident_timestamp_override_create_attributes.go create mode 100644 api/datadogV2/model_incident_timestamp_override_create_data.go create mode 100644 api/datadogV2/model_incident_timestamp_override_create_request.go create mode 100644 api/datadogV2/model_incident_timestamp_override_data.go create mode 100644 api/datadogV2/model_incident_timestamp_override_patch_attributes.go create mode 100644 api/datadogV2/model_incident_timestamp_override_patch_data.go create mode 100644 api/datadogV2/model_incident_timestamp_override_patch_request.go create mode 100644 api/datadogV2/model_incident_timestamp_override_relationships.go create mode 100644 api/datadogV2/model_incident_timestamp_override_response.go create mode 100644 api/datadogV2/model_incident_timestamp_overrides_response.go create mode 100644 api/datadogV2/model_incidents_timestamp_overrides_type.go create mode 100644 api/datadogV2/model_timestamp_override_user_relationship.go create mode 100644 api/datadogV2/model_timestamp_override_user_relationship_data.go create mode 100644 api/datadogV2/model_timestamp_type.go create mode 100644 api/datadogV2/model_user_included.go create mode 100644 api/datadogV2/model_user_included_attributes.go create mode 100644 examples/v2/incidents/CreateIncidentTimestampOverride.go create mode 100644 examples/v2/incidents/DeleteIncidentTimestampOverride.go create mode 100644 examples/v2/incidents/ListIncidentTimestampOverrides.go create mode 100644 examples/v2/incidents/UpdateIncidentTimestampOverride.go diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e301432aca7..1fbbc433026 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -494,6 +494,15 @@ components: items: $ref: '#/components/schemas/GetIssueIncludeQueryParameterItem' type: array + IncidentID: + description: The UUID of the incident. + in: path + name: incident_id + required: true + schema: + example: 9cecfde8-e35d-4387-8985-9b30dcb9cb1c + format: uuid + type: string IncidentIDPathParameter: description: The UUID of the incident. in: path @@ -660,6 +669,14 @@ components: schema: example: ExampleTeamName type: string + IncidentTimestampOverrideInclude: + description: Specifies which types of related objects are included in the response. + in: query + name: include + required: false + schema: + example: created_by_user,last_modified_by_user + type: string IncidentTodoIDPathParameter: description: The UUID of the incident todo. in: path @@ -689,6 +706,15 @@ components: required: false schema: $ref: '#/components/schemas/IncludeType' + IncludeDeleted: + description: Specifies whether to include deleted timestamp overrides in the + response. + in: query + name: include-deleted + required: false + schema: + example: false + type: boolean InstanceId: description: The ID of the workflow instance. in: path @@ -1152,6 +1178,15 @@ components: required: true schema: type: string + TimestampOverrideID: + description: The UUID of the timestamp override. + in: path + name: timestamp_override_id + required: true + schema: + example: 6f48a86f-9a39-4bcf-a76b-9a1b20188995 + format: uuid + type: string ToTimestamp: description: The ending timestamp for the SLO status query in epoch seconds. in: query @@ -30334,6 +30369,168 @@ components: nullable: false type: string type: object + IncidentTimestampOverrideAttributes: + description: Attributes of an incident timestamp override. + properties: + created_at: + description: Timestamp of when the override was created. + example: '2026-01-13T17:15:55.379155748Z' + format: date-time + type: string + deleted_at: + description: Timestamp of when the override was deleted (soft delete). + example: null + format: date-time + nullable: true + type: string + incident_id: + description: The UUID of the incident. + example: 9cecfde8-e35d-4387-8985-9b30dcb9cb1c + format: uuid + type: string + modified_at: + description: Timestamp of when the override was last modified. + example: '2026-01-13T17:15:55.379155834Z' + format: date-time + type: string + timestamp_type: + $ref: '#/components/schemas/TimestampType' + timestamp_value: + description: The timestamp value for the override. + example: '2024-12-29T10:00:00Z' + format: date-time + type: string + required: + - incident_id + - timestamp_type + - timestamp_value + - created_at + - modified_at + - deleted_at + type: object + IncidentTimestampOverrideCreateAttributes: + description: Attributes for creating an incident timestamp override. + properties: + timestamp_type: + $ref: '#/components/schemas/TimestampType' + timestamp_value: + description: The timestamp value for the override. + example: '2024-12-29T10:00:00Z' + format: date-time + type: string + required: + - timestamp_type + - timestamp_value + type: object + IncidentTimestampOverrideCreateData: + description: Data for creating an incident timestamp override. + properties: + attributes: + $ref: '#/components/schemas/IncidentTimestampOverrideCreateAttributes' + type: + $ref: '#/components/schemas/IncidentsTimestampOverridesType' + required: + - type + - attributes + type: object + IncidentTimestampOverrideCreateRequest: + description: Request to create an incident timestamp override. + properties: + data: + $ref: '#/components/schemas/IncidentTimestampOverrideCreateData' + required: + - data + type: object + IncidentTimestampOverrideData: + description: Data for a single incident timestamp override. + properties: + attributes: + $ref: '#/components/schemas/IncidentTimestampOverrideAttributes' + id: + description: The UUID of the timestamp override. + example: 35301c93-75c0-4ec4-a889-28e1dfc092a9 + format: uuid + type: string + relationships: + $ref: '#/components/schemas/IncidentTimestampOverrideRelationships' + type: + $ref: '#/components/schemas/IncidentsTimestampOverridesType' + required: + - id + - type + - attributes + - relationships + type: object + IncidentTimestampOverridePatchAttributes: + description: Attributes for patching an incident timestamp override. + properties: + timestamp_value: + description: The timestamp value for the override. + example: '2024-12-29T11:00:00Z' + format: date-time + type: string + required: + - timestamp_value + type: object + IncidentTimestampOverridePatchData: + description: Data for patching an incident timestamp override. + properties: + attributes: + $ref: '#/components/schemas/IncidentTimestampOverridePatchAttributes' + type: + $ref: '#/components/schemas/IncidentsTimestampOverridesType' + required: + - type + - attributes + type: object + IncidentTimestampOverridePatchRequest: + description: Request to patch an incident timestamp override. + properties: + data: + $ref: '#/components/schemas/IncidentTimestampOverridePatchData' + required: + - data + type: object + IncidentTimestampOverrideRelationships: + description: Relationships for incident timestamp override. + properties: + created_by_user: + $ref: '#/components/schemas/TimestampOverrideUserRelationship' + last_modified_by_user: + $ref: '#/components/schemas/TimestampOverrideUserRelationship' + required: + - created_by_user + - last_modified_by_user + type: object + IncidentTimestampOverrideResponse: + description: Response containing a single incident timestamp override. + properties: + data: + $ref: '#/components/schemas/IncidentTimestampOverrideData' + included: + description: Included related resources. + items: + $ref: '#/components/schemas/UserIncluded' + type: array + required: + - data + type: object + IncidentTimestampOverridesResponse: + description: Response containing a list of incident timestamp overrides. + properties: + data: + description: Array of incident timestamp overrides. + items: + $ref: '#/components/schemas/IncidentTimestampOverrideData' + type: array + included: + description: Included related resources. + items: + $ref: '#/components/schemas/UserIncluded' + type: array + required: + - data + type: object IncidentTodoAnonymousAssignee: description: Anonymous assignee entity. properties: @@ -30994,6 +31191,15 @@ components: required: - data type: object + IncidentsTimestampOverridesType: + default: incidents_timestamp_overrides + description: The JSON:API type for timestamp overrides. + enum: + - incidents_timestamp_overrides + example: incidents_timestamp_overrides + type: string + x-enum-varnames: + - INCIDENTS_TIMESTAMP_OVERRIDES IncludeType: description: Supported include types. enum: @@ -64053,6 +64259,44 @@ components: items: $ref: '#/components/schemas/TimeseriesResponseValues' type: array + TimestampOverrideUserRelationship: + description: Relationship to a user. + properties: + data: + $ref: '#/components/schemas/TimestampOverrideUserRelationshipData' + required: + - data + type: object + TimestampOverrideUserRelationshipData: + description: User relationship data. + properties: + id: + description: The UUID of the user. + example: 8ec982dd-cd99-41c6-992a-c47fc9168cad + format: uuid + type: string + type: + description: The type of the related resource. + example: users + type: string + required: + - id + - type + type: object + TimestampType: + description: The type of timestamp being overridden. + enum: + - created + - detected + - resolved + - declared + example: created + type: string + x-enum-varnames: + - CREATED + - DETECTED + - RESOLVED + - DECLARED TokenName: description: Name for tokens. example: MyTokenName @@ -65792,6 +66036,56 @@ components: required: - data type: object + UserIncluded: + description: Included user data. + properties: + attributes: + $ref: '#/components/schemas/UserIncludedAttributes' + id: + description: The UUID of the user. + example: 8ec982dd-cd99-41c6-992a-c47fc9168cad + format: uuid + type: string + type: + description: The type of the included resource. + example: users + type: string + required: + - id + - type + - attributes + type: object + UserIncludedAttributes: + description: Attributes of an included user. + properties: + email: + description: The email address of the user. + example: fake1@email.com + type: string + handle: + description: The handle of the user. + example: fakeUserHandle1 + type: string + icon: + description: The icon URL for the user. + example: http://a.com/some-icon-1.jpg + type: string + name: + description: The name of the user. + example: fakeUserName1 + type: string + uuid: + description: The UUID of the user. + example: 8ec982dd-cd99-41c6-992a-c47fc9168cad + format: uuid + type: string + required: + - email + - handle + - icon + - name + - uuid + type: object UserInvitationData: description: Object to create a user invitation. properties: @@ -79659,6 +79953,184 @@ paths: - incident_write x-unstable: '**Note**: This endpoint is in public beta. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/{incident_id}/timestamp-overrides: + get: + description: Get all timestamp overrides for a specific incident. + operationId: ListIncidentTimestampOverrides + parameters: + - $ref: '#/components/parameters/IncidentID' + - $ref: '#/components/parameters/IncidentTimestampOverrideInclude' + - $ref: '#/components/parameters/IncludeDeleted' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentTimestampOverridesResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: List timestamp overrides for an incident + tags: + - Incidents + 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/).' + post: + description: Create a new timestamp override for a specific incident. + operationId: CreateIncidentTimestampOverride + parameters: + - $ref: '#/components/parameters/IncidentID' + - $ref: '#/components/parameters/IncidentTimestampOverrideInclude' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentTimestampOverrideCreateRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentTimestampOverrideResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Create a timestamp override for an incident + tags: + - Incidents + x-codegen-request-body-name: body + 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/incidents/{incident_id}/timestamp-overrides/{timestamp_override_id}: + delete: + description: Delete an existing timestamp override for a specific incident. + operationId: DeleteIncidentTimestampOverride + parameters: + - $ref: '#/components/parameters/IncidentID' + - $ref: '#/components/parameters/TimestampOverrideID' + responses: + '204': + description: No Content + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Delete a timestamp override for an incident + tags: + - Incidents + 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/).' + patch: + description: Update an existing timestamp override for a specific incident. + operationId: UpdateIncidentTimestampOverride + parameters: + - $ref: '#/components/parameters/IncidentID' + - $ref: '#/components/parameters/TimestampOverrideID' + - $ref: '#/components/parameters/IncidentTimestampOverrideInclude' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentTimestampOverridePatchRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentTimestampOverrideResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Update a timestamp override for an incident + tags: + - Incidents + x-codegen-request-body-name: body + 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/integration/aws/accounts: get: diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 6e36cfe4464..1856cb0bb90 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -721,6 +721,7 @@ func NewConfiguration() *Configuration { "v2.CreateIncidentNotificationTemplate": false, "v2.CreateIncidentPostmortemAttachment": false, "v2.CreateIncidentPostmortemTemplate": false, + "v2.CreateIncidentTimestampOverride": false, "v2.CreateIncidentTodo": false, "v2.CreateIncidentType": false, "v2.DeleteGlobalIncidentHandle": false, @@ -730,6 +731,7 @@ func NewConfiguration() *Configuration { "v2.DeleteIncidentNotificationRule": false, "v2.DeleteIncidentNotificationTemplate": false, "v2.DeleteIncidentPostmortemTemplate": false, + "v2.DeleteIncidentTimestampOverride": false, "v2.DeleteIncidentTodo": false, "v2.DeleteIncidentType": false, "v2.GetGlobalIncidentSettings": false, @@ -747,6 +749,7 @@ func NewConfiguration() *Configuration { "v2.ListIncidentNotificationTemplates": false, "v2.ListIncidentPostmortemTemplates": false, "v2.ListIncidents": false, + "v2.ListIncidentTimestampOverrides": false, "v2.ListIncidentTodos": false, "v2.ListIncidentTypes": false, "v2.SearchIncidents": false, @@ -758,6 +761,7 @@ func NewConfiguration() *Configuration { "v2.UpdateIncidentNotificationRule": false, "v2.UpdateIncidentNotificationTemplate": false, "v2.UpdateIncidentPostmortemTemplate": false, + "v2.UpdateIncidentTimestampOverride": false, "v2.UpdateIncidentTodo": false, "v2.UpdateIncidentType": false, "v2.CreateJiraIssueTemplate": false, diff --git a/api/datadogV2/api_incidents.go b/api/datadogV2/api_incidents.go index 1e7dc230c8f..6f3c2b9b180 100644 --- a/api/datadogV2/api_incidents.go +++ b/api/datadogV2/api_incidents.go @@ -929,6 +929,133 @@ func (a *IncidentsApi) CreateIncidentPostmortemTemplate(ctx _context.Context, bo return localVarReturnValue, localVarHTTPResponse, nil } +// CreateIncidentTimestampOverrideOptionalParameters holds optional parameters for CreateIncidentTimestampOverride. +type CreateIncidentTimestampOverrideOptionalParameters struct { + Include *string +} + +// NewCreateIncidentTimestampOverrideOptionalParameters creates an empty struct for parameters. +func NewCreateIncidentTimestampOverrideOptionalParameters() *CreateIncidentTimestampOverrideOptionalParameters { + this := CreateIncidentTimestampOverrideOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *CreateIncidentTimestampOverrideOptionalParameters) WithInclude(include string) *CreateIncidentTimestampOverrideOptionalParameters { + r.Include = &include + return r +} + +// CreateIncidentTimestampOverride Create a timestamp override for an incident. +// Create a new timestamp override for a specific incident. +func (a *IncidentsApi) CreateIncidentTimestampOverride(ctx _context.Context, incidentId uuid.UUID, body IncidentTimestampOverrideCreateRequest, o ...CreateIncidentTimestampOverrideOptionalParameters) (IncidentTimestampOverrideResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentTimestampOverrideResponse + optionalParams CreateIncidentTimestampOverrideOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type CreateIncidentTimestampOverrideOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.CreateIncidentTimestampOverride" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, 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.IncidentsApi.CreateIncidentTimestampOverride") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/timestamp-overrides" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, 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 localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // CreateIncidentTodo Create an incident todo. // Create an incident todo. func (a *IncidentsApi) CreateIncidentTodo(ctx _context.Context, incidentId string, body IncidentTodoCreateRequest) (IncidentTodoResponse, *_nethttp.Response, error) { @@ -1791,6 +1918,93 @@ func (a *IncidentsApi) DeleteIncidentPostmortemTemplate(ctx _context.Context, te return localVarHTTPResponse, nil } +// DeleteIncidentTimestampOverride Delete a timestamp override for an incident. +// Delete an existing timestamp override for a specific incident. +func (a *IncidentsApi) DeleteIncidentTimestampOverride(ctx _context.Context, incidentId uuid.UUID, timestampOverrideId uuid.UUID) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncidentTimestampOverride" + 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.IncidentsApi.DeleteIncidentTimestampOverride") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/timestamp-overrides/{timestamp_override_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{timestamp_override_id}", _neturl.PathEscape(datadog.ParameterToString(timestampOverrideId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + 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 == 403 || localVarHTTPResponse.StatusCode == 404 { + 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 +} + // DeleteIncidentTodo Delete an incident todo. // Delete an incident todo. func (a *IncidentsApi) DeleteIncidentTodo(ctx _context.Context, incidentId string, todoId string) (*_nethttp.Response, error) { @@ -3519,6 +3733,140 @@ func (a *IncidentsApi) ListIncidentPostmortemTemplates(ctx _context.Context) (Po return localVarReturnValue, localVarHTTPResponse, nil } +// ListIncidentTimestampOverridesOptionalParameters holds optional parameters for ListIncidentTimestampOverrides. +type ListIncidentTimestampOverridesOptionalParameters struct { + Include *string + IncludeDeleted *bool +} + +// NewListIncidentTimestampOverridesOptionalParameters creates an empty struct for parameters. +func NewListIncidentTimestampOverridesOptionalParameters() *ListIncidentTimestampOverridesOptionalParameters { + this := ListIncidentTimestampOverridesOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ListIncidentTimestampOverridesOptionalParameters) WithInclude(include string) *ListIncidentTimestampOverridesOptionalParameters { + r.Include = &include + return r +} + +// WithIncludeDeleted sets the corresponding parameter name and returns the struct. +func (r *ListIncidentTimestampOverridesOptionalParameters) WithIncludeDeleted(includeDeleted bool) *ListIncidentTimestampOverridesOptionalParameters { + r.IncludeDeleted = &includeDeleted + return r +} + +// ListIncidentTimestampOverrides List timestamp overrides for an incident. +// Get all timestamp overrides for a specific incident. +func (a *IncidentsApi) ListIncidentTimestampOverrides(ctx _context.Context, incidentId uuid.UUID, o ...ListIncidentTimestampOverridesOptionalParameters) (IncidentTimestampOverridesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentTimestampOverridesResponse + optionalParams ListIncidentTimestampOverridesOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentTimestampOverridesOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListIncidentTimestampOverrides" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, 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.IncidentsApi.ListIncidentTimestampOverrides") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/timestamp-overrides" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + if optionalParams.IncludeDeleted != nil { + localVarQueryParams.Add("include-deleted", datadog.ParameterToString(*optionalParams.IncludeDeleted, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, 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 localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // ListIncidentTodos Get a list of an incident's todos. // Get all todos for an incident. func (a *IncidentsApi) ListIncidentTodos(ctx _context.Context, incidentId string) (IncidentTodoListResponse, *_nethttp.Response, error) { @@ -4994,6 +5342,134 @@ func (a *IncidentsApi) UpdateIncidentPostmortemTemplate(ctx _context.Context, te return localVarReturnValue, localVarHTTPResponse, nil } +// UpdateIncidentTimestampOverrideOptionalParameters holds optional parameters for UpdateIncidentTimestampOverride. +type UpdateIncidentTimestampOverrideOptionalParameters struct { + Include *string +} + +// NewUpdateIncidentTimestampOverrideOptionalParameters creates an empty struct for parameters. +func NewUpdateIncidentTimestampOverrideOptionalParameters() *UpdateIncidentTimestampOverrideOptionalParameters { + this := UpdateIncidentTimestampOverrideOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *UpdateIncidentTimestampOverrideOptionalParameters) WithInclude(include string) *UpdateIncidentTimestampOverrideOptionalParameters { + r.Include = &include + return r +} + +// UpdateIncidentTimestampOverride Update a timestamp override for an incident. +// Update an existing timestamp override for a specific incident. +func (a *IncidentsApi) UpdateIncidentTimestampOverride(ctx _context.Context, incidentId uuid.UUID, timestampOverrideId uuid.UUID, body IncidentTimestampOverridePatchRequest, o ...UpdateIncidentTimestampOverrideOptionalParameters) (IncidentTimestampOverrideResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue IncidentTimestampOverrideResponse + optionalParams UpdateIncidentTimestampOverrideOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentTimestampOverrideOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.UpdateIncidentTimestampOverride" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, 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.IncidentsApi.UpdateIncidentTimestampOverride") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/timestamp-overrides/{timestamp_override_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{timestamp_override_id}", _neturl.PathEscape(datadog.ParameterToString(timestampOverrideId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, 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 localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // UpdateIncidentTodo Update an incident todo. // Update an incident todo. func (a *IncidentsApi) UpdateIncidentTodo(ctx _context.Context, incidentId string, todoId string, body IncidentTodoPatchRequest) (IncidentTodoResponse, *_nethttp.Response, error) { diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 20575dc737a..080eceb4135 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -310,6 +310,7 @@ // - [IncidentsApi.CreateIncidentNotificationTemplate] // - [IncidentsApi.CreateIncidentPostmortemAttachment] // - [IncidentsApi.CreateIncidentPostmortemTemplate] +// - [IncidentsApi.CreateIncidentTimestampOverride] // - [IncidentsApi.CreateIncidentTodo] // - [IncidentsApi.CreateIncidentType] // - [IncidentsApi.DeleteGlobalIncidentHandle] @@ -320,6 +321,7 @@ // - [IncidentsApi.DeleteIncidentNotificationRule] // - [IncidentsApi.DeleteIncidentNotificationTemplate] // - [IncidentsApi.DeleteIncidentPostmortemTemplate] +// - [IncidentsApi.DeleteIncidentTimestampOverride] // - [IncidentsApi.DeleteIncidentTodo] // - [IncidentsApi.DeleteIncidentType] // - [IncidentsApi.GetGlobalIncidentSettings] @@ -337,6 +339,7 @@ // - [IncidentsApi.ListIncidentNotificationRules] // - [IncidentsApi.ListIncidentNotificationTemplates] // - [IncidentsApi.ListIncidentPostmortemTemplates] +// - [IncidentsApi.ListIncidentTimestampOverrides] // - [IncidentsApi.ListIncidentTodos] // - [IncidentsApi.ListIncidentTypes] // - [IncidentsApi.ListIncidents] @@ -349,6 +352,7 @@ // - [IncidentsApi.UpdateIncidentNotificationRule] // - [IncidentsApi.UpdateIncidentNotificationTemplate] // - [IncidentsApi.UpdateIncidentPostmortemTemplate] +// - [IncidentsApi.UpdateIncidentTimestampOverride] // - [IncidentsApi.UpdateIncidentTodo] // - [IncidentsApi.UpdateIncidentType] // - [JiraIntegrationApi.CreateJiraIssueTemplate] diff --git a/api/datadogV2/model_incident_timestamp_override_attributes.go b/api/datadogV2/model_incident_timestamp_override_attributes.go new file mode 100644 index 00000000000..11f8b82d151 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_attributes.go @@ -0,0 +1,288 @@ +// 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/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideAttributes Attributes of an incident timestamp override. +type IncidentTimestampOverrideAttributes struct { + // Timestamp of when the override was created. + CreatedAt time.Time `json:"created_at"` + // Timestamp of when the override was deleted (soft delete). + DeletedAt datadog.NullableTime `json:"deleted_at"` + // The UUID of the incident. + IncidentId uuid.UUID `json:"incident_id"` + // Timestamp of when the override was last modified. + ModifiedAt time.Time `json:"modified_at"` + // The type of timestamp being overridden. + TimestampType TimestampType `json:"timestamp_type"` + // The timestamp value for the override. + TimestampValue time.Time `json:"timestamp_value"` + // 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:"-"` +} + +// NewIncidentTimestampOverrideAttributes instantiates a new IncidentTimestampOverrideAttributes 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 NewIncidentTimestampOverrideAttributes(createdAt time.Time, deletedAt datadog.NullableTime, incidentId uuid.UUID, modifiedAt time.Time, timestampType TimestampType, timestampValue time.Time) *IncidentTimestampOverrideAttributes { + this := IncidentTimestampOverrideAttributes{} + this.CreatedAt = createdAt + this.DeletedAt = deletedAt + this.IncidentId = incidentId + this.ModifiedAt = modifiedAt + this.TimestampType = timestampType + this.TimestampValue = timestampValue + return &this +} + +// NewIncidentTimestampOverrideAttributesWithDefaults instantiates a new IncidentTimestampOverrideAttributes 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 NewIncidentTimestampOverrideAttributesWithDefaults() *IncidentTimestampOverrideAttributes { + this := IncidentTimestampOverrideAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *IncidentTimestampOverrideAttributes) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *IncidentTimestampOverrideAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetDeletedAt returns the DeletedAt field value. +// If the value is explicit nil, the zero value for time.Time will be returned. +func (o *IncidentTimestampOverrideAttributes) GetDeletedAt() time.Time { + if o == nil || o.DeletedAt.Get() == nil { + var ret time.Time + return ret + } + return *o.DeletedAt.Get() +} + +// GetDeletedAtOk returns a tuple with the DeletedAt field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *IncidentTimestampOverrideAttributes) GetDeletedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.DeletedAt.Get(), o.DeletedAt.IsSet() +} + +// SetDeletedAt sets field value. +func (o *IncidentTimestampOverrideAttributes) SetDeletedAt(v time.Time) { + o.DeletedAt.Set(&v) +} + +// GetIncidentId returns the IncidentId field value. +func (o *IncidentTimestampOverrideAttributes) GetIncidentId() uuid.UUID { + if o == nil { + var ret uuid.UUID + return ret + } + return o.IncidentId +} + +// GetIncidentIdOk returns a tuple with the IncidentId field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideAttributes) GetIncidentIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.IncidentId, true +} + +// SetIncidentId sets field value. +func (o *IncidentTimestampOverrideAttributes) SetIncidentId(v uuid.UUID) { + o.IncidentId = v +} + +// GetModifiedAt returns the ModifiedAt field value. +func (o *IncidentTimestampOverrideAttributes) GetModifiedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.ModifiedAt, true +} + +// SetModifiedAt sets field value. +func (o *IncidentTimestampOverrideAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = v +} + +// GetTimestampType returns the TimestampType field value. +func (o *IncidentTimestampOverrideAttributes) GetTimestampType() TimestampType { + if o == nil { + var ret TimestampType + return ret + } + return o.TimestampType +} + +// GetTimestampTypeOk returns a tuple with the TimestampType field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideAttributes) GetTimestampTypeOk() (*TimestampType, bool) { + if o == nil { + return nil, false + } + return &o.TimestampType, true +} + +// SetTimestampType sets field value. +func (o *IncidentTimestampOverrideAttributes) SetTimestampType(v TimestampType) { + o.TimestampType = v +} + +// GetTimestampValue returns the TimestampValue field value. +func (o *IncidentTimestampOverrideAttributes) GetTimestampValue() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.TimestampValue +} + +// GetTimestampValueOk returns a tuple with the TimestampValue field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideAttributes) GetTimestampValueOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimestampValue, true +} + +// SetTimestampValue sets field value. +func (o *IncidentTimestampOverrideAttributes) SetTimestampValue(v time.Time) { + o.TimestampValue = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + toSerialize["deleted_at"] = o.DeletedAt.Get() + toSerialize["incident_id"] = o.IncidentId + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + toSerialize["timestamp_type"] = o.TimestampType + if o.TimestampValue.Nanosecond() == 0 { + toSerialize["timestamp_value"] = o.TimestampValue.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp_value"] = o.TimestampValue.Format("2006-01-02T15:04:05.000Z07:00") + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at"` + DeletedAt datadog.NullableTime `json:"deleted_at"` + IncidentId *uuid.UUID `json:"incident_id"` + ModifiedAt *time.Time `json:"modified_at"` + TimestampType *TimestampType `json:"timestamp_type"` + TimestampValue *time.Time `json:"timestamp_value"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if !all.DeletedAt.IsSet() { + return fmt.Errorf("required field deleted_at missing") + } + if all.IncidentId == nil { + return fmt.Errorf("required field incident_id missing") + } + if all.ModifiedAt == nil { + return fmt.Errorf("required field modified_at missing") + } + if all.TimestampType == nil { + return fmt.Errorf("required field timestamp_type missing") + } + if all.TimestampValue == nil { + return fmt.Errorf("required field timestamp_value missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "deleted_at", "incident_id", "modified_at", "timestamp_type", "timestamp_value"}) + } else { + return err + } + + hasInvalidField := false + o.CreatedAt = *all.CreatedAt + o.DeletedAt = all.DeletedAt + o.IncidentId = *all.IncidentId + o.ModifiedAt = *all.ModifiedAt + if !all.TimestampType.IsValid() { + hasInvalidField = true + } else { + o.TimestampType = *all.TimestampType + } + o.TimestampValue = *all.TimestampValue + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_create_attributes.go b/api/datadogV2/model_incident_timestamp_override_create_attributes.go new file mode 100644 index 00000000000..e478b844400 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_create_attributes.go @@ -0,0 +1,148 @@ +// 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" +) + +// IncidentTimestampOverrideCreateAttributes Attributes for creating an incident timestamp override. +type IncidentTimestampOverrideCreateAttributes struct { + // The type of timestamp being overridden. + TimestampType TimestampType `json:"timestamp_type"` + // The timestamp value for the override. + TimestampValue time.Time `json:"timestamp_value"` + // 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:"-"` +} + +// NewIncidentTimestampOverrideCreateAttributes instantiates a new IncidentTimestampOverrideCreateAttributes 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 NewIncidentTimestampOverrideCreateAttributes(timestampType TimestampType, timestampValue time.Time) *IncidentTimestampOverrideCreateAttributes { + this := IncidentTimestampOverrideCreateAttributes{} + this.TimestampType = timestampType + this.TimestampValue = timestampValue + return &this +} + +// NewIncidentTimestampOverrideCreateAttributesWithDefaults instantiates a new IncidentTimestampOverrideCreateAttributes 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 NewIncidentTimestampOverrideCreateAttributesWithDefaults() *IncidentTimestampOverrideCreateAttributes { + this := IncidentTimestampOverrideCreateAttributes{} + return &this +} + +// GetTimestampType returns the TimestampType field value. +func (o *IncidentTimestampOverrideCreateAttributes) GetTimestampType() TimestampType { + if o == nil { + var ret TimestampType + return ret + } + return o.TimestampType +} + +// GetTimestampTypeOk returns a tuple with the TimestampType field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideCreateAttributes) GetTimestampTypeOk() (*TimestampType, bool) { + if o == nil { + return nil, false + } + return &o.TimestampType, true +} + +// SetTimestampType sets field value. +func (o *IncidentTimestampOverrideCreateAttributes) SetTimestampType(v TimestampType) { + o.TimestampType = v +} + +// GetTimestampValue returns the TimestampValue field value. +func (o *IncidentTimestampOverrideCreateAttributes) GetTimestampValue() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.TimestampValue +} + +// GetTimestampValueOk returns a tuple with the TimestampValue field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideCreateAttributes) GetTimestampValueOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimestampValue, true +} + +// SetTimestampValue sets field value. +func (o *IncidentTimestampOverrideCreateAttributes) SetTimestampValue(v time.Time) { + o.TimestampValue = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["timestamp_type"] = o.TimestampType + if o.TimestampValue.Nanosecond() == 0 { + toSerialize["timestamp_value"] = o.TimestampValue.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp_value"] = o.TimestampValue.Format("2006-01-02T15:04:05.000Z07:00") + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + TimestampType *TimestampType `json:"timestamp_type"` + TimestampValue *time.Time `json:"timestamp_value"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.TimestampType == nil { + return fmt.Errorf("required field timestamp_type missing") + } + if all.TimestampValue == nil { + return fmt.Errorf("required field timestamp_value missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"timestamp_type", "timestamp_value"}) + } else { + return err + } + + hasInvalidField := false + if !all.TimestampType.IsValid() { + hasInvalidField = true + } else { + o.TimestampType = *all.TimestampType + } + o.TimestampValue = *all.TimestampValue + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_create_data.go b/api/datadogV2/model_incident_timestamp_override_create_data.go new file mode 100644 index 00000000000..65c18e684cc --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_create_data.go @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideCreateData Data for creating an incident timestamp override. +type IncidentTimestampOverrideCreateData struct { + // Attributes for creating an incident timestamp override. + Attributes IncidentTimestampOverrideCreateAttributes `json:"attributes"` + // The JSON:API type for timestamp overrides. + Type IncidentsTimestampOverridesType `json:"type"` + // 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:"-"` +} + +// NewIncidentTimestampOverrideCreateData instantiates a new IncidentTimestampOverrideCreateData 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 NewIncidentTimestampOverrideCreateData(attributes IncidentTimestampOverrideCreateAttributes, typeVar IncidentsTimestampOverridesType) *IncidentTimestampOverrideCreateData { + this := IncidentTimestampOverrideCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewIncidentTimestampOverrideCreateDataWithDefaults instantiates a new IncidentTimestampOverrideCreateData 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 NewIncidentTimestampOverrideCreateDataWithDefaults() *IncidentTimestampOverrideCreateData { + this := IncidentTimestampOverrideCreateData{} + var typeVar IncidentsTimestampOverridesType = INCIDENTSTIMESTAMPOVERRIDESTYPE_INCIDENTS_TIMESTAMP_OVERRIDES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentTimestampOverrideCreateData) GetAttributes() IncidentTimestampOverrideCreateAttributes { + if o == nil { + var ret IncidentTimestampOverrideCreateAttributes + 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 *IncidentTimestampOverrideCreateData) GetAttributesOk() (*IncidentTimestampOverrideCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentTimestampOverrideCreateData) SetAttributes(v IncidentTimestampOverrideCreateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *IncidentTimestampOverrideCreateData) GetType() IncidentsTimestampOverridesType { + if o == nil { + var ret IncidentsTimestampOverridesType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideCreateData) GetTypeOk() (*IncidentsTimestampOverridesType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentTimestampOverrideCreateData) SetType(v IncidentsTimestampOverridesType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideCreateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentTimestampOverrideCreateAttributes `json:"attributes"` + Type *IncidentsTimestampOverridesType `json:"type"` + }{} + 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.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_create_request.go b/api/datadogV2/model_incident_timestamp_override_create_request.go new file mode 100644 index 00000000000..acb684708c4 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_create_request.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideCreateRequest Request to create an incident timestamp override. +type IncidentTimestampOverrideCreateRequest struct { + // Data for creating an incident timestamp override. + Data IncidentTimestampOverrideCreateData `json:"data"` + // 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:"-"` +} + +// NewIncidentTimestampOverrideCreateRequest instantiates a new IncidentTimestampOverrideCreateRequest 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 NewIncidentTimestampOverrideCreateRequest(data IncidentTimestampOverrideCreateData) *IncidentTimestampOverrideCreateRequest { + this := IncidentTimestampOverrideCreateRequest{} + this.Data = data + return &this +} + +// NewIncidentTimestampOverrideCreateRequestWithDefaults instantiates a new IncidentTimestampOverrideCreateRequest 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 NewIncidentTimestampOverrideCreateRequestWithDefaults() *IncidentTimestampOverrideCreateRequest { + this := IncidentTimestampOverrideCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentTimestampOverrideCreateRequest) GetData() IncidentTimestampOverrideCreateData { + if o == nil { + var ret IncidentTimestampOverrideCreateData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideCreateRequest) GetDataOk() (*IncidentTimestampOverrideCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentTimestampOverrideCreateRequest) SetData(v IncidentTimestampOverrideCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentTimestampOverrideCreateData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_data.go b/api/datadogV2/model_incident_timestamp_override_data.go new file mode 100644 index 00000000000..ba7701d413f --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_data.go @@ -0,0 +1,217 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideData Data for a single incident timestamp override. +type IncidentTimestampOverrideData struct { + // Attributes of an incident timestamp override. + Attributes IncidentTimestampOverrideAttributes `json:"attributes"` + // The UUID of the timestamp override. + Id uuid.UUID `json:"id"` + // Relationships for incident timestamp override. + Relationships IncidentTimestampOverrideRelationships `json:"relationships"` + // The JSON:API type for timestamp overrides. + Type IncidentsTimestampOverridesType `json:"type"` + // 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:"-"` +} + +// NewIncidentTimestampOverrideData instantiates a new IncidentTimestampOverrideData 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 NewIncidentTimestampOverrideData(attributes IncidentTimestampOverrideAttributes, id uuid.UUID, relationships IncidentTimestampOverrideRelationships, typeVar IncidentsTimestampOverridesType) *IncidentTimestampOverrideData { + this := IncidentTimestampOverrideData{} + this.Attributes = attributes + this.Id = id + this.Relationships = relationships + this.Type = typeVar + return &this +} + +// NewIncidentTimestampOverrideDataWithDefaults instantiates a new IncidentTimestampOverrideData 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 NewIncidentTimestampOverrideDataWithDefaults() *IncidentTimestampOverrideData { + this := IncidentTimestampOverrideData{} + var typeVar IncidentsTimestampOverridesType = INCIDENTSTIMESTAMPOVERRIDESTYPE_INCIDENTS_TIMESTAMP_OVERRIDES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentTimestampOverrideData) GetAttributes() IncidentTimestampOverrideAttributes { + if o == nil { + var ret IncidentTimestampOverrideAttributes + 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 *IncidentTimestampOverrideData) GetAttributesOk() (*IncidentTimestampOverrideAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentTimestampOverrideData) SetAttributes(v IncidentTimestampOverrideAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *IncidentTimestampOverrideData) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideData) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentTimestampOverrideData) SetId(v uuid.UUID) { + o.Id = v +} + +// GetRelationships returns the Relationships field value. +func (o *IncidentTimestampOverrideData) GetRelationships() IncidentTimestampOverrideRelationships { + if o == nil { + var ret IncidentTimestampOverrideRelationships + return ret + } + return o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideData) GetRelationshipsOk() (*IncidentTimestampOverrideRelationships, bool) { + if o == nil { + return nil, false + } + return &o.Relationships, true +} + +// SetRelationships sets field value. +func (o *IncidentTimestampOverrideData) SetRelationships(v IncidentTimestampOverrideRelationships) { + o.Relationships = v +} + +// GetType returns the Type field value. +func (o *IncidentTimestampOverrideData) GetType() IncidentsTimestampOverridesType { + if o == nil { + var ret IncidentsTimestampOverridesType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideData) GetTypeOk() (*IncidentsTimestampOverridesType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentTimestampOverrideData) SetType(v IncidentsTimestampOverridesType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["relationships"] = o.Relationships + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentTimestampOverrideAttributes `json:"attributes"` + Id *uuid.UUID `json:"id"` + Relationships *IncidentTimestampOverrideRelationships `json:"relationships"` + Type *IncidentsTimestampOverridesType `json:"type"` + }{} + 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.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Relationships == nil { + return fmt.Errorf("required field relationships missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = *all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_patch_attributes.go b/api/datadogV2/model_incident_timestamp_override_patch_attributes.go new file mode 100644 index 00000000000..a5129d413e8 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_patch_attributes.go @@ -0,0 +1,106 @@ +// 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" +) + +// IncidentTimestampOverridePatchAttributes Attributes for patching an incident timestamp override. +type IncidentTimestampOverridePatchAttributes struct { + // The timestamp value for the override. + TimestampValue time.Time `json:"timestamp_value"` + // 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:"-"` +} + +// NewIncidentTimestampOverridePatchAttributes instantiates a new IncidentTimestampOverridePatchAttributes 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 NewIncidentTimestampOverridePatchAttributes(timestampValue time.Time) *IncidentTimestampOverridePatchAttributes { + this := IncidentTimestampOverridePatchAttributes{} + this.TimestampValue = timestampValue + return &this +} + +// NewIncidentTimestampOverridePatchAttributesWithDefaults instantiates a new IncidentTimestampOverridePatchAttributes 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 NewIncidentTimestampOverridePatchAttributesWithDefaults() *IncidentTimestampOverridePatchAttributes { + this := IncidentTimestampOverridePatchAttributes{} + return &this +} + +// GetTimestampValue returns the TimestampValue field value. +func (o *IncidentTimestampOverridePatchAttributes) GetTimestampValue() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.TimestampValue +} + +// GetTimestampValueOk returns a tuple with the TimestampValue field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverridePatchAttributes) GetTimestampValueOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimestampValue, true +} + +// SetTimestampValue sets field value. +func (o *IncidentTimestampOverridePatchAttributes) SetTimestampValue(v time.Time) { + o.TimestampValue = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverridePatchAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.TimestampValue.Nanosecond() == 0 { + toSerialize["timestamp_value"] = o.TimestampValue.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp_value"] = o.TimestampValue.Format("2006-01-02T15:04:05.000Z07:00") + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverridePatchAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + TimestampValue *time.Time `json:"timestamp_value"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.TimestampValue == nil { + return fmt.Errorf("required field timestamp_value missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"timestamp_value"}) + } else { + return err + } + o.TimestampValue = *all.TimestampValue + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_patch_data.go b/api/datadogV2/model_incident_timestamp_override_patch_data.go new file mode 100644 index 00000000000..37656ae5fce --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_patch_data.go @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverridePatchData Data for patching an incident timestamp override. +type IncidentTimestampOverridePatchData struct { + // Attributes for patching an incident timestamp override. + Attributes IncidentTimestampOverridePatchAttributes `json:"attributes"` + // The JSON:API type for timestamp overrides. + Type IncidentsTimestampOverridesType `json:"type"` + // 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:"-"` +} + +// NewIncidentTimestampOverridePatchData instantiates a new IncidentTimestampOverridePatchData 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 NewIncidentTimestampOverridePatchData(attributes IncidentTimestampOverridePatchAttributes, typeVar IncidentsTimestampOverridesType) *IncidentTimestampOverridePatchData { + this := IncidentTimestampOverridePatchData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewIncidentTimestampOverridePatchDataWithDefaults instantiates a new IncidentTimestampOverridePatchData 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 NewIncidentTimestampOverridePatchDataWithDefaults() *IncidentTimestampOverridePatchData { + this := IncidentTimestampOverridePatchData{} + var typeVar IncidentsTimestampOverridesType = INCIDENTSTIMESTAMPOVERRIDESTYPE_INCIDENTS_TIMESTAMP_OVERRIDES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentTimestampOverridePatchData) GetAttributes() IncidentTimestampOverridePatchAttributes { + if o == nil { + var ret IncidentTimestampOverridePatchAttributes + 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 *IncidentTimestampOverridePatchData) GetAttributesOk() (*IncidentTimestampOverridePatchAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentTimestampOverridePatchData) SetAttributes(v IncidentTimestampOverridePatchAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *IncidentTimestampOverridePatchData) GetType() IncidentsTimestampOverridesType { + if o == nil { + var ret IncidentsTimestampOverridesType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverridePatchData) GetTypeOk() (*IncidentsTimestampOverridesType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentTimestampOverridePatchData) SetType(v IncidentsTimestampOverridesType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverridePatchData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverridePatchData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentTimestampOverridePatchAttributes `json:"attributes"` + Type *IncidentsTimestampOverridesType `json:"type"` + }{} + 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.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_patch_request.go b/api/datadogV2/model_incident_timestamp_override_patch_request.go new file mode 100644 index 00000000000..609d687b53a --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_patch_request.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverridePatchRequest Request to patch an incident timestamp override. +type IncidentTimestampOverridePatchRequest struct { + // Data for patching an incident timestamp override. + Data IncidentTimestampOverridePatchData `json:"data"` + // 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:"-"` +} + +// NewIncidentTimestampOverridePatchRequest instantiates a new IncidentTimestampOverridePatchRequest 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 NewIncidentTimestampOverridePatchRequest(data IncidentTimestampOverridePatchData) *IncidentTimestampOverridePatchRequest { + this := IncidentTimestampOverridePatchRequest{} + this.Data = data + return &this +} + +// NewIncidentTimestampOverridePatchRequestWithDefaults instantiates a new IncidentTimestampOverridePatchRequest 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 NewIncidentTimestampOverridePatchRequestWithDefaults() *IncidentTimestampOverridePatchRequest { + this := IncidentTimestampOverridePatchRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentTimestampOverridePatchRequest) GetData() IncidentTimestampOverridePatchData { + if o == nil { + var ret IncidentTimestampOverridePatchData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverridePatchRequest) GetDataOk() (*IncidentTimestampOverridePatchData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentTimestampOverridePatchRequest) SetData(v IncidentTimestampOverridePatchData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverridePatchRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverridePatchRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentTimestampOverridePatchData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_relationships.go b/api/datadogV2/model_incident_timestamp_override_relationships.go new file mode 100644 index 00000000000..1d3938697a5 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_relationships.go @@ -0,0 +1,145 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideRelationships Relationships for incident timestamp override. +type IncidentTimestampOverrideRelationships struct { + // Relationship to a user. + CreatedByUser TimestampOverrideUserRelationship `json:"created_by_user"` + // Relationship to a user. + LastModifiedByUser TimestampOverrideUserRelationship `json:"last_modified_by_user"` + // 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:"-"` +} + +// NewIncidentTimestampOverrideRelationships instantiates a new IncidentTimestampOverrideRelationships 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 NewIncidentTimestampOverrideRelationships(createdByUser TimestampOverrideUserRelationship, lastModifiedByUser TimestampOverrideUserRelationship) *IncidentTimestampOverrideRelationships { + this := IncidentTimestampOverrideRelationships{} + this.CreatedByUser = createdByUser + this.LastModifiedByUser = lastModifiedByUser + return &this +} + +// NewIncidentTimestampOverrideRelationshipsWithDefaults instantiates a new IncidentTimestampOverrideRelationships 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 NewIncidentTimestampOverrideRelationshipsWithDefaults() *IncidentTimestampOverrideRelationships { + this := IncidentTimestampOverrideRelationships{} + return &this +} + +// GetCreatedByUser returns the CreatedByUser field value. +func (o *IncidentTimestampOverrideRelationships) GetCreatedByUser() TimestampOverrideUserRelationship { + if o == nil { + var ret TimestampOverrideUserRelationship + return ret + } + return o.CreatedByUser +} + +// GetCreatedByUserOk returns a tuple with the CreatedByUser field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideRelationships) GetCreatedByUserOk() (*TimestampOverrideUserRelationship, bool) { + if o == nil { + return nil, false + } + return &o.CreatedByUser, true +} + +// SetCreatedByUser sets field value. +func (o *IncidentTimestampOverrideRelationships) SetCreatedByUser(v TimestampOverrideUserRelationship) { + o.CreatedByUser = v +} + +// GetLastModifiedByUser returns the LastModifiedByUser field value. +func (o *IncidentTimestampOverrideRelationships) GetLastModifiedByUser() TimestampOverrideUserRelationship { + if o == nil { + var ret TimestampOverrideUserRelationship + return ret + } + return o.LastModifiedByUser +} + +// GetLastModifiedByUserOk returns a tuple with the LastModifiedByUser field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideRelationships) GetLastModifiedByUserOk() (*TimestampOverrideUserRelationship, bool) { + if o == nil { + return nil, false + } + return &o.LastModifiedByUser, true +} + +// SetLastModifiedByUser sets field value. +func (o *IncidentTimestampOverrideRelationships) SetLastModifiedByUser(v TimestampOverrideUserRelationship) { + o.LastModifiedByUser = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["created_by_user"] = o.CreatedByUser + toSerialize["last_modified_by_user"] = o.LastModifiedByUser + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedByUser *TimestampOverrideUserRelationship `json:"created_by_user"` + LastModifiedByUser *TimestampOverrideUserRelationship `json:"last_modified_by_user"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CreatedByUser == nil { + return fmt.Errorf("required field created_by_user missing") + } + if all.LastModifiedByUser == nil { + return fmt.Errorf("required field last_modified_by_user missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_by_user", "last_modified_by_user"}) + } else { + return err + } + + hasInvalidField := false + if all.CreatedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedByUser = *all.CreatedByUser + if all.LastModifiedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LastModifiedByUser = *all.LastModifiedByUser + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_response.go b/api/datadogV2/model_incident_timestamp_override_response.go new file mode 100644 index 00000000000..d2ea7833db4 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_response.go @@ -0,0 +1,145 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideResponse Response containing a single incident timestamp override. +type IncidentTimestampOverrideResponse struct { + // Data for a single incident timestamp override. + Data IncidentTimestampOverrideData `json:"data"` + // Included related resources. + Included []UserIncluded `json:"included,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:"-"` +} + +// NewIncidentTimestampOverrideResponse instantiates a new IncidentTimestampOverrideResponse 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 NewIncidentTimestampOverrideResponse(data IncidentTimestampOverrideData) *IncidentTimestampOverrideResponse { + this := IncidentTimestampOverrideResponse{} + this.Data = data + return &this +} + +// NewIncidentTimestampOverrideResponseWithDefaults instantiates a new IncidentTimestampOverrideResponse 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 NewIncidentTimestampOverrideResponseWithDefaults() *IncidentTimestampOverrideResponse { + this := IncidentTimestampOverrideResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentTimestampOverrideResponse) GetData() IncidentTimestampOverrideData { + if o == nil { + var ret IncidentTimestampOverrideData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideResponse) GetDataOk() (*IncidentTimestampOverrideData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentTimestampOverrideResponse) SetData(v IncidentTimestampOverrideData) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentTimestampOverrideResponse) GetIncluded() []UserIncluded { + if o == nil || o.Included == nil { + var ret []UserIncluded + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideResponse) GetIncludedOk() (*[]UserIncluded, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *IncidentTimestampOverrideResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []UserIncluded and assigns it to the Included field. +func (o *IncidentTimestampOverrideResponse) SetIncluded(v []UserIncluded) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentTimestampOverrideData `json:"data"` + Included []UserIncluded `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_overrides_response.go b/api/datadogV2/model_incident_timestamp_overrides_response.go new file mode 100644 index 00000000000..51e800b261b --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_overrides_response.go @@ -0,0 +1,136 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverridesResponse Response containing a list of incident timestamp overrides. +type IncidentTimestampOverridesResponse struct { + // Array of incident timestamp overrides. + Data []IncidentTimestampOverrideData `json:"data"` + // Included related resources. + Included []UserIncluded `json:"included,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:"-"` +} + +// NewIncidentTimestampOverridesResponse instantiates a new IncidentTimestampOverridesResponse 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 NewIncidentTimestampOverridesResponse(data []IncidentTimestampOverrideData) *IncidentTimestampOverridesResponse { + this := IncidentTimestampOverridesResponse{} + this.Data = data + return &this +} + +// NewIncidentTimestampOverridesResponseWithDefaults instantiates a new IncidentTimestampOverridesResponse 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 NewIncidentTimestampOverridesResponseWithDefaults() *IncidentTimestampOverridesResponse { + this := IncidentTimestampOverridesResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentTimestampOverridesResponse) GetData() []IncidentTimestampOverrideData { + if o == nil { + var ret []IncidentTimestampOverrideData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverridesResponse) GetDataOk() (*[]IncidentTimestampOverrideData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentTimestampOverridesResponse) SetData(v []IncidentTimestampOverrideData) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentTimestampOverridesResponse) GetIncluded() []UserIncluded { + if o == nil || o.Included == nil { + var ret []UserIncluded + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverridesResponse) GetIncludedOk() (*[]UserIncluded, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *IncidentTimestampOverridesResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []UserIncluded and assigns it to the Included field. +func (o *IncidentTimestampOverridesResponse) SetIncluded(v []UserIncluded) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverridesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverridesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]IncidentTimestampOverrideData `json:"data"` + Included []UserIncluded `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incidents_timestamp_overrides_type.go b/api/datadogV2/model_incidents_timestamp_overrides_type.go new file mode 100644 index 00000000000..f8062317754 --- /dev/null +++ b/api/datadogV2/model_incidents_timestamp_overrides_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentsTimestampOverridesType The JSON:API type for timestamp overrides. +type IncidentsTimestampOverridesType string + +// List of IncidentsTimestampOverridesType. +const ( + INCIDENTSTIMESTAMPOVERRIDESTYPE_INCIDENTS_TIMESTAMP_OVERRIDES IncidentsTimestampOverridesType = "incidents_timestamp_overrides" +) + +var allowedIncidentsTimestampOverridesTypeEnumValues = []IncidentsTimestampOverridesType{ + INCIDENTSTIMESTAMPOVERRIDESTYPE_INCIDENTS_TIMESTAMP_OVERRIDES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentsTimestampOverridesType) GetAllowedValues() []IncidentsTimestampOverridesType { + return allowedIncidentsTimestampOverridesTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentsTimestampOverridesType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentsTimestampOverridesType(value) + return nil +} + +// NewIncidentsTimestampOverridesTypeFromValue returns a pointer to a valid IncidentsTimestampOverridesType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentsTimestampOverridesTypeFromValue(v string) (*IncidentsTimestampOverridesType, error) { + ev := IncidentsTimestampOverridesType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentsTimestampOverridesType: valid values are %v", v, allowedIncidentsTimestampOverridesTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentsTimestampOverridesType) IsValid() bool { + for _, existing := range allowedIncidentsTimestampOverridesTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentsTimestampOverridesType value. +func (v IncidentsTimestampOverridesType) Ptr() *IncidentsTimestampOverridesType { + return &v +} diff --git a/api/datadogV2/model_timestamp_override_user_relationship.go b/api/datadogV2/model_timestamp_override_user_relationship.go new file mode 100644 index 00000000000..ad566c6a43e --- /dev/null +++ b/api/datadogV2/model_timestamp_override_user_relationship.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TimestampOverrideUserRelationship Relationship to a user. +type TimestampOverrideUserRelationship struct { + // User relationship data. + Data TimestampOverrideUserRelationshipData `json:"data"` + // 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:"-"` +} + +// NewTimestampOverrideUserRelationship instantiates a new TimestampOverrideUserRelationship 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 NewTimestampOverrideUserRelationship(data TimestampOverrideUserRelationshipData) *TimestampOverrideUserRelationship { + this := TimestampOverrideUserRelationship{} + this.Data = data + return &this +} + +// NewTimestampOverrideUserRelationshipWithDefaults instantiates a new TimestampOverrideUserRelationship 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 NewTimestampOverrideUserRelationshipWithDefaults() *TimestampOverrideUserRelationship { + this := TimestampOverrideUserRelationship{} + return &this +} + +// GetData returns the Data field value. +func (o *TimestampOverrideUserRelationship) GetData() TimestampOverrideUserRelationshipData { + if o == nil { + var ret TimestampOverrideUserRelationshipData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *TimestampOverrideUserRelationship) GetDataOk() (*TimestampOverrideUserRelationshipData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *TimestampOverrideUserRelationship) SetData(v TimestampOverrideUserRelationshipData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TimestampOverrideUserRelationship) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TimestampOverrideUserRelationship) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *TimestampOverrideUserRelationshipData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_timestamp_override_user_relationship_data.go b/api/datadogV2/model_timestamp_override_user_relationship_data.go new file mode 100644 index 00000000000..c54d385aa45 --- /dev/null +++ b/api/datadogV2/model_timestamp_override_user_relationship_data.go @@ -0,0 +1,135 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TimestampOverrideUserRelationshipData User relationship data. +type TimestampOverrideUserRelationshipData struct { + // The UUID of the user. + Id uuid.UUID `json:"id"` + // The type of the related resource. + Type string `json:"type"` + // 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:"-"` +} + +// NewTimestampOverrideUserRelationshipData instantiates a new TimestampOverrideUserRelationshipData 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 NewTimestampOverrideUserRelationshipData(id uuid.UUID, typeVar string) *TimestampOverrideUserRelationshipData { + this := TimestampOverrideUserRelationshipData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewTimestampOverrideUserRelationshipDataWithDefaults instantiates a new TimestampOverrideUserRelationshipData 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 NewTimestampOverrideUserRelationshipDataWithDefaults() *TimestampOverrideUserRelationshipData { + this := TimestampOverrideUserRelationshipData{} + return &this +} + +// GetId returns the Id field value. +func (o *TimestampOverrideUserRelationshipData) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *TimestampOverrideUserRelationshipData) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *TimestampOverrideUserRelationshipData) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *TimestampOverrideUserRelationshipData) GetType() string { + if o == nil { + var ret string + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *TimestampOverrideUserRelationshipData) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TimestampOverrideUserRelationshipData) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TimestampOverrideUserRelationshipData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TimestampOverrideUserRelationshipData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *uuid.UUID `json:"id"` + Type *string `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + o.Id = *all.Id + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_timestamp_type.go b/api/datadogV2/model_timestamp_type.go new file mode 100644 index 00000000000..82aabc1bad9 --- /dev/null +++ b/api/datadogV2/model_timestamp_type.go @@ -0,0 +1,70 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TimestampType The type of timestamp being overridden. +type TimestampType string + +// List of TimestampType. +const ( + TIMESTAMPTYPE_CREATED TimestampType = "created" + TIMESTAMPTYPE_DETECTED TimestampType = "detected" + TIMESTAMPTYPE_RESOLVED TimestampType = "resolved" + TIMESTAMPTYPE_DECLARED TimestampType = "declared" +) + +var allowedTimestampTypeEnumValues = []TimestampType{ + TIMESTAMPTYPE_CREATED, + TIMESTAMPTYPE_DETECTED, + TIMESTAMPTYPE_RESOLVED, + TIMESTAMPTYPE_DECLARED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TimestampType) GetAllowedValues() []TimestampType { + return allowedTimestampTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TimestampType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TimestampType(value) + return nil +} + +// NewTimestampTypeFromValue returns a pointer to a valid TimestampType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTimestampTypeFromValue(v string) (*TimestampType, error) { + ev := TimestampType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TimestampType: valid values are %v", v, allowedTimestampTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TimestampType) IsValid() bool { + for _, existing := range allowedTimestampTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TimestampType value. +func (v TimestampType) Ptr() *TimestampType { + return &v +} diff --git a/api/datadogV2/model_user_included.go b/api/datadogV2/model_user_included.go new file mode 100644 index 00000000000..340411cbedf --- /dev/null +++ b/api/datadogV2/model_user_included.go @@ -0,0 +1,176 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// UserIncluded Included user data. +type UserIncluded struct { + // Attributes of an included user. + Attributes UserIncludedAttributes `json:"attributes"` + // The UUID of the user. + Id uuid.UUID `json:"id"` + // The type of the included resource. + Type string `json:"type"` + // 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:"-"` +} + +// NewUserIncluded instantiates a new UserIncluded 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 NewUserIncluded(attributes UserIncludedAttributes, id uuid.UUID, typeVar string) *UserIncluded { + this := UserIncluded{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewUserIncludedWithDefaults instantiates a new UserIncluded 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 NewUserIncludedWithDefaults() *UserIncluded { + this := UserIncluded{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *UserIncluded) GetAttributes() UserIncludedAttributes { + if o == nil { + var ret UserIncludedAttributes + 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 *UserIncluded) GetAttributesOk() (*UserIncludedAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *UserIncluded) SetAttributes(v UserIncludedAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *UserIncluded) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *UserIncluded) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *UserIncluded) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *UserIncluded) GetType() string { + if o == nil { + var ret string + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *UserIncluded) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UserIncluded) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserIncluded) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserIncluded) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *UserIncludedAttributes `json:"attributes"` + Id *uuid.UUID `json:"id"` + Type *string `json:"type"` + }{} + 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.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_user_included_attributes.go b/api/datadogV2/model_user_included_attributes.go new file mode 100644 index 00000000000..8acf0386ce7 --- /dev/null +++ b/api/datadogV2/model_user_included_attributes.go @@ -0,0 +1,231 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// UserIncludedAttributes Attributes of an included user. +type UserIncludedAttributes struct { + // The email address of the user. + Email string `json:"email"` + // The handle of the user. + Handle string `json:"handle"` + // The icon URL for the user. + Icon string `json:"icon"` + // The name of the user. + Name string `json:"name"` + // The UUID of the user. + Uuid uuid.UUID `json:"uuid"` + // 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:"-"` +} + +// NewUserIncludedAttributes instantiates a new UserIncludedAttributes 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 NewUserIncludedAttributes(email string, handle string, icon string, name string, uuid uuid.UUID) *UserIncludedAttributes { + this := UserIncludedAttributes{} + this.Email = email + this.Handle = handle + this.Icon = icon + this.Name = name + this.Uuid = uuid + return &this +} + +// NewUserIncludedAttributesWithDefaults instantiates a new UserIncludedAttributes 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 NewUserIncludedAttributesWithDefaults() *UserIncludedAttributes { + this := UserIncludedAttributes{} + return &this +} + +// GetEmail returns the Email field value. +func (o *UserIncludedAttributes) GetEmail() string { + if o == nil { + var ret string + return ret + } + return o.Email +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +func (o *UserIncludedAttributes) GetEmailOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Email, true +} + +// SetEmail sets field value. +func (o *UserIncludedAttributes) SetEmail(v string) { + o.Email = v +} + +// GetHandle returns the Handle field value. +func (o *UserIncludedAttributes) GetHandle() string { + if o == nil { + var ret string + return ret + } + return o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value +// and a boolean to check if the value has been set. +func (o *UserIncludedAttributes) GetHandleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Handle, true +} + +// SetHandle sets field value. +func (o *UserIncludedAttributes) SetHandle(v string) { + o.Handle = v +} + +// GetIcon returns the Icon field value. +func (o *UserIncludedAttributes) GetIcon() string { + if o == nil { + var ret string + return ret + } + return o.Icon +} + +// GetIconOk returns a tuple with the Icon field value +// and a boolean to check if the value has been set. +func (o *UserIncludedAttributes) GetIconOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Icon, true +} + +// SetIcon sets field value. +func (o *UserIncludedAttributes) SetIcon(v string) { + o.Icon = v +} + +// GetName returns the Name field value. +func (o *UserIncludedAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *UserIncludedAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *UserIncludedAttributes) SetName(v string) { + o.Name = v +} + +// GetUuid returns the Uuid field value. +func (o *UserIncludedAttributes) GetUuid() uuid.UUID { + if o == nil { + var ret uuid.UUID + return ret + } + return o.Uuid +} + +// GetUuidOk returns a tuple with the Uuid field value +// and a boolean to check if the value has been set. +func (o *UserIncludedAttributes) GetUuidOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Uuid, true +} + +// SetUuid sets field value. +func (o *UserIncludedAttributes) SetUuid(v uuid.UUID) { + o.Uuid = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UserIncludedAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["email"] = o.Email + toSerialize["handle"] = o.Handle + toSerialize["icon"] = o.Icon + toSerialize["name"] = o.Name + toSerialize["uuid"] = o.Uuid + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UserIncludedAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Email *string `json:"email"` + Handle *string `json:"handle"` + Icon *string `json:"icon"` + Name *string `json:"name"` + Uuid *uuid.UUID `json:"uuid"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Email == nil { + return fmt.Errorf("required field email missing") + } + if all.Handle == nil { + return fmt.Errorf("required field handle missing") + } + if all.Icon == nil { + return fmt.Errorf("required field icon missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Uuid == nil { + return fmt.Errorf("required field uuid missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"email", "handle", "icon", "name", "uuid"}) + } else { + return err + } + o.Email = *all.Email + o.Handle = *all.Handle + o.Icon = *all.Icon + o.Name = *all.Name + o.Uuid = *all.Uuid + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/incidents/CreateIncidentTimestampOverride.go b/examples/v2/incidents/CreateIncidentTimestampOverride.go new file mode 100644 index 00000000000..c9332e3442b --- /dev/null +++ b/examples/v2/incidents/CreateIncidentTimestampOverride.go @@ -0,0 +1,41 @@ +// Create a timestamp override for an incident returns "Created" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" + "github.com/google/uuid" +) + +func main() { + body := datadogV2.IncidentTimestampOverrideCreateRequest{ + Data: datadogV2.IncidentTimestampOverrideCreateData{ + Attributes: datadogV2.IncidentTimestampOverrideCreateAttributes{ + TimestampType: datadogV2.TIMESTAMPTYPE_CREATED, + TimestampValue: time.Date(2024, 12, 29, 10, 0, 0, 0, time.UTC), + }, + Type: datadogV2.INCIDENTSTIMESTAMPOVERRIDESTYPE_INCIDENTS_TIMESTAMP_OVERRIDES, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.CreateIncidentTimestampOverride", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewIncidentsApi(apiClient) + resp, r, err := api.CreateIncidentTimestampOverride(ctx, uuid.MustParse("9cecfde8-e35d-4387-8985-9b30dcb9cb1c"), body, *datadogV2.NewCreateIncidentTimestampOverrideOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.CreateIncidentTimestampOverride`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.CreateIncidentTimestampOverride`:\n%s\n", responseContent) +} diff --git a/examples/v2/incidents/DeleteIncidentTimestampOverride.go b/examples/v2/incidents/DeleteIncidentTimestampOverride.go new file mode 100644 index 00000000000..5f04e0ea184 --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentTimestampOverride.go @@ -0,0 +1,27 @@ +// Delete a timestamp override for an incident returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" + "github.com/google/uuid" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.DeleteIncidentTimestampOverride", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewIncidentsApi(apiClient) + r, err := api.DeleteIncidentTimestampOverride(ctx, uuid.MustParse("9cecfde8-e35d-4387-8985-9b30dcb9cb1c"), uuid.MustParse("6f48a86f-9a39-4bcf-a76b-9a1b20188995")) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.DeleteIncidentTimestampOverride`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/incidents/ListIncidentTimestampOverrides.go b/examples/v2/incidents/ListIncidentTimestampOverrides.go new file mode 100644 index 00000000000..88f3dbec219 --- /dev/null +++ b/examples/v2/incidents/ListIncidentTimestampOverrides.go @@ -0,0 +1,31 @@ +// List timestamp overrides for an incident returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" + "github.com/google/uuid" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListIncidentTimestampOverrides", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewIncidentsApi(apiClient) + resp, r, err := api.ListIncidentTimestampOverrides(ctx, uuid.MustParse("9cecfde8-e35d-4387-8985-9b30dcb9cb1c"), *datadogV2.NewListIncidentTimestampOverridesOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.ListIncidentTimestampOverrides`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.ListIncidentTimestampOverrides`:\n%s\n", responseContent) +} diff --git a/examples/v2/incidents/UpdateIncidentTimestampOverride.go b/examples/v2/incidents/UpdateIncidentTimestampOverride.go new file mode 100644 index 00000000000..b0ee6d939c4 --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentTimestampOverride.go @@ -0,0 +1,40 @@ +// Update a timestamp override for an incident returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" + "github.com/google/uuid" +) + +func main() { + body := datadogV2.IncidentTimestampOverridePatchRequest{ + Data: datadogV2.IncidentTimestampOverridePatchData{ + Attributes: datadogV2.IncidentTimestampOverridePatchAttributes{ + TimestampValue: time.Date(2024, 12, 29, 11, 0, 0, 0, time.UTC), + }, + Type: datadogV2.INCIDENTSTIMESTAMPOVERRIDESTYPE_INCIDENTS_TIMESTAMP_OVERRIDES, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.UpdateIncidentTimestampOverride", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewIncidentsApi(apiClient) + resp, r, err := api.UpdateIncidentTimestampOverride(ctx, uuid.MustParse("9cecfde8-e35d-4387-8985-9b30dcb9cb1c"), uuid.MustParse("6f48a86f-9a39-4bcf-a76b-9a1b20188995"), body, *datadogV2.NewUpdateIncidentTimestampOverrideOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.UpdateIncidentTimestampOverride`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.UpdateIncidentTimestampOverride`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/features/v2/incidents.feature b/tests/scenarios/features/v2/incidents.feature index a683c2cac14..e9062093145 100644 --- a/tests/scenarios/features/v2/incidents.feature +++ b/tests/scenarios/features/v2/incidents.feature @@ -21,6 +21,33 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:Datadog/incident-app + Scenario: Create a timestamp override for an incident returns "Bad Request" response + Given operation "CreateIncidentTimestampOverride" enabled + And new "CreateIncidentTimestampOverride" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"timestamp_type": "created", "timestamp_value": "2024-12-29T10:00:00Z"}, "type": "incidents_timestamp_overrides"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/incident-app + Scenario: Create a timestamp override for an incident returns "Created" response + Given operation "CreateIncidentTimestampOverride" enabled + And new "CreateIncidentTimestampOverride" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"timestamp_type": "created", "timestamp_value": "2024-12-29T10:00:00Z"}, "type": "incidents_timestamp_overrides"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:Datadog/incident-app + Scenario: Create a timestamp override for an incident returns "Not Found" response + Given operation "CreateIncidentTimestampOverride" enabled + And new "CreateIncidentTimestampOverride" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"timestamp_type": "created", "timestamp_value": "2024-12-29T10:00:00Z"}, "type": "incidents_timestamp_overrides"}} + When the request is sent + Then the response status is 404 Not Found + @skip @team:DataDog/incident-app Scenario: Create an incident impact returns "Bad Request" response Given operation "CreateIncidentImpact" enabled @@ -330,6 +357,24 @@ Feature: Incidents When the request is sent Then the response status is 404 Not Found + @generated @skip @team:Datadog/incident-app + Scenario: Delete a timestamp override for an incident returns "No Content" response + Given operation "DeleteIncidentTimestampOverride" enabled + And new "DeleteIncidentTimestampOverride" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "timestamp_override_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:Datadog/incident-app + Scenario: Delete a timestamp override for an incident returns "Not Found" response + Given operation "DeleteIncidentTimestampOverride" enabled + And new "DeleteIncidentTimestampOverride" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "timestamp_override_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Delete an existing incident returns "Bad Request" response Given operation "DeleteIncident" enabled @@ -1018,6 +1063,22 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:Datadog/incident-app + Scenario: List timestamp overrides for an incident returns "Not Found" response + Given operation "ListIncidentTimestampOverrides" enabled + And new "ListIncidentTimestampOverrides" request + And request contains "incident_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:Datadog/incident-app + Scenario: List timestamp overrides for an incident returns "OK" response + Given operation "ListIncidentTimestampOverrides" enabled + And new "ListIncidentTimestampOverrides" request + And request contains "incident_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @team:DataDog/incident-app Scenario: Remove commander from an incident returns "OK" response Given operation "UpdateIncident" enabled @@ -1066,6 +1127,36 @@ Feature: Incidents Then the response status is 200 OK And the response has 3 items + @generated @skip @team:Datadog/incident-app + Scenario: Update a timestamp override for an incident returns "Bad Request" response + Given operation "UpdateIncidentTimestampOverride" enabled + And new "UpdateIncidentTimestampOverride" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "timestamp_override_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"timestamp_value": "2024-12-29T11:00:00Z"}, "type": "incidents_timestamp_overrides"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/incident-app + Scenario: Update a timestamp override for an incident returns "Not Found" response + Given operation "UpdateIncidentTimestampOverride" enabled + And new "UpdateIncidentTimestampOverride" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "timestamp_override_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"timestamp_value": "2024-12-29T11:00:00Z"}, "type": "incidents_timestamp_overrides"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:Datadog/incident-app + Scenario: Update a timestamp override for an incident returns "OK" response + Given operation "UpdateIncidentTimestampOverride" enabled + And new "UpdateIncidentTimestampOverride" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "timestamp_override_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"timestamp_value": "2024-12-29T11:00:00Z"}, "type": "incidents_timestamp_overrides"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app Scenario: Update an existing incident integration metadata returns "Bad Request" response Given operation "UpdateIncidentIntegration" enabled diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index c77dfee3356..8c4911b6c29 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -2013,6 +2013,30 @@ "type": "idempotent" } }, + "ListIncidentTimestampOverrides": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "CreateIncidentTimestampOverride": { + "tag": "Incidents", + "undo": { + "type": "unsafe" + } + }, + "DeleteIncidentTimestampOverride": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "UpdateIncidentTimestampOverride": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, "ListAWSAccounts": { "tag": "AWS Integration", "undo": {