diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 147e01bf6b9..9a80dea5bbb 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -764,6 +764,14 @@ components: required: false schema: type: string + NotificationRuleIDPathParameter: + description: Notification Rule UUID + example: e555e290-ed65-49bd-ae18-8acbfcf18db7 + in: path + name: notification_rule_id + required: true + schema: + type: string OnDemandTaskId: description: The UUID of the task. example: 6d09294c-9ad9-42fd-a759-a0c1599b4828 @@ -3198,6 +3206,36 @@ components: required: - type type: object + AnyValue: + description: Represents any valid JSON value. + nullable: true + oneOf: + - $ref: '#/components/schemas/AnyValueString' + - $ref: '#/components/schemas/AnyValueNumber' + - $ref: '#/components/schemas/AnyValueObject' + - $ref: '#/components/schemas/AnyValueArray' + - $ref: '#/components/schemas/AnyValueBoolean' + type: object + AnyValueArray: + items: + $ref: '#/components/schemas/AnyValueItem' + type: array + AnyValueBoolean: + type: boolean + AnyValueItem: + oneOf: + - $ref: '#/components/schemas/AnyValueString' + - $ref: '#/components/schemas/AnyValueNumber' + - $ref: '#/components/schemas/AnyValueObject' + - $ref: '#/components/schemas/AnyValueBoolean' + AnyValueNumber: + format: double + type: number + AnyValueObject: + additionalProperties: {} + type: object + AnyValueString: + type: string ApiID: description: API identifier. example: 90646597-5fdb-4a17-a240-647003f8c028 @@ -5960,6 +5998,24 @@ components: type: string x-enum-varnames: - AUTHN_MAPPINGS + AutoCloseInactiveCases: + description: Auto-close inactive cases settings + properties: + enabled: + description: Whether auto-close is enabled + type: boolean + max_inactive_time_in_secs: + description: Maximum inactive time in seconds before auto-closing + format: int64 + type: integer + type: object + AutoTransitionAssignedCases: + description: Auto-transition assigned cases settings + properties: + auto_transition_assigned_cases_on_self_assigned: + description: Whether to auto-transition cases when self-assigned + type: boolean + type: object AwsAccountId: description: The ID of the AWS account. example: '123456789012' @@ -9417,6 +9473,214 @@ components: type: string x-enum-varnames: - PROJECTS + CaseNotificationRule: + description: A notification rule for case management + properties: + attributes: + $ref: '#/components/schemas/CaseNotificationRuleAttributes' + id: + description: The notification rule's identifier + example: aeadc05e-98a8-11ec-ac2c-da7ad0900001 + type: string + type: + $ref: '#/components/schemas/CaseNotificationRuleResourceType' + required: + - id + - type + - attributes + type: object + CaseNotificationRuleAttributes: + description: Notification rule attributes + properties: + is_enabled: + description: Whether the notification rule is enabled + type: boolean + query: + description: Query to filter cases for this notification rule + type: string + recipients: + description: List of notification recipients + items: + $ref: '#/components/schemas/CaseNotificationRuleRecipient' + type: array + triggers: + description: List of triggers for this notification rule + items: + $ref: '#/components/schemas/CaseNotificationRuleTrigger' + type: array + type: object + CaseNotificationRuleCreate: + description: Notification rule create + properties: + attributes: + $ref: '#/components/schemas/CaseNotificationRuleCreateAttributes' + type: + $ref: '#/components/schemas/CaseNotificationRuleResourceType' + required: + - attributes + - type + type: object + CaseNotificationRuleCreateAttributes: + description: Notification rule creation attributes + properties: + is_enabled: + default: true + description: Whether the notification rule is enabled + type: boolean + query: + description: Query to filter cases for this notification rule + type: string + recipients: + description: List of notification recipients + items: + $ref: '#/components/schemas/CaseNotificationRuleRecipient' + type: array + triggers: + description: List of triggers for this notification rule + items: + $ref: '#/components/schemas/CaseNotificationRuleTrigger' + type: array + required: + - recipients + - triggers + type: object + CaseNotificationRuleCreateRequest: + description: Notification rule create request + properties: + data: + $ref: '#/components/schemas/CaseNotificationRuleCreate' + required: + - data + type: object + CaseNotificationRuleRecipient: + description: Notification rule recipient + properties: + data: + $ref: '#/components/schemas/CaseNotificationRuleRecipientData' + type: + description: Type of recipient (SLACK_CHANNEL, EMAIL, HTTP, PAGERDUTY_SERVICE, + MS_TEAMS_CHANNEL) + example: EMAIL + type: string + type: object + CaseNotificationRuleRecipientData: + description: Recipient data + properties: + channel: + description: Slack channel name + type: string + channel_id: + description: Slack channel ID + type: string + channel_name: + description: Microsoft Teams channel name + type: string + connector_name: + description: Microsoft Teams connector name + type: string + email: + description: Email address + type: string + name: + description: HTTP webhook name + type: string + service_name: + description: PagerDuty service name + type: string + team_id: + description: Microsoft Teams team ID + type: string + team_name: + description: Microsoft Teams team name + type: string + tenant_id: + description: Microsoft Teams tenant ID + type: string + tenant_name: + description: Microsoft Teams tenant name + type: string + workspace: + description: Slack workspace name + type: string + workspace_id: + description: Slack workspace ID + type: string + type: object + CaseNotificationRuleResourceType: + default: notification_rule + description: Notification rule resource type + enum: + - notification_rule + example: notification_rule + type: string + x-enum-varnames: + - NOTIFICATION_RULE + CaseNotificationRuleResponse: + description: Notification rule response + properties: + data: + $ref: '#/components/schemas/CaseNotificationRule' + type: object + CaseNotificationRuleTrigger: + description: Notification rule trigger + properties: + data: + $ref: '#/components/schemas/CaseNotificationRuleTriggerData' + type: + description: Type of trigger (CASE_CREATED, STATUS_TRANSITIONED, ATTRIBUTE_VALUE_CHANGED, + EVENT_CORRELATION_SIGNAL_CORRELATED) + example: CASE_CREATED + type: string + type: object + CaseNotificationRuleTriggerData: + description: Trigger data + properties: + change_type: + description: Change type (added, removed, changed) + type: string + field: + description: Field name for attribute value changed trigger + type: string + from_status: + description: Status ID to transition from + type: string + from_status_name: + description: Status name to transition from + type: string + to_status: + description: Status ID to transition to + type: string + to_status_name: + description: Status name to transition to + type: string + type: object + CaseNotificationRuleUpdate: + description: Notification rule update + properties: + attributes: + $ref: '#/components/schemas/CaseNotificationRuleAttributes' + type: + $ref: '#/components/schemas/CaseNotificationRuleResourceType' + required: + - type + type: object + CaseNotificationRuleUpdateRequest: + description: Notification rule update request + properties: + data: + $ref: '#/components/schemas/CaseNotificationRuleUpdate' + required: + - data + type: object + CaseNotificationRulesResponse: + description: Response with notification rules + properties: + data: + description: Notification rules data + items: + $ref: '#/components/schemas/CaseNotificationRule' + type: array + type: object CaseObjectAttributes: additionalProperties: items: @@ -30458,6 +30722,212 @@ components: type: string type: array type: object + IntegrationIncident: + description: Incident integration settings + properties: + auto_escalation_query: + description: Query for auto-escalation + type: string + default_incident_commander: + description: Default incident commander + type: string + enabled: + description: Whether incident integration is enabled + type: boolean + field_mappings: + items: + $ref: '#/components/schemas/IntegrationIncidentFieldMappingsItems' + type: array + incident_type: + description: Incident type + type: string + severity_config: + $ref: '#/components/schemas/IntegrationIncidentSeverityConfig' + type: object + IntegrationIncidentFieldMappingsItems: + properties: + case_field: + type: string + incident_user_defined_field_id: + type: string + type: object + IntegrationIncidentSeverityConfig: + properties: + priority_mapping: + additionalProperties: + type: string + type: object + type: object + IntegrationJira: + description: Jira integration settings + properties: + auto_creation: + $ref: '#/components/schemas/IntegrationJiraAutoCreation' + enabled: + description: Whether Jira integration is enabled + type: boolean + metadata: + $ref: '#/components/schemas/IntegrationJiraMetadata' + sync: + $ref: '#/components/schemas/IntegrationJiraSync' + type: object + IntegrationJiraAutoCreation: + properties: + enabled: + type: boolean + type: object + IntegrationJiraMetadata: + properties: + account_id: + type: string + issue_type_id: + type: string + project_id: + type: string + type: object + IntegrationJiraSync: + properties: + enabled: + type: boolean + properties: + $ref: '#/components/schemas/IntegrationJiraSyncProperties' + type: object + IntegrationJiraSyncDueDate: + properties: + jira_field_id: + type: string + sync_type: + type: string + type: object + IntegrationJiraSyncProperties: + properties: + assignee: + $ref: '#/components/schemas/SyncProperty' + comments: + $ref: '#/components/schemas/SyncProperty' + custom_fields: + additionalProperties: + $ref: '#/components/schemas/IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties' + type: object + description: + $ref: '#/components/schemas/SyncProperty' + due_date: + $ref: '#/components/schemas/IntegrationJiraSyncDueDate' + priority: + $ref: '#/components/schemas/SyncPropertyWithMapping' + status: + $ref: '#/components/schemas/SyncPropertyWithMapping' + title: + $ref: '#/components/schemas/SyncProperty' + type: object + IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties: + properties: + sync_type: + type: string + value: + $ref: '#/components/schemas/AnyValue' + type: object + IntegrationMonitor: + description: Monitor integration settings + properties: + auto_resolve_enabled: + description: Whether auto-resolve is enabled + type: boolean + case_type_id: + description: Case type ID for monitor integration + type: string + enabled: + description: Whether monitor integration is enabled + type: boolean + handle: + description: Monitor handle + type: string + type: object + IntegrationOnCall: + description: On-Call integration settings + properties: + auto_assign_on_call: + description: Whether to auto-assign on-call + type: boolean + enabled: + description: Whether On-Call integration is enabled + type: boolean + escalation_queries: + items: + $ref: '#/components/schemas/IntegrationOnCallEscalationQueriesItems' + type: array + type: object + IntegrationOnCallEscalationQueriesItems: + properties: + enabled: + type: boolean + id: + type: string + query: + type: string + target: + $ref: '#/components/schemas/IntegrationOnCallEscalationQueriesItemsTarget' + type: object + IntegrationOnCallEscalationQueriesItemsTarget: + properties: + dynamic_team_paging: + type: boolean + team_id: + type: string + user_id: + type: string + type: object + IntegrationServiceNow: + description: ServiceNow integration settings + properties: + assignment_group: + description: Assignment group + type: string + auto_creation: + $ref: '#/components/schemas/IntegrationServiceNowAutoCreation' + enabled: + description: Whether ServiceNow integration is enabled + type: boolean + instance_name: + description: ServiceNow instance name + type: string + sync_config: + $ref: '#/components/schemas/IntegrationServiceNowSyncConfig' + type: object + IntegrationServiceNowAutoCreation: + properties: + enabled: + type: boolean + type: object + IntegrationServiceNowSyncConfig: + properties: + enabled: + type: boolean + properties: + $ref: '#/components/schemas/IntegrationServiceNowSyncConfig139772721534496' + type: object + IntegrationServiceNowSyncConfig139772721534496: + properties: + comments: + $ref: '#/components/schemas/SyncProperty' + priority: + $ref: '#/components/schemas/IntegrationServiceNowSyncConfigPriority' + status: + $ref: '#/components/schemas/SyncPropertyWithMapping' + type: object + IntegrationServiceNowSyncConfigPriority: + properties: + impact_mapping: + additionalProperties: + type: string + type: object + sync_type: + type: string + urgency_mapping: + additionalProperties: + type: string + type: object + type: object InterfaceAttributes: description: The interface attributes properties: @@ -44797,14 +45267,52 @@ components: ProjectAttributes: description: Project attributes properties: + columns_config: + $ref: '#/components/schemas/ProjectColumnsConfig' + enabled_custom_case_types: + description: List of enabled custom case type IDs + items: + type: string + type: array key: description: The project's key example: CASEM type: string name: description: Project's name + example: Security Investigation + type: string + restricted: + description: Whether the project is restricted + type: boolean + settings: + $ref: '#/components/schemas/ProjectSettings' + type: object + ProjectColumnsConfig: + description: Project columns configuration + properties: + columns: + items: + $ref: '#/components/schemas/ProjectColumnsConfigColumnsItems' + type: array + type: object + ProjectColumnsConfigColumnsItems: + properties: + sort: + $ref: '#/components/schemas/ProjectColumnsConfigColumnsItemsSort' + sort_field: + type: string + type: type: string type: object + ProjectColumnsConfigColumnsItemsSort: + properties: + ascending: + type: boolean + priority: + format: int64 + type: integer + type: object ProjectCreate: description: Project create properties: @@ -44819,14 +45327,22 @@ components: ProjectCreateAttributes: description: Project creation attributes properties: + enabled_custom_case_types: + description: List of enabled custom case type IDs + items: + type: string + type: array key: description: Project's key. Cannot be "CASE" example: SEC type: string name: - description: name + description: Project name example: Security Investigation type: string + team_uuid: + description: Team UUID to associate with the project + type: string required: - name - key @@ -44839,6 +45355,32 @@ components: required: - data type: object + ProjectNotificationSettings: + description: Project notification settings + properties: + destinations: + description: Notification destinations (1=email, 2=slack, 3=in-app) + items: + type: integer + type: array + enabled: + description: Whether notifications are enabled + type: boolean + notify_on_case_assignment: + type: boolean + notify_on_case_closed: + type: boolean + notify_on_case_comment: + type: boolean + notify_on_case_comment_mention: + type: boolean + notify_on_case_priority_change: + type: boolean + notify_on_case_status_change: + type: boolean + notify_on_case_unassignment: + type: boolean + type: object ProjectRelationship: description: Relationship to project properties: @@ -44883,6 +45425,63 @@ components: data: $ref: '#/components/schemas/Project' type: object + ProjectSettings: + description: Project settings + properties: + auto_close_inactive_cases: + $ref: '#/components/schemas/AutoCloseInactiveCases' + auto_transition_assigned_cases: + $ref: '#/components/schemas/AutoTransitionAssignedCases' + integration_incident: + $ref: '#/components/schemas/IntegrationIncident' + integration_jira: + $ref: '#/components/schemas/IntegrationJira' + integration_monitor: + $ref: '#/components/schemas/IntegrationMonitor' + integration_on_call: + $ref: '#/components/schemas/IntegrationOnCall' + integration_service_now: + $ref: '#/components/schemas/IntegrationServiceNow' + notification: + $ref: '#/components/schemas/ProjectNotificationSettings' + type: object + ProjectUpdate: + description: Project update + properties: + attributes: + $ref: '#/components/schemas/ProjectUpdateAttributes' + type: + $ref: '#/components/schemas/ProjectResourceType' + required: + - type + type: object + ProjectUpdateAttributes: + description: Project update attributes + properties: + columns_config: + $ref: '#/components/schemas/ProjectColumnsConfig' + enabled_custom_case_types: + description: List of enabled custom case type IDs + items: + type: string + type: array + name: + description: Project name + type: string + settings: + $ref: '#/components/schemas/ProjectSettings' + team_uuid: + description: Team UUID to associate with the project + type: string + type: object + ProjectUpdateRequest: + description: Project update request + properties: + data: + $ref: '#/components/schemas/ProjectUpdate' + required: + - data + type: object ProjectedCost: description: Projected Cost data. properties: @@ -59245,6 +59844,26 @@ components: suppression: $ref: '#/components/schemas/SecurityMonitoringSuppressionAttributes' type: object + SyncProperty: + description: Sync property configuration + properties: + sync_type: + type: string + type: object + SyncPropertyWithMapping: + description: Sync property with mapping configuration + properties: + mapping: + additionalProperties: + type: string + type: object + name_mapping: + additionalProperties: + type: string + type: object + sync_type: + type: string + type: object SyntheticsGlobalVariable: description: Synthetic global variable. properties: @@ -69566,6 +70185,197 @@ paths: summary: Get the details of a project tags: - Case Management + patch: + description: Update a project. + operationId: UpdateProject + parameters: + - $ref: '#/components/parameters/ProjectIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectUpdateRequest' + description: Project payload + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Update a project + tags: + - Case Management + /api/v2/cases/projects/{project_id}/notification_rules: + get: + description: Get all notification rules for a project. + operationId: GetProjectNotificationRules + parameters: + - description: Project UUID + example: e555e290-ed65-49bd-ae18-8acbfcf18db7 + in: path + name: project_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CaseNotificationRulesResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_read + summary: Get notification rules + tags: + - Case Management + post: + description: Create a notification rule for a project. + operationId: CreateProjectNotificationRule + parameters: + - description: Project UUID + example: e555e290-ed65-49bd-ae18-8acbfcf18db7 + in: path + name: project_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CaseNotificationRuleCreateRequest' + description: Notification rule payload + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/CaseNotificationRuleResponse' + description: CREATED + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Create a notification rule + tags: + - Case Management + /api/v2/cases/projects/{project_id}/notification_rules/{notification_rule_id}: + delete: + description: Delete a notification rule using the notification rule's `id`. + operationId: DeleteProjectNotificationRule + parameters: + - description: Project UUID + example: e555e290-ed65-49bd-ae18-8acbfcf18db7 + in: path + name: project_id + required: true + schema: + type: string + - $ref: '#/components/parameters/NotificationRuleIDPathParameter' + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Delete a notification rule + tags: + - Case Management + put: + description: Update a notification rule. + operationId: UpdateProjectNotificationRule + parameters: + - description: Project UUID + example: e555e290-ed65-49bd-ae18-8acbfcf18db7 + in: path + name: project_id + required: true + schema: + type: string + - $ref: '#/components/parameters/NotificationRuleIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CaseNotificationRuleUpdateRequest' + description: Notification rule payload + required: true + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Update a notification rule + tags: + - Case Management /api/v2/cases/types: get: description: Get all case types diff --git a/api/datadogV2/api_case_management.go b/api/datadogV2/api_case_management.go index 76cf227edbe..be1224fe85c 100644 --- a/api/datadogV2/api_case_management.go +++ b/api/datadogV2/api_case_management.go @@ -418,6 +418,87 @@ func (a *CaseManagementApi) CreateProject(ctx _context.Context, body ProjectCrea return localVarReturnValue, localVarHTTPResponse, nil } +// CreateProjectNotificationRule Create a notification rule. +// Create a notification rule for a project. +func (a *CaseManagementApi) CreateProjectNotificationRule(ctx _context.Context, projectId string, body CaseNotificationRuleCreateRequest) (CaseNotificationRuleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue CaseNotificationRuleResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CaseManagementApi.CreateProjectNotificationRule") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/cases/projects/{project_id}/notification_rules" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{project_id}", _neturl.PathEscape(datadog.ParameterToString(projectId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + 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 == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || 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 +} + // DeleteCaseComment Delete case comment. // Delete case comment func (a *CaseManagementApi) DeleteCaseComment(ctx _context.Context, caseId string, cellId string) (*_nethttp.Response, error) { @@ -634,6 +715,75 @@ func (a *CaseManagementApi) DeleteProject(ctx _context.Context, projectId string return localVarHTTPResponse, nil } +// DeleteProjectNotificationRule Delete a notification rule. +// Delete a notification rule using the notification rule's `id`. +func (a *CaseManagementApi) DeleteProjectNotificationRule(ctx _context.Context, projectId string, notificationRuleId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CaseManagementApi.DeleteProjectNotificationRule") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/cases/projects/{project_id}/notification_rules/{notification_rule_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{project_id}", _neturl.PathEscape(datadog.ParameterToString(projectId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{notification_rule_id}", _neturl.PathEscape(datadog.ParameterToString(notificationRuleId, ""))) + + 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 || 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 +} + // GetCase Get the details of a case. // Get the details of case by `case_id` func (a *CaseManagementApi) GetCase(ctx _context.Context, caseId string) (CaseResponse, *_nethttp.Response, error) { @@ -790,6 +940,84 @@ func (a *CaseManagementApi) GetProject(ctx _context.Context, projectId string) ( return localVarReturnValue, localVarHTTPResponse, nil } +// GetProjectNotificationRules Get notification rules. +// Get all notification rules for a project. +func (a *CaseManagementApi) GetProjectNotificationRules(ctx _context.Context, projectId string) (CaseNotificationRulesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue CaseNotificationRulesResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CaseManagementApi.GetProjectNotificationRules") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/cases/projects/{project_id}/notification_rules" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{project_id}", _neturl.PathEscape(datadog.ParameterToString(projectId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + 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 == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || 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 +} + // GetProjects Get all projects. // Get all projects. func (a *CaseManagementApi) GetProjects(ctx _context.Context) (ProjectsResponse, *_nethttp.Response, error) { @@ -1628,6 +1856,159 @@ func (a *CaseManagementApi) UpdatePriority(ctx _context.Context, caseId string, return localVarReturnValue, localVarHTTPResponse, nil } +// UpdateProject Update a project. +// Update a project. +func (a *CaseManagementApi) UpdateProject(ctx _context.Context, projectId string, body ProjectUpdateRequest) (ProjectResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue ProjectResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CaseManagementApi.UpdateProject") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/cases/projects/{project_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{project_id}", _neturl.PathEscape(datadog.ParameterToString(projectId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + 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 == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || 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 +} + +// UpdateProjectNotificationRule Update a notification rule. +// Update a notification rule. +func (a *CaseManagementApi) UpdateProjectNotificationRule(ctx _context.Context, projectId string, notificationRuleId string, body CaseNotificationRuleUpdateRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CaseManagementApi.UpdateProjectNotificationRule") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/cases/projects/{project_id}/notification_rules/{notification_rule_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{project_id}", _neturl.PathEscape(datadog.ParameterToString(projectId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{notification_rule_id}", _neturl.PathEscape(datadog.ParameterToString(notificationRuleId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || 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 +} + // UpdateStatus Update case status. // Update case status func (a *CaseManagementApi) UpdateStatus(ctx _context.Context, caseId string, body CaseUpdateStatusRequest) (CaseResponse, *_nethttp.Response, error) { diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index d34d39ac275..97f4465d68e 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -124,11 +124,14 @@ // - [CaseManagementApi.CommentCase] // - [CaseManagementApi.CreateCase] // - [CaseManagementApi.CreateProject] +// - [CaseManagementApi.CreateProjectNotificationRule] // - [CaseManagementApi.DeleteCaseComment] // - [CaseManagementApi.DeleteCaseCustomAttribute] // - [CaseManagementApi.DeleteProject] +// - [CaseManagementApi.DeleteProjectNotificationRule] // - [CaseManagementApi.GetCase] // - [CaseManagementApi.GetProject] +// - [CaseManagementApi.GetProjectNotificationRules] // - [CaseManagementApi.GetProjects] // - [CaseManagementApi.SearchCases] // - [CaseManagementApi.UnarchiveCase] @@ -138,6 +141,8 @@ // - [CaseManagementApi.UpdateCaseDescription] // - [CaseManagementApi.UpdateCaseTitle] // - [CaseManagementApi.UpdatePriority] +// - [CaseManagementApi.UpdateProject] +// - [CaseManagementApi.UpdateProjectNotificationRule] // - [CaseManagementApi.UpdateStatus] // - [CaseManagementAttributeApi.CreateCustomAttributeConfig] // - [CaseManagementAttributeApi.DeleteCustomAttributeConfig] diff --git a/api/datadogV2/model_any_value.go b/api/datadogV2/model_any_value.go new file mode 100644 index 00000000000..f2430f61019 --- /dev/null +++ b/api/datadogV2/model_any_value.go @@ -0,0 +1,251 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AnyValue - Represents any valid JSON value. +type AnyValue struct { + AnyValueString *string + AnyValueNumber *float64 + AnyValueObject map[string]interface{} + AnyValueArray *[]AnyValueItem + AnyValueBoolean *bool + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// AnyValueStringAsAnyValue is a convenience function that returns string wrapped in AnyValue. +func AnyValueStringAsAnyValue(v *string) AnyValue { + return AnyValue{AnyValueString: v} +} + +// AnyValueNumberAsAnyValue is a convenience function that returns float64 wrapped in AnyValue. +func AnyValueNumberAsAnyValue(v *float64) AnyValue { + return AnyValue{AnyValueNumber: v} +} + +// AnyValueObjectAsAnyValue is a convenience function that returns map[string]interface{} wrapped in AnyValue. +func AnyValueObjectAsAnyValue(v map[string]interface{}) AnyValue { + return AnyValue{AnyValueObject: v} +} + +// AnyValueArrayAsAnyValue is a convenience function that returns []AnyValueItem wrapped in AnyValue. +func AnyValueArrayAsAnyValue(v *[]AnyValueItem) AnyValue { + return AnyValue{AnyValueArray: v} +} + +// AnyValueBooleanAsAnyValue is a convenience function that returns bool wrapped in AnyValue. +func AnyValueBooleanAsAnyValue(v *bool) AnyValue { + return AnyValue{AnyValueBoolean: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *AnyValue) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into AnyValueString + err = datadog.Unmarshal(data, &obj.AnyValueString) + if err == nil { + if obj.AnyValueString != nil { + jsonAnyValueString, _ := datadog.Marshal(obj.AnyValueString) + if string(jsonAnyValueString) == "{}" { // empty struct + obj.AnyValueString = nil + } else { + match++ + } + } else { + obj.AnyValueString = nil + } + } else { + obj.AnyValueString = nil + } + + // try to unmarshal data into AnyValueNumber + err = datadog.Unmarshal(data, &obj.AnyValueNumber) + if err == nil { + if obj.AnyValueNumber != nil { + jsonAnyValueNumber, _ := datadog.Marshal(obj.AnyValueNumber) + if string(jsonAnyValueNumber) == "{}" { // empty struct + obj.AnyValueNumber = nil + } else { + match++ + } + } else { + obj.AnyValueNumber = nil + } + } else { + obj.AnyValueNumber = nil + } + + // try to unmarshal data into AnyValueObject + err = datadog.Unmarshal(data, &obj.AnyValueObject) + if err == nil { + if obj.AnyValueObject != nil { + jsonAnyValueObject, _ := datadog.Marshal(obj.AnyValueObject) + if string(jsonAnyValueObject) == "{}" && string(data) != "{}" { // empty struct + obj.AnyValueObject = nil + } else { + match++ + } + } else { + obj.AnyValueObject = nil + } + } else { + obj.AnyValueObject = nil + } + + // try to unmarshal data into AnyValueArray + err = datadog.Unmarshal(data, &obj.AnyValueArray) + if err == nil { + if obj.AnyValueArray != nil { + jsonAnyValueArray, _ := datadog.Marshal(obj.AnyValueArray) + if string(jsonAnyValueArray) == "{}" && string(data) != "{}" { // empty struct + obj.AnyValueArray = nil + } else { + match++ + } + } else { + obj.AnyValueArray = nil + } + } else { + obj.AnyValueArray = nil + } + + // try to unmarshal data into AnyValueBoolean + err = datadog.Unmarshal(data, &obj.AnyValueBoolean) + if err == nil { + if obj.AnyValueBoolean != nil { + jsonAnyValueBoolean, _ := datadog.Marshal(obj.AnyValueBoolean) + if string(jsonAnyValueBoolean) == "{}" { // empty struct + obj.AnyValueBoolean = nil + } else { + match++ + } + } else { + obj.AnyValueBoolean = nil + } + } else { + obj.AnyValueBoolean = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.AnyValueString = nil + obj.AnyValueNumber = nil + obj.AnyValueObject = nil + obj.AnyValueArray = nil + obj.AnyValueBoolean = nil + return datadog.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj AnyValue) MarshalJSON() ([]byte, error) { + if obj.AnyValueString != nil { + return datadog.Marshal(&obj.AnyValueString) + } + + if obj.AnyValueNumber != nil { + return datadog.Marshal(&obj.AnyValueNumber) + } + + if obj.AnyValueObject != nil { + return datadog.Marshal(&obj.AnyValueObject) + } + + if obj.AnyValueArray != nil { + return datadog.Marshal(&obj.AnyValueArray) + } + + if obj.AnyValueBoolean != nil { + return datadog.Marshal(&obj.AnyValueBoolean) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *AnyValue) GetActualInstance() interface{} { + if obj.AnyValueString != nil { + return obj.AnyValueString + } + + if obj.AnyValueNumber != nil { + return obj.AnyValueNumber + } + + if obj.AnyValueObject != nil { + return obj.AnyValueObject + } + + if obj.AnyValueArray != nil { + return obj.AnyValueArray + } + + if obj.AnyValueBoolean != nil { + return obj.AnyValueBoolean + } + + // all schemas are nil + return nil +} + +// NullableAnyValue handles when a null is used for AnyValue. +type NullableAnyValue struct { + value *AnyValue + isSet bool +} + +// Get returns the associated value. +func (v NullableAnyValue) Get() *AnyValue { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableAnyValue) Set(val *AnyValue) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableAnyValue) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableAnyValue) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableAnyValue initializes the struct as if Set has been called. +func NewNullableAnyValue(val *AnyValue) *NullableAnyValue { + return &NullableAnyValue{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableAnyValue) MarshalJSON() ([]byte, error) { + return datadog.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableAnyValue) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return datadog.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_any_value_item.go b/api/datadogV2/model_any_value_item.go new file mode 100644 index 00000000000..d6e43103de9 --- /dev/null +++ b/api/datadogV2/model_any_value_item.go @@ -0,0 +1,169 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AnyValueItem - +type AnyValueItem struct { + AnyValueString *string + AnyValueNumber *float64 + AnyValueObject map[string]interface{} + AnyValueBoolean *bool + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// AnyValueStringAsAnyValueItem is a convenience function that returns string wrapped in AnyValueItem. +func AnyValueStringAsAnyValueItem(v *string) AnyValueItem { + return AnyValueItem{AnyValueString: v} +} + +// AnyValueNumberAsAnyValueItem is a convenience function that returns float64 wrapped in AnyValueItem. +func AnyValueNumberAsAnyValueItem(v *float64) AnyValueItem { + return AnyValueItem{AnyValueNumber: v} +} + +// AnyValueObjectAsAnyValueItem is a convenience function that returns map[string]interface{} wrapped in AnyValueItem. +func AnyValueObjectAsAnyValueItem(v map[string]interface{}) AnyValueItem { + return AnyValueItem{AnyValueObject: v} +} + +// AnyValueBooleanAsAnyValueItem is a convenience function that returns bool wrapped in AnyValueItem. +func AnyValueBooleanAsAnyValueItem(v *bool) AnyValueItem { + return AnyValueItem{AnyValueBoolean: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *AnyValueItem) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into AnyValueString + err = datadog.Unmarshal(data, &obj.AnyValueString) + if err == nil { + if obj.AnyValueString != nil { + jsonAnyValueString, _ := datadog.Marshal(obj.AnyValueString) + if string(jsonAnyValueString) == "{}" { // empty struct + obj.AnyValueString = nil + } else { + match++ + } + } else { + obj.AnyValueString = nil + } + } else { + obj.AnyValueString = nil + } + + // try to unmarshal data into AnyValueNumber + err = datadog.Unmarshal(data, &obj.AnyValueNumber) + if err == nil { + if obj.AnyValueNumber != nil { + jsonAnyValueNumber, _ := datadog.Marshal(obj.AnyValueNumber) + if string(jsonAnyValueNumber) == "{}" { // empty struct + obj.AnyValueNumber = nil + } else { + match++ + } + } else { + obj.AnyValueNumber = nil + } + } else { + obj.AnyValueNumber = nil + } + + // try to unmarshal data into AnyValueObject + err = datadog.Unmarshal(data, &obj.AnyValueObject) + if err == nil { + if obj.AnyValueObject != nil { + jsonAnyValueObject, _ := datadog.Marshal(obj.AnyValueObject) + if string(jsonAnyValueObject) == "{}" && string(data) != "{}" { // empty struct + obj.AnyValueObject = nil + } else { + match++ + } + } else { + obj.AnyValueObject = nil + } + } else { + obj.AnyValueObject = nil + } + + // try to unmarshal data into AnyValueBoolean + err = datadog.Unmarshal(data, &obj.AnyValueBoolean) + if err == nil { + if obj.AnyValueBoolean != nil { + jsonAnyValueBoolean, _ := datadog.Marshal(obj.AnyValueBoolean) + if string(jsonAnyValueBoolean) == "{}" { // empty struct + obj.AnyValueBoolean = nil + } else { + match++ + } + } else { + obj.AnyValueBoolean = nil + } + } else { + obj.AnyValueBoolean = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.AnyValueString = nil + obj.AnyValueNumber = nil + obj.AnyValueObject = nil + obj.AnyValueBoolean = nil + return datadog.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj AnyValueItem) MarshalJSON() ([]byte, error) { + if obj.AnyValueString != nil { + return datadog.Marshal(&obj.AnyValueString) + } + + if obj.AnyValueNumber != nil { + return datadog.Marshal(&obj.AnyValueNumber) + } + + if obj.AnyValueObject != nil { + return datadog.Marshal(&obj.AnyValueObject) + } + + if obj.AnyValueBoolean != nil { + return datadog.Marshal(&obj.AnyValueBoolean) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *AnyValueItem) GetActualInstance() interface{} { + if obj.AnyValueString != nil { + return obj.AnyValueString + } + + if obj.AnyValueNumber != nil { + return obj.AnyValueNumber + } + + if obj.AnyValueObject != nil { + return obj.AnyValueObject + } + + if obj.AnyValueBoolean != nil { + return obj.AnyValueBoolean + } + + // all schemas are nil + return nil +} diff --git a/api/datadogV2/model_auto_close_inactive_cases.go b/api/datadogV2/model_auto_close_inactive_cases.go new file mode 100644 index 00000000000..182bfcab9c3 --- /dev/null +++ b/api/datadogV2/model_auto_close_inactive_cases.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AutoCloseInactiveCases Auto-close inactive cases settings +type AutoCloseInactiveCases struct { + // Whether auto-close is enabled + Enabled *bool `json:"enabled,omitempty"` + // Maximum inactive time in seconds before auto-closing + MaxInactiveTimeInSecs *int64 `json:"max_inactive_time_in_secs,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:"-"` +} + +// NewAutoCloseInactiveCases instantiates a new AutoCloseInactiveCases 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 NewAutoCloseInactiveCases() *AutoCloseInactiveCases { + this := AutoCloseInactiveCases{} + return &this +} + +// NewAutoCloseInactiveCasesWithDefaults instantiates a new AutoCloseInactiveCases 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 NewAutoCloseInactiveCasesWithDefaults() *AutoCloseInactiveCases { + this := AutoCloseInactiveCases{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *AutoCloseInactiveCases) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AutoCloseInactiveCases) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *AutoCloseInactiveCases) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *AutoCloseInactiveCases) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetMaxInactiveTimeInSecs returns the MaxInactiveTimeInSecs field value if set, zero value otherwise. +func (o *AutoCloseInactiveCases) GetMaxInactiveTimeInSecs() int64 { + if o == nil || o.MaxInactiveTimeInSecs == nil { + var ret int64 + return ret + } + return *o.MaxInactiveTimeInSecs +} + +// GetMaxInactiveTimeInSecsOk returns a tuple with the MaxInactiveTimeInSecs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AutoCloseInactiveCases) GetMaxInactiveTimeInSecsOk() (*int64, bool) { + if o == nil || o.MaxInactiveTimeInSecs == nil { + return nil, false + } + return o.MaxInactiveTimeInSecs, true +} + +// HasMaxInactiveTimeInSecs returns a boolean if a field has been set. +func (o *AutoCloseInactiveCases) HasMaxInactiveTimeInSecs() bool { + return o != nil && o.MaxInactiveTimeInSecs != nil +} + +// SetMaxInactiveTimeInSecs gets a reference to the given int64 and assigns it to the MaxInactiveTimeInSecs field. +func (o *AutoCloseInactiveCases) SetMaxInactiveTimeInSecs(v int64) { + o.MaxInactiveTimeInSecs = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AutoCloseInactiveCases) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.MaxInactiveTimeInSecs != nil { + toSerialize["max_inactive_time_in_secs"] = o.MaxInactiveTimeInSecs + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AutoCloseInactiveCases) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Enabled *bool `json:"enabled,omitempty"` + MaxInactiveTimeInSecs *int64 `json:"max_inactive_time_in_secs,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"enabled", "max_inactive_time_in_secs"}) + } else { + return err + } + o.Enabled = all.Enabled + o.MaxInactiveTimeInSecs = all.MaxInactiveTimeInSecs + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_auto_transition_assigned_cases.go b/api/datadogV2/model_auto_transition_assigned_cases.go new file mode 100644 index 00000000000..d36c79edeaa --- /dev/null +++ b/api/datadogV2/model_auto_transition_assigned_cases.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AutoTransitionAssignedCases Auto-transition assigned cases settings +type AutoTransitionAssignedCases struct { + // Whether to auto-transition cases when self-assigned + AutoTransitionAssignedCasesOnSelfAssigned *bool `json:"auto_transition_assigned_cases_on_self_assigned,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:"-"` +} + +// NewAutoTransitionAssignedCases instantiates a new AutoTransitionAssignedCases 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 NewAutoTransitionAssignedCases() *AutoTransitionAssignedCases { + this := AutoTransitionAssignedCases{} + return &this +} + +// NewAutoTransitionAssignedCasesWithDefaults instantiates a new AutoTransitionAssignedCases 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 NewAutoTransitionAssignedCasesWithDefaults() *AutoTransitionAssignedCases { + this := AutoTransitionAssignedCases{} + return &this +} + +// GetAutoTransitionAssignedCasesOnSelfAssigned returns the AutoTransitionAssignedCasesOnSelfAssigned field value if set, zero value otherwise. +func (o *AutoTransitionAssignedCases) GetAutoTransitionAssignedCasesOnSelfAssigned() bool { + if o == nil || o.AutoTransitionAssignedCasesOnSelfAssigned == nil { + var ret bool + return ret + } + return *o.AutoTransitionAssignedCasesOnSelfAssigned +} + +// GetAutoTransitionAssignedCasesOnSelfAssignedOk returns a tuple with the AutoTransitionAssignedCasesOnSelfAssigned field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AutoTransitionAssignedCases) GetAutoTransitionAssignedCasesOnSelfAssignedOk() (*bool, bool) { + if o == nil || o.AutoTransitionAssignedCasesOnSelfAssigned == nil { + return nil, false + } + return o.AutoTransitionAssignedCasesOnSelfAssigned, true +} + +// HasAutoTransitionAssignedCasesOnSelfAssigned returns a boolean if a field has been set. +func (o *AutoTransitionAssignedCases) HasAutoTransitionAssignedCasesOnSelfAssigned() bool { + return o != nil && o.AutoTransitionAssignedCasesOnSelfAssigned != nil +} + +// SetAutoTransitionAssignedCasesOnSelfAssigned gets a reference to the given bool and assigns it to the AutoTransitionAssignedCasesOnSelfAssigned field. +func (o *AutoTransitionAssignedCases) SetAutoTransitionAssignedCasesOnSelfAssigned(v bool) { + o.AutoTransitionAssignedCasesOnSelfAssigned = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AutoTransitionAssignedCases) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AutoTransitionAssignedCasesOnSelfAssigned != nil { + toSerialize["auto_transition_assigned_cases_on_self_assigned"] = o.AutoTransitionAssignedCasesOnSelfAssigned + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AutoTransitionAssignedCases) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AutoTransitionAssignedCasesOnSelfAssigned *bool `json:"auto_transition_assigned_cases_on_self_assigned,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"auto_transition_assigned_cases_on_self_assigned"}) + } else { + return err + } + o.AutoTransitionAssignedCasesOnSelfAssigned = all.AutoTransitionAssignedCasesOnSelfAssigned + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_case_notification_rule.go b/api/datadogV2/model_case_notification_rule.go new file mode 100644 index 00000000000..d8bbae40d12 --- /dev/null +++ b/api/datadogV2/model_case_notification_rule.go @@ -0,0 +1,180 @@ +// 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" +) + +// CaseNotificationRule A notification rule for case management +type CaseNotificationRule struct { + // Notification rule attributes + Attributes CaseNotificationRuleAttributes `json:"attributes"` + // The notification rule's identifier + Id string `json:"id"` + // Notification rule resource type + Type CaseNotificationRuleResourceType `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:"-"` +} + +// NewCaseNotificationRule instantiates a new CaseNotificationRule 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 NewCaseNotificationRule(attributes CaseNotificationRuleAttributes, id string, typeVar CaseNotificationRuleResourceType) *CaseNotificationRule { + this := CaseNotificationRule{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewCaseNotificationRuleWithDefaults instantiates a new CaseNotificationRule 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 NewCaseNotificationRuleWithDefaults() *CaseNotificationRule { + this := CaseNotificationRule{} + var typeVar CaseNotificationRuleResourceType = CASENOTIFICATIONRULERESOURCETYPE_NOTIFICATION_RULE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *CaseNotificationRule) GetAttributes() CaseNotificationRuleAttributes { + if o == nil { + var ret CaseNotificationRuleAttributes + 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 *CaseNotificationRule) GetAttributesOk() (*CaseNotificationRuleAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *CaseNotificationRule) SetAttributes(v CaseNotificationRuleAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *CaseNotificationRule) GetId() string { + if o == nil { + var ret string + 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 *CaseNotificationRule) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *CaseNotificationRule) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *CaseNotificationRule) GetType() CaseNotificationRuleResourceType { + if o == nil { + var ret CaseNotificationRuleResourceType + 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 *CaseNotificationRule) GetTypeOk() (*CaseNotificationRuleResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CaseNotificationRule) SetType(v CaseNotificationRuleResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRule) 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 *CaseNotificationRule) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CaseNotificationRuleAttributes `json:"attributes"` + Id *string `json:"id"` + Type *CaseNotificationRuleResourceType `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 + 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_case_notification_rule_attributes.go b/api/datadogV2/model_case_notification_rule_attributes.go new file mode 100644 index 00000000000..e8702286a06 --- /dev/null +++ b/api/datadogV2/model_case_notification_rule_attributes.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseNotificationRuleAttributes Notification rule attributes +type CaseNotificationRuleAttributes struct { + // Whether the notification rule is enabled + IsEnabled *bool `json:"is_enabled,omitempty"` + // Query to filter cases for this notification rule + Query *string `json:"query,omitempty"` + // List of notification recipients + Recipients []CaseNotificationRuleRecipient `json:"recipients,omitempty"` + // List of triggers for this notification rule + Triggers []CaseNotificationRuleTrigger `json:"triggers,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:"-"` +} + +// NewCaseNotificationRuleAttributes instantiates a new CaseNotificationRuleAttributes 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 NewCaseNotificationRuleAttributes() *CaseNotificationRuleAttributes { + this := CaseNotificationRuleAttributes{} + return &this +} + +// NewCaseNotificationRuleAttributesWithDefaults instantiates a new CaseNotificationRuleAttributes 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 NewCaseNotificationRuleAttributesWithDefaults() *CaseNotificationRuleAttributes { + this := CaseNotificationRuleAttributes{} + return &this +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *CaseNotificationRuleAttributes) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleAttributes) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *CaseNotificationRuleAttributes) HasIsEnabled() bool { + return o != nil && o.IsEnabled != nil +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *CaseNotificationRuleAttributes) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *CaseNotificationRuleAttributes) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleAttributes) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *CaseNotificationRuleAttributes) HasQuery() bool { + return o != nil && o.Query != nil +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *CaseNotificationRuleAttributes) SetQuery(v string) { + o.Query = &v +} + +// GetRecipients returns the Recipients field value if set, zero value otherwise. +func (o *CaseNotificationRuleAttributes) GetRecipients() []CaseNotificationRuleRecipient { + if o == nil || o.Recipients == nil { + var ret []CaseNotificationRuleRecipient + return ret + } + return o.Recipients +} + +// GetRecipientsOk returns a tuple with the Recipients field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleAttributes) GetRecipientsOk() (*[]CaseNotificationRuleRecipient, bool) { + if o == nil || o.Recipients == nil { + return nil, false + } + return &o.Recipients, true +} + +// HasRecipients returns a boolean if a field has been set. +func (o *CaseNotificationRuleAttributes) HasRecipients() bool { + return o != nil && o.Recipients != nil +} + +// SetRecipients gets a reference to the given []CaseNotificationRuleRecipient and assigns it to the Recipients field. +func (o *CaseNotificationRuleAttributes) SetRecipients(v []CaseNotificationRuleRecipient) { + o.Recipients = v +} + +// GetTriggers returns the Triggers field value if set, zero value otherwise. +func (o *CaseNotificationRuleAttributes) GetTriggers() []CaseNotificationRuleTrigger { + if o == nil || o.Triggers == nil { + var ret []CaseNotificationRuleTrigger + return ret + } + return o.Triggers +} + +// GetTriggersOk returns a tuple with the Triggers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleAttributes) GetTriggersOk() (*[]CaseNotificationRuleTrigger, bool) { + if o == nil || o.Triggers == nil { + return nil, false + } + return &o.Triggers, true +} + +// HasTriggers returns a boolean if a field has been set. +func (o *CaseNotificationRuleAttributes) HasTriggers() bool { + return o != nil && o.Triggers != nil +} + +// SetTriggers gets a reference to the given []CaseNotificationRuleTrigger and assigns it to the Triggers field. +func (o *CaseNotificationRuleAttributes) SetTriggers(v []CaseNotificationRuleTrigger) { + o.Triggers = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRuleAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.Recipients != nil { + toSerialize["recipients"] = o.Recipients + } + if o.Triggers != nil { + toSerialize["triggers"] = o.Triggers + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CaseNotificationRuleAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` + Query *string `json:"query,omitempty"` + Recipients []CaseNotificationRuleRecipient `json:"recipients,omitempty"` + Triggers []CaseNotificationRuleTrigger `json:"triggers,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "query", "recipients", "triggers"}) + } else { + return err + } + o.IsEnabled = all.IsEnabled + o.Query = all.Query + o.Recipients = all.Recipients + o.Triggers = all.Triggers + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_case_notification_rule_create.go b/api/datadogV2/model_case_notification_rule_create.go new file mode 100644 index 00000000000..5908384b544 --- /dev/null +++ b/api/datadogV2/model_case_notification_rule_create.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" +) + +// CaseNotificationRuleCreate Notification rule create +type CaseNotificationRuleCreate struct { + // Notification rule creation attributes + Attributes CaseNotificationRuleCreateAttributes `json:"attributes"` + // Notification rule resource type + Type CaseNotificationRuleResourceType `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:"-"` +} + +// NewCaseNotificationRuleCreate instantiates a new CaseNotificationRuleCreate 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 NewCaseNotificationRuleCreate(attributes CaseNotificationRuleCreateAttributes, typeVar CaseNotificationRuleResourceType) *CaseNotificationRuleCreate { + this := CaseNotificationRuleCreate{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewCaseNotificationRuleCreateWithDefaults instantiates a new CaseNotificationRuleCreate 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 NewCaseNotificationRuleCreateWithDefaults() *CaseNotificationRuleCreate { + this := CaseNotificationRuleCreate{} + var typeVar CaseNotificationRuleResourceType = CASENOTIFICATIONRULERESOURCETYPE_NOTIFICATION_RULE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *CaseNotificationRuleCreate) GetAttributes() CaseNotificationRuleCreateAttributes { + if o == nil { + var ret CaseNotificationRuleCreateAttributes + 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 *CaseNotificationRuleCreate) GetAttributesOk() (*CaseNotificationRuleCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *CaseNotificationRuleCreate) SetAttributes(v CaseNotificationRuleCreateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *CaseNotificationRuleCreate) GetType() CaseNotificationRuleResourceType { + if o == nil { + var ret CaseNotificationRuleResourceType + 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 *CaseNotificationRuleCreate) GetTypeOk() (*CaseNotificationRuleResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CaseNotificationRuleCreate) SetType(v CaseNotificationRuleResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRuleCreate) 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 *CaseNotificationRuleCreate) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CaseNotificationRuleCreateAttributes `json:"attributes"` + Type *CaseNotificationRuleResourceType `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_case_notification_rule_create_attributes.go b/api/datadogV2/model_case_notification_rule_create_attributes.go new file mode 100644 index 00000000000..d1457142c39 --- /dev/null +++ b/api/datadogV2/model_case_notification_rule_create_attributes.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseNotificationRuleCreateAttributes Notification rule creation attributes +type CaseNotificationRuleCreateAttributes struct { + // Whether the notification rule is enabled + IsEnabled *bool `json:"is_enabled,omitempty"` + // Query to filter cases for this notification rule + Query *string `json:"query,omitempty"` + // List of notification recipients + Recipients []CaseNotificationRuleRecipient `json:"recipients"` + // List of triggers for this notification rule + Triggers []CaseNotificationRuleTrigger `json:"triggers"` + // 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:"-"` +} + +// NewCaseNotificationRuleCreateAttributes instantiates a new CaseNotificationRuleCreateAttributes 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 NewCaseNotificationRuleCreateAttributes(recipients []CaseNotificationRuleRecipient, triggers []CaseNotificationRuleTrigger) *CaseNotificationRuleCreateAttributes { + this := CaseNotificationRuleCreateAttributes{} + var isEnabled bool = true + this.IsEnabled = &isEnabled + this.Recipients = recipients + this.Triggers = triggers + return &this +} + +// NewCaseNotificationRuleCreateAttributesWithDefaults instantiates a new CaseNotificationRuleCreateAttributes 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 NewCaseNotificationRuleCreateAttributesWithDefaults() *CaseNotificationRuleCreateAttributes { + this := CaseNotificationRuleCreateAttributes{} + var isEnabled bool = true + this.IsEnabled = &isEnabled + return &this +} + +// GetIsEnabled returns the IsEnabled field value if set, zero value otherwise. +func (o *CaseNotificationRuleCreateAttributes) GetIsEnabled() bool { + if o == nil || o.IsEnabled == nil { + var ret bool + return ret + } + return *o.IsEnabled +} + +// GetIsEnabledOk returns a tuple with the IsEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleCreateAttributes) GetIsEnabledOk() (*bool, bool) { + if o == nil || o.IsEnabled == nil { + return nil, false + } + return o.IsEnabled, true +} + +// HasIsEnabled returns a boolean if a field has been set. +func (o *CaseNotificationRuleCreateAttributes) HasIsEnabled() bool { + return o != nil && o.IsEnabled != nil +} + +// SetIsEnabled gets a reference to the given bool and assigns it to the IsEnabled field. +func (o *CaseNotificationRuleCreateAttributes) SetIsEnabled(v bool) { + o.IsEnabled = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *CaseNotificationRuleCreateAttributes) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleCreateAttributes) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *CaseNotificationRuleCreateAttributes) HasQuery() bool { + return o != nil && o.Query != nil +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *CaseNotificationRuleCreateAttributes) SetQuery(v string) { + o.Query = &v +} + +// GetRecipients returns the Recipients field value. +func (o *CaseNotificationRuleCreateAttributes) GetRecipients() []CaseNotificationRuleRecipient { + if o == nil { + var ret []CaseNotificationRuleRecipient + return ret + } + return o.Recipients +} + +// GetRecipientsOk returns a tuple with the Recipients field value +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleCreateAttributes) GetRecipientsOk() (*[]CaseNotificationRuleRecipient, bool) { + if o == nil { + return nil, false + } + return &o.Recipients, true +} + +// SetRecipients sets field value. +func (o *CaseNotificationRuleCreateAttributes) SetRecipients(v []CaseNotificationRuleRecipient) { + o.Recipients = v +} + +// GetTriggers returns the Triggers field value. +func (o *CaseNotificationRuleCreateAttributes) GetTriggers() []CaseNotificationRuleTrigger { + if o == nil { + var ret []CaseNotificationRuleTrigger + return ret + } + return o.Triggers +} + +// GetTriggersOk returns a tuple with the Triggers field value +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleCreateAttributes) GetTriggersOk() (*[]CaseNotificationRuleTrigger, bool) { + if o == nil { + return nil, false + } + return &o.Triggers, true +} + +// SetTriggers sets field value. +func (o *CaseNotificationRuleCreateAttributes) SetTriggers(v []CaseNotificationRuleTrigger) { + o.Triggers = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRuleCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.IsEnabled != nil { + toSerialize["is_enabled"] = o.IsEnabled + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + toSerialize["recipients"] = o.Recipients + toSerialize["triggers"] = o.Triggers + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CaseNotificationRuleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IsEnabled *bool `json:"is_enabled,omitempty"` + Query *string `json:"query,omitempty"` + Recipients *[]CaseNotificationRuleRecipient `json:"recipients"` + Triggers *[]CaseNotificationRuleTrigger `json:"triggers"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Recipients == nil { + return fmt.Errorf("required field recipients missing") + } + if all.Triggers == nil { + return fmt.Errorf("required field triggers missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"is_enabled", "query", "recipients", "triggers"}) + } else { + return err + } + o.IsEnabled = all.IsEnabled + o.Query = all.Query + o.Recipients = *all.Recipients + o.Triggers = *all.Triggers + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_case_notification_rule_create_request.go b/api/datadogV2/model_case_notification_rule_create_request.go new file mode 100644 index 00000000000..550ea579f55 --- /dev/null +++ b/api/datadogV2/model_case_notification_rule_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" +) + +// CaseNotificationRuleCreateRequest Notification rule create request +type CaseNotificationRuleCreateRequest struct { + // Notification rule create + Data CaseNotificationRuleCreate `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:"-"` +} + +// NewCaseNotificationRuleCreateRequest instantiates a new CaseNotificationRuleCreateRequest 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 NewCaseNotificationRuleCreateRequest(data CaseNotificationRuleCreate) *CaseNotificationRuleCreateRequest { + this := CaseNotificationRuleCreateRequest{} + this.Data = data + return &this +} + +// NewCaseNotificationRuleCreateRequestWithDefaults instantiates a new CaseNotificationRuleCreateRequest 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 NewCaseNotificationRuleCreateRequestWithDefaults() *CaseNotificationRuleCreateRequest { + this := CaseNotificationRuleCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *CaseNotificationRuleCreateRequest) GetData() CaseNotificationRuleCreate { + if o == nil { + var ret CaseNotificationRuleCreate + 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 *CaseNotificationRuleCreateRequest) GetDataOk() (*CaseNotificationRuleCreate, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CaseNotificationRuleCreateRequest) SetData(v CaseNotificationRuleCreate) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRuleCreateRequest) 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 *CaseNotificationRuleCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CaseNotificationRuleCreate `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_case_notification_rule_recipient.go b/api/datadogV2/model_case_notification_rule_recipient.go new file mode 100644 index 00000000000..b06a8c1420c --- /dev/null +++ b/api/datadogV2/model_case_notification_rule_recipient.go @@ -0,0 +1,146 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseNotificationRuleRecipient Notification rule recipient +type CaseNotificationRuleRecipient struct { + // Recipient data + Data *CaseNotificationRuleRecipientData `json:"data,omitempty"` + // Type of recipient (SLACK_CHANNEL, EMAIL, HTTP, PAGERDUTY_SERVICE, MS_TEAMS_CHANNEL) + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCaseNotificationRuleRecipient instantiates a new CaseNotificationRuleRecipient 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 NewCaseNotificationRuleRecipient() *CaseNotificationRuleRecipient { + this := CaseNotificationRuleRecipient{} + return &this +} + +// NewCaseNotificationRuleRecipientWithDefaults instantiates a new CaseNotificationRuleRecipient 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 NewCaseNotificationRuleRecipientWithDefaults() *CaseNotificationRuleRecipient { + this := CaseNotificationRuleRecipient{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipient) GetData() CaseNotificationRuleRecipientData { + if o == nil || o.Data == nil { + var ret CaseNotificationRuleRecipientData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipient) GetDataOk() (*CaseNotificationRuleRecipientData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipient) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given CaseNotificationRuleRecipientData and assigns it to the Data field. +func (o *CaseNotificationRuleRecipient) SetData(v CaseNotificationRuleRecipientData) { + o.Data = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipient) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipient) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipient) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *CaseNotificationRuleRecipient) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRuleRecipient) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CaseNotificationRuleRecipient) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CaseNotificationRuleRecipientData `json:"data,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + 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_case_notification_rule_recipient_data.go b/api/datadogV2/model_case_notification_rule_recipient_data.go new file mode 100644 index 00000000000..5005f8241b9 --- /dev/null +++ b/api/datadogV2/model_case_notification_rule_recipient_data.go @@ -0,0 +1,522 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseNotificationRuleRecipientData Recipient data +type CaseNotificationRuleRecipientData struct { + // Slack channel name + Channel *string `json:"channel,omitempty"` + // Slack channel ID + ChannelId *string `json:"channel_id,omitempty"` + // Microsoft Teams channel name + ChannelName *string `json:"channel_name,omitempty"` + // Microsoft Teams connector name + ConnectorName *string `json:"connector_name,omitempty"` + // Email address + Email *string `json:"email,omitempty"` + // HTTP webhook name + Name *string `json:"name,omitempty"` + // PagerDuty service name + ServiceName *string `json:"service_name,omitempty"` + // Microsoft Teams team ID + TeamId *string `json:"team_id,omitempty"` + // Microsoft Teams team name + TeamName *string `json:"team_name,omitempty"` + // Microsoft Teams tenant ID + TenantId *string `json:"tenant_id,omitempty"` + // Microsoft Teams tenant name + TenantName *string `json:"tenant_name,omitempty"` + // Slack workspace name + Workspace *string `json:"workspace,omitempty"` + // Slack workspace ID + WorkspaceId *string `json:"workspace_id,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCaseNotificationRuleRecipientData instantiates a new CaseNotificationRuleRecipientData 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 NewCaseNotificationRuleRecipientData() *CaseNotificationRuleRecipientData { + this := CaseNotificationRuleRecipientData{} + return &this +} + +// NewCaseNotificationRuleRecipientDataWithDefaults instantiates a new CaseNotificationRuleRecipientData 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 NewCaseNotificationRuleRecipientDataWithDefaults() *CaseNotificationRuleRecipientData { + this := CaseNotificationRuleRecipientData{} + return &this +} + +// GetChannel returns the Channel field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetChannel() string { + if o == nil || o.Channel == nil { + var ret string + return ret + } + return *o.Channel +} + +// GetChannelOk returns a tuple with the Channel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetChannelOk() (*string, bool) { + if o == nil || o.Channel == nil { + return nil, false + } + return o.Channel, true +} + +// HasChannel returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasChannel() bool { + return o != nil && o.Channel != nil +} + +// SetChannel gets a reference to the given string and assigns it to the Channel field. +func (o *CaseNotificationRuleRecipientData) SetChannel(v string) { + o.Channel = &v +} + +// GetChannelId returns the ChannelId field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetChannelId() string { + if o == nil || o.ChannelId == nil { + var ret string + return ret + } + return *o.ChannelId +} + +// GetChannelIdOk returns a tuple with the ChannelId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetChannelIdOk() (*string, bool) { + if o == nil || o.ChannelId == nil { + return nil, false + } + return o.ChannelId, true +} + +// HasChannelId returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasChannelId() bool { + return o != nil && o.ChannelId != nil +} + +// SetChannelId gets a reference to the given string and assigns it to the ChannelId field. +func (o *CaseNotificationRuleRecipientData) SetChannelId(v string) { + o.ChannelId = &v +} + +// GetChannelName returns the ChannelName field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetChannelName() string { + if o == nil || o.ChannelName == nil { + var ret string + return ret + } + return *o.ChannelName +} + +// GetChannelNameOk returns a tuple with the ChannelName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetChannelNameOk() (*string, bool) { + if o == nil || o.ChannelName == nil { + return nil, false + } + return o.ChannelName, true +} + +// HasChannelName returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasChannelName() bool { + return o != nil && o.ChannelName != nil +} + +// SetChannelName gets a reference to the given string and assigns it to the ChannelName field. +func (o *CaseNotificationRuleRecipientData) SetChannelName(v string) { + o.ChannelName = &v +} + +// GetConnectorName returns the ConnectorName field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetConnectorName() string { + if o == nil || o.ConnectorName == nil { + var ret string + return ret + } + return *o.ConnectorName +} + +// GetConnectorNameOk returns a tuple with the ConnectorName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetConnectorNameOk() (*string, bool) { + if o == nil || o.ConnectorName == nil { + return nil, false + } + return o.ConnectorName, true +} + +// HasConnectorName returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasConnectorName() bool { + return o != nil && o.ConnectorName != nil +} + +// SetConnectorName gets a reference to the given string and assigns it to the ConnectorName field. +func (o *CaseNotificationRuleRecipientData) SetConnectorName(v string) { + o.ConnectorName = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasEmail() bool { + return o != nil && o.Email != nil +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *CaseNotificationRuleRecipientData) SetEmail(v string) { + o.Email = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CaseNotificationRuleRecipientData) SetName(v string) { + o.Name = &v +} + +// GetServiceName returns the ServiceName field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetServiceName() string { + if o == nil || o.ServiceName == nil { + var ret string + return ret + } + return *o.ServiceName +} + +// GetServiceNameOk returns a tuple with the ServiceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetServiceNameOk() (*string, bool) { + if o == nil || o.ServiceName == nil { + return nil, false + } + return o.ServiceName, true +} + +// HasServiceName returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasServiceName() bool { + return o != nil && o.ServiceName != nil +} + +// SetServiceName gets a reference to the given string and assigns it to the ServiceName field. +func (o *CaseNotificationRuleRecipientData) SetServiceName(v string) { + o.ServiceName = &v +} + +// GetTeamId returns the TeamId field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetTeamId() string { + if o == nil || o.TeamId == nil { + var ret string + return ret + } + return *o.TeamId +} + +// GetTeamIdOk returns a tuple with the TeamId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetTeamIdOk() (*string, bool) { + if o == nil || o.TeamId == nil { + return nil, false + } + return o.TeamId, true +} + +// HasTeamId returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasTeamId() bool { + return o != nil && o.TeamId != nil +} + +// SetTeamId gets a reference to the given string and assigns it to the TeamId field. +func (o *CaseNotificationRuleRecipientData) SetTeamId(v string) { + o.TeamId = &v +} + +// GetTeamName returns the TeamName field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetTeamName() string { + if o == nil || o.TeamName == nil { + var ret string + return ret + } + return *o.TeamName +} + +// GetTeamNameOk returns a tuple with the TeamName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetTeamNameOk() (*string, bool) { + if o == nil || o.TeamName == nil { + return nil, false + } + return o.TeamName, true +} + +// HasTeamName returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasTeamName() bool { + return o != nil && o.TeamName != nil +} + +// SetTeamName gets a reference to the given string and assigns it to the TeamName field. +func (o *CaseNotificationRuleRecipientData) SetTeamName(v string) { + o.TeamName = &v +} + +// GetTenantId returns the TenantId field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetTenantId() string { + if o == nil || o.TenantId == nil { + var ret string + return ret + } + return *o.TenantId +} + +// GetTenantIdOk returns a tuple with the TenantId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetTenantIdOk() (*string, bool) { + if o == nil || o.TenantId == nil { + return nil, false + } + return o.TenantId, true +} + +// HasTenantId returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasTenantId() bool { + return o != nil && o.TenantId != nil +} + +// SetTenantId gets a reference to the given string and assigns it to the TenantId field. +func (o *CaseNotificationRuleRecipientData) SetTenantId(v string) { + o.TenantId = &v +} + +// GetTenantName returns the TenantName field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetTenantName() string { + if o == nil || o.TenantName == nil { + var ret string + return ret + } + return *o.TenantName +} + +// GetTenantNameOk returns a tuple with the TenantName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetTenantNameOk() (*string, bool) { + if o == nil || o.TenantName == nil { + return nil, false + } + return o.TenantName, true +} + +// HasTenantName returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasTenantName() bool { + return o != nil && o.TenantName != nil +} + +// SetTenantName gets a reference to the given string and assigns it to the TenantName field. +func (o *CaseNotificationRuleRecipientData) SetTenantName(v string) { + o.TenantName = &v +} + +// GetWorkspace returns the Workspace field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetWorkspace() string { + if o == nil || o.Workspace == nil { + var ret string + return ret + } + return *o.Workspace +} + +// GetWorkspaceOk returns a tuple with the Workspace field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetWorkspaceOk() (*string, bool) { + if o == nil || o.Workspace == nil { + return nil, false + } + return o.Workspace, true +} + +// HasWorkspace returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasWorkspace() bool { + return o != nil && o.Workspace != nil +} + +// SetWorkspace gets a reference to the given string and assigns it to the Workspace field. +func (o *CaseNotificationRuleRecipientData) SetWorkspace(v string) { + o.Workspace = &v +} + +// GetWorkspaceId returns the WorkspaceId field value if set, zero value otherwise. +func (o *CaseNotificationRuleRecipientData) GetWorkspaceId() string { + if o == nil || o.WorkspaceId == nil { + var ret string + return ret + } + return *o.WorkspaceId +} + +// GetWorkspaceIdOk returns a tuple with the WorkspaceId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleRecipientData) GetWorkspaceIdOk() (*string, bool) { + if o == nil || o.WorkspaceId == nil { + return nil, false + } + return o.WorkspaceId, true +} + +// HasWorkspaceId returns a boolean if a field has been set. +func (o *CaseNotificationRuleRecipientData) HasWorkspaceId() bool { + return o != nil && o.WorkspaceId != nil +} + +// SetWorkspaceId gets a reference to the given string and assigns it to the WorkspaceId field. +func (o *CaseNotificationRuleRecipientData) SetWorkspaceId(v string) { + o.WorkspaceId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRuleRecipientData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Channel != nil { + toSerialize["channel"] = o.Channel + } + if o.ChannelId != nil { + toSerialize["channel_id"] = o.ChannelId + } + if o.ChannelName != nil { + toSerialize["channel_name"] = o.ChannelName + } + if o.ConnectorName != nil { + toSerialize["connector_name"] = o.ConnectorName + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.ServiceName != nil { + toSerialize["service_name"] = o.ServiceName + } + if o.TeamId != nil { + toSerialize["team_id"] = o.TeamId + } + if o.TeamName != nil { + toSerialize["team_name"] = o.TeamName + } + if o.TenantId != nil { + toSerialize["tenant_id"] = o.TenantId + } + if o.TenantName != nil { + toSerialize["tenant_name"] = o.TenantName + } + if o.Workspace != nil { + toSerialize["workspace"] = o.Workspace + } + if o.WorkspaceId != nil { + toSerialize["workspace_id"] = o.WorkspaceId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CaseNotificationRuleRecipientData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Channel *string `json:"channel,omitempty"` + ChannelId *string `json:"channel_id,omitempty"` + ChannelName *string `json:"channel_name,omitempty"` + ConnectorName *string `json:"connector_name,omitempty"` + Email *string `json:"email,omitempty"` + Name *string `json:"name,omitempty"` + ServiceName *string `json:"service_name,omitempty"` + TeamId *string `json:"team_id,omitempty"` + TeamName *string `json:"team_name,omitempty"` + TenantId *string `json:"tenant_id,omitempty"` + TenantName *string `json:"tenant_name,omitempty"` + Workspace *string `json:"workspace,omitempty"` + WorkspaceId *string `json:"workspace_id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"channel", "channel_id", "channel_name", "connector_name", "email", "name", "service_name", "team_id", "team_name", "tenant_id", "tenant_name", "workspace", "workspace_id"}) + } else { + return err + } + o.Channel = all.Channel + o.ChannelId = all.ChannelId + o.ChannelName = all.ChannelName + o.ConnectorName = all.ConnectorName + o.Email = all.Email + o.Name = all.Name + o.ServiceName = all.ServiceName + o.TeamId = all.TeamId + o.TeamName = all.TeamName + o.TenantId = all.TenantId + o.TenantName = all.TenantName + o.Workspace = all.Workspace + o.WorkspaceId = all.WorkspaceId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_case_notification_rule_resource_type.go b/api/datadogV2/model_case_notification_rule_resource_type.go new file mode 100644 index 00000000000..cc8eb201fae --- /dev/null +++ b/api/datadogV2/model_case_notification_rule_resource_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" +) + +// CaseNotificationRuleResourceType Notification rule resource type +type CaseNotificationRuleResourceType string + +// List of CaseNotificationRuleResourceType. +const ( + CASENOTIFICATIONRULERESOURCETYPE_NOTIFICATION_RULE CaseNotificationRuleResourceType = "notification_rule" +) + +var allowedCaseNotificationRuleResourceTypeEnumValues = []CaseNotificationRuleResourceType{ + CASENOTIFICATIONRULERESOURCETYPE_NOTIFICATION_RULE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *CaseNotificationRuleResourceType) GetAllowedValues() []CaseNotificationRuleResourceType { + return allowedCaseNotificationRuleResourceTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *CaseNotificationRuleResourceType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = CaseNotificationRuleResourceType(value) + return nil +} + +// NewCaseNotificationRuleResourceTypeFromValue returns a pointer to a valid CaseNotificationRuleResourceType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewCaseNotificationRuleResourceTypeFromValue(v string) (*CaseNotificationRuleResourceType, error) { + ev := CaseNotificationRuleResourceType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for CaseNotificationRuleResourceType: valid values are %v", v, allowedCaseNotificationRuleResourceTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v CaseNotificationRuleResourceType) IsValid() bool { + for _, existing := range allowedCaseNotificationRuleResourceTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CaseNotificationRuleResourceType value. +func (v CaseNotificationRuleResourceType) Ptr() *CaseNotificationRuleResourceType { + return &v +} diff --git a/api/datadogV2/model_case_notification_rule_response.go b/api/datadogV2/model_case_notification_rule_response.go new file mode 100644 index 00000000000..c01d4109423 --- /dev/null +++ b/api/datadogV2/model_case_notification_rule_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseNotificationRuleResponse Notification rule response +type CaseNotificationRuleResponse struct { + // A notification rule for case management + Data *CaseNotificationRule `json:"data,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:"-"` +} + +// NewCaseNotificationRuleResponse instantiates a new CaseNotificationRuleResponse 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 NewCaseNotificationRuleResponse() *CaseNotificationRuleResponse { + this := CaseNotificationRuleResponse{} + return &this +} + +// NewCaseNotificationRuleResponseWithDefaults instantiates a new CaseNotificationRuleResponse 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 NewCaseNotificationRuleResponseWithDefaults() *CaseNotificationRuleResponse { + this := CaseNotificationRuleResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CaseNotificationRuleResponse) GetData() CaseNotificationRule { + if o == nil || o.Data == nil { + var ret CaseNotificationRule + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleResponse) GetDataOk() (*CaseNotificationRule, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CaseNotificationRuleResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given CaseNotificationRule and assigns it to the Data field. +func (o *CaseNotificationRuleResponse) SetData(v CaseNotificationRule) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRuleResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CaseNotificationRuleResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CaseNotificationRule `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && 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_case_notification_rule_trigger.go b/api/datadogV2/model_case_notification_rule_trigger.go new file mode 100644 index 00000000000..519ea46e72e --- /dev/null +++ b/api/datadogV2/model_case_notification_rule_trigger.go @@ -0,0 +1,146 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseNotificationRuleTrigger Notification rule trigger +type CaseNotificationRuleTrigger struct { + // Trigger data + Data *CaseNotificationRuleTriggerData `json:"data,omitempty"` + // Type of trigger (CASE_CREATED, STATUS_TRANSITIONED, ATTRIBUTE_VALUE_CHANGED, EVENT_CORRELATION_SIGNAL_CORRELATED) + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCaseNotificationRuleTrigger instantiates a new CaseNotificationRuleTrigger 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 NewCaseNotificationRuleTrigger() *CaseNotificationRuleTrigger { + this := CaseNotificationRuleTrigger{} + return &this +} + +// NewCaseNotificationRuleTriggerWithDefaults instantiates a new CaseNotificationRuleTrigger 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 NewCaseNotificationRuleTriggerWithDefaults() *CaseNotificationRuleTrigger { + this := CaseNotificationRuleTrigger{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CaseNotificationRuleTrigger) GetData() CaseNotificationRuleTriggerData { + if o == nil || o.Data == nil { + var ret CaseNotificationRuleTriggerData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleTrigger) GetDataOk() (*CaseNotificationRuleTriggerData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CaseNotificationRuleTrigger) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given CaseNotificationRuleTriggerData and assigns it to the Data field. +func (o *CaseNotificationRuleTrigger) SetData(v CaseNotificationRuleTriggerData) { + o.Data = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CaseNotificationRuleTrigger) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleTrigger) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *CaseNotificationRuleTrigger) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *CaseNotificationRuleTrigger) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRuleTrigger) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CaseNotificationRuleTrigger) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CaseNotificationRuleTriggerData `json:"data,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + 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_case_notification_rule_trigger_data.go b/api/datadogV2/model_case_notification_rule_trigger_data.go new file mode 100644 index 00000000000..6f24a1c23f3 --- /dev/null +++ b/api/datadogV2/model_case_notification_rule_trigger_data.go @@ -0,0 +1,277 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseNotificationRuleTriggerData Trigger data +type CaseNotificationRuleTriggerData struct { + // Change type (added, removed, changed) + ChangeType *string `json:"change_type,omitempty"` + // Field name for attribute value changed trigger + Field *string `json:"field,omitempty"` + // Status ID to transition from + FromStatus *string `json:"from_status,omitempty"` + // Status name to transition from + FromStatusName *string `json:"from_status_name,omitempty"` + // Status ID to transition to + ToStatus *string `json:"to_status,omitempty"` + // Status name to transition to + ToStatusName *string `json:"to_status_name,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:"-"` +} + +// NewCaseNotificationRuleTriggerData instantiates a new CaseNotificationRuleTriggerData 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 NewCaseNotificationRuleTriggerData() *CaseNotificationRuleTriggerData { + this := CaseNotificationRuleTriggerData{} + return &this +} + +// NewCaseNotificationRuleTriggerDataWithDefaults instantiates a new CaseNotificationRuleTriggerData 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 NewCaseNotificationRuleTriggerDataWithDefaults() *CaseNotificationRuleTriggerData { + this := CaseNotificationRuleTriggerData{} + return &this +} + +// GetChangeType returns the ChangeType field value if set, zero value otherwise. +func (o *CaseNotificationRuleTriggerData) GetChangeType() string { + if o == nil || o.ChangeType == nil { + var ret string + return ret + } + return *o.ChangeType +} + +// GetChangeTypeOk returns a tuple with the ChangeType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleTriggerData) GetChangeTypeOk() (*string, bool) { + if o == nil || o.ChangeType == nil { + return nil, false + } + return o.ChangeType, true +} + +// HasChangeType returns a boolean if a field has been set. +func (o *CaseNotificationRuleTriggerData) HasChangeType() bool { + return o != nil && o.ChangeType != nil +} + +// SetChangeType gets a reference to the given string and assigns it to the ChangeType field. +func (o *CaseNotificationRuleTriggerData) SetChangeType(v string) { + o.ChangeType = &v +} + +// GetField returns the Field field value if set, zero value otherwise. +func (o *CaseNotificationRuleTriggerData) GetField() string { + if o == nil || o.Field == nil { + var ret string + return ret + } + return *o.Field +} + +// GetFieldOk returns a tuple with the Field field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleTriggerData) GetFieldOk() (*string, bool) { + if o == nil || o.Field == nil { + return nil, false + } + return o.Field, true +} + +// HasField returns a boolean if a field has been set. +func (o *CaseNotificationRuleTriggerData) HasField() bool { + return o != nil && o.Field != nil +} + +// SetField gets a reference to the given string and assigns it to the Field field. +func (o *CaseNotificationRuleTriggerData) SetField(v string) { + o.Field = &v +} + +// GetFromStatus returns the FromStatus field value if set, zero value otherwise. +func (o *CaseNotificationRuleTriggerData) GetFromStatus() string { + if o == nil || o.FromStatus == nil { + var ret string + return ret + } + return *o.FromStatus +} + +// GetFromStatusOk returns a tuple with the FromStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleTriggerData) GetFromStatusOk() (*string, bool) { + if o == nil || o.FromStatus == nil { + return nil, false + } + return o.FromStatus, true +} + +// HasFromStatus returns a boolean if a field has been set. +func (o *CaseNotificationRuleTriggerData) HasFromStatus() bool { + return o != nil && o.FromStatus != nil +} + +// SetFromStatus gets a reference to the given string and assigns it to the FromStatus field. +func (o *CaseNotificationRuleTriggerData) SetFromStatus(v string) { + o.FromStatus = &v +} + +// GetFromStatusName returns the FromStatusName field value if set, zero value otherwise. +func (o *CaseNotificationRuleTriggerData) GetFromStatusName() string { + if o == nil || o.FromStatusName == nil { + var ret string + return ret + } + return *o.FromStatusName +} + +// GetFromStatusNameOk returns a tuple with the FromStatusName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleTriggerData) GetFromStatusNameOk() (*string, bool) { + if o == nil || o.FromStatusName == nil { + return nil, false + } + return o.FromStatusName, true +} + +// HasFromStatusName returns a boolean if a field has been set. +func (o *CaseNotificationRuleTriggerData) HasFromStatusName() bool { + return o != nil && o.FromStatusName != nil +} + +// SetFromStatusName gets a reference to the given string and assigns it to the FromStatusName field. +func (o *CaseNotificationRuleTriggerData) SetFromStatusName(v string) { + o.FromStatusName = &v +} + +// GetToStatus returns the ToStatus field value if set, zero value otherwise. +func (o *CaseNotificationRuleTriggerData) GetToStatus() string { + if o == nil || o.ToStatus == nil { + var ret string + return ret + } + return *o.ToStatus +} + +// GetToStatusOk returns a tuple with the ToStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleTriggerData) GetToStatusOk() (*string, bool) { + if o == nil || o.ToStatus == nil { + return nil, false + } + return o.ToStatus, true +} + +// HasToStatus returns a boolean if a field has been set. +func (o *CaseNotificationRuleTriggerData) HasToStatus() bool { + return o != nil && o.ToStatus != nil +} + +// SetToStatus gets a reference to the given string and assigns it to the ToStatus field. +func (o *CaseNotificationRuleTriggerData) SetToStatus(v string) { + o.ToStatus = &v +} + +// GetToStatusName returns the ToStatusName field value if set, zero value otherwise. +func (o *CaseNotificationRuleTriggerData) GetToStatusName() string { + if o == nil || o.ToStatusName == nil { + var ret string + return ret + } + return *o.ToStatusName +} + +// GetToStatusNameOk returns a tuple with the ToStatusName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleTriggerData) GetToStatusNameOk() (*string, bool) { + if o == nil || o.ToStatusName == nil { + return nil, false + } + return o.ToStatusName, true +} + +// HasToStatusName returns a boolean if a field has been set. +func (o *CaseNotificationRuleTriggerData) HasToStatusName() bool { + return o != nil && o.ToStatusName != nil +} + +// SetToStatusName gets a reference to the given string and assigns it to the ToStatusName field. +func (o *CaseNotificationRuleTriggerData) SetToStatusName(v string) { + o.ToStatusName = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRuleTriggerData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ChangeType != nil { + toSerialize["change_type"] = o.ChangeType + } + if o.Field != nil { + toSerialize["field"] = o.Field + } + if o.FromStatus != nil { + toSerialize["from_status"] = o.FromStatus + } + if o.FromStatusName != nil { + toSerialize["from_status_name"] = o.FromStatusName + } + if o.ToStatus != nil { + toSerialize["to_status"] = o.ToStatus + } + if o.ToStatusName != nil { + toSerialize["to_status_name"] = o.ToStatusName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CaseNotificationRuleTriggerData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ChangeType *string `json:"change_type,omitempty"` + Field *string `json:"field,omitempty"` + FromStatus *string `json:"from_status,omitempty"` + FromStatusName *string `json:"from_status_name,omitempty"` + ToStatus *string `json:"to_status,omitempty"` + ToStatusName *string `json:"to_status_name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"change_type", "field", "from_status", "from_status_name", "to_status", "to_status_name"}) + } else { + return err + } + o.ChangeType = all.ChangeType + o.Field = all.Field + o.FromStatus = all.FromStatus + o.FromStatusName = all.FromStatusName + o.ToStatus = all.ToStatus + o.ToStatusName = all.ToStatusName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_case_notification_rule_update.go b/api/datadogV2/model_case_notification_rule_update.go new file mode 100644 index 00000000000..ccff9a193c1 --- /dev/null +++ b/api/datadogV2/model_case_notification_rule_update.go @@ -0,0 +1,151 @@ +// 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" +) + +// CaseNotificationRuleUpdate Notification rule update +type CaseNotificationRuleUpdate struct { + // Notification rule attributes + Attributes *CaseNotificationRuleAttributes `json:"attributes,omitempty"` + // Notification rule resource type + Type CaseNotificationRuleResourceType `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:"-"` +} + +// NewCaseNotificationRuleUpdate instantiates a new CaseNotificationRuleUpdate 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 NewCaseNotificationRuleUpdate(typeVar CaseNotificationRuleResourceType) *CaseNotificationRuleUpdate { + this := CaseNotificationRuleUpdate{} + this.Type = typeVar + return &this +} + +// NewCaseNotificationRuleUpdateWithDefaults instantiates a new CaseNotificationRuleUpdate 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 NewCaseNotificationRuleUpdateWithDefaults() *CaseNotificationRuleUpdate { + this := CaseNotificationRuleUpdate{} + var typeVar CaseNotificationRuleResourceType = CASENOTIFICATIONRULERESOURCETYPE_NOTIFICATION_RULE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CaseNotificationRuleUpdate) GetAttributes() CaseNotificationRuleAttributes { + if o == nil || o.Attributes == nil { + var ret CaseNotificationRuleAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRuleUpdate) GetAttributesOk() (*CaseNotificationRuleAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *CaseNotificationRuleUpdate) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given CaseNotificationRuleAttributes and assigns it to the Attributes field. +func (o *CaseNotificationRuleUpdate) SetAttributes(v CaseNotificationRuleAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value. +func (o *CaseNotificationRuleUpdate) GetType() CaseNotificationRuleResourceType { + if o == nil { + var ret CaseNotificationRuleResourceType + 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 *CaseNotificationRuleUpdate) GetTypeOk() (*CaseNotificationRuleResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CaseNotificationRuleUpdate) SetType(v CaseNotificationRuleResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRuleUpdate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + 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 *CaseNotificationRuleUpdate) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CaseNotificationRuleAttributes `json:"attributes,omitempty"` + Type *CaseNotificationRuleResourceType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + 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 != nil && 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_case_notification_rule_update_request.go b/api/datadogV2/model_case_notification_rule_update_request.go new file mode 100644 index 00000000000..8307f91bccc --- /dev/null +++ b/api/datadogV2/model_case_notification_rule_update_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" +) + +// CaseNotificationRuleUpdateRequest Notification rule update request +type CaseNotificationRuleUpdateRequest struct { + // Notification rule update + Data CaseNotificationRuleUpdate `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:"-"` +} + +// NewCaseNotificationRuleUpdateRequest instantiates a new CaseNotificationRuleUpdateRequest 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 NewCaseNotificationRuleUpdateRequest(data CaseNotificationRuleUpdate) *CaseNotificationRuleUpdateRequest { + this := CaseNotificationRuleUpdateRequest{} + this.Data = data + return &this +} + +// NewCaseNotificationRuleUpdateRequestWithDefaults instantiates a new CaseNotificationRuleUpdateRequest 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 NewCaseNotificationRuleUpdateRequestWithDefaults() *CaseNotificationRuleUpdateRequest { + this := CaseNotificationRuleUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *CaseNotificationRuleUpdateRequest) GetData() CaseNotificationRuleUpdate { + if o == nil { + var ret CaseNotificationRuleUpdate + 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 *CaseNotificationRuleUpdateRequest) GetDataOk() (*CaseNotificationRuleUpdate, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CaseNotificationRuleUpdateRequest) SetData(v CaseNotificationRuleUpdate) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRuleUpdateRequest) 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 *CaseNotificationRuleUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CaseNotificationRuleUpdate `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_case_notification_rules_response.go b/api/datadogV2/model_case_notification_rules_response.go new file mode 100644 index 00000000000..ff024ac6b0b --- /dev/null +++ b/api/datadogV2/model_case_notification_rules_response.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseNotificationRulesResponse Response with notification rules +type CaseNotificationRulesResponse struct { + // Notification rules data + Data []CaseNotificationRule `json:"data,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:"-"` +} + +// NewCaseNotificationRulesResponse instantiates a new CaseNotificationRulesResponse 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 NewCaseNotificationRulesResponse() *CaseNotificationRulesResponse { + this := CaseNotificationRulesResponse{} + return &this +} + +// NewCaseNotificationRulesResponseWithDefaults instantiates a new CaseNotificationRulesResponse 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 NewCaseNotificationRulesResponseWithDefaults() *CaseNotificationRulesResponse { + this := CaseNotificationRulesResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CaseNotificationRulesResponse) GetData() []CaseNotificationRule { + if o == nil || o.Data == nil { + var ret []CaseNotificationRule + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseNotificationRulesResponse) GetDataOk() (*[]CaseNotificationRule, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *CaseNotificationRulesResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []CaseNotificationRule and assigns it to the Data field. +func (o *CaseNotificationRulesResponse) SetData(v []CaseNotificationRule) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseNotificationRulesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CaseNotificationRulesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []CaseNotificationRule `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_integration_incident.go b/api/datadogV2/model_integration_incident.go new file mode 100644 index 00000000000..bf13f16ffba --- /dev/null +++ b/api/datadogV2/model_integration_incident.go @@ -0,0 +1,286 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationIncident Incident integration settings +type IntegrationIncident struct { + // Query for auto-escalation + AutoEscalationQuery *string `json:"auto_escalation_query,omitempty"` + // Default incident commander + DefaultIncidentCommander *string `json:"default_incident_commander,omitempty"` + // Whether incident integration is enabled + Enabled *bool `json:"enabled,omitempty"` + // + FieldMappings []IntegrationIncidentFieldMappingsItems `json:"field_mappings,omitempty"` + // Incident type + IncidentType *string `json:"incident_type,omitempty"` + // + SeverityConfig *IntegrationIncidentSeverityConfig `json:"severity_config,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:"-"` +} + +// NewIntegrationIncident instantiates a new IntegrationIncident 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 NewIntegrationIncident() *IntegrationIncident { + this := IntegrationIncident{} + return &this +} + +// NewIntegrationIncidentWithDefaults instantiates a new IntegrationIncident 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 NewIntegrationIncidentWithDefaults() *IntegrationIncident { + this := IntegrationIncident{} + return &this +} + +// GetAutoEscalationQuery returns the AutoEscalationQuery field value if set, zero value otherwise. +func (o *IntegrationIncident) GetAutoEscalationQuery() string { + if o == nil || o.AutoEscalationQuery == nil { + var ret string + return ret + } + return *o.AutoEscalationQuery +} + +// GetAutoEscalationQueryOk returns a tuple with the AutoEscalationQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationIncident) GetAutoEscalationQueryOk() (*string, bool) { + if o == nil || o.AutoEscalationQuery == nil { + return nil, false + } + return o.AutoEscalationQuery, true +} + +// HasAutoEscalationQuery returns a boolean if a field has been set. +func (o *IntegrationIncident) HasAutoEscalationQuery() bool { + return o != nil && o.AutoEscalationQuery != nil +} + +// SetAutoEscalationQuery gets a reference to the given string and assigns it to the AutoEscalationQuery field. +func (o *IntegrationIncident) SetAutoEscalationQuery(v string) { + o.AutoEscalationQuery = &v +} + +// GetDefaultIncidentCommander returns the DefaultIncidentCommander field value if set, zero value otherwise. +func (o *IntegrationIncident) GetDefaultIncidentCommander() string { + if o == nil || o.DefaultIncidentCommander == nil { + var ret string + return ret + } + return *o.DefaultIncidentCommander +} + +// GetDefaultIncidentCommanderOk returns a tuple with the DefaultIncidentCommander field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationIncident) GetDefaultIncidentCommanderOk() (*string, bool) { + if o == nil || o.DefaultIncidentCommander == nil { + return nil, false + } + return o.DefaultIncidentCommander, true +} + +// HasDefaultIncidentCommander returns a boolean if a field has been set. +func (o *IntegrationIncident) HasDefaultIncidentCommander() bool { + return o != nil && o.DefaultIncidentCommander != nil +} + +// SetDefaultIncidentCommander gets a reference to the given string and assigns it to the DefaultIncidentCommander field. +func (o *IntegrationIncident) SetDefaultIncidentCommander(v string) { + o.DefaultIncidentCommander = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IntegrationIncident) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationIncident) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *IntegrationIncident) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IntegrationIncident) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetFieldMappings returns the FieldMappings field value if set, zero value otherwise. +func (o *IntegrationIncident) GetFieldMappings() []IntegrationIncidentFieldMappingsItems { + if o == nil || o.FieldMappings == nil { + var ret []IntegrationIncidentFieldMappingsItems + return ret + } + return o.FieldMappings +} + +// GetFieldMappingsOk returns a tuple with the FieldMappings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationIncident) GetFieldMappingsOk() (*[]IntegrationIncidentFieldMappingsItems, bool) { + if o == nil || o.FieldMappings == nil { + return nil, false + } + return &o.FieldMappings, true +} + +// HasFieldMappings returns a boolean if a field has been set. +func (o *IntegrationIncident) HasFieldMappings() bool { + return o != nil && o.FieldMappings != nil +} + +// SetFieldMappings gets a reference to the given []IntegrationIncidentFieldMappingsItems and assigns it to the FieldMappings field. +func (o *IntegrationIncident) SetFieldMappings(v []IntegrationIncidentFieldMappingsItems) { + o.FieldMappings = v +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IntegrationIncident) GetIncidentType() string { + if o == nil || o.IncidentType == nil { + var ret string + return ret + } + return *o.IncidentType +} + +// GetIncidentTypeOk returns a tuple with the IncidentType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationIncident) GetIncidentTypeOk() (*string, bool) { + if o == nil || o.IncidentType == nil { + return nil, false + } + return o.IncidentType, true +} + +// HasIncidentType returns a boolean if a field has been set. +func (o *IntegrationIncident) HasIncidentType() bool { + return o != nil && o.IncidentType != nil +} + +// SetIncidentType gets a reference to the given string and assigns it to the IncidentType field. +func (o *IntegrationIncident) SetIncidentType(v string) { + o.IncidentType = &v +} + +// GetSeverityConfig returns the SeverityConfig field value if set, zero value otherwise. +func (o *IntegrationIncident) GetSeverityConfig() IntegrationIncidentSeverityConfig { + if o == nil || o.SeverityConfig == nil { + var ret IntegrationIncidentSeverityConfig + return ret + } + return *o.SeverityConfig +} + +// GetSeverityConfigOk returns a tuple with the SeverityConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationIncident) GetSeverityConfigOk() (*IntegrationIncidentSeverityConfig, bool) { + if o == nil || o.SeverityConfig == nil { + return nil, false + } + return o.SeverityConfig, true +} + +// HasSeverityConfig returns a boolean if a field has been set. +func (o *IntegrationIncident) HasSeverityConfig() bool { + return o != nil && o.SeverityConfig != nil +} + +// SetSeverityConfig gets a reference to the given IntegrationIncidentSeverityConfig and assigns it to the SeverityConfig field. +func (o *IntegrationIncident) SetSeverityConfig(v IntegrationIncidentSeverityConfig) { + o.SeverityConfig = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationIncident) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AutoEscalationQuery != nil { + toSerialize["auto_escalation_query"] = o.AutoEscalationQuery + } + if o.DefaultIncidentCommander != nil { + toSerialize["default_incident_commander"] = o.DefaultIncidentCommander + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.FieldMappings != nil { + toSerialize["field_mappings"] = o.FieldMappings + } + if o.IncidentType != nil { + toSerialize["incident_type"] = o.IncidentType + } + if o.SeverityConfig != nil { + toSerialize["severity_config"] = o.SeverityConfig + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationIncident) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AutoEscalationQuery *string `json:"auto_escalation_query,omitempty"` + DefaultIncidentCommander *string `json:"default_incident_commander,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + FieldMappings []IntegrationIncidentFieldMappingsItems `json:"field_mappings,omitempty"` + IncidentType *string `json:"incident_type,omitempty"` + SeverityConfig *IntegrationIncidentSeverityConfig `json:"severity_config,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"auto_escalation_query", "default_incident_commander", "enabled", "field_mappings", "incident_type", "severity_config"}) + } else { + return err + } + + hasInvalidField := false + o.AutoEscalationQuery = all.AutoEscalationQuery + o.DefaultIncidentCommander = all.DefaultIncidentCommander + o.Enabled = all.Enabled + o.FieldMappings = all.FieldMappings + o.IncidentType = all.IncidentType + if all.SeverityConfig != nil && all.SeverityConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.SeverityConfig = all.SeverityConfig + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_integration_incident_field_mappings_items.go b/api/datadogV2/model_integration_incident_field_mappings_items.go new file mode 100644 index 00000000000..45e53735154 --- /dev/null +++ b/api/datadogV2/model_integration_incident_field_mappings_items.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationIncidentFieldMappingsItems +type IntegrationIncidentFieldMappingsItems struct { + // + CaseField *string `json:"case_field,omitempty"` + // + IncidentUserDefinedFieldId *string `json:"incident_user_defined_field_id,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIntegrationIncidentFieldMappingsItems instantiates a new IntegrationIncidentFieldMappingsItems 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 NewIntegrationIncidentFieldMappingsItems() *IntegrationIncidentFieldMappingsItems { + this := IntegrationIncidentFieldMappingsItems{} + return &this +} + +// NewIntegrationIncidentFieldMappingsItemsWithDefaults instantiates a new IntegrationIncidentFieldMappingsItems 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 NewIntegrationIncidentFieldMappingsItemsWithDefaults() *IntegrationIncidentFieldMappingsItems { + this := IntegrationIncidentFieldMappingsItems{} + return &this +} + +// GetCaseField returns the CaseField field value if set, zero value otherwise. +func (o *IntegrationIncidentFieldMappingsItems) GetCaseField() string { + if o == nil || o.CaseField == nil { + var ret string + return ret + } + return *o.CaseField +} + +// GetCaseFieldOk returns a tuple with the CaseField field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationIncidentFieldMappingsItems) GetCaseFieldOk() (*string, bool) { + if o == nil || o.CaseField == nil { + return nil, false + } + return o.CaseField, true +} + +// HasCaseField returns a boolean if a field has been set. +func (o *IntegrationIncidentFieldMappingsItems) HasCaseField() bool { + return o != nil && o.CaseField != nil +} + +// SetCaseField gets a reference to the given string and assigns it to the CaseField field. +func (o *IntegrationIncidentFieldMappingsItems) SetCaseField(v string) { + o.CaseField = &v +} + +// GetIncidentUserDefinedFieldId returns the IncidentUserDefinedFieldId field value if set, zero value otherwise. +func (o *IntegrationIncidentFieldMappingsItems) GetIncidentUserDefinedFieldId() string { + if o == nil || o.IncidentUserDefinedFieldId == nil { + var ret string + return ret + } + return *o.IncidentUserDefinedFieldId +} + +// GetIncidentUserDefinedFieldIdOk returns a tuple with the IncidentUserDefinedFieldId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationIncidentFieldMappingsItems) GetIncidentUserDefinedFieldIdOk() (*string, bool) { + if o == nil || o.IncidentUserDefinedFieldId == nil { + return nil, false + } + return o.IncidentUserDefinedFieldId, true +} + +// HasIncidentUserDefinedFieldId returns a boolean if a field has been set. +func (o *IntegrationIncidentFieldMappingsItems) HasIncidentUserDefinedFieldId() bool { + return o != nil && o.IncidentUserDefinedFieldId != nil +} + +// SetIncidentUserDefinedFieldId gets a reference to the given string and assigns it to the IncidentUserDefinedFieldId field. +func (o *IntegrationIncidentFieldMappingsItems) SetIncidentUserDefinedFieldId(v string) { + o.IncidentUserDefinedFieldId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationIncidentFieldMappingsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CaseField != nil { + toSerialize["case_field"] = o.CaseField + } + if o.IncidentUserDefinedFieldId != nil { + toSerialize["incident_user_defined_field_id"] = o.IncidentUserDefinedFieldId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationIncidentFieldMappingsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CaseField *string `json:"case_field,omitempty"` + IncidentUserDefinedFieldId *string `json:"incident_user_defined_field_id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"case_field", "incident_user_defined_field_id"}) + } else { + return err + } + o.CaseField = all.CaseField + o.IncidentUserDefinedFieldId = all.IncidentUserDefinedFieldId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_integration_incident_severity_config.go b/api/datadogV2/model_integration_incident_severity_config.go new file mode 100644 index 00000000000..b73e38f3656 --- /dev/null +++ b/api/datadogV2/model_integration_incident_severity_config.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationIncidentSeverityConfig +type IntegrationIncidentSeverityConfig struct { + // + PriorityMapping map[string]string `json:"priority_mapping,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:"-"` +} + +// NewIntegrationIncidentSeverityConfig instantiates a new IntegrationIncidentSeverityConfig 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 NewIntegrationIncidentSeverityConfig() *IntegrationIncidentSeverityConfig { + this := IntegrationIncidentSeverityConfig{} + return &this +} + +// NewIntegrationIncidentSeverityConfigWithDefaults instantiates a new IntegrationIncidentSeverityConfig 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 NewIntegrationIncidentSeverityConfigWithDefaults() *IntegrationIncidentSeverityConfig { + this := IntegrationIncidentSeverityConfig{} + return &this +} + +// GetPriorityMapping returns the PriorityMapping field value if set, zero value otherwise. +func (o *IntegrationIncidentSeverityConfig) GetPriorityMapping() map[string]string { + if o == nil || o.PriorityMapping == nil { + var ret map[string]string + return ret + } + return o.PriorityMapping +} + +// GetPriorityMappingOk returns a tuple with the PriorityMapping field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationIncidentSeverityConfig) GetPriorityMappingOk() (*map[string]string, bool) { + if o == nil || o.PriorityMapping == nil { + return nil, false + } + return &o.PriorityMapping, true +} + +// HasPriorityMapping returns a boolean if a field has been set. +func (o *IntegrationIncidentSeverityConfig) HasPriorityMapping() bool { + return o != nil && o.PriorityMapping != nil +} + +// SetPriorityMapping gets a reference to the given map[string]string and assigns it to the PriorityMapping field. +func (o *IntegrationIncidentSeverityConfig) SetPriorityMapping(v map[string]string) { + o.PriorityMapping = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationIncidentSeverityConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.PriorityMapping != nil { + toSerialize["priority_mapping"] = o.PriorityMapping + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationIncidentSeverityConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + PriorityMapping map[string]string `json:"priority_mapping,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"priority_mapping"}) + } else { + return err + } + o.PriorityMapping = all.PriorityMapping + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_integration_jira.go b/api/datadogV2/model_integration_jira.go new file mode 100644 index 00000000000..c6202030d64 --- /dev/null +++ b/api/datadogV2/model_integration_jira.go @@ -0,0 +1,222 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationJira Jira integration settings +type IntegrationJira struct { + // + AutoCreation *IntegrationJiraAutoCreation `json:"auto_creation,omitempty"` + // Whether Jira integration is enabled + Enabled *bool `json:"enabled,omitempty"` + // + Metadata *IntegrationJiraMetadata `json:"metadata,omitempty"` + // + Sync *IntegrationJiraSync `json:"sync,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:"-"` +} + +// NewIntegrationJira instantiates a new IntegrationJira 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 NewIntegrationJira() *IntegrationJira { + this := IntegrationJira{} + return &this +} + +// NewIntegrationJiraWithDefaults instantiates a new IntegrationJira 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 NewIntegrationJiraWithDefaults() *IntegrationJira { + this := IntegrationJira{} + return &this +} + +// GetAutoCreation returns the AutoCreation field value if set, zero value otherwise. +func (o *IntegrationJira) GetAutoCreation() IntegrationJiraAutoCreation { + if o == nil || o.AutoCreation == nil { + var ret IntegrationJiraAutoCreation + return ret + } + return *o.AutoCreation +} + +// GetAutoCreationOk returns a tuple with the AutoCreation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJira) GetAutoCreationOk() (*IntegrationJiraAutoCreation, bool) { + if o == nil || o.AutoCreation == nil { + return nil, false + } + return o.AutoCreation, true +} + +// HasAutoCreation returns a boolean if a field has been set. +func (o *IntegrationJira) HasAutoCreation() bool { + return o != nil && o.AutoCreation != nil +} + +// SetAutoCreation gets a reference to the given IntegrationJiraAutoCreation and assigns it to the AutoCreation field. +func (o *IntegrationJira) SetAutoCreation(v IntegrationJiraAutoCreation) { + o.AutoCreation = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IntegrationJira) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJira) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *IntegrationJira) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IntegrationJira) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *IntegrationJira) GetMetadata() IntegrationJiraMetadata { + if o == nil || o.Metadata == nil { + var ret IntegrationJiraMetadata + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJira) GetMetadataOk() (*IntegrationJiraMetadata, bool) { + if o == nil || o.Metadata == nil { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *IntegrationJira) HasMetadata() bool { + return o != nil && o.Metadata != nil +} + +// SetMetadata gets a reference to the given IntegrationJiraMetadata and assigns it to the Metadata field. +func (o *IntegrationJira) SetMetadata(v IntegrationJiraMetadata) { + o.Metadata = &v +} + +// GetSync returns the Sync field value if set, zero value otherwise. +func (o *IntegrationJira) GetSync() IntegrationJiraSync { + if o == nil || o.Sync == nil { + var ret IntegrationJiraSync + return ret + } + return *o.Sync +} + +// GetSyncOk returns a tuple with the Sync field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJira) GetSyncOk() (*IntegrationJiraSync, bool) { + if o == nil || o.Sync == nil { + return nil, false + } + return o.Sync, true +} + +// HasSync returns a boolean if a field has been set. +func (o *IntegrationJira) HasSync() bool { + return o != nil && o.Sync != nil +} + +// SetSync gets a reference to the given IntegrationJiraSync and assigns it to the Sync field. +func (o *IntegrationJira) SetSync(v IntegrationJiraSync) { + o.Sync = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationJira) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AutoCreation != nil { + toSerialize["auto_creation"] = o.AutoCreation + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.Sync != nil { + toSerialize["sync"] = o.Sync + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationJira) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AutoCreation *IntegrationJiraAutoCreation `json:"auto_creation,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Metadata *IntegrationJiraMetadata `json:"metadata,omitempty"` + Sync *IntegrationJiraSync `json:"sync,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"auto_creation", "enabled", "metadata", "sync"}) + } else { + return err + } + + hasInvalidField := false + if all.AutoCreation != nil && all.AutoCreation.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AutoCreation = all.AutoCreation + o.Enabled = all.Enabled + if all.Metadata != nil && all.Metadata.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Metadata = all.Metadata + if all.Sync != nil && all.Sync.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Sync = all.Sync + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_integration_jira_auto_creation.go b/api/datadogV2/model_integration_jira_auto_creation.go new file mode 100644 index 00000000000..642169ccf4a --- /dev/null +++ b/api/datadogV2/model_integration_jira_auto_creation.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationJiraAutoCreation +type IntegrationJiraAutoCreation struct { + // + Enabled *bool `json:"enabled,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:"-"` +} + +// NewIntegrationJiraAutoCreation instantiates a new IntegrationJiraAutoCreation 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 NewIntegrationJiraAutoCreation() *IntegrationJiraAutoCreation { + this := IntegrationJiraAutoCreation{} + return &this +} + +// NewIntegrationJiraAutoCreationWithDefaults instantiates a new IntegrationJiraAutoCreation 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 NewIntegrationJiraAutoCreationWithDefaults() *IntegrationJiraAutoCreation { + this := IntegrationJiraAutoCreation{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IntegrationJiraAutoCreation) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraAutoCreation) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *IntegrationJiraAutoCreation) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IntegrationJiraAutoCreation) SetEnabled(v bool) { + o.Enabled = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationJiraAutoCreation) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationJiraAutoCreation) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Enabled *bool `json:"enabled,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"enabled"}) + } else { + return err + } + o.Enabled = all.Enabled + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_integration_jira_metadata.go b/api/datadogV2/model_integration_jira_metadata.go new file mode 100644 index 00000000000..6bc7b49785d --- /dev/null +++ b/api/datadogV2/model_integration_jira_metadata.go @@ -0,0 +1,172 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationJiraMetadata +type IntegrationJiraMetadata struct { + // + AccountId *string `json:"account_id,omitempty"` + // + IssueTypeId *string `json:"issue_type_id,omitempty"` + // + ProjectId *string `json:"project_id,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIntegrationJiraMetadata instantiates a new IntegrationJiraMetadata 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 NewIntegrationJiraMetadata() *IntegrationJiraMetadata { + this := IntegrationJiraMetadata{} + return &this +} + +// NewIntegrationJiraMetadataWithDefaults instantiates a new IntegrationJiraMetadata 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 NewIntegrationJiraMetadataWithDefaults() *IntegrationJiraMetadata { + this := IntegrationJiraMetadata{} + return &this +} + +// GetAccountId returns the AccountId field value if set, zero value otherwise. +func (o *IntegrationJiraMetadata) GetAccountId() string { + if o == nil || o.AccountId == nil { + var ret string + return ret + } + return *o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraMetadata) GetAccountIdOk() (*string, bool) { + if o == nil || o.AccountId == nil { + return nil, false + } + return o.AccountId, true +} + +// HasAccountId returns a boolean if a field has been set. +func (o *IntegrationJiraMetadata) HasAccountId() bool { + return o != nil && o.AccountId != nil +} + +// SetAccountId gets a reference to the given string and assigns it to the AccountId field. +func (o *IntegrationJiraMetadata) SetAccountId(v string) { + o.AccountId = &v +} + +// GetIssueTypeId returns the IssueTypeId field value if set, zero value otherwise. +func (o *IntegrationJiraMetadata) GetIssueTypeId() string { + if o == nil || o.IssueTypeId == nil { + var ret string + return ret + } + return *o.IssueTypeId +} + +// GetIssueTypeIdOk returns a tuple with the IssueTypeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraMetadata) GetIssueTypeIdOk() (*string, bool) { + if o == nil || o.IssueTypeId == nil { + return nil, false + } + return o.IssueTypeId, true +} + +// HasIssueTypeId returns a boolean if a field has been set. +func (o *IntegrationJiraMetadata) HasIssueTypeId() bool { + return o != nil && o.IssueTypeId != nil +} + +// SetIssueTypeId gets a reference to the given string and assigns it to the IssueTypeId field. +func (o *IntegrationJiraMetadata) SetIssueTypeId(v string) { + o.IssueTypeId = &v +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *IntegrationJiraMetadata) GetProjectId() string { + if o == nil || o.ProjectId == nil { + var ret string + return ret + } + return *o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraMetadata) GetProjectIdOk() (*string, bool) { + if o == nil || o.ProjectId == nil { + return nil, false + } + return o.ProjectId, true +} + +// HasProjectId returns a boolean if a field has been set. +func (o *IntegrationJiraMetadata) HasProjectId() bool { + return o != nil && o.ProjectId != nil +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *IntegrationJiraMetadata) SetProjectId(v string) { + o.ProjectId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationJiraMetadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AccountId != nil { + toSerialize["account_id"] = o.AccountId + } + if o.IssueTypeId != nil { + toSerialize["issue_type_id"] = o.IssueTypeId + } + if o.ProjectId != nil { + toSerialize["project_id"] = o.ProjectId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationJiraMetadata) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccountId *string `json:"account_id,omitempty"` + IssueTypeId *string `json:"issue_type_id,omitempty"` + ProjectId *string `json:"project_id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"account_id", "issue_type_id", "project_id"}) + } else { + return err + } + o.AccountId = all.AccountId + o.IssueTypeId = all.IssueTypeId + o.ProjectId = all.ProjectId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_integration_jira_sync.go b/api/datadogV2/model_integration_jira_sync.go new file mode 100644 index 00000000000..e5bde584927 --- /dev/null +++ b/api/datadogV2/model_integration_jira_sync.go @@ -0,0 +1,146 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationJiraSync +type IntegrationJiraSync struct { + // + Enabled *bool `json:"enabled,omitempty"` + // + Properties *IntegrationJiraSyncProperties `json:"properties,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:"-"` +} + +// NewIntegrationJiraSync instantiates a new IntegrationJiraSync 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 NewIntegrationJiraSync() *IntegrationJiraSync { + this := IntegrationJiraSync{} + return &this +} + +// NewIntegrationJiraSyncWithDefaults instantiates a new IntegrationJiraSync 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 NewIntegrationJiraSyncWithDefaults() *IntegrationJiraSync { + this := IntegrationJiraSync{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IntegrationJiraSync) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSync) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *IntegrationJiraSync) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IntegrationJiraSync) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetProperties returns the Properties field value if set, zero value otherwise. +func (o *IntegrationJiraSync) GetProperties() IntegrationJiraSyncProperties { + if o == nil || o.Properties == nil { + var ret IntegrationJiraSyncProperties + return ret + } + return *o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSync) GetPropertiesOk() (*IntegrationJiraSyncProperties, bool) { + if o == nil || o.Properties == nil { + return nil, false + } + return o.Properties, true +} + +// HasProperties returns a boolean if a field has been set. +func (o *IntegrationJiraSync) HasProperties() bool { + return o != nil && o.Properties != nil +} + +// SetProperties gets a reference to the given IntegrationJiraSyncProperties and assigns it to the Properties field. +func (o *IntegrationJiraSync) SetProperties(v IntegrationJiraSyncProperties) { + o.Properties = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationJiraSync) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationJiraSync) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Enabled *bool `json:"enabled,omitempty"` + Properties *IntegrationJiraSyncProperties `json:"properties,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"enabled", "properties"}) + } else { + return err + } + + hasInvalidField := false + o.Enabled = all.Enabled + if all.Properties != nil && all.Properties.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Properties = all.Properties + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_integration_jira_sync_due_date.go b/api/datadogV2/model_integration_jira_sync_due_date.go new file mode 100644 index 00000000000..25b38bd21e6 --- /dev/null +++ b/api/datadogV2/model_integration_jira_sync_due_date.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationJiraSyncDueDate +type IntegrationJiraSyncDueDate struct { + // + JiraFieldId *string `json:"jira_field_id,omitempty"` + // + SyncType *string `json:"sync_type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIntegrationJiraSyncDueDate instantiates a new IntegrationJiraSyncDueDate 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 NewIntegrationJiraSyncDueDate() *IntegrationJiraSyncDueDate { + this := IntegrationJiraSyncDueDate{} + return &this +} + +// NewIntegrationJiraSyncDueDateWithDefaults instantiates a new IntegrationJiraSyncDueDate 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 NewIntegrationJiraSyncDueDateWithDefaults() *IntegrationJiraSyncDueDate { + this := IntegrationJiraSyncDueDate{} + return &this +} + +// GetJiraFieldId returns the JiraFieldId field value if set, zero value otherwise. +func (o *IntegrationJiraSyncDueDate) GetJiraFieldId() string { + if o == nil || o.JiraFieldId == nil { + var ret string + return ret + } + return *o.JiraFieldId +} + +// GetJiraFieldIdOk returns a tuple with the JiraFieldId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSyncDueDate) GetJiraFieldIdOk() (*string, bool) { + if o == nil || o.JiraFieldId == nil { + return nil, false + } + return o.JiraFieldId, true +} + +// HasJiraFieldId returns a boolean if a field has been set. +func (o *IntegrationJiraSyncDueDate) HasJiraFieldId() bool { + return o != nil && o.JiraFieldId != nil +} + +// SetJiraFieldId gets a reference to the given string and assigns it to the JiraFieldId field. +func (o *IntegrationJiraSyncDueDate) SetJiraFieldId(v string) { + o.JiraFieldId = &v +} + +// GetSyncType returns the SyncType field value if set, zero value otherwise. +func (o *IntegrationJiraSyncDueDate) GetSyncType() string { + if o == nil || o.SyncType == nil { + var ret string + return ret + } + return *o.SyncType +} + +// GetSyncTypeOk returns a tuple with the SyncType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSyncDueDate) GetSyncTypeOk() (*string, bool) { + if o == nil || o.SyncType == nil { + return nil, false + } + return o.SyncType, true +} + +// HasSyncType returns a boolean if a field has been set. +func (o *IntegrationJiraSyncDueDate) HasSyncType() bool { + return o != nil && o.SyncType != nil +} + +// SetSyncType gets a reference to the given string and assigns it to the SyncType field. +func (o *IntegrationJiraSyncDueDate) SetSyncType(v string) { + o.SyncType = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationJiraSyncDueDate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.JiraFieldId != nil { + toSerialize["jira_field_id"] = o.JiraFieldId + } + if o.SyncType != nil { + toSerialize["sync_type"] = o.SyncType + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationJiraSyncDueDate) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + JiraFieldId *string `json:"jira_field_id,omitempty"` + SyncType *string `json:"sync_type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"jira_field_id", "sync_type"}) + } else { + return err + } + o.JiraFieldId = all.JiraFieldId + o.SyncType = all.SyncType + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_integration_jira_sync_properties.go b/api/datadogV2/model_integration_jira_sync_properties.go new file mode 100644 index 00000000000..7137051ac17 --- /dev/null +++ b/api/datadogV2/model_integration_jira_sync_properties.go @@ -0,0 +1,374 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationJiraSyncProperties +type IntegrationJiraSyncProperties struct { + // Sync property configuration + Assignee *SyncProperty `json:"assignee,omitempty"` + // Sync property configuration + Comments *SyncProperty `json:"comments,omitempty"` + // + CustomFields map[string]IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties `json:"custom_fields,omitempty"` + // Sync property configuration + Description *SyncProperty `json:"description,omitempty"` + // + DueDate *IntegrationJiraSyncDueDate `json:"due_date,omitempty"` + // Sync property with mapping configuration + Priority *SyncPropertyWithMapping `json:"priority,omitempty"` + // Sync property with mapping configuration + Status *SyncPropertyWithMapping `json:"status,omitempty"` + // Sync property configuration + Title *SyncProperty `json:"title,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:"-"` +} + +// NewIntegrationJiraSyncProperties instantiates a new IntegrationJiraSyncProperties 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 NewIntegrationJiraSyncProperties() *IntegrationJiraSyncProperties { + this := IntegrationJiraSyncProperties{} + return &this +} + +// NewIntegrationJiraSyncPropertiesWithDefaults instantiates a new IntegrationJiraSyncProperties 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 NewIntegrationJiraSyncPropertiesWithDefaults() *IntegrationJiraSyncProperties { + this := IntegrationJiraSyncProperties{} + return &this +} + +// GetAssignee returns the Assignee field value if set, zero value otherwise. +func (o *IntegrationJiraSyncProperties) GetAssignee() SyncProperty { + if o == nil || o.Assignee == nil { + var ret SyncProperty + return ret + } + return *o.Assignee +} + +// GetAssigneeOk returns a tuple with the Assignee field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSyncProperties) GetAssigneeOk() (*SyncProperty, bool) { + if o == nil || o.Assignee == nil { + return nil, false + } + return o.Assignee, true +} + +// HasAssignee returns a boolean if a field has been set. +func (o *IntegrationJiraSyncProperties) HasAssignee() bool { + return o != nil && o.Assignee != nil +} + +// SetAssignee gets a reference to the given SyncProperty and assigns it to the Assignee field. +func (o *IntegrationJiraSyncProperties) SetAssignee(v SyncProperty) { + o.Assignee = &v +} + +// GetComments returns the Comments field value if set, zero value otherwise. +func (o *IntegrationJiraSyncProperties) GetComments() SyncProperty { + if o == nil || o.Comments == nil { + var ret SyncProperty + return ret + } + return *o.Comments +} + +// GetCommentsOk returns a tuple with the Comments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSyncProperties) GetCommentsOk() (*SyncProperty, bool) { + if o == nil || o.Comments == nil { + return nil, false + } + return o.Comments, true +} + +// HasComments returns a boolean if a field has been set. +func (o *IntegrationJiraSyncProperties) HasComments() bool { + return o != nil && o.Comments != nil +} + +// SetComments gets a reference to the given SyncProperty and assigns it to the Comments field. +func (o *IntegrationJiraSyncProperties) SetComments(v SyncProperty) { + o.Comments = &v +} + +// GetCustomFields returns the CustomFields field value if set, zero value otherwise. +func (o *IntegrationJiraSyncProperties) GetCustomFields() map[string]IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties { + if o == nil || o.CustomFields == nil { + var ret map[string]IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties + return ret + } + return o.CustomFields +} + +// GetCustomFieldsOk returns a tuple with the CustomFields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSyncProperties) GetCustomFieldsOk() (*map[string]IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties, bool) { + if o == nil || o.CustomFields == nil { + return nil, false + } + return &o.CustomFields, true +} + +// HasCustomFields returns a boolean if a field has been set. +func (o *IntegrationJiraSyncProperties) HasCustomFields() bool { + return o != nil && o.CustomFields != nil +} + +// SetCustomFields gets a reference to the given map[string]IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties and assigns it to the CustomFields field. +func (o *IntegrationJiraSyncProperties) SetCustomFields(v map[string]IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) { + o.CustomFields = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *IntegrationJiraSyncProperties) GetDescription() SyncProperty { + if o == nil || o.Description == nil { + var ret SyncProperty + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSyncProperties) GetDescriptionOk() (*SyncProperty, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *IntegrationJiraSyncProperties) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given SyncProperty and assigns it to the Description field. +func (o *IntegrationJiraSyncProperties) SetDescription(v SyncProperty) { + o.Description = &v +} + +// GetDueDate returns the DueDate field value if set, zero value otherwise. +func (o *IntegrationJiraSyncProperties) GetDueDate() IntegrationJiraSyncDueDate { + if o == nil || o.DueDate == nil { + var ret IntegrationJiraSyncDueDate + return ret + } + return *o.DueDate +} + +// GetDueDateOk returns a tuple with the DueDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSyncProperties) GetDueDateOk() (*IntegrationJiraSyncDueDate, bool) { + if o == nil || o.DueDate == nil { + return nil, false + } + return o.DueDate, true +} + +// HasDueDate returns a boolean if a field has been set. +func (o *IntegrationJiraSyncProperties) HasDueDate() bool { + return o != nil && o.DueDate != nil +} + +// SetDueDate gets a reference to the given IntegrationJiraSyncDueDate and assigns it to the DueDate field. +func (o *IntegrationJiraSyncProperties) SetDueDate(v IntegrationJiraSyncDueDate) { + o.DueDate = &v +} + +// GetPriority returns the Priority field value if set, zero value otherwise. +func (o *IntegrationJiraSyncProperties) GetPriority() SyncPropertyWithMapping { + if o == nil || o.Priority == nil { + var ret SyncPropertyWithMapping + return ret + } + return *o.Priority +} + +// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSyncProperties) GetPriorityOk() (*SyncPropertyWithMapping, bool) { + if o == nil || o.Priority == nil { + return nil, false + } + return o.Priority, true +} + +// HasPriority returns a boolean if a field has been set. +func (o *IntegrationJiraSyncProperties) HasPriority() bool { + return o != nil && o.Priority != nil +} + +// SetPriority gets a reference to the given SyncPropertyWithMapping and assigns it to the Priority field. +func (o *IntegrationJiraSyncProperties) SetPriority(v SyncPropertyWithMapping) { + o.Priority = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *IntegrationJiraSyncProperties) GetStatus() SyncPropertyWithMapping { + if o == nil || o.Status == nil { + var ret SyncPropertyWithMapping + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSyncProperties) GetStatusOk() (*SyncPropertyWithMapping, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *IntegrationJiraSyncProperties) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given SyncPropertyWithMapping and assigns it to the Status field. +func (o *IntegrationJiraSyncProperties) SetStatus(v SyncPropertyWithMapping) { + o.Status = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *IntegrationJiraSyncProperties) GetTitle() SyncProperty { + if o == nil || o.Title == nil { + var ret SyncProperty + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSyncProperties) GetTitleOk() (*SyncProperty, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *IntegrationJiraSyncProperties) HasTitle() bool { + return o != nil && o.Title != nil +} + +// SetTitle gets a reference to the given SyncProperty and assigns it to the Title field. +func (o *IntegrationJiraSyncProperties) SetTitle(v SyncProperty) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationJiraSyncProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Assignee != nil { + toSerialize["assignee"] = o.Assignee + } + if o.Comments != nil { + toSerialize["comments"] = o.Comments + } + if o.CustomFields != nil { + toSerialize["custom_fields"] = o.CustomFields + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.DueDate != nil { + toSerialize["due_date"] = o.DueDate + } + if o.Priority != nil { + toSerialize["priority"] = o.Priority + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationJiraSyncProperties) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Assignee *SyncProperty `json:"assignee,omitempty"` + Comments *SyncProperty `json:"comments,omitempty"` + CustomFields map[string]IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties `json:"custom_fields,omitempty"` + Description *SyncProperty `json:"description,omitempty"` + DueDate *IntegrationJiraSyncDueDate `json:"due_date,omitempty"` + Priority *SyncPropertyWithMapping `json:"priority,omitempty"` + Status *SyncPropertyWithMapping `json:"status,omitempty"` + Title *SyncProperty `json:"title,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"assignee", "comments", "custom_fields", "description", "due_date", "priority", "status", "title"}) + } else { + return err + } + + hasInvalidField := false + if all.Assignee != nil && all.Assignee.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Assignee = all.Assignee + if all.Comments != nil && all.Comments.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Comments = all.Comments + o.CustomFields = all.CustomFields + if all.Description != nil && all.Description.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Description = all.Description + if all.DueDate != nil && all.DueDate.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.DueDate = all.DueDate + if all.Priority != nil && all.Priority.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Priority = all.Priority + if all.Status != nil && all.Status.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Status = all.Status + if all.Title != nil && all.Title.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Title = all.Title + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_integration_jira_sync_properties_custom_fields_additional_properties.go b/api/datadogV2/model_integration_jira_sync_properties_custom_fields_additional_properties.go new file mode 100644 index 00000000000..c3a8200a4e6 --- /dev/null +++ b/api/datadogV2/model_integration_jira_sync_properties_custom_fields_additional_properties.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 ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties +type IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties struct { + // + SyncType *string `json:"sync_type,omitempty"` + // Represents any valid JSON value. + Value NullableAnyValue `json:"value,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:"-"` +} + +// NewIntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties instantiates a new IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties 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 NewIntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties() *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties { + this := IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties{} + return &this +} + +// NewIntegrationJiraSyncPropertiesCustomFieldsAdditionalPropertiesWithDefaults instantiates a new IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties 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 NewIntegrationJiraSyncPropertiesCustomFieldsAdditionalPropertiesWithDefaults() *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties { + this := IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties{} + return &this +} + +// GetSyncType returns the SyncType field value if set, zero value otherwise. +func (o *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) GetSyncType() string { + if o == nil || o.SyncType == nil { + var ret string + return ret + } + return *o.SyncType +} + +// GetSyncTypeOk returns a tuple with the SyncType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) GetSyncTypeOk() (*string, bool) { + if o == nil || o.SyncType == nil { + return nil, false + } + return o.SyncType, true +} + +// HasSyncType returns a boolean if a field has been set. +func (o *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) HasSyncType() bool { + return o != nil && o.SyncType != nil +} + +// SetSyncType gets a reference to the given string and assigns it to the SyncType field. +func (o *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) SetSyncType(v string) { + o.SyncType = &v +} + +// GetValue returns the Value field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) GetValue() AnyValue { + if o == nil || o.Value.Get() == nil { + var ret AnyValue + return ret + } + return *o.Value.Get() +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// 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 *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) GetValueOk() (*AnyValue, bool) { + if o == nil { + return nil, false + } + return o.Value.Get(), o.Value.IsSet() +} + +// HasValue returns a boolean if a field has been set. +func (o *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) HasValue() bool { + return o != nil && o.Value.IsSet() +} + +// SetValue gets a reference to the given NullableAnyValue and assigns it to the Value field. +func (o *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) SetValue(v AnyValue) { + o.Value.Set(&v) +} + +// SetValueNil sets the value for Value to be an explicit nil. +func (o *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) SetValueNil() { + o.Value.Set(nil) +} + +// UnsetValue ensures that no value is present for Value, not even an explicit nil. +func (o *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) UnsetValue() { + o.Value.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.SyncType != nil { + toSerialize["sync_type"] = o.SyncType + } + if o.Value.IsSet() { + toSerialize["value"] = o.Value.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationJiraSyncPropertiesCustomFieldsAdditionalProperties) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + SyncType *string `json:"sync_type,omitempty"` + Value NullableAnyValue `json:"value,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"sync_type", "value"}) + } else { + return err + } + o.SyncType = all.SyncType + o.Value = all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_integration_monitor.go b/api/datadogV2/model_integration_monitor.go new file mode 100644 index 00000000000..3b53f2443a6 --- /dev/null +++ b/api/datadogV2/model_integration_monitor.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationMonitor Monitor integration settings +type IntegrationMonitor struct { + // Whether auto-resolve is enabled + AutoResolveEnabled *bool `json:"auto_resolve_enabled,omitempty"` + // Case type ID for monitor integration + CaseTypeId *string `json:"case_type_id,omitempty"` + // Whether monitor integration is enabled + Enabled *bool `json:"enabled,omitempty"` + // Monitor handle + Handle *string `json:"handle,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:"-"` +} + +// NewIntegrationMonitor instantiates a new IntegrationMonitor 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 NewIntegrationMonitor() *IntegrationMonitor { + this := IntegrationMonitor{} + return &this +} + +// NewIntegrationMonitorWithDefaults instantiates a new IntegrationMonitor 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 NewIntegrationMonitorWithDefaults() *IntegrationMonitor { + this := IntegrationMonitor{} + return &this +} + +// GetAutoResolveEnabled returns the AutoResolveEnabled field value if set, zero value otherwise. +func (o *IntegrationMonitor) GetAutoResolveEnabled() bool { + if o == nil || o.AutoResolveEnabled == nil { + var ret bool + return ret + } + return *o.AutoResolveEnabled +} + +// GetAutoResolveEnabledOk returns a tuple with the AutoResolveEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationMonitor) GetAutoResolveEnabledOk() (*bool, bool) { + if o == nil || o.AutoResolveEnabled == nil { + return nil, false + } + return o.AutoResolveEnabled, true +} + +// HasAutoResolveEnabled returns a boolean if a field has been set. +func (o *IntegrationMonitor) HasAutoResolveEnabled() bool { + return o != nil && o.AutoResolveEnabled != nil +} + +// SetAutoResolveEnabled gets a reference to the given bool and assigns it to the AutoResolveEnabled field. +func (o *IntegrationMonitor) SetAutoResolveEnabled(v bool) { + o.AutoResolveEnabled = &v +} + +// GetCaseTypeId returns the CaseTypeId field value if set, zero value otherwise. +func (o *IntegrationMonitor) GetCaseTypeId() string { + if o == nil || o.CaseTypeId == nil { + var ret string + return ret + } + return *o.CaseTypeId +} + +// GetCaseTypeIdOk returns a tuple with the CaseTypeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationMonitor) GetCaseTypeIdOk() (*string, bool) { + if o == nil || o.CaseTypeId == nil { + return nil, false + } + return o.CaseTypeId, true +} + +// HasCaseTypeId returns a boolean if a field has been set. +func (o *IntegrationMonitor) HasCaseTypeId() bool { + return o != nil && o.CaseTypeId != nil +} + +// SetCaseTypeId gets a reference to the given string and assigns it to the CaseTypeId field. +func (o *IntegrationMonitor) SetCaseTypeId(v string) { + o.CaseTypeId = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IntegrationMonitor) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationMonitor) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *IntegrationMonitor) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IntegrationMonitor) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *IntegrationMonitor) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationMonitor) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *IntegrationMonitor) HasHandle() bool { + return o != nil && o.Handle != nil +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *IntegrationMonitor) SetHandle(v string) { + o.Handle = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationMonitor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AutoResolveEnabled != nil { + toSerialize["auto_resolve_enabled"] = o.AutoResolveEnabled + } + if o.CaseTypeId != nil { + toSerialize["case_type_id"] = o.CaseTypeId + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationMonitor) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AutoResolveEnabled *bool `json:"auto_resolve_enabled,omitempty"` + CaseTypeId *string `json:"case_type_id,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Handle *string `json:"handle,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"auto_resolve_enabled", "case_type_id", "enabled", "handle"}) + } else { + return err + } + o.AutoResolveEnabled = all.AutoResolveEnabled + o.CaseTypeId = all.CaseTypeId + o.Enabled = all.Enabled + o.Handle = all.Handle + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_integration_on_call.go b/api/datadogV2/model_integration_on_call.go new file mode 100644 index 00000000000..c55f033df25 --- /dev/null +++ b/api/datadogV2/model_integration_on_call.go @@ -0,0 +1,172 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationOnCall On-Call integration settings +type IntegrationOnCall struct { + // Whether to auto-assign on-call + AutoAssignOnCall *bool `json:"auto_assign_on_call,omitempty"` + // Whether On-Call integration is enabled + Enabled *bool `json:"enabled,omitempty"` + // + EscalationQueries []IntegrationOnCallEscalationQueriesItems `json:"escalation_queries,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:"-"` +} + +// NewIntegrationOnCall instantiates a new IntegrationOnCall 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 NewIntegrationOnCall() *IntegrationOnCall { + this := IntegrationOnCall{} + return &this +} + +// NewIntegrationOnCallWithDefaults instantiates a new IntegrationOnCall 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 NewIntegrationOnCallWithDefaults() *IntegrationOnCall { + this := IntegrationOnCall{} + return &this +} + +// GetAutoAssignOnCall returns the AutoAssignOnCall field value if set, zero value otherwise. +func (o *IntegrationOnCall) GetAutoAssignOnCall() bool { + if o == nil || o.AutoAssignOnCall == nil { + var ret bool + return ret + } + return *o.AutoAssignOnCall +} + +// GetAutoAssignOnCallOk returns a tuple with the AutoAssignOnCall field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationOnCall) GetAutoAssignOnCallOk() (*bool, bool) { + if o == nil || o.AutoAssignOnCall == nil { + return nil, false + } + return o.AutoAssignOnCall, true +} + +// HasAutoAssignOnCall returns a boolean if a field has been set. +func (o *IntegrationOnCall) HasAutoAssignOnCall() bool { + return o != nil && o.AutoAssignOnCall != nil +} + +// SetAutoAssignOnCall gets a reference to the given bool and assigns it to the AutoAssignOnCall field. +func (o *IntegrationOnCall) SetAutoAssignOnCall(v bool) { + o.AutoAssignOnCall = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IntegrationOnCall) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationOnCall) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *IntegrationOnCall) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IntegrationOnCall) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetEscalationQueries returns the EscalationQueries field value if set, zero value otherwise. +func (o *IntegrationOnCall) GetEscalationQueries() []IntegrationOnCallEscalationQueriesItems { + if o == nil || o.EscalationQueries == nil { + var ret []IntegrationOnCallEscalationQueriesItems + return ret + } + return o.EscalationQueries +} + +// GetEscalationQueriesOk returns a tuple with the EscalationQueries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationOnCall) GetEscalationQueriesOk() (*[]IntegrationOnCallEscalationQueriesItems, bool) { + if o == nil || o.EscalationQueries == nil { + return nil, false + } + return &o.EscalationQueries, true +} + +// HasEscalationQueries returns a boolean if a field has been set. +func (o *IntegrationOnCall) HasEscalationQueries() bool { + return o != nil && o.EscalationQueries != nil +} + +// SetEscalationQueries gets a reference to the given []IntegrationOnCallEscalationQueriesItems and assigns it to the EscalationQueries field. +func (o *IntegrationOnCall) SetEscalationQueries(v []IntegrationOnCallEscalationQueriesItems) { + o.EscalationQueries = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationOnCall) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AutoAssignOnCall != nil { + toSerialize["auto_assign_on_call"] = o.AutoAssignOnCall + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.EscalationQueries != nil { + toSerialize["escalation_queries"] = o.EscalationQueries + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationOnCall) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AutoAssignOnCall *bool `json:"auto_assign_on_call,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + EscalationQueries []IntegrationOnCallEscalationQueriesItems `json:"escalation_queries,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"auto_assign_on_call", "enabled", "escalation_queries"}) + } else { + return err + } + o.AutoAssignOnCall = all.AutoAssignOnCall + o.Enabled = all.Enabled + o.EscalationQueries = all.EscalationQueries + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_integration_on_call_escalation_queries_items.go b/api/datadogV2/model_integration_on_call_escalation_queries_items.go new file mode 100644 index 00000000000..60bfc061c00 --- /dev/null +++ b/api/datadogV2/model_integration_on_call_escalation_queries_items.go @@ -0,0 +1,216 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationOnCallEscalationQueriesItems +type IntegrationOnCallEscalationQueriesItems struct { + // + Enabled *bool `json:"enabled,omitempty"` + // + Id *string `json:"id,omitempty"` + // + Query *string `json:"query,omitempty"` + // + Target *IntegrationOnCallEscalationQueriesItemsTarget `json:"target,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:"-"` +} + +// NewIntegrationOnCallEscalationQueriesItems instantiates a new IntegrationOnCallEscalationQueriesItems 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 NewIntegrationOnCallEscalationQueriesItems() *IntegrationOnCallEscalationQueriesItems { + this := IntegrationOnCallEscalationQueriesItems{} + return &this +} + +// NewIntegrationOnCallEscalationQueriesItemsWithDefaults instantiates a new IntegrationOnCallEscalationQueriesItems 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 NewIntegrationOnCallEscalationQueriesItemsWithDefaults() *IntegrationOnCallEscalationQueriesItems { + this := IntegrationOnCallEscalationQueriesItems{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IntegrationOnCallEscalationQueriesItems) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationOnCallEscalationQueriesItems) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *IntegrationOnCallEscalationQueriesItems) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IntegrationOnCallEscalationQueriesItems) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *IntegrationOnCallEscalationQueriesItems) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationOnCallEscalationQueriesItems) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *IntegrationOnCallEscalationQueriesItems) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *IntegrationOnCallEscalationQueriesItems) SetId(v string) { + o.Id = &v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *IntegrationOnCallEscalationQueriesItems) GetQuery() string { + if o == nil || o.Query == nil { + var ret string + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationOnCallEscalationQueriesItems) GetQueryOk() (*string, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *IntegrationOnCallEscalationQueriesItems) HasQuery() bool { + return o != nil && o.Query != nil +} + +// SetQuery gets a reference to the given string and assigns it to the Query field. +func (o *IntegrationOnCallEscalationQueriesItems) SetQuery(v string) { + o.Query = &v +} + +// GetTarget returns the Target field value if set, zero value otherwise. +func (o *IntegrationOnCallEscalationQueriesItems) GetTarget() IntegrationOnCallEscalationQueriesItemsTarget { + if o == nil || o.Target == nil { + var ret IntegrationOnCallEscalationQueriesItemsTarget + return ret + } + return *o.Target +} + +// GetTargetOk returns a tuple with the Target field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationOnCallEscalationQueriesItems) GetTargetOk() (*IntegrationOnCallEscalationQueriesItemsTarget, bool) { + if o == nil || o.Target == nil { + return nil, false + } + return o.Target, true +} + +// HasTarget returns a boolean if a field has been set. +func (o *IntegrationOnCallEscalationQueriesItems) HasTarget() bool { + return o != nil && o.Target != nil +} + +// SetTarget gets a reference to the given IntegrationOnCallEscalationQueriesItemsTarget and assigns it to the Target field. +func (o *IntegrationOnCallEscalationQueriesItems) SetTarget(v IntegrationOnCallEscalationQueriesItemsTarget) { + o.Target = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationOnCallEscalationQueriesItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.Target != nil { + toSerialize["target"] = o.Target + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationOnCallEscalationQueriesItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Enabled *bool `json:"enabled,omitempty"` + Id *string `json:"id,omitempty"` + Query *string `json:"query,omitempty"` + Target *IntegrationOnCallEscalationQueriesItemsTarget `json:"target,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"enabled", "id", "query", "target"}) + } else { + return err + } + + hasInvalidField := false + o.Enabled = all.Enabled + o.Id = all.Id + o.Query = all.Query + if all.Target != nil && all.Target.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Target = all.Target + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_integration_on_call_escalation_queries_items_target.go b/api/datadogV2/model_integration_on_call_escalation_queries_items_target.go new file mode 100644 index 00000000000..91f77512565 --- /dev/null +++ b/api/datadogV2/model_integration_on_call_escalation_queries_items_target.go @@ -0,0 +1,172 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationOnCallEscalationQueriesItemsTarget +type IntegrationOnCallEscalationQueriesItemsTarget struct { + // + DynamicTeamPaging *bool `json:"dynamic_team_paging,omitempty"` + // + TeamId *string `json:"team_id,omitempty"` + // + UserId *string `json:"user_id,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIntegrationOnCallEscalationQueriesItemsTarget instantiates a new IntegrationOnCallEscalationQueriesItemsTarget 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 NewIntegrationOnCallEscalationQueriesItemsTarget() *IntegrationOnCallEscalationQueriesItemsTarget { + this := IntegrationOnCallEscalationQueriesItemsTarget{} + return &this +} + +// NewIntegrationOnCallEscalationQueriesItemsTargetWithDefaults instantiates a new IntegrationOnCallEscalationQueriesItemsTarget 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 NewIntegrationOnCallEscalationQueriesItemsTargetWithDefaults() *IntegrationOnCallEscalationQueriesItemsTarget { + this := IntegrationOnCallEscalationQueriesItemsTarget{} + return &this +} + +// GetDynamicTeamPaging returns the DynamicTeamPaging field value if set, zero value otherwise. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) GetDynamicTeamPaging() bool { + if o == nil || o.DynamicTeamPaging == nil { + var ret bool + return ret + } + return *o.DynamicTeamPaging +} + +// GetDynamicTeamPagingOk returns a tuple with the DynamicTeamPaging field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) GetDynamicTeamPagingOk() (*bool, bool) { + if o == nil || o.DynamicTeamPaging == nil { + return nil, false + } + return o.DynamicTeamPaging, true +} + +// HasDynamicTeamPaging returns a boolean if a field has been set. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) HasDynamicTeamPaging() bool { + return o != nil && o.DynamicTeamPaging != nil +} + +// SetDynamicTeamPaging gets a reference to the given bool and assigns it to the DynamicTeamPaging field. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) SetDynamicTeamPaging(v bool) { + o.DynamicTeamPaging = &v +} + +// GetTeamId returns the TeamId field value if set, zero value otherwise. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) GetTeamId() string { + if o == nil || o.TeamId == nil { + var ret string + return ret + } + return *o.TeamId +} + +// GetTeamIdOk returns a tuple with the TeamId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) GetTeamIdOk() (*string, bool) { + if o == nil || o.TeamId == nil { + return nil, false + } + return o.TeamId, true +} + +// HasTeamId returns a boolean if a field has been set. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) HasTeamId() bool { + return o != nil && o.TeamId != nil +} + +// SetTeamId gets a reference to the given string and assigns it to the TeamId field. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) SetTeamId(v string) { + o.TeamId = &v +} + +// GetUserId returns the UserId field value if set, zero value otherwise. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) GetUserId() string { + if o == nil || o.UserId == nil { + var ret string + return ret + } + return *o.UserId +} + +// GetUserIdOk returns a tuple with the UserId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) GetUserIdOk() (*string, bool) { + if o == nil || o.UserId == nil { + return nil, false + } + return o.UserId, true +} + +// HasUserId returns a boolean if a field has been set. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) HasUserId() bool { + return o != nil && o.UserId != nil +} + +// SetUserId gets a reference to the given string and assigns it to the UserId field. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) SetUserId(v string) { + o.UserId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationOnCallEscalationQueriesItemsTarget) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DynamicTeamPaging != nil { + toSerialize["dynamic_team_paging"] = o.DynamicTeamPaging + } + if o.TeamId != nil { + toSerialize["team_id"] = o.TeamId + } + if o.UserId != nil { + toSerialize["user_id"] = o.UserId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationOnCallEscalationQueriesItemsTarget) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DynamicTeamPaging *bool `json:"dynamic_team_paging,omitempty"` + TeamId *string `json:"team_id,omitempty"` + UserId *string `json:"user_id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"dynamic_team_paging", "team_id", "user_id"}) + } else { + return err + } + o.DynamicTeamPaging = all.DynamicTeamPaging + o.TeamId = all.TeamId + o.UserId = all.UserId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_integration_service_now.go b/api/datadogV2/model_integration_service_now.go new file mode 100644 index 00000000000..24abd1bb02e --- /dev/null +++ b/api/datadogV2/model_integration_service_now.go @@ -0,0 +1,254 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationServiceNow ServiceNow integration settings +type IntegrationServiceNow struct { + // Assignment group + AssignmentGroup *string `json:"assignment_group,omitempty"` + // + AutoCreation *IntegrationServiceNowAutoCreation `json:"auto_creation,omitempty"` + // Whether ServiceNow integration is enabled + Enabled *bool `json:"enabled,omitempty"` + // ServiceNow instance name + InstanceName *string `json:"instance_name,omitempty"` + // + SyncConfig *IntegrationServiceNowSyncConfig `json:"sync_config,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:"-"` +} + +// NewIntegrationServiceNow instantiates a new IntegrationServiceNow 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 NewIntegrationServiceNow() *IntegrationServiceNow { + this := IntegrationServiceNow{} + return &this +} + +// NewIntegrationServiceNowWithDefaults instantiates a new IntegrationServiceNow 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 NewIntegrationServiceNowWithDefaults() *IntegrationServiceNow { + this := IntegrationServiceNow{} + return &this +} + +// GetAssignmentGroup returns the AssignmentGroup field value if set, zero value otherwise. +func (o *IntegrationServiceNow) GetAssignmentGroup() string { + if o == nil || o.AssignmentGroup == nil { + var ret string + return ret + } + return *o.AssignmentGroup +} + +// GetAssignmentGroupOk returns a tuple with the AssignmentGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNow) GetAssignmentGroupOk() (*string, bool) { + if o == nil || o.AssignmentGroup == nil { + return nil, false + } + return o.AssignmentGroup, true +} + +// HasAssignmentGroup returns a boolean if a field has been set. +func (o *IntegrationServiceNow) HasAssignmentGroup() bool { + return o != nil && o.AssignmentGroup != nil +} + +// SetAssignmentGroup gets a reference to the given string and assigns it to the AssignmentGroup field. +func (o *IntegrationServiceNow) SetAssignmentGroup(v string) { + o.AssignmentGroup = &v +} + +// GetAutoCreation returns the AutoCreation field value if set, zero value otherwise. +func (o *IntegrationServiceNow) GetAutoCreation() IntegrationServiceNowAutoCreation { + if o == nil || o.AutoCreation == nil { + var ret IntegrationServiceNowAutoCreation + return ret + } + return *o.AutoCreation +} + +// GetAutoCreationOk returns a tuple with the AutoCreation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNow) GetAutoCreationOk() (*IntegrationServiceNowAutoCreation, bool) { + if o == nil || o.AutoCreation == nil { + return nil, false + } + return o.AutoCreation, true +} + +// HasAutoCreation returns a boolean if a field has been set. +func (o *IntegrationServiceNow) HasAutoCreation() bool { + return o != nil && o.AutoCreation != nil +} + +// SetAutoCreation gets a reference to the given IntegrationServiceNowAutoCreation and assigns it to the AutoCreation field. +func (o *IntegrationServiceNow) SetAutoCreation(v IntegrationServiceNowAutoCreation) { + o.AutoCreation = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IntegrationServiceNow) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNow) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *IntegrationServiceNow) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IntegrationServiceNow) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetInstanceName returns the InstanceName field value if set, zero value otherwise. +func (o *IntegrationServiceNow) GetInstanceName() string { + if o == nil || o.InstanceName == nil { + var ret string + return ret + } + return *o.InstanceName +} + +// GetInstanceNameOk returns a tuple with the InstanceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNow) GetInstanceNameOk() (*string, bool) { + if o == nil || o.InstanceName == nil { + return nil, false + } + return o.InstanceName, true +} + +// HasInstanceName returns a boolean if a field has been set. +func (o *IntegrationServiceNow) HasInstanceName() bool { + return o != nil && o.InstanceName != nil +} + +// SetInstanceName gets a reference to the given string and assigns it to the InstanceName field. +func (o *IntegrationServiceNow) SetInstanceName(v string) { + o.InstanceName = &v +} + +// GetSyncConfig returns the SyncConfig field value if set, zero value otherwise. +func (o *IntegrationServiceNow) GetSyncConfig() IntegrationServiceNowSyncConfig { + if o == nil || o.SyncConfig == nil { + var ret IntegrationServiceNowSyncConfig + return ret + } + return *o.SyncConfig +} + +// GetSyncConfigOk returns a tuple with the SyncConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNow) GetSyncConfigOk() (*IntegrationServiceNowSyncConfig, bool) { + if o == nil || o.SyncConfig == nil { + return nil, false + } + return o.SyncConfig, true +} + +// HasSyncConfig returns a boolean if a field has been set. +func (o *IntegrationServiceNow) HasSyncConfig() bool { + return o != nil && o.SyncConfig != nil +} + +// SetSyncConfig gets a reference to the given IntegrationServiceNowSyncConfig and assigns it to the SyncConfig field. +func (o *IntegrationServiceNow) SetSyncConfig(v IntegrationServiceNowSyncConfig) { + o.SyncConfig = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationServiceNow) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AssignmentGroup != nil { + toSerialize["assignment_group"] = o.AssignmentGroup + } + if o.AutoCreation != nil { + toSerialize["auto_creation"] = o.AutoCreation + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.InstanceName != nil { + toSerialize["instance_name"] = o.InstanceName + } + if o.SyncConfig != nil { + toSerialize["sync_config"] = o.SyncConfig + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationServiceNow) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AssignmentGroup *string `json:"assignment_group,omitempty"` + AutoCreation *IntegrationServiceNowAutoCreation `json:"auto_creation,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + InstanceName *string `json:"instance_name,omitempty"` + SyncConfig *IntegrationServiceNowSyncConfig `json:"sync_config,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"assignment_group", "auto_creation", "enabled", "instance_name", "sync_config"}) + } else { + return err + } + + hasInvalidField := false + o.AssignmentGroup = all.AssignmentGroup + if all.AutoCreation != nil && all.AutoCreation.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AutoCreation = all.AutoCreation + o.Enabled = all.Enabled + o.InstanceName = all.InstanceName + if all.SyncConfig != nil && all.SyncConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.SyncConfig = all.SyncConfig + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_integration_service_now_auto_creation.go b/api/datadogV2/model_integration_service_now_auto_creation.go new file mode 100644 index 00000000000..f39aeb10649 --- /dev/null +++ b/api/datadogV2/model_integration_service_now_auto_creation.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationServiceNowAutoCreation +type IntegrationServiceNowAutoCreation struct { + // + Enabled *bool `json:"enabled,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:"-"` +} + +// NewIntegrationServiceNowAutoCreation instantiates a new IntegrationServiceNowAutoCreation 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 NewIntegrationServiceNowAutoCreation() *IntegrationServiceNowAutoCreation { + this := IntegrationServiceNowAutoCreation{} + return &this +} + +// NewIntegrationServiceNowAutoCreationWithDefaults instantiates a new IntegrationServiceNowAutoCreation 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 NewIntegrationServiceNowAutoCreationWithDefaults() *IntegrationServiceNowAutoCreation { + this := IntegrationServiceNowAutoCreation{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IntegrationServiceNowAutoCreation) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNowAutoCreation) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *IntegrationServiceNowAutoCreation) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IntegrationServiceNowAutoCreation) SetEnabled(v bool) { + o.Enabled = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationServiceNowAutoCreation) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationServiceNowAutoCreation) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Enabled *bool `json:"enabled,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"enabled"}) + } else { + return err + } + o.Enabled = all.Enabled + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_integration_service_now_sync_config.go b/api/datadogV2/model_integration_service_now_sync_config.go new file mode 100644 index 00000000000..8183e007a5f --- /dev/null +++ b/api/datadogV2/model_integration_service_now_sync_config.go @@ -0,0 +1,146 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationServiceNowSyncConfig +type IntegrationServiceNowSyncConfig struct { + // + Enabled *bool `json:"enabled,omitempty"` + // + Properties *IntegrationServiceNowSyncConfig139772721534496 `json:"properties,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:"-"` +} + +// NewIntegrationServiceNowSyncConfig instantiates a new IntegrationServiceNowSyncConfig 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 NewIntegrationServiceNowSyncConfig() *IntegrationServiceNowSyncConfig { + this := IntegrationServiceNowSyncConfig{} + return &this +} + +// NewIntegrationServiceNowSyncConfigWithDefaults instantiates a new IntegrationServiceNowSyncConfig 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 NewIntegrationServiceNowSyncConfigWithDefaults() *IntegrationServiceNowSyncConfig { + this := IntegrationServiceNowSyncConfig{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IntegrationServiceNowSyncConfig) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNowSyncConfig) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *IntegrationServiceNowSyncConfig) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IntegrationServiceNowSyncConfig) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetProperties returns the Properties field value if set, zero value otherwise. +func (o *IntegrationServiceNowSyncConfig) GetProperties() IntegrationServiceNowSyncConfig139772721534496 { + if o == nil || o.Properties == nil { + var ret IntegrationServiceNowSyncConfig139772721534496 + return ret + } + return *o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNowSyncConfig) GetPropertiesOk() (*IntegrationServiceNowSyncConfig139772721534496, bool) { + if o == nil || o.Properties == nil { + return nil, false + } + return o.Properties, true +} + +// HasProperties returns a boolean if a field has been set. +func (o *IntegrationServiceNowSyncConfig) HasProperties() bool { + return o != nil && o.Properties != nil +} + +// SetProperties gets a reference to the given IntegrationServiceNowSyncConfig139772721534496 and assigns it to the Properties field. +func (o *IntegrationServiceNowSyncConfig) SetProperties(v IntegrationServiceNowSyncConfig139772721534496) { + o.Properties = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationServiceNowSyncConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationServiceNowSyncConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Enabled *bool `json:"enabled,omitempty"` + Properties *IntegrationServiceNowSyncConfig139772721534496 `json:"properties,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"enabled", "properties"}) + } else { + return err + } + + hasInvalidField := false + o.Enabled = all.Enabled + if all.Properties != nil && all.Properties.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Properties = all.Properties + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_integration_service_now_sync_config139772721534496.go b/api/datadogV2/model_integration_service_now_sync_config139772721534496.go new file mode 100644 index 00000000000..c240317deeb --- /dev/null +++ b/api/datadogV2/model_integration_service_now_sync_config139772721534496.go @@ -0,0 +1,187 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationServiceNowSyncConfig139772721534496 +type IntegrationServiceNowSyncConfig139772721534496 struct { + // Sync property configuration + Comments *SyncProperty `json:"comments,omitempty"` + // + Priority *IntegrationServiceNowSyncConfigPriority `json:"priority,omitempty"` + // Sync property with mapping configuration + Status *SyncPropertyWithMapping `json:"status,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:"-"` +} + +// NewIntegrationServiceNowSyncConfig139772721534496 instantiates a new IntegrationServiceNowSyncConfig139772721534496 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 NewIntegrationServiceNowSyncConfig139772721534496() *IntegrationServiceNowSyncConfig139772721534496 { + this := IntegrationServiceNowSyncConfig139772721534496{} + return &this +} + +// NewIntegrationServiceNowSyncConfig139772721534496WithDefaults instantiates a new IntegrationServiceNowSyncConfig139772721534496 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 NewIntegrationServiceNowSyncConfig139772721534496WithDefaults() *IntegrationServiceNowSyncConfig139772721534496 { + this := IntegrationServiceNowSyncConfig139772721534496{} + return &this +} + +// GetComments returns the Comments field value if set, zero value otherwise. +func (o *IntegrationServiceNowSyncConfig139772721534496) GetComments() SyncProperty { + if o == nil || o.Comments == nil { + var ret SyncProperty + return ret + } + return *o.Comments +} + +// GetCommentsOk returns a tuple with the Comments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNowSyncConfig139772721534496) GetCommentsOk() (*SyncProperty, bool) { + if o == nil || o.Comments == nil { + return nil, false + } + return o.Comments, true +} + +// HasComments returns a boolean if a field has been set. +func (o *IntegrationServiceNowSyncConfig139772721534496) HasComments() bool { + return o != nil && o.Comments != nil +} + +// SetComments gets a reference to the given SyncProperty and assigns it to the Comments field. +func (o *IntegrationServiceNowSyncConfig139772721534496) SetComments(v SyncProperty) { + o.Comments = &v +} + +// GetPriority returns the Priority field value if set, zero value otherwise. +func (o *IntegrationServiceNowSyncConfig139772721534496) GetPriority() IntegrationServiceNowSyncConfigPriority { + if o == nil || o.Priority == nil { + var ret IntegrationServiceNowSyncConfigPriority + return ret + } + return *o.Priority +} + +// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNowSyncConfig139772721534496) GetPriorityOk() (*IntegrationServiceNowSyncConfigPriority, bool) { + if o == nil || o.Priority == nil { + return nil, false + } + return o.Priority, true +} + +// HasPriority returns a boolean if a field has been set. +func (o *IntegrationServiceNowSyncConfig139772721534496) HasPriority() bool { + return o != nil && o.Priority != nil +} + +// SetPriority gets a reference to the given IntegrationServiceNowSyncConfigPriority and assigns it to the Priority field. +func (o *IntegrationServiceNowSyncConfig139772721534496) SetPriority(v IntegrationServiceNowSyncConfigPriority) { + o.Priority = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *IntegrationServiceNowSyncConfig139772721534496) GetStatus() SyncPropertyWithMapping { + if o == nil || o.Status == nil { + var ret SyncPropertyWithMapping + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNowSyncConfig139772721534496) GetStatusOk() (*SyncPropertyWithMapping, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *IntegrationServiceNowSyncConfig139772721534496) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given SyncPropertyWithMapping and assigns it to the Status field. +func (o *IntegrationServiceNowSyncConfig139772721534496) SetStatus(v SyncPropertyWithMapping) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationServiceNowSyncConfig139772721534496) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Comments != nil { + toSerialize["comments"] = o.Comments + } + if o.Priority != nil { + toSerialize["priority"] = o.Priority + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationServiceNowSyncConfig139772721534496) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Comments *SyncProperty `json:"comments,omitempty"` + Priority *IntegrationServiceNowSyncConfigPriority `json:"priority,omitempty"` + Status *SyncPropertyWithMapping `json:"status,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"comments", "priority", "status"}) + } else { + return err + } + + hasInvalidField := false + if all.Comments != nil && all.Comments.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Comments = all.Comments + if all.Priority != nil && all.Priority.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Priority = all.Priority + if all.Status != nil && all.Status.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Status = all.Status + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_integration_service_now_sync_config_priority.go b/api/datadogV2/model_integration_service_now_sync_config_priority.go new file mode 100644 index 00000000000..2a99fcf4899 --- /dev/null +++ b/api/datadogV2/model_integration_service_now_sync_config_priority.go @@ -0,0 +1,172 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IntegrationServiceNowSyncConfigPriority +type IntegrationServiceNowSyncConfigPriority struct { + // + ImpactMapping map[string]string `json:"impact_mapping,omitempty"` + // + SyncType *string `json:"sync_type,omitempty"` + // + UrgencyMapping map[string]string `json:"urgency_mapping,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:"-"` +} + +// NewIntegrationServiceNowSyncConfigPriority instantiates a new IntegrationServiceNowSyncConfigPriority 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 NewIntegrationServiceNowSyncConfigPriority() *IntegrationServiceNowSyncConfigPriority { + this := IntegrationServiceNowSyncConfigPriority{} + return &this +} + +// NewIntegrationServiceNowSyncConfigPriorityWithDefaults instantiates a new IntegrationServiceNowSyncConfigPriority 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 NewIntegrationServiceNowSyncConfigPriorityWithDefaults() *IntegrationServiceNowSyncConfigPriority { + this := IntegrationServiceNowSyncConfigPriority{} + return &this +} + +// GetImpactMapping returns the ImpactMapping field value if set, zero value otherwise. +func (o *IntegrationServiceNowSyncConfigPriority) GetImpactMapping() map[string]string { + if o == nil || o.ImpactMapping == nil { + var ret map[string]string + return ret + } + return o.ImpactMapping +} + +// GetImpactMappingOk returns a tuple with the ImpactMapping field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNowSyncConfigPriority) GetImpactMappingOk() (*map[string]string, bool) { + if o == nil || o.ImpactMapping == nil { + return nil, false + } + return &o.ImpactMapping, true +} + +// HasImpactMapping returns a boolean if a field has been set. +func (o *IntegrationServiceNowSyncConfigPriority) HasImpactMapping() bool { + return o != nil && o.ImpactMapping != nil +} + +// SetImpactMapping gets a reference to the given map[string]string and assigns it to the ImpactMapping field. +func (o *IntegrationServiceNowSyncConfigPriority) SetImpactMapping(v map[string]string) { + o.ImpactMapping = v +} + +// GetSyncType returns the SyncType field value if set, zero value otherwise. +func (o *IntegrationServiceNowSyncConfigPriority) GetSyncType() string { + if o == nil || o.SyncType == nil { + var ret string + return ret + } + return *o.SyncType +} + +// GetSyncTypeOk returns a tuple with the SyncType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNowSyncConfigPriority) GetSyncTypeOk() (*string, bool) { + if o == nil || o.SyncType == nil { + return nil, false + } + return o.SyncType, true +} + +// HasSyncType returns a boolean if a field has been set. +func (o *IntegrationServiceNowSyncConfigPriority) HasSyncType() bool { + return o != nil && o.SyncType != nil +} + +// SetSyncType gets a reference to the given string and assigns it to the SyncType field. +func (o *IntegrationServiceNowSyncConfigPriority) SetSyncType(v string) { + o.SyncType = &v +} + +// GetUrgencyMapping returns the UrgencyMapping field value if set, zero value otherwise. +func (o *IntegrationServiceNowSyncConfigPriority) GetUrgencyMapping() map[string]string { + if o == nil || o.UrgencyMapping == nil { + var ret map[string]string + return ret + } + return o.UrgencyMapping +} + +// GetUrgencyMappingOk returns a tuple with the UrgencyMapping field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegrationServiceNowSyncConfigPriority) GetUrgencyMappingOk() (*map[string]string, bool) { + if o == nil || o.UrgencyMapping == nil { + return nil, false + } + return &o.UrgencyMapping, true +} + +// HasUrgencyMapping returns a boolean if a field has been set. +func (o *IntegrationServiceNowSyncConfigPriority) HasUrgencyMapping() bool { + return o != nil && o.UrgencyMapping != nil +} + +// SetUrgencyMapping gets a reference to the given map[string]string and assigns it to the UrgencyMapping field. +func (o *IntegrationServiceNowSyncConfigPriority) SetUrgencyMapping(v map[string]string) { + o.UrgencyMapping = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IntegrationServiceNowSyncConfigPriority) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ImpactMapping != nil { + toSerialize["impact_mapping"] = o.ImpactMapping + } + if o.SyncType != nil { + toSerialize["sync_type"] = o.SyncType + } + if o.UrgencyMapping != nil { + toSerialize["urgency_mapping"] = o.UrgencyMapping + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IntegrationServiceNowSyncConfigPriority) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ImpactMapping map[string]string `json:"impact_mapping,omitempty"` + SyncType *string `json:"sync_type,omitempty"` + UrgencyMapping map[string]string `json:"urgency_mapping,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"impact_mapping", "sync_type", "urgency_mapping"}) + } else { + return err + } + o.ImpactMapping = all.ImpactMapping + o.SyncType = all.SyncType + o.UrgencyMapping = all.UrgencyMapping + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_project_attributes.go b/api/datadogV2/model_project_attributes.go index df32e62b6b7..d78d26da705 100644 --- a/api/datadogV2/model_project_attributes.go +++ b/api/datadogV2/model_project_attributes.go @@ -10,10 +10,18 @@ import ( // ProjectAttributes Project attributes type ProjectAttributes struct { + // Project columns configuration + ColumnsConfig *ProjectColumnsConfig `json:"columns_config,omitempty"` + // List of enabled custom case type IDs + EnabledCustomCaseTypes []string `json:"enabled_custom_case_types,omitempty"` // The project's key Key *string `json:"key,omitempty"` // Project's name Name *string `json:"name,omitempty"` + // Whether the project is restricted + Restricted *bool `json:"restricted,omitempty"` + // Project settings + Settings *ProjectSettings `json:"settings,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:"-"` @@ -36,6 +44,62 @@ func NewProjectAttributesWithDefaults() *ProjectAttributes { return &this } +// GetColumnsConfig returns the ColumnsConfig field value if set, zero value otherwise. +func (o *ProjectAttributes) GetColumnsConfig() ProjectColumnsConfig { + if o == nil || o.ColumnsConfig == nil { + var ret ProjectColumnsConfig + return ret + } + return *o.ColumnsConfig +} + +// GetColumnsConfigOk returns a tuple with the ColumnsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectAttributes) GetColumnsConfigOk() (*ProjectColumnsConfig, bool) { + if o == nil || o.ColumnsConfig == nil { + return nil, false + } + return o.ColumnsConfig, true +} + +// HasColumnsConfig returns a boolean if a field has been set. +func (o *ProjectAttributes) HasColumnsConfig() bool { + return o != nil && o.ColumnsConfig != nil +} + +// SetColumnsConfig gets a reference to the given ProjectColumnsConfig and assigns it to the ColumnsConfig field. +func (o *ProjectAttributes) SetColumnsConfig(v ProjectColumnsConfig) { + o.ColumnsConfig = &v +} + +// GetEnabledCustomCaseTypes returns the EnabledCustomCaseTypes field value if set, zero value otherwise. +func (o *ProjectAttributes) GetEnabledCustomCaseTypes() []string { + if o == nil || o.EnabledCustomCaseTypes == nil { + var ret []string + return ret + } + return o.EnabledCustomCaseTypes +} + +// GetEnabledCustomCaseTypesOk returns a tuple with the EnabledCustomCaseTypes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectAttributes) GetEnabledCustomCaseTypesOk() (*[]string, bool) { + if o == nil || o.EnabledCustomCaseTypes == nil { + return nil, false + } + return &o.EnabledCustomCaseTypes, true +} + +// HasEnabledCustomCaseTypes returns a boolean if a field has been set. +func (o *ProjectAttributes) HasEnabledCustomCaseTypes() bool { + return o != nil && o.EnabledCustomCaseTypes != nil +} + +// SetEnabledCustomCaseTypes gets a reference to the given []string and assigns it to the EnabledCustomCaseTypes field. +func (o *ProjectAttributes) SetEnabledCustomCaseTypes(v []string) { + o.EnabledCustomCaseTypes = v +} + // GetKey returns the Key field value if set, zero value otherwise. func (o *ProjectAttributes) GetKey() string { if o == nil || o.Key == nil { @@ -92,18 +156,86 @@ func (o *ProjectAttributes) SetName(v string) { o.Name = &v } +// GetRestricted returns the Restricted field value if set, zero value otherwise. +func (o *ProjectAttributes) GetRestricted() bool { + if o == nil || o.Restricted == nil { + var ret bool + return ret + } + return *o.Restricted +} + +// GetRestrictedOk returns a tuple with the Restricted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectAttributes) GetRestrictedOk() (*bool, bool) { + if o == nil || o.Restricted == nil { + return nil, false + } + return o.Restricted, true +} + +// HasRestricted returns a boolean if a field has been set. +func (o *ProjectAttributes) HasRestricted() bool { + return o != nil && o.Restricted != nil +} + +// SetRestricted gets a reference to the given bool and assigns it to the Restricted field. +func (o *ProjectAttributes) SetRestricted(v bool) { + o.Restricted = &v +} + +// GetSettings returns the Settings field value if set, zero value otherwise. +func (o *ProjectAttributes) GetSettings() ProjectSettings { + if o == nil || o.Settings == nil { + var ret ProjectSettings + return ret + } + return *o.Settings +} + +// GetSettingsOk returns a tuple with the Settings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectAttributes) GetSettingsOk() (*ProjectSettings, bool) { + if o == nil || o.Settings == nil { + return nil, false + } + return o.Settings, true +} + +// HasSettings returns a boolean if a field has been set. +func (o *ProjectAttributes) HasSettings() bool { + return o != nil && o.Settings != nil +} + +// SetSettings gets a reference to the given ProjectSettings and assigns it to the Settings field. +func (o *ProjectAttributes) SetSettings(v ProjectSettings) { + o.Settings = &v +} + // MarshalJSON serializes the struct using spec logic. func (o ProjectAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } + if o.ColumnsConfig != nil { + toSerialize["columns_config"] = o.ColumnsConfig + } + if o.EnabledCustomCaseTypes != nil { + toSerialize["enabled_custom_case_types"] = o.EnabledCustomCaseTypes + } if o.Key != nil { toSerialize["key"] = o.Key } if o.Name != nil { toSerialize["name"] = o.Name } + if o.Restricted != nil { + toSerialize["restricted"] = o.Restricted + } + if o.Settings != nil { + toSerialize["settings"] = o.Settings + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -114,24 +246,44 @@ func (o ProjectAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ProjectAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Key *string `json:"key,omitempty"` - Name *string `json:"name,omitempty"` + ColumnsConfig *ProjectColumnsConfig `json:"columns_config,omitempty"` + EnabledCustomCaseTypes []string `json:"enabled_custom_case_types,omitempty"` + Key *string `json:"key,omitempty"` + Name *string `json:"name,omitempty"` + Restricted *bool `json:"restricted,omitempty"` + Settings *ProjectSettings `json:"settings,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"key", "name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"columns_config", "enabled_custom_case_types", "key", "name", "restricted", "settings"}) } else { return err } + + hasInvalidField := false + if all.ColumnsConfig != nil && all.ColumnsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ColumnsConfig = all.ColumnsConfig + o.EnabledCustomCaseTypes = all.EnabledCustomCaseTypes o.Key = all.Key o.Name = all.Name + o.Restricted = all.Restricted + if all.Settings != nil && all.Settings.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Settings = all.Settings if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties } + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + return nil } diff --git a/api/datadogV2/model_project_columns_config.go b/api/datadogV2/model_project_columns_config.go new file mode 100644 index 00000000000..4051140717c --- /dev/null +++ b/api/datadogV2/model_project_columns_config.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ProjectColumnsConfig Project columns configuration +type ProjectColumnsConfig struct { + // + Columns []ProjectColumnsConfigColumnsItems `json:"columns,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:"-"` +} + +// NewProjectColumnsConfig instantiates a new ProjectColumnsConfig 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 NewProjectColumnsConfig() *ProjectColumnsConfig { + this := ProjectColumnsConfig{} + return &this +} + +// NewProjectColumnsConfigWithDefaults instantiates a new ProjectColumnsConfig 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 NewProjectColumnsConfigWithDefaults() *ProjectColumnsConfig { + this := ProjectColumnsConfig{} + return &this +} + +// GetColumns returns the Columns field value if set, zero value otherwise. +func (o *ProjectColumnsConfig) GetColumns() []ProjectColumnsConfigColumnsItems { + if o == nil || o.Columns == nil { + var ret []ProjectColumnsConfigColumnsItems + return ret + } + return o.Columns +} + +// GetColumnsOk returns a tuple with the Columns field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectColumnsConfig) GetColumnsOk() (*[]ProjectColumnsConfigColumnsItems, bool) { + if o == nil || o.Columns == nil { + return nil, false + } + return &o.Columns, true +} + +// HasColumns returns a boolean if a field has been set. +func (o *ProjectColumnsConfig) HasColumns() bool { + return o != nil && o.Columns != nil +} + +// SetColumns gets a reference to the given []ProjectColumnsConfigColumnsItems and assigns it to the Columns field. +func (o *ProjectColumnsConfig) SetColumns(v []ProjectColumnsConfigColumnsItems) { + o.Columns = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProjectColumnsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Columns != nil { + toSerialize["columns"] = o.Columns + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ProjectColumnsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Columns []ProjectColumnsConfigColumnsItems `json:"columns,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"columns"}) + } else { + return err + } + o.Columns = all.Columns + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_project_columns_config_columns_items.go b/api/datadogV2/model_project_columns_config_columns_items.go new file mode 100644 index 00000000000..7079c97bd0a --- /dev/null +++ b/api/datadogV2/model_project_columns_config_columns_items.go @@ -0,0 +1,181 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ProjectColumnsConfigColumnsItems +type ProjectColumnsConfigColumnsItems struct { + // + Sort *ProjectColumnsConfigColumnsItemsSort `json:"sort,omitempty"` + // + SortField *string `json:"sort_field,omitempty"` + // + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewProjectColumnsConfigColumnsItems instantiates a new ProjectColumnsConfigColumnsItems 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 NewProjectColumnsConfigColumnsItems() *ProjectColumnsConfigColumnsItems { + this := ProjectColumnsConfigColumnsItems{} + return &this +} + +// NewProjectColumnsConfigColumnsItemsWithDefaults instantiates a new ProjectColumnsConfigColumnsItems 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 NewProjectColumnsConfigColumnsItemsWithDefaults() *ProjectColumnsConfigColumnsItems { + this := ProjectColumnsConfigColumnsItems{} + return &this +} + +// GetSort returns the Sort field value if set, zero value otherwise. +func (o *ProjectColumnsConfigColumnsItems) GetSort() ProjectColumnsConfigColumnsItemsSort { + if o == nil || o.Sort == nil { + var ret ProjectColumnsConfigColumnsItemsSort + return ret + } + return *o.Sort +} + +// GetSortOk returns a tuple with the Sort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectColumnsConfigColumnsItems) GetSortOk() (*ProjectColumnsConfigColumnsItemsSort, bool) { + if o == nil || o.Sort == nil { + return nil, false + } + return o.Sort, true +} + +// HasSort returns a boolean if a field has been set. +func (o *ProjectColumnsConfigColumnsItems) HasSort() bool { + return o != nil && o.Sort != nil +} + +// SetSort gets a reference to the given ProjectColumnsConfigColumnsItemsSort and assigns it to the Sort field. +func (o *ProjectColumnsConfigColumnsItems) SetSort(v ProjectColumnsConfigColumnsItemsSort) { + o.Sort = &v +} + +// GetSortField returns the SortField field value if set, zero value otherwise. +func (o *ProjectColumnsConfigColumnsItems) GetSortField() string { + if o == nil || o.SortField == nil { + var ret string + return ret + } + return *o.SortField +} + +// GetSortFieldOk returns a tuple with the SortField field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectColumnsConfigColumnsItems) GetSortFieldOk() (*string, bool) { + if o == nil || o.SortField == nil { + return nil, false + } + return o.SortField, true +} + +// HasSortField returns a boolean if a field has been set. +func (o *ProjectColumnsConfigColumnsItems) HasSortField() bool { + return o != nil && o.SortField != nil +} + +// SetSortField gets a reference to the given string and assigns it to the SortField field. +func (o *ProjectColumnsConfigColumnsItems) SetSortField(v string) { + o.SortField = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ProjectColumnsConfigColumnsItems) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectColumnsConfigColumnsItems) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ProjectColumnsConfigColumnsItems) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ProjectColumnsConfigColumnsItems) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProjectColumnsConfigColumnsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Sort != nil { + toSerialize["sort"] = o.Sort + } + if o.SortField != nil { + toSerialize["sort_field"] = o.SortField + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ProjectColumnsConfigColumnsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Sort *ProjectColumnsConfigColumnsItemsSort `json:"sort,omitempty"` + SortField *string `json:"sort_field,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"sort", "sort_field", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Sort = all.Sort + o.SortField = all.SortField + 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_project_columns_config_columns_items_sort.go b/api/datadogV2/model_project_columns_config_columns_items_sort.go new file mode 100644 index 00000000000..70a121c94cb --- /dev/null +++ b/api/datadogV2/model_project_columns_config_columns_items_sort.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ProjectColumnsConfigColumnsItemsSort +type ProjectColumnsConfigColumnsItemsSort struct { + // + Ascending *bool `json:"ascending,omitempty"` + // + Priority *int64 `json:"priority,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:"-"` +} + +// NewProjectColumnsConfigColumnsItemsSort instantiates a new ProjectColumnsConfigColumnsItemsSort 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 NewProjectColumnsConfigColumnsItemsSort() *ProjectColumnsConfigColumnsItemsSort { + this := ProjectColumnsConfigColumnsItemsSort{} + return &this +} + +// NewProjectColumnsConfigColumnsItemsSortWithDefaults instantiates a new ProjectColumnsConfigColumnsItemsSort 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 NewProjectColumnsConfigColumnsItemsSortWithDefaults() *ProjectColumnsConfigColumnsItemsSort { + this := ProjectColumnsConfigColumnsItemsSort{} + return &this +} + +// GetAscending returns the Ascending field value if set, zero value otherwise. +func (o *ProjectColumnsConfigColumnsItemsSort) GetAscending() bool { + if o == nil || o.Ascending == nil { + var ret bool + return ret + } + return *o.Ascending +} + +// GetAscendingOk returns a tuple with the Ascending field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectColumnsConfigColumnsItemsSort) GetAscendingOk() (*bool, bool) { + if o == nil || o.Ascending == nil { + return nil, false + } + return o.Ascending, true +} + +// HasAscending returns a boolean if a field has been set. +func (o *ProjectColumnsConfigColumnsItemsSort) HasAscending() bool { + return o != nil && o.Ascending != nil +} + +// SetAscending gets a reference to the given bool and assigns it to the Ascending field. +func (o *ProjectColumnsConfigColumnsItemsSort) SetAscending(v bool) { + o.Ascending = &v +} + +// GetPriority returns the Priority field value if set, zero value otherwise. +func (o *ProjectColumnsConfigColumnsItemsSort) GetPriority() int64 { + if o == nil || o.Priority == nil { + var ret int64 + return ret + } + return *o.Priority +} + +// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectColumnsConfigColumnsItemsSort) GetPriorityOk() (*int64, bool) { + if o == nil || o.Priority == nil { + return nil, false + } + return o.Priority, true +} + +// HasPriority returns a boolean if a field has been set. +func (o *ProjectColumnsConfigColumnsItemsSort) HasPriority() bool { + return o != nil && o.Priority != nil +} + +// SetPriority gets a reference to the given int64 and assigns it to the Priority field. +func (o *ProjectColumnsConfigColumnsItemsSort) SetPriority(v int64) { + o.Priority = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProjectColumnsConfigColumnsItemsSort) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Ascending != nil { + toSerialize["ascending"] = o.Ascending + } + if o.Priority != nil { + toSerialize["priority"] = o.Priority + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ProjectColumnsConfigColumnsItemsSort) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Ascending *bool `json:"ascending,omitempty"` + Priority *int64 `json:"priority,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"ascending", "priority"}) + } else { + return err + } + o.Ascending = all.Ascending + o.Priority = all.Priority + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_project_create_attributes.go b/api/datadogV2/model_project_create_attributes.go index f6e6d8f4f91..422411549db 100644 --- a/api/datadogV2/model_project_create_attributes.go +++ b/api/datadogV2/model_project_create_attributes.go @@ -12,10 +12,14 @@ import ( // ProjectCreateAttributes Project creation attributes type ProjectCreateAttributes struct { + // List of enabled custom case type IDs + EnabledCustomCaseTypes []string `json:"enabled_custom_case_types,omitempty"` // Project's key. Cannot be "CASE" Key string `json:"key"` - // name + // Project name Name string `json:"name"` + // Team UUID to associate with the project + TeamUuid *string `json:"team_uuid,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:"-"` @@ -40,6 +44,34 @@ func NewProjectCreateAttributesWithDefaults() *ProjectCreateAttributes { return &this } +// GetEnabledCustomCaseTypes returns the EnabledCustomCaseTypes field value if set, zero value otherwise. +func (o *ProjectCreateAttributes) GetEnabledCustomCaseTypes() []string { + if o == nil || o.EnabledCustomCaseTypes == nil { + var ret []string + return ret + } + return o.EnabledCustomCaseTypes +} + +// GetEnabledCustomCaseTypesOk returns a tuple with the EnabledCustomCaseTypes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectCreateAttributes) GetEnabledCustomCaseTypesOk() (*[]string, bool) { + if o == nil || o.EnabledCustomCaseTypes == nil { + return nil, false + } + return &o.EnabledCustomCaseTypes, true +} + +// HasEnabledCustomCaseTypes returns a boolean if a field has been set. +func (o *ProjectCreateAttributes) HasEnabledCustomCaseTypes() bool { + return o != nil && o.EnabledCustomCaseTypes != nil +} + +// SetEnabledCustomCaseTypes gets a reference to the given []string and assigns it to the EnabledCustomCaseTypes field. +func (o *ProjectCreateAttributes) SetEnabledCustomCaseTypes(v []string) { + o.EnabledCustomCaseTypes = v +} + // GetKey returns the Key field value. func (o *ProjectCreateAttributes) GetKey() string { if o == nil { @@ -86,14 +118,48 @@ func (o *ProjectCreateAttributes) SetName(v string) { o.Name = v } +// GetTeamUuid returns the TeamUuid field value if set, zero value otherwise. +func (o *ProjectCreateAttributes) GetTeamUuid() string { + if o == nil || o.TeamUuid == nil { + var ret string + return ret + } + return *o.TeamUuid +} + +// GetTeamUuidOk returns a tuple with the TeamUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectCreateAttributes) GetTeamUuidOk() (*string, bool) { + if o == nil || o.TeamUuid == nil { + return nil, false + } + return o.TeamUuid, true +} + +// HasTeamUuid returns a boolean if a field has been set. +func (o *ProjectCreateAttributes) HasTeamUuid() bool { + return o != nil && o.TeamUuid != nil +} + +// SetTeamUuid gets a reference to the given string and assigns it to the TeamUuid field. +func (o *ProjectCreateAttributes) SetTeamUuid(v string) { + o.TeamUuid = &v +} + // MarshalJSON serializes the struct using spec logic. func (o ProjectCreateAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } + if o.EnabledCustomCaseTypes != nil { + toSerialize["enabled_custom_case_types"] = o.EnabledCustomCaseTypes + } toSerialize["key"] = o.Key toSerialize["name"] = o.Name + if o.TeamUuid != nil { + toSerialize["team_uuid"] = o.TeamUuid + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -104,8 +170,10 @@ func (o ProjectCreateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *ProjectCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Key *string `json:"key"` - Name *string `json:"name"` + EnabledCustomCaseTypes []string `json:"enabled_custom_case_types,omitempty"` + Key *string `json:"key"` + Name *string `json:"name"` + TeamUuid *string `json:"team_uuid,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -118,12 +186,14 @@ func (o *ProjectCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"key", "name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"enabled_custom_case_types", "key", "name", "team_uuid"}) } else { return err } + o.EnabledCustomCaseTypes = all.EnabledCustomCaseTypes o.Key = *all.Key o.Name = *all.Name + o.TeamUuid = all.TeamUuid if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_project_notification_settings.go b/api/datadogV2/model_project_notification_settings.go new file mode 100644 index 00000000000..4d0dce85421 --- /dev/null +++ b/api/datadogV2/model_project_notification_settings.go @@ -0,0 +1,382 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ProjectNotificationSettings Project notification settings +type ProjectNotificationSettings struct { + // Notification destinations (1=email, 2=slack, 3=in-app) + Destinations []int32 `json:"destinations,omitempty"` + // Whether notifications are enabled + Enabled *bool `json:"enabled,omitempty"` + // + NotifyOnCaseAssignment *bool `json:"notify_on_case_assignment,omitempty"` + // + NotifyOnCaseClosed *bool `json:"notify_on_case_closed,omitempty"` + // + NotifyOnCaseComment *bool `json:"notify_on_case_comment,omitempty"` + // + NotifyOnCaseCommentMention *bool `json:"notify_on_case_comment_mention,omitempty"` + // + NotifyOnCasePriorityChange *bool `json:"notify_on_case_priority_change,omitempty"` + // + NotifyOnCaseStatusChange *bool `json:"notify_on_case_status_change,omitempty"` + // + NotifyOnCaseUnassignment *bool `json:"notify_on_case_unassignment,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:"-"` +} + +// NewProjectNotificationSettings instantiates a new ProjectNotificationSettings 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 NewProjectNotificationSettings() *ProjectNotificationSettings { + this := ProjectNotificationSettings{} + return &this +} + +// NewProjectNotificationSettingsWithDefaults instantiates a new ProjectNotificationSettings 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 NewProjectNotificationSettingsWithDefaults() *ProjectNotificationSettings { + this := ProjectNotificationSettings{} + return &this +} + +// GetDestinations returns the Destinations field value if set, zero value otherwise. +func (o *ProjectNotificationSettings) GetDestinations() []int32 { + if o == nil || o.Destinations == nil { + var ret []int32 + return ret + } + return o.Destinations +} + +// GetDestinationsOk returns a tuple with the Destinations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectNotificationSettings) GetDestinationsOk() (*[]int32, bool) { + if o == nil || o.Destinations == nil { + return nil, false + } + return &o.Destinations, true +} + +// HasDestinations returns a boolean if a field has been set. +func (o *ProjectNotificationSettings) HasDestinations() bool { + return o != nil && o.Destinations != nil +} + +// SetDestinations gets a reference to the given []int32 and assigns it to the Destinations field. +func (o *ProjectNotificationSettings) SetDestinations(v []int32) { + o.Destinations = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *ProjectNotificationSettings) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectNotificationSettings) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *ProjectNotificationSettings) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *ProjectNotificationSettings) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetNotifyOnCaseAssignment returns the NotifyOnCaseAssignment field value if set, zero value otherwise. +func (o *ProjectNotificationSettings) GetNotifyOnCaseAssignment() bool { + if o == nil || o.NotifyOnCaseAssignment == nil { + var ret bool + return ret + } + return *o.NotifyOnCaseAssignment +} + +// GetNotifyOnCaseAssignmentOk returns a tuple with the NotifyOnCaseAssignment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectNotificationSettings) GetNotifyOnCaseAssignmentOk() (*bool, bool) { + if o == nil || o.NotifyOnCaseAssignment == nil { + return nil, false + } + return o.NotifyOnCaseAssignment, true +} + +// HasNotifyOnCaseAssignment returns a boolean if a field has been set. +func (o *ProjectNotificationSettings) HasNotifyOnCaseAssignment() bool { + return o != nil && o.NotifyOnCaseAssignment != nil +} + +// SetNotifyOnCaseAssignment gets a reference to the given bool and assigns it to the NotifyOnCaseAssignment field. +func (o *ProjectNotificationSettings) SetNotifyOnCaseAssignment(v bool) { + o.NotifyOnCaseAssignment = &v +} + +// GetNotifyOnCaseClosed returns the NotifyOnCaseClosed field value if set, zero value otherwise. +func (o *ProjectNotificationSettings) GetNotifyOnCaseClosed() bool { + if o == nil || o.NotifyOnCaseClosed == nil { + var ret bool + return ret + } + return *o.NotifyOnCaseClosed +} + +// GetNotifyOnCaseClosedOk returns a tuple with the NotifyOnCaseClosed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectNotificationSettings) GetNotifyOnCaseClosedOk() (*bool, bool) { + if o == nil || o.NotifyOnCaseClosed == nil { + return nil, false + } + return o.NotifyOnCaseClosed, true +} + +// HasNotifyOnCaseClosed returns a boolean if a field has been set. +func (o *ProjectNotificationSettings) HasNotifyOnCaseClosed() bool { + return o != nil && o.NotifyOnCaseClosed != nil +} + +// SetNotifyOnCaseClosed gets a reference to the given bool and assigns it to the NotifyOnCaseClosed field. +func (o *ProjectNotificationSettings) SetNotifyOnCaseClosed(v bool) { + o.NotifyOnCaseClosed = &v +} + +// GetNotifyOnCaseComment returns the NotifyOnCaseComment field value if set, zero value otherwise. +func (o *ProjectNotificationSettings) GetNotifyOnCaseComment() bool { + if o == nil || o.NotifyOnCaseComment == nil { + var ret bool + return ret + } + return *o.NotifyOnCaseComment +} + +// GetNotifyOnCaseCommentOk returns a tuple with the NotifyOnCaseComment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectNotificationSettings) GetNotifyOnCaseCommentOk() (*bool, bool) { + if o == nil || o.NotifyOnCaseComment == nil { + return nil, false + } + return o.NotifyOnCaseComment, true +} + +// HasNotifyOnCaseComment returns a boolean if a field has been set. +func (o *ProjectNotificationSettings) HasNotifyOnCaseComment() bool { + return o != nil && o.NotifyOnCaseComment != nil +} + +// SetNotifyOnCaseComment gets a reference to the given bool and assigns it to the NotifyOnCaseComment field. +func (o *ProjectNotificationSettings) SetNotifyOnCaseComment(v bool) { + o.NotifyOnCaseComment = &v +} + +// GetNotifyOnCaseCommentMention returns the NotifyOnCaseCommentMention field value if set, zero value otherwise. +func (o *ProjectNotificationSettings) GetNotifyOnCaseCommentMention() bool { + if o == nil || o.NotifyOnCaseCommentMention == nil { + var ret bool + return ret + } + return *o.NotifyOnCaseCommentMention +} + +// GetNotifyOnCaseCommentMentionOk returns a tuple with the NotifyOnCaseCommentMention field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectNotificationSettings) GetNotifyOnCaseCommentMentionOk() (*bool, bool) { + if o == nil || o.NotifyOnCaseCommentMention == nil { + return nil, false + } + return o.NotifyOnCaseCommentMention, true +} + +// HasNotifyOnCaseCommentMention returns a boolean if a field has been set. +func (o *ProjectNotificationSettings) HasNotifyOnCaseCommentMention() bool { + return o != nil && o.NotifyOnCaseCommentMention != nil +} + +// SetNotifyOnCaseCommentMention gets a reference to the given bool and assigns it to the NotifyOnCaseCommentMention field. +func (o *ProjectNotificationSettings) SetNotifyOnCaseCommentMention(v bool) { + o.NotifyOnCaseCommentMention = &v +} + +// GetNotifyOnCasePriorityChange returns the NotifyOnCasePriorityChange field value if set, zero value otherwise. +func (o *ProjectNotificationSettings) GetNotifyOnCasePriorityChange() bool { + if o == nil || o.NotifyOnCasePriorityChange == nil { + var ret bool + return ret + } + return *o.NotifyOnCasePriorityChange +} + +// GetNotifyOnCasePriorityChangeOk returns a tuple with the NotifyOnCasePriorityChange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectNotificationSettings) GetNotifyOnCasePriorityChangeOk() (*bool, bool) { + if o == nil || o.NotifyOnCasePriorityChange == nil { + return nil, false + } + return o.NotifyOnCasePriorityChange, true +} + +// HasNotifyOnCasePriorityChange returns a boolean if a field has been set. +func (o *ProjectNotificationSettings) HasNotifyOnCasePriorityChange() bool { + return o != nil && o.NotifyOnCasePriorityChange != nil +} + +// SetNotifyOnCasePriorityChange gets a reference to the given bool and assigns it to the NotifyOnCasePriorityChange field. +func (o *ProjectNotificationSettings) SetNotifyOnCasePriorityChange(v bool) { + o.NotifyOnCasePriorityChange = &v +} + +// GetNotifyOnCaseStatusChange returns the NotifyOnCaseStatusChange field value if set, zero value otherwise. +func (o *ProjectNotificationSettings) GetNotifyOnCaseStatusChange() bool { + if o == nil || o.NotifyOnCaseStatusChange == nil { + var ret bool + return ret + } + return *o.NotifyOnCaseStatusChange +} + +// GetNotifyOnCaseStatusChangeOk returns a tuple with the NotifyOnCaseStatusChange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectNotificationSettings) GetNotifyOnCaseStatusChangeOk() (*bool, bool) { + if o == nil || o.NotifyOnCaseStatusChange == nil { + return nil, false + } + return o.NotifyOnCaseStatusChange, true +} + +// HasNotifyOnCaseStatusChange returns a boolean if a field has been set. +func (o *ProjectNotificationSettings) HasNotifyOnCaseStatusChange() bool { + return o != nil && o.NotifyOnCaseStatusChange != nil +} + +// SetNotifyOnCaseStatusChange gets a reference to the given bool and assigns it to the NotifyOnCaseStatusChange field. +func (o *ProjectNotificationSettings) SetNotifyOnCaseStatusChange(v bool) { + o.NotifyOnCaseStatusChange = &v +} + +// GetNotifyOnCaseUnassignment returns the NotifyOnCaseUnassignment field value if set, zero value otherwise. +func (o *ProjectNotificationSettings) GetNotifyOnCaseUnassignment() bool { + if o == nil || o.NotifyOnCaseUnassignment == nil { + var ret bool + return ret + } + return *o.NotifyOnCaseUnassignment +} + +// GetNotifyOnCaseUnassignmentOk returns a tuple with the NotifyOnCaseUnassignment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectNotificationSettings) GetNotifyOnCaseUnassignmentOk() (*bool, bool) { + if o == nil || o.NotifyOnCaseUnassignment == nil { + return nil, false + } + return o.NotifyOnCaseUnassignment, true +} + +// HasNotifyOnCaseUnassignment returns a boolean if a field has been set. +func (o *ProjectNotificationSettings) HasNotifyOnCaseUnassignment() bool { + return o != nil && o.NotifyOnCaseUnassignment != nil +} + +// SetNotifyOnCaseUnassignment gets a reference to the given bool and assigns it to the NotifyOnCaseUnassignment field. +func (o *ProjectNotificationSettings) SetNotifyOnCaseUnassignment(v bool) { + o.NotifyOnCaseUnassignment = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProjectNotificationSettings) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Destinations != nil { + toSerialize["destinations"] = o.Destinations + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.NotifyOnCaseAssignment != nil { + toSerialize["notify_on_case_assignment"] = o.NotifyOnCaseAssignment + } + if o.NotifyOnCaseClosed != nil { + toSerialize["notify_on_case_closed"] = o.NotifyOnCaseClosed + } + if o.NotifyOnCaseComment != nil { + toSerialize["notify_on_case_comment"] = o.NotifyOnCaseComment + } + if o.NotifyOnCaseCommentMention != nil { + toSerialize["notify_on_case_comment_mention"] = o.NotifyOnCaseCommentMention + } + if o.NotifyOnCasePriorityChange != nil { + toSerialize["notify_on_case_priority_change"] = o.NotifyOnCasePriorityChange + } + if o.NotifyOnCaseStatusChange != nil { + toSerialize["notify_on_case_status_change"] = o.NotifyOnCaseStatusChange + } + if o.NotifyOnCaseUnassignment != nil { + toSerialize["notify_on_case_unassignment"] = o.NotifyOnCaseUnassignment + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ProjectNotificationSettings) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Destinations []int32 `json:"destinations,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + NotifyOnCaseAssignment *bool `json:"notify_on_case_assignment,omitempty"` + NotifyOnCaseClosed *bool `json:"notify_on_case_closed,omitempty"` + NotifyOnCaseComment *bool `json:"notify_on_case_comment,omitempty"` + NotifyOnCaseCommentMention *bool `json:"notify_on_case_comment_mention,omitempty"` + NotifyOnCasePriorityChange *bool `json:"notify_on_case_priority_change,omitempty"` + NotifyOnCaseStatusChange *bool `json:"notify_on_case_status_change,omitempty"` + NotifyOnCaseUnassignment *bool `json:"notify_on_case_unassignment,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"destinations", "enabled", "notify_on_case_assignment", "notify_on_case_closed", "notify_on_case_comment", "notify_on_case_comment_mention", "notify_on_case_priority_change", "notify_on_case_status_change", "notify_on_case_unassignment"}) + } else { + return err + } + o.Destinations = all.Destinations + o.Enabled = all.Enabled + o.NotifyOnCaseAssignment = all.NotifyOnCaseAssignment + o.NotifyOnCaseClosed = all.NotifyOnCaseClosed + o.NotifyOnCaseComment = all.NotifyOnCaseComment + o.NotifyOnCaseCommentMention = all.NotifyOnCaseCommentMention + o.NotifyOnCasePriorityChange = all.NotifyOnCasePriorityChange + o.NotifyOnCaseStatusChange = all.NotifyOnCaseStatusChange + o.NotifyOnCaseUnassignment = all.NotifyOnCaseUnassignment + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_project_settings.go b/api/datadogV2/model_project_settings.go new file mode 100644 index 00000000000..0057a876470 --- /dev/null +++ b/api/datadogV2/model_project_settings.go @@ -0,0 +1,377 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ProjectSettings Project settings +type ProjectSettings struct { + // Auto-close inactive cases settings + AutoCloseInactiveCases *AutoCloseInactiveCases `json:"auto_close_inactive_cases,omitempty"` + // Auto-transition assigned cases settings + AutoTransitionAssignedCases *AutoTransitionAssignedCases `json:"auto_transition_assigned_cases,omitempty"` + // Incident integration settings + IntegrationIncident *IntegrationIncident `json:"integration_incident,omitempty"` + // Jira integration settings + IntegrationJira *IntegrationJira `json:"integration_jira,omitempty"` + // Monitor integration settings + IntegrationMonitor *IntegrationMonitor `json:"integration_monitor,omitempty"` + // On-Call integration settings + IntegrationOnCall *IntegrationOnCall `json:"integration_on_call,omitempty"` + // ServiceNow integration settings + IntegrationServiceNow *IntegrationServiceNow `json:"integration_service_now,omitempty"` + // Project notification settings + Notification *ProjectNotificationSettings `json:"notification,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:"-"` +} + +// NewProjectSettings instantiates a new ProjectSettings 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 NewProjectSettings() *ProjectSettings { + this := ProjectSettings{} + return &this +} + +// NewProjectSettingsWithDefaults instantiates a new ProjectSettings 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 NewProjectSettingsWithDefaults() *ProjectSettings { + this := ProjectSettings{} + return &this +} + +// GetAutoCloseInactiveCases returns the AutoCloseInactiveCases field value if set, zero value otherwise. +func (o *ProjectSettings) GetAutoCloseInactiveCases() AutoCloseInactiveCases { + if o == nil || o.AutoCloseInactiveCases == nil { + var ret AutoCloseInactiveCases + return ret + } + return *o.AutoCloseInactiveCases +} + +// GetAutoCloseInactiveCasesOk returns a tuple with the AutoCloseInactiveCases field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectSettings) GetAutoCloseInactiveCasesOk() (*AutoCloseInactiveCases, bool) { + if o == nil || o.AutoCloseInactiveCases == nil { + return nil, false + } + return o.AutoCloseInactiveCases, true +} + +// HasAutoCloseInactiveCases returns a boolean if a field has been set. +func (o *ProjectSettings) HasAutoCloseInactiveCases() bool { + return o != nil && o.AutoCloseInactiveCases != nil +} + +// SetAutoCloseInactiveCases gets a reference to the given AutoCloseInactiveCases and assigns it to the AutoCloseInactiveCases field. +func (o *ProjectSettings) SetAutoCloseInactiveCases(v AutoCloseInactiveCases) { + o.AutoCloseInactiveCases = &v +} + +// GetAutoTransitionAssignedCases returns the AutoTransitionAssignedCases field value if set, zero value otherwise. +func (o *ProjectSettings) GetAutoTransitionAssignedCases() AutoTransitionAssignedCases { + if o == nil || o.AutoTransitionAssignedCases == nil { + var ret AutoTransitionAssignedCases + return ret + } + return *o.AutoTransitionAssignedCases +} + +// GetAutoTransitionAssignedCasesOk returns a tuple with the AutoTransitionAssignedCases field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectSettings) GetAutoTransitionAssignedCasesOk() (*AutoTransitionAssignedCases, bool) { + if o == nil || o.AutoTransitionAssignedCases == nil { + return nil, false + } + return o.AutoTransitionAssignedCases, true +} + +// HasAutoTransitionAssignedCases returns a boolean if a field has been set. +func (o *ProjectSettings) HasAutoTransitionAssignedCases() bool { + return o != nil && o.AutoTransitionAssignedCases != nil +} + +// SetAutoTransitionAssignedCases gets a reference to the given AutoTransitionAssignedCases and assigns it to the AutoTransitionAssignedCases field. +func (o *ProjectSettings) SetAutoTransitionAssignedCases(v AutoTransitionAssignedCases) { + o.AutoTransitionAssignedCases = &v +} + +// GetIntegrationIncident returns the IntegrationIncident field value if set, zero value otherwise. +func (o *ProjectSettings) GetIntegrationIncident() IntegrationIncident { + if o == nil || o.IntegrationIncident == nil { + var ret IntegrationIncident + return ret + } + return *o.IntegrationIncident +} + +// GetIntegrationIncidentOk returns a tuple with the IntegrationIncident field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectSettings) GetIntegrationIncidentOk() (*IntegrationIncident, bool) { + if o == nil || o.IntegrationIncident == nil { + return nil, false + } + return o.IntegrationIncident, true +} + +// HasIntegrationIncident returns a boolean if a field has been set. +func (o *ProjectSettings) HasIntegrationIncident() bool { + return o != nil && o.IntegrationIncident != nil +} + +// SetIntegrationIncident gets a reference to the given IntegrationIncident and assigns it to the IntegrationIncident field. +func (o *ProjectSettings) SetIntegrationIncident(v IntegrationIncident) { + o.IntegrationIncident = &v +} + +// GetIntegrationJira returns the IntegrationJira field value if set, zero value otherwise. +func (o *ProjectSettings) GetIntegrationJira() IntegrationJira { + if o == nil || o.IntegrationJira == nil { + var ret IntegrationJira + return ret + } + return *o.IntegrationJira +} + +// GetIntegrationJiraOk returns a tuple with the IntegrationJira field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectSettings) GetIntegrationJiraOk() (*IntegrationJira, bool) { + if o == nil || o.IntegrationJira == nil { + return nil, false + } + return o.IntegrationJira, true +} + +// HasIntegrationJira returns a boolean if a field has been set. +func (o *ProjectSettings) HasIntegrationJira() bool { + return o != nil && o.IntegrationJira != nil +} + +// SetIntegrationJira gets a reference to the given IntegrationJira and assigns it to the IntegrationJira field. +func (o *ProjectSettings) SetIntegrationJira(v IntegrationJira) { + o.IntegrationJira = &v +} + +// GetIntegrationMonitor returns the IntegrationMonitor field value if set, zero value otherwise. +func (o *ProjectSettings) GetIntegrationMonitor() IntegrationMonitor { + if o == nil || o.IntegrationMonitor == nil { + var ret IntegrationMonitor + return ret + } + return *o.IntegrationMonitor +} + +// GetIntegrationMonitorOk returns a tuple with the IntegrationMonitor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectSettings) GetIntegrationMonitorOk() (*IntegrationMonitor, bool) { + if o == nil || o.IntegrationMonitor == nil { + return nil, false + } + return o.IntegrationMonitor, true +} + +// HasIntegrationMonitor returns a boolean if a field has been set. +func (o *ProjectSettings) HasIntegrationMonitor() bool { + return o != nil && o.IntegrationMonitor != nil +} + +// SetIntegrationMonitor gets a reference to the given IntegrationMonitor and assigns it to the IntegrationMonitor field. +func (o *ProjectSettings) SetIntegrationMonitor(v IntegrationMonitor) { + o.IntegrationMonitor = &v +} + +// GetIntegrationOnCall returns the IntegrationOnCall field value if set, zero value otherwise. +func (o *ProjectSettings) GetIntegrationOnCall() IntegrationOnCall { + if o == nil || o.IntegrationOnCall == nil { + var ret IntegrationOnCall + return ret + } + return *o.IntegrationOnCall +} + +// GetIntegrationOnCallOk returns a tuple with the IntegrationOnCall field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectSettings) GetIntegrationOnCallOk() (*IntegrationOnCall, bool) { + if o == nil || o.IntegrationOnCall == nil { + return nil, false + } + return o.IntegrationOnCall, true +} + +// HasIntegrationOnCall returns a boolean if a field has been set. +func (o *ProjectSettings) HasIntegrationOnCall() bool { + return o != nil && o.IntegrationOnCall != nil +} + +// SetIntegrationOnCall gets a reference to the given IntegrationOnCall and assigns it to the IntegrationOnCall field. +func (o *ProjectSettings) SetIntegrationOnCall(v IntegrationOnCall) { + o.IntegrationOnCall = &v +} + +// GetIntegrationServiceNow returns the IntegrationServiceNow field value if set, zero value otherwise. +func (o *ProjectSettings) GetIntegrationServiceNow() IntegrationServiceNow { + if o == nil || o.IntegrationServiceNow == nil { + var ret IntegrationServiceNow + return ret + } + return *o.IntegrationServiceNow +} + +// GetIntegrationServiceNowOk returns a tuple with the IntegrationServiceNow field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectSettings) GetIntegrationServiceNowOk() (*IntegrationServiceNow, bool) { + if o == nil || o.IntegrationServiceNow == nil { + return nil, false + } + return o.IntegrationServiceNow, true +} + +// HasIntegrationServiceNow returns a boolean if a field has been set. +func (o *ProjectSettings) HasIntegrationServiceNow() bool { + return o != nil && o.IntegrationServiceNow != nil +} + +// SetIntegrationServiceNow gets a reference to the given IntegrationServiceNow and assigns it to the IntegrationServiceNow field. +func (o *ProjectSettings) SetIntegrationServiceNow(v IntegrationServiceNow) { + o.IntegrationServiceNow = &v +} + +// GetNotification returns the Notification field value if set, zero value otherwise. +func (o *ProjectSettings) GetNotification() ProjectNotificationSettings { + if o == nil || o.Notification == nil { + var ret ProjectNotificationSettings + return ret + } + return *o.Notification +} + +// GetNotificationOk returns a tuple with the Notification field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectSettings) GetNotificationOk() (*ProjectNotificationSettings, bool) { + if o == nil || o.Notification == nil { + return nil, false + } + return o.Notification, true +} + +// HasNotification returns a boolean if a field has been set. +func (o *ProjectSettings) HasNotification() bool { + return o != nil && o.Notification != nil +} + +// SetNotification gets a reference to the given ProjectNotificationSettings and assigns it to the Notification field. +func (o *ProjectSettings) SetNotification(v ProjectNotificationSettings) { + o.Notification = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProjectSettings) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AutoCloseInactiveCases != nil { + toSerialize["auto_close_inactive_cases"] = o.AutoCloseInactiveCases + } + if o.AutoTransitionAssignedCases != nil { + toSerialize["auto_transition_assigned_cases"] = o.AutoTransitionAssignedCases + } + if o.IntegrationIncident != nil { + toSerialize["integration_incident"] = o.IntegrationIncident + } + if o.IntegrationJira != nil { + toSerialize["integration_jira"] = o.IntegrationJira + } + if o.IntegrationMonitor != nil { + toSerialize["integration_monitor"] = o.IntegrationMonitor + } + if o.IntegrationOnCall != nil { + toSerialize["integration_on_call"] = o.IntegrationOnCall + } + if o.IntegrationServiceNow != nil { + toSerialize["integration_service_now"] = o.IntegrationServiceNow + } + if o.Notification != nil { + toSerialize["notification"] = o.Notification + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ProjectSettings) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AutoCloseInactiveCases *AutoCloseInactiveCases `json:"auto_close_inactive_cases,omitempty"` + AutoTransitionAssignedCases *AutoTransitionAssignedCases `json:"auto_transition_assigned_cases,omitempty"` + IntegrationIncident *IntegrationIncident `json:"integration_incident,omitempty"` + IntegrationJira *IntegrationJira `json:"integration_jira,omitempty"` + IntegrationMonitor *IntegrationMonitor `json:"integration_monitor,omitempty"` + IntegrationOnCall *IntegrationOnCall `json:"integration_on_call,omitempty"` + IntegrationServiceNow *IntegrationServiceNow `json:"integration_service_now,omitempty"` + Notification *ProjectNotificationSettings `json:"notification,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"auto_close_inactive_cases", "auto_transition_assigned_cases", "integration_incident", "integration_jira", "integration_monitor", "integration_on_call", "integration_service_now", "notification"}) + } else { + return err + } + + hasInvalidField := false + if all.AutoCloseInactiveCases != nil && all.AutoCloseInactiveCases.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AutoCloseInactiveCases = all.AutoCloseInactiveCases + if all.AutoTransitionAssignedCases != nil && all.AutoTransitionAssignedCases.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AutoTransitionAssignedCases = all.AutoTransitionAssignedCases + if all.IntegrationIncident != nil && all.IntegrationIncident.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IntegrationIncident = all.IntegrationIncident + if all.IntegrationJira != nil && all.IntegrationJira.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IntegrationJira = all.IntegrationJira + if all.IntegrationMonitor != nil && all.IntegrationMonitor.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IntegrationMonitor = all.IntegrationMonitor + if all.IntegrationOnCall != nil && all.IntegrationOnCall.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IntegrationOnCall = all.IntegrationOnCall + if all.IntegrationServiceNow != nil && all.IntegrationServiceNow.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IntegrationServiceNow = all.IntegrationServiceNow + if all.Notification != nil && all.Notification.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Notification = all.Notification + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_project_update.go b/api/datadogV2/model_project_update.go new file mode 100644 index 00000000000..10f79262f6d --- /dev/null +++ b/api/datadogV2/model_project_update.go @@ -0,0 +1,151 @@ +// 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" +) + +// ProjectUpdate Project update +type ProjectUpdate struct { + // Project update attributes + Attributes *ProjectUpdateAttributes `json:"attributes,omitempty"` + // Project resource type + Type ProjectResourceType `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:"-"` +} + +// NewProjectUpdate instantiates a new ProjectUpdate 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 NewProjectUpdate(typeVar ProjectResourceType) *ProjectUpdate { + this := ProjectUpdate{} + this.Type = typeVar + return &this +} + +// NewProjectUpdateWithDefaults instantiates a new ProjectUpdate 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 NewProjectUpdateWithDefaults() *ProjectUpdate { + this := ProjectUpdate{} + var typeVar ProjectResourceType = PROJECTRESOURCETYPE_PROJECT + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *ProjectUpdate) GetAttributes() ProjectUpdateAttributes { + if o == nil || o.Attributes == nil { + var ret ProjectUpdateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUpdate) GetAttributesOk() (*ProjectUpdateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *ProjectUpdate) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given ProjectUpdateAttributes and assigns it to the Attributes field. +func (o *ProjectUpdate) SetAttributes(v ProjectUpdateAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value. +func (o *ProjectUpdate) GetType() ProjectResourceType { + if o == nil { + var ret ProjectResourceType + 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 *ProjectUpdate) GetTypeOk() (*ProjectResourceType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *ProjectUpdate) SetType(v ProjectResourceType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProjectUpdate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + 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 *ProjectUpdate) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *ProjectUpdateAttributes `json:"attributes,omitempty"` + Type *ProjectResourceType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + 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 != nil && 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_project_update_attributes.go b/api/datadogV2/model_project_update_attributes.go new file mode 100644 index 00000000000..c66351b8a20 --- /dev/null +++ b/api/datadogV2/model_project_update_attributes.go @@ -0,0 +1,254 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// ProjectUpdateAttributes Project update attributes +type ProjectUpdateAttributes struct { + // Project columns configuration + ColumnsConfig *ProjectColumnsConfig `json:"columns_config,omitempty"` + // List of enabled custom case type IDs + EnabledCustomCaseTypes []string `json:"enabled_custom_case_types,omitempty"` + // Project name + Name *string `json:"name,omitempty"` + // Project settings + Settings *ProjectSettings `json:"settings,omitempty"` + // Team UUID to associate with the project + TeamUuid *string `json:"team_uuid,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:"-"` +} + +// NewProjectUpdateAttributes instantiates a new ProjectUpdateAttributes 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 NewProjectUpdateAttributes() *ProjectUpdateAttributes { + this := ProjectUpdateAttributes{} + return &this +} + +// NewProjectUpdateAttributesWithDefaults instantiates a new ProjectUpdateAttributes 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 NewProjectUpdateAttributesWithDefaults() *ProjectUpdateAttributes { + this := ProjectUpdateAttributes{} + return &this +} + +// GetColumnsConfig returns the ColumnsConfig field value if set, zero value otherwise. +func (o *ProjectUpdateAttributes) GetColumnsConfig() ProjectColumnsConfig { + if o == nil || o.ColumnsConfig == nil { + var ret ProjectColumnsConfig + return ret + } + return *o.ColumnsConfig +} + +// GetColumnsConfigOk returns a tuple with the ColumnsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUpdateAttributes) GetColumnsConfigOk() (*ProjectColumnsConfig, bool) { + if o == nil || o.ColumnsConfig == nil { + return nil, false + } + return o.ColumnsConfig, true +} + +// HasColumnsConfig returns a boolean if a field has been set. +func (o *ProjectUpdateAttributes) HasColumnsConfig() bool { + return o != nil && o.ColumnsConfig != nil +} + +// SetColumnsConfig gets a reference to the given ProjectColumnsConfig and assigns it to the ColumnsConfig field. +func (o *ProjectUpdateAttributes) SetColumnsConfig(v ProjectColumnsConfig) { + o.ColumnsConfig = &v +} + +// GetEnabledCustomCaseTypes returns the EnabledCustomCaseTypes field value if set, zero value otherwise. +func (o *ProjectUpdateAttributes) GetEnabledCustomCaseTypes() []string { + if o == nil || o.EnabledCustomCaseTypes == nil { + var ret []string + return ret + } + return o.EnabledCustomCaseTypes +} + +// GetEnabledCustomCaseTypesOk returns a tuple with the EnabledCustomCaseTypes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUpdateAttributes) GetEnabledCustomCaseTypesOk() (*[]string, bool) { + if o == nil || o.EnabledCustomCaseTypes == nil { + return nil, false + } + return &o.EnabledCustomCaseTypes, true +} + +// HasEnabledCustomCaseTypes returns a boolean if a field has been set. +func (o *ProjectUpdateAttributes) HasEnabledCustomCaseTypes() bool { + return o != nil && o.EnabledCustomCaseTypes != nil +} + +// SetEnabledCustomCaseTypes gets a reference to the given []string and assigns it to the EnabledCustomCaseTypes field. +func (o *ProjectUpdateAttributes) SetEnabledCustomCaseTypes(v []string) { + o.EnabledCustomCaseTypes = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ProjectUpdateAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUpdateAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ProjectUpdateAttributes) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ProjectUpdateAttributes) SetName(v string) { + o.Name = &v +} + +// GetSettings returns the Settings field value if set, zero value otherwise. +func (o *ProjectUpdateAttributes) GetSettings() ProjectSettings { + if o == nil || o.Settings == nil { + var ret ProjectSettings + return ret + } + return *o.Settings +} + +// GetSettingsOk returns a tuple with the Settings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUpdateAttributes) GetSettingsOk() (*ProjectSettings, bool) { + if o == nil || o.Settings == nil { + return nil, false + } + return o.Settings, true +} + +// HasSettings returns a boolean if a field has been set. +func (o *ProjectUpdateAttributes) HasSettings() bool { + return o != nil && o.Settings != nil +} + +// SetSettings gets a reference to the given ProjectSettings and assigns it to the Settings field. +func (o *ProjectUpdateAttributes) SetSettings(v ProjectSettings) { + o.Settings = &v +} + +// GetTeamUuid returns the TeamUuid field value if set, zero value otherwise. +func (o *ProjectUpdateAttributes) GetTeamUuid() string { + if o == nil || o.TeamUuid == nil { + var ret string + return ret + } + return *o.TeamUuid +} + +// GetTeamUuidOk returns a tuple with the TeamUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProjectUpdateAttributes) GetTeamUuidOk() (*string, bool) { + if o == nil || o.TeamUuid == nil { + return nil, false + } + return o.TeamUuid, true +} + +// HasTeamUuid returns a boolean if a field has been set. +func (o *ProjectUpdateAttributes) HasTeamUuid() bool { + return o != nil && o.TeamUuid != nil +} + +// SetTeamUuid gets a reference to the given string and assigns it to the TeamUuid field. +func (o *ProjectUpdateAttributes) SetTeamUuid(v string) { + o.TeamUuid = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProjectUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ColumnsConfig != nil { + toSerialize["columns_config"] = o.ColumnsConfig + } + if o.EnabledCustomCaseTypes != nil { + toSerialize["enabled_custom_case_types"] = o.EnabledCustomCaseTypes + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Settings != nil { + toSerialize["settings"] = o.Settings + } + if o.TeamUuid != nil { + toSerialize["team_uuid"] = o.TeamUuid + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ProjectUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ColumnsConfig *ProjectColumnsConfig `json:"columns_config,omitempty"` + EnabledCustomCaseTypes []string `json:"enabled_custom_case_types,omitempty"` + Name *string `json:"name,omitempty"` + Settings *ProjectSettings `json:"settings,omitempty"` + TeamUuid *string `json:"team_uuid,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"columns_config", "enabled_custom_case_types", "name", "settings", "team_uuid"}) + } else { + return err + } + + hasInvalidField := false + if all.ColumnsConfig != nil && all.ColumnsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ColumnsConfig = all.ColumnsConfig + o.EnabledCustomCaseTypes = all.EnabledCustomCaseTypes + o.Name = all.Name + if all.Settings != nil && all.Settings.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Settings = all.Settings + o.TeamUuid = all.TeamUuid + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_project_update_request.go b/api/datadogV2/model_project_update_request.go new file mode 100644 index 00000000000..82a3f0015e0 --- /dev/null +++ b/api/datadogV2/model_project_update_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" +) + +// ProjectUpdateRequest Project update request +type ProjectUpdateRequest struct { + // Project update + Data ProjectUpdate `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:"-"` +} + +// NewProjectUpdateRequest instantiates a new ProjectUpdateRequest 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 NewProjectUpdateRequest(data ProjectUpdate) *ProjectUpdateRequest { + this := ProjectUpdateRequest{} + this.Data = data + return &this +} + +// NewProjectUpdateRequestWithDefaults instantiates a new ProjectUpdateRequest 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 NewProjectUpdateRequestWithDefaults() *ProjectUpdateRequest { + this := ProjectUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *ProjectUpdateRequest) GetData() ProjectUpdate { + if o == nil { + var ret ProjectUpdate + 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 *ProjectUpdateRequest) GetDataOk() (*ProjectUpdate, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *ProjectUpdateRequest) SetData(v ProjectUpdate) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ProjectUpdateRequest) 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 *ProjectUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *ProjectUpdate `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_sync_property.go b/api/datadogV2/model_sync_property.go new file mode 100644 index 00000000000..b2c416f2206 --- /dev/null +++ b/api/datadogV2/model_sync_property.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyncProperty Sync property configuration +type SyncProperty struct { + // + SyncType *string `json:"sync_type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSyncProperty instantiates a new SyncProperty 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 NewSyncProperty() *SyncProperty { + this := SyncProperty{} + return &this +} + +// NewSyncPropertyWithDefaults instantiates a new SyncProperty 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 NewSyncPropertyWithDefaults() *SyncProperty { + this := SyncProperty{} + return &this +} + +// GetSyncType returns the SyncType field value if set, zero value otherwise. +func (o *SyncProperty) GetSyncType() string { + if o == nil || o.SyncType == nil { + var ret string + return ret + } + return *o.SyncType +} + +// GetSyncTypeOk returns a tuple with the SyncType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyncProperty) GetSyncTypeOk() (*string, bool) { + if o == nil || o.SyncType == nil { + return nil, false + } + return o.SyncType, true +} + +// HasSyncType returns a boolean if a field has been set. +func (o *SyncProperty) HasSyncType() bool { + return o != nil && o.SyncType != nil +} + +// SetSyncType gets a reference to the given string and assigns it to the SyncType field. +func (o *SyncProperty) SetSyncType(v string) { + o.SyncType = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyncProperty) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.SyncType != nil { + toSerialize["sync_type"] = o.SyncType + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyncProperty) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + SyncType *string `json:"sync_type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"sync_type"}) + } else { + return err + } + o.SyncType = all.SyncType + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_sync_property_with_mapping.go b/api/datadogV2/model_sync_property_with_mapping.go new file mode 100644 index 00000000000..f85591663c2 --- /dev/null +++ b/api/datadogV2/model_sync_property_with_mapping.go @@ -0,0 +1,172 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SyncPropertyWithMapping Sync property with mapping configuration +type SyncPropertyWithMapping struct { + // + Mapping map[string]string `json:"mapping,omitempty"` + // + NameMapping map[string]string `json:"name_mapping,omitempty"` + // + SyncType *string `json:"sync_type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSyncPropertyWithMapping instantiates a new SyncPropertyWithMapping 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 NewSyncPropertyWithMapping() *SyncPropertyWithMapping { + this := SyncPropertyWithMapping{} + return &this +} + +// NewSyncPropertyWithMappingWithDefaults instantiates a new SyncPropertyWithMapping 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 NewSyncPropertyWithMappingWithDefaults() *SyncPropertyWithMapping { + this := SyncPropertyWithMapping{} + return &this +} + +// GetMapping returns the Mapping field value if set, zero value otherwise. +func (o *SyncPropertyWithMapping) GetMapping() map[string]string { + if o == nil || o.Mapping == nil { + var ret map[string]string + return ret + } + return o.Mapping +} + +// GetMappingOk returns a tuple with the Mapping field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyncPropertyWithMapping) GetMappingOk() (*map[string]string, bool) { + if o == nil || o.Mapping == nil { + return nil, false + } + return &o.Mapping, true +} + +// HasMapping returns a boolean if a field has been set. +func (o *SyncPropertyWithMapping) HasMapping() bool { + return o != nil && o.Mapping != nil +} + +// SetMapping gets a reference to the given map[string]string and assigns it to the Mapping field. +func (o *SyncPropertyWithMapping) SetMapping(v map[string]string) { + o.Mapping = v +} + +// GetNameMapping returns the NameMapping field value if set, zero value otherwise. +func (o *SyncPropertyWithMapping) GetNameMapping() map[string]string { + if o == nil || o.NameMapping == nil { + var ret map[string]string + return ret + } + return o.NameMapping +} + +// GetNameMappingOk returns a tuple with the NameMapping field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyncPropertyWithMapping) GetNameMappingOk() (*map[string]string, bool) { + if o == nil || o.NameMapping == nil { + return nil, false + } + return &o.NameMapping, true +} + +// HasNameMapping returns a boolean if a field has been set. +func (o *SyncPropertyWithMapping) HasNameMapping() bool { + return o != nil && o.NameMapping != nil +} + +// SetNameMapping gets a reference to the given map[string]string and assigns it to the NameMapping field. +func (o *SyncPropertyWithMapping) SetNameMapping(v map[string]string) { + o.NameMapping = v +} + +// GetSyncType returns the SyncType field value if set, zero value otherwise. +func (o *SyncPropertyWithMapping) GetSyncType() string { + if o == nil || o.SyncType == nil { + var ret string + return ret + } + return *o.SyncType +} + +// GetSyncTypeOk returns a tuple with the SyncType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SyncPropertyWithMapping) GetSyncTypeOk() (*string, bool) { + if o == nil || o.SyncType == nil { + return nil, false + } + return o.SyncType, true +} + +// HasSyncType returns a boolean if a field has been set. +func (o *SyncPropertyWithMapping) HasSyncType() bool { + return o != nil && o.SyncType != nil +} + +// SetSyncType gets a reference to the given string and assigns it to the SyncType field. +func (o *SyncPropertyWithMapping) SetSyncType(v string) { + o.SyncType = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SyncPropertyWithMapping) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Mapping != nil { + toSerialize["mapping"] = o.Mapping + } + if o.NameMapping != nil { + toSerialize["name_mapping"] = o.NameMapping + } + if o.SyncType != nil { + toSerialize["sync_type"] = o.SyncType + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SyncPropertyWithMapping) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Mapping map[string]string `json:"mapping,omitempty"` + NameMapping map[string]string `json:"name_mapping,omitempty"` + SyncType *string `json:"sync_type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"mapping", "name_mapping", "sync_type"}) + } else { + return err + } + o.Mapping = all.Mapping + o.NameMapping = all.NameMapping + o.SyncType = all.SyncType + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/case-management/CreateProject.go b/examples/v2/case-management/CreateProject.go index 97f7e714829..84db6b17718 100644 --- a/examples/v2/case-management/CreateProject.go +++ b/examples/v2/case-management/CreateProject.go @@ -16,8 +16,9 @@ func main() { body := datadogV2.ProjectCreateRequest{ Data: datadogV2.ProjectCreate{ Attributes: datadogV2.ProjectCreateAttributes{ - Key: "SEC", - Name: "Security Investigation", + EnabledCustomCaseTypes: []string{}, + Key: "SEC", + Name: "Security Investigation", }, Type: datadogV2.PROJECTRESOURCETYPE_PROJECT, }, diff --git a/examples/v2/case-management/CreateProjectNotificationRule.go b/examples/v2/case-management/CreateProjectNotificationRule.go new file mode 100644 index 00000000000..5f9ae44b55c --- /dev/null +++ b/examples/v2/case-management/CreateProjectNotificationRule.go @@ -0,0 +1,49 @@ +// Create a notification rule returns "CREATED" 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" +) + +func main() { + body := datadogV2.CaseNotificationRuleCreateRequest{ + Data: datadogV2.CaseNotificationRuleCreate{ + Attributes: datadogV2.CaseNotificationRuleCreateAttributes{ + IsEnabled: datadog.PtrBool(true), + Recipients: []datadogV2.CaseNotificationRuleRecipient{ + { + Data: &datadogV2.CaseNotificationRuleRecipientData{}, + Type: datadog.PtrString("EMAIL"), + }, + }, + Triggers: []datadogV2.CaseNotificationRuleTrigger{ + { + Data: &datadogV2.CaseNotificationRuleTriggerData{}, + Type: datadog.PtrString("CASE_CREATED"), + }, + }, + }, + Type: datadogV2.CASENOTIFICATIONRULERESOURCETYPE_NOTIFICATION_RULE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCaseManagementApi(apiClient) + resp, r, err := api.CreateProjectNotificationRule(ctx, "project_id", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.CreateProjectNotificationRule`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CaseManagementApi.CreateProjectNotificationRule`:\n%s\n", responseContent) +} diff --git a/examples/v2/case-management/DeleteProjectNotificationRule.go b/examples/v2/case-management/DeleteProjectNotificationRule.go new file mode 100644 index 00000000000..f8b408214f3 --- /dev/null +++ b/examples/v2/case-management/DeleteProjectNotificationRule.go @@ -0,0 +1,25 @@ +// Delete a notification rule 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" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCaseManagementApi(apiClient) + r, err := api.DeleteProjectNotificationRule(ctx, "project_id", "notification_rule_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.DeleteProjectNotificationRule`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/case-management/GetProjectNotificationRules.go b/examples/v2/case-management/GetProjectNotificationRules.go new file mode 100644 index 00000000000..52f710b24f7 --- /dev/null +++ b/examples/v2/case-management/GetProjectNotificationRules.go @@ -0,0 +1,29 @@ +// Get notification rules 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" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCaseManagementApi(apiClient) + resp, r, err := api.GetProjectNotificationRules(ctx, "project_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.GetProjectNotificationRules`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CaseManagementApi.GetProjectNotificationRules`:\n%s\n", responseContent) +} diff --git a/examples/v2/case-management/UpdateProject.go b/examples/v2/case-management/UpdateProject.go new file mode 100644 index 00000000000..1672f277f4a --- /dev/null +++ b/examples/v2/case-management/UpdateProject.go @@ -0,0 +1,37 @@ +// Update a project 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" +) + +func main() { + body := datadogV2.ProjectUpdateRequest{ + Data: datadogV2.ProjectUpdate{ + Type: datadogV2.PROJECTRESOURCETYPE_PROJECT, + Attributes: &datadogV2.ProjectUpdateAttributes{ + Name: datadog.PtrString("Updated Project Name Example-Case-Management"), + }, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCaseManagementApi(apiClient) + resp, r, err := api.UpdateProject(ctx, "d4bbe1af-f36e-42f1-87c1-493ca35c320e", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.UpdateProject`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `CaseManagementApi.UpdateProject`:\n%s\n", responseContent) +} diff --git a/examples/v2/case-management/UpdateProjectNotificationRule.go b/examples/v2/case-management/UpdateProjectNotificationRule.go new file mode 100644 index 00000000000..cdb7bf796fd --- /dev/null +++ b/examples/v2/case-management/UpdateProjectNotificationRule.go @@ -0,0 +1,44 @@ +// Update a notification rule 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" +) + +func main() { + body := datadogV2.CaseNotificationRuleUpdateRequest{ + Data: datadogV2.CaseNotificationRuleUpdate{ + Attributes: &datadogV2.CaseNotificationRuleAttributes{ + Recipients: []datadogV2.CaseNotificationRuleRecipient{ + { + Data: &datadogV2.CaseNotificationRuleRecipientData{}, + Type: datadog.PtrString("EMAIL"), + }, + }, + Triggers: []datadogV2.CaseNotificationRuleTrigger{ + { + Data: &datadogV2.CaseNotificationRuleTriggerData{}, + Type: datadog.PtrString("CASE_CREATED"), + }, + }, + }, + Type: datadogV2.CASENOTIFICATIONRULERESOURCETYPE_NOTIFICATION_RULE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewCaseManagementApi(apiClient) + r, err := api.UpdateProjectNotificationRule(ctx, "project_id", "notification_rule_id", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.UpdateProjectNotificationRule`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..57657a05d9a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2026-01-28T12:51:16.724Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..0368635b2ac --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_Bad_Request_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"type":"invalid_type"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/cases/projects/d4bbe1af-f36e-42f1-87c1-493ca35c320e + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"got type \"invalid_type\" + expected one of \"project\""}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..cf21958a608 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2026-01-28T12:51:17.270Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..f9a0193f5be --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_Not_Found_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"name":"Updated Project Name"},"type":"project"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/cases/projects/67d80aa3-36ff-44b9-a694-c501a7591737 + response: + body: '{"errors":[{"code":"resource_not_found","title":"failed to get project: + project not found"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_OK_response.freeze new file mode 100644 index 00000000000..b19d06ed2de --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-01-28T12:51:17.621Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_OK_response.yaml new file mode 100644 index 00000000000..409773543de --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Case_Management/Scenario_Update_a_project_returns_OK_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"name":"Updated Project Name Test-Update_a_project_returns_OK_response-1769604677"},"type":"project"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/cases/projects/d4bbe1af-f36e-42f1-87c1-493ca35c320e + response: + body: '{"data":{"id":"d4bbe1af-f36e-42f1-87c1-493ca35c320e","type":"project","attributes":{"key":"DDFC","name":"Updated + Project Name Test-Update_a_project_returns_OK_response-1769604677","restricted":false,"settings":{"notification":{"enabled":true,"destinations":[1],"notify_on_case_assignment":true,"notify_on_case_unassignment":true,"notify_on_case_closed":true,"notify_on_case_priority_change":true,"notify_on_case_comment":true,"notify_on_case_comment_mention":true,"notify_on_case_status_change":true}}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/features/v2/case_management.feature b/tests/scenarios/features/v2/case_management.feature index 2f239155671..7e26a5815f2 100644 --- a/tests/scenarios/features/v2/case_management.feature +++ b/tests/scenarios/features/v2/case_management.feature @@ -116,27 +116,67 @@ Feature: Case Management When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/case-management + Scenario: Create a notification rule returns "Bad Request" response + Given new "CreateProjectNotificationRule" request + And request contains "project_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"is_enabled": true, "recipients": [{"data": {}, "type": "EMAIL"}], "triggers": [{"data": {}, "type": "CASE_CREATED"}]}, "type": "notification_rule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Create a notification rule returns "CREATED" response + Given new "CreateProjectNotificationRule" request + And request contains "project_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"is_enabled": true, "recipients": [{"data": {}, "type": "EMAIL"}], "triggers": [{"data": {}, "type": "CASE_CREATED"}]}, "type": "notification_rule"}} + When the request is sent + Then the response status is 201 CREATED + + @generated @skip @team:DataDog/case-management + Scenario: Create a notification rule returns "Not Found" response + Given new "CreateProjectNotificationRule" request + And request contains "project_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"is_enabled": true, "recipients": [{"data": {}, "type": "EMAIL"}], "triggers": [{"data": {}, "type": "CASE_CREATED"}]}, "type": "notification_rule"}} + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/case-management Scenario: Create a project returns "Bad Request" response Given new "CreateProject" request - And body with value {"data": {"attributes": {"key": "SEC", "name": "Security Investigation"}, "type": "project"}} + And body with value {"data": {"attributes": {"enabled_custom_case_types": [], "key": "SEC", "name": "Security Investigation"}, "type": "project"}} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/case-management Scenario: Create a project returns "CREATED" response Given new "CreateProject" request - And body with value {"data": {"attributes": {"key": "SEC", "name": "Security Investigation"}, "type": "project"}} + And body with value {"data": {"attributes": {"enabled_custom_case_types": [], "key": "SEC", "name": "Security Investigation"}, "type": "project"}} When the request is sent Then the response status is 201 CREATED @generated @skip @team:DataDog/case-management Scenario: Create a project returns "Not Found" response Given new "CreateProject" request - And body with value {"data": {"attributes": {"key": "SEC", "name": "Security Investigation"}, "type": "project"}} + And body with value {"data": {"attributes": {"enabled_custom_case_types": [], "key": "SEC", "name": "Security Investigation"}, "type": "project"}} When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/case-management + Scenario: Delete a notification rule returns "API error response" response + Given new "DeleteProjectNotificationRule" request + And request contains "project_id" parameter from "REPLACE.ME" + And request contains "notification_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 API error response + + @generated @skip @team:DataDog/case-management + Scenario: Delete a notification rule returns "No Content" response + Given new "DeleteProjectNotificationRule" request + And request contains "project_id" parameter from "REPLACE.ME" + And request contains "notification_rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + @skip @team:DataDog/case-management Scenario: Delete case comment returns "Bad Request" response Given new "DeleteCaseComment" request @@ -203,6 +243,27 @@ Feature: Case Management When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/case-management + Scenario: Get notification rules returns "Bad Request" response + Given new "GetProjectNotificationRules" request + And request contains "project_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Get notification rules returns "Not Found" response + Given new "GetProjectNotificationRules" request + And request contains "project_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/case-management + Scenario: Get notification rules returns "OK" response + Given new "GetProjectNotificationRules" request + And request contains "project_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/case-management Scenario: Get the details of a case returns "Bad Request" response Given new "GetCase" request @@ -337,6 +398,59 @@ Feature: Case Management When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/case-management + Scenario: Update a notification rule returns "Bad Request" response + Given new "UpdateProjectNotificationRule" request + And request contains "project_id" parameter from "REPLACE.ME" + And request contains "notification_rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"recipients": [{"data": {}, "type": "EMAIL"}], "triggers": [{"data": {}, "type": "CASE_CREATED"}]}, "type": "notification_rule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Update a notification rule returns "No Content" response + Given new "UpdateProjectNotificationRule" request + And request contains "project_id" parameter from "REPLACE.ME" + And request contains "notification_rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"recipients": [{"data": {}, "type": "EMAIL"}], "triggers": [{"data": {}, "type": "CASE_CREATED"}]}, "type": "notification_rule"}} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/case-management + Scenario: Update a notification rule returns "Not Found" response + Given new "UpdateProjectNotificationRule" request + And request contains "project_id" parameter from "REPLACE.ME" + And request contains "notification_rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"recipients": [{"data": {}, "type": "EMAIL"}], "triggers": [{"data": {}, "type": "CASE_CREATED"}]}, "type": "notification_rule"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/case-management + Scenario: Update a project returns "Bad Request" response + Given new "UpdateProject" request + And request contains "project_id" parameter with value "d4bbe1af-f36e-42f1-87c1-493ca35c320e" + And body with value {"data": {"type": "invalid_type"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/case-management + Scenario: Update a project returns "Not Found" response + Given new "UpdateProject" request + And request contains "project_id" parameter with value "67d80aa3-36ff-44b9-a694-c501a7591737" + And body with value {"data": {"type": "project", "attributes": {"name": "Updated Project Name"}}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/case-management + Scenario: Update a project returns "OK" response + Given new "UpdateProject" request + And request contains "project_id" parameter with value "d4bbe1af-f36e-42f1-87c1-493ca35c320e" + And body with value {"data": {"type": "project", "attributes": {"name": "Updated Project Name {{ unique }}"}}} + When the request is sent + Then the response status is 200 OK + And the response "data" has field "id" + And the response "data.attributes.name" is equal to "Updated Project Name {{ unique }}" + @skip @team:DataDog/case-management Scenario: Update case attributes returns "Bad Request" response Given new "UpdateAttributes" request diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 1d65907ff13..3605ca7f8e7 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -190,6 +190,36 @@ "tag": "Case Management", "operationId": "CreateCase" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"project\",\n \"attributes\": {\n \"key\": \"TST\",\n \"name\": \"Test Project {{ unique }}\"\n }\n }\n}" + } + ], + "source": "data", + "step": "there is a valid \"project\" in the system", + "key": "project", + "tag": "Case Management", + "operationId": "CreateProject" + }, + { + "parameters": [ + { + "name": "project_id", + "value": "d4bbe1af-f36e-42f1-87c1-493ca35c320e" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"notification_rule\",\n \"attributes\": {\n \"is_enabled\": true,\n \"triggers\": [{\"type\": \"CASE_CREATED\", \"data\": {}}],\n \"recipients\": [{\"type\": \"EMAIL\", \"data\": {\"email\": \"test-{{ unique }}@example.com\"}}]\n }\n }\n}" + } + ], + "source": "data", + "step": "there is a valid \"case_notification_rule\" in the system", + "key": "case_notification_rule", + "tag": "Case Management", + "operationId": "CreateProjectNotificationRule" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 5a347bddf11..6387dae5fac 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -693,6 +693,47 @@ "type": "safe" } }, + "UpdateProject": { + "tag": "Case Management", + "undo": { + "type": "idempotent" + } + }, + "GetProjectNotificationRules": { + "tag": "Case Management", + "undo": { + "type": "safe" + } + }, + "CreateProjectNotificationRule": { + "tag": "Case Management", + "undo": { + "operationId": "DeleteProjectNotificationRule", + "parameters": [ + { + "name": "project_id", + "source": "path.project_id" + }, + { + "name": "notification_rule_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteProjectNotificationRule": { + "tag": "Case Management", + "undo": { + "type": "idempotent" + } + }, + "UpdateProjectNotificationRule": { + "tag": "Case Management", + "undo": { + "type": "idempotent" + } + }, "GetAllCaseTypes": { "tag": "Case Management Type", "undo": {