From ed3c6645301c4452c914704a5491362e6ef568a3 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 2 Jun 2026 10:58:18 +0000 Subject: [PATCH] Regenerate client from commit 9027692 of spec repo --- .generator/schemas/v2/openapi.yaml | 532 ++++++++++++++++++ api/datadogV2/api_salesforce_integration.go | 478 ++++++++++++++++ api/datadogV2/doc.go | 6 + ...idents_organization_response_attributes.go | 207 +++++++ ...ce_incidents_organization_response_data.go | 180 ++++++ ..._salesforce_incidents_organization_type.go | 64 +++ ...sforce_incidents_organizations_response.go | 102 ++++ ...ce_incidents_template_create_attributes.go | 273 +++++++++ ...lesforce_incidents_template_create_data.go | 148 +++++ ...force_incidents_template_create_request.go | 110 ++++ ..._salesforce_incidents_template_priority.go | 70 +++ ..._salesforce_incidents_template_response.go | 110 ++++ ..._incidents_template_response_attributes.go | 289 ++++++++++ ...sforce_incidents_template_response_data.go | 180 ++++++ ...odel_salesforce_incidents_template_type.go | 64 +++ ...ce_incidents_template_update_attributes.go | 289 ++++++++++ ...lesforce_incidents_template_update_data.go | 180 ++++++ ...force_incidents_template_update_request.go | 110 ++++ ...salesforce_incidents_templates_response.go | 101 ++++ .../CreateIncidentTemplate.go | 43 ++ .../DeleteIncidentTemplate.go | 25 + .../DeleteSalesforceOrganization.go | 25 + .../GetIncidentTemplates.go | 29 + .../GetSalesforceOrganizations.go | 29 + .../UpdateIncidentTemplate.go | 44 ++ tests/scenarios/api_mappings.go | 1 + tests/scenarios/features/v2/given.json | 12 + .../v2/salesforce_integration.feature | 129 +++++ tests/scenarios/features/v2/undo.json | 43 ++ 29 files changed, 3873 insertions(+) create mode 100644 api/datadogV2/api_salesforce_integration.go create mode 100644 api/datadogV2/model_salesforce_incidents_organization_response_attributes.go create mode 100644 api/datadogV2/model_salesforce_incidents_organization_response_data.go create mode 100644 api/datadogV2/model_salesforce_incidents_organization_type.go create mode 100644 api/datadogV2/model_salesforce_incidents_organizations_response.go create mode 100644 api/datadogV2/model_salesforce_incidents_template_create_attributes.go create mode 100644 api/datadogV2/model_salesforce_incidents_template_create_data.go create mode 100644 api/datadogV2/model_salesforce_incidents_template_create_request.go create mode 100644 api/datadogV2/model_salesforce_incidents_template_priority.go create mode 100644 api/datadogV2/model_salesforce_incidents_template_response.go create mode 100644 api/datadogV2/model_salesforce_incidents_template_response_attributes.go create mode 100644 api/datadogV2/model_salesforce_incidents_template_response_data.go create mode 100644 api/datadogV2/model_salesforce_incidents_template_type.go create mode 100644 api/datadogV2/model_salesforce_incidents_template_update_attributes.go create mode 100644 api/datadogV2/model_salesforce_incidents_template_update_data.go create mode 100644 api/datadogV2/model_salesforce_incidents_template_update_request.go create mode 100644 api/datadogV2/model_salesforce_incidents_templates_response.go create mode 100644 examples/v2/salesforce-integration/CreateIncidentTemplate.go create mode 100644 examples/v2/salesforce-integration/DeleteIncidentTemplate.go create mode 100644 examples/v2/salesforce-integration/DeleteSalesforceOrganization.go create mode 100644 examples/v2/salesforce-integration/GetIncidentTemplates.go create mode 100644 examples/v2/salesforce-integration/GetSalesforceOrganizations.go create mode 100644 examples/v2/salesforce-integration/UpdateIncidentTemplate.go create mode 100644 tests/scenarios/features/v2/salesforce_integration.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b4cbd81ddfa..ecc69ea9c12 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1579,6 +1579,20 @@ components: required: true schema: type: string + SalesforceIncidentsOrganizationIDPathParameter: + description: The Datadog-assigned ID of the connected Salesforce organization. + in: path + name: salesforce_org_id + required: true + schema: + type: string + SalesforceIncidentsTemplateIDPathParameter: + description: The ID of the Salesforce incident template. + in: path + name: incident_template_id + required: true + schema: + type: string SampleLogGenerationContentPackID: description: The identifier of the Cloud SIEM content pack to operate on (for example, `aws-cloudtrail`). in: path @@ -72430,6 +72444,275 @@ components: example: "report_id" type: string type: object + SalesforceIncidentsOrganizationResponseAttributes: + description: Attributes of a Salesforce organization connected to the Datadog Salesforce integration. + properties: + instance_url: + description: The Salesforce instance URL used to call this organization's APIs. + example: "https://acme.my.salesforce.com" + type: string + name: + description: Human-readable name of the Salesforce organization. + example: "Acme Production Org" + type: string + sfdc_org_id: + description: The Salesforce organization identifier (15- or 18-character Salesforce org ID). + example: "00D000000000000" + type: string + sfdc_org_type: + description: The Salesforce organization type (for example, `Production` or `Sandbox`). + example: "Production" + type: string + type: object + SalesforceIncidentsOrganizationResponseData: + description: Salesforce organization data from a response. + properties: + attributes: + $ref: "#/components/schemas/SalesforceIncidentsOrganizationResponseAttributes" + id: + description: The Datadog-assigned ID of the connected Salesforce organization. + example: "596da4af-0563-4097-90ff-07230c3f9db3" + maxLength: 100 + minLength: 1 + type: string + type: + $ref: "#/components/schemas/SalesforceIncidentsOrganizationType" + required: + - id + - type + - attributes + type: object + SalesforceIncidentsOrganizationType: + default: salesforce-incidents-org + description: Salesforce organization resource type. + enum: + - salesforce-incidents-org + example: salesforce-incidents-org + type: string + x-enum-varnames: + - SALESFORCE_INCIDENTS_ORG + SalesforceIncidentsOrganizationsResponse: + description: |- + Response containing a list of Salesforce organizations connected to the + Datadog Salesforce integration. + properties: + data: + description: An array of Salesforce organizations. + items: + $ref: "#/components/schemas/SalesforceIncidentsOrganizationResponseData" + type: array + required: + - data + type: object + SalesforceIncidentsTemplateCreateAttributes: + description: Salesforce incident template attributes for a create request. + properties: + description: + description: Long-form description body for Salesforce incidents created from this template. + example: "An incident was detected by Datadog monitors." + maxLength: 2048 + minLength: 1 + type: string + name: + description: Human-readable name for this incident template. Must be unique within your organization. + example: "production-outage" + maxLength: 100 + minLength: 1 + type: string + owner_id: + description: The Salesforce user ID that owns incidents created from this template. + example: "005000000000000" + maxLength: 255 + minLength: 1 + type: string + priority: + $ref: "#/components/schemas/SalesforceIncidentsTemplatePriority" + salesforce_org_id: + description: The Datadog-assigned ID of the Salesforce organization this template belongs to. + example: "596da4af-0563-4097-90ff-07230c3f9db3" + format: uuid + type: string + subject: + description: Subject line for Salesforce incidents created from this template. + example: "Datadog Incident: Production Outage" + maxLength: 255 + minLength: 1 + type: string + required: + - salesforce_org_id + - name + - subject + - description + - owner_id + - priority + type: object + SalesforceIncidentsTemplateCreateData: + description: Salesforce incident template data for a create request. + properties: + attributes: + $ref: "#/components/schemas/SalesforceIncidentsTemplateCreateAttributes" + type: + $ref: "#/components/schemas/SalesforceIncidentsTemplateType" + required: + - type + - attributes + type: object + SalesforceIncidentsTemplateCreateRequest: + description: Create request for a Salesforce incident template. + properties: + data: + $ref: "#/components/schemas/SalesforceIncidentsTemplateCreateData" + required: + - data + type: object + SalesforceIncidentsTemplatePriority: + description: Priority of the Salesforce incident created from this template. + enum: + - Critical + - High + - Moderate + - Low + example: "High" + type: string + x-enum-varnames: + - CRITICAL + - HIGH + - MODERATE + - LOW + SalesforceIncidentsTemplateResponse: + description: Response containing a Salesforce incident template. + properties: + data: + $ref: "#/components/schemas/SalesforceIncidentsTemplateResponseData" + required: + - data + type: object + SalesforceIncidentsTemplateResponseAttributes: + description: Salesforce incident template attributes returned by the API. + properties: + description: + description: Long-form description body for Salesforce incidents created from this template. + example: "An incident was detected by Datadog monitors." + type: string + name: + description: Human-readable name for this incident template. + example: "production-outage" + type: string + owner_id: + description: The Salesforce user ID that owns incidents created from this template. + example: "005000000000000" + type: string + priority: + $ref: "#/components/schemas/SalesforceIncidentsTemplatePriority" + salesforce_org_id: + description: The Datadog-assigned ID of the Salesforce organization this template belongs to. + example: "596da4af-0563-4097-90ff-07230c3f9db3" + format: uuid + type: string + subject: + description: Subject line for Salesforce incidents created from this template. + example: "Datadog Incident: Production Outage" + type: string + type: object + SalesforceIncidentsTemplateResponseData: + description: Salesforce incident template data from a response. + properties: + attributes: + $ref: "#/components/schemas/SalesforceIncidentsTemplateResponseAttributes" + id: + description: The ID of the Salesforce incident template. + example: "596da4af-0563-4097-90ff-07230c3f9db3" + maxLength: 100 + minLength: 1 + type: string + type: + $ref: "#/components/schemas/SalesforceIncidentsTemplateType" + required: + - id + - type + - attributes + type: object + SalesforceIncidentsTemplateType: + default: salesforce-incidents-incident-template + description: Salesforce incident template resource type. + enum: + - salesforce-incidents-incident-template + example: salesforce-incidents-incident-template + type: string + x-enum-varnames: + - SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE + SalesforceIncidentsTemplateUpdateAttributes: + description: Salesforce incident template attributes for an update request. + properties: + description: + description: Long-form description body for Salesforce incidents created from this template. + example: "An incident was detected by Datadog monitors." + maxLength: 2048 + minLength: 1 + type: string + name: + description: Human-readable name for this incident template. + example: "production-outage" + maxLength: 100 + minLength: 1 + type: string + owner_id: + description: The Salesforce user ID that owns incidents created from this template. + example: "005000000000000" + maxLength: 255 + minLength: 1 + type: string + priority: + $ref: "#/components/schemas/SalesforceIncidentsTemplatePriority" + salesforce_org_id: + description: The Datadog-assigned ID of the Salesforce organization this template belongs to. + example: "596da4af-0563-4097-90ff-07230c3f9db3" + format: uuid + type: string + subject: + description: Subject line for Salesforce incidents created from this template. + example: "Datadog Incident: Production Outage" + maxLength: 255 + minLength: 1 + type: string + type: object + SalesforceIncidentsTemplateUpdateData: + description: Salesforce incident template data for an update request. + properties: + attributes: + $ref: "#/components/schemas/SalesforceIncidentsTemplateUpdateAttributes" + id: + description: The ID of the Salesforce incident template being updated. Must match the path parameter. + example: "596da4af-0563-4097-90ff-07230c3f9db3" + maxLength: 100 + minLength: 1 + type: string + type: + $ref: "#/components/schemas/SalesforceIncidentsTemplateType" + required: + - id + - type + - attributes + type: object + SalesforceIncidentsTemplateUpdateRequest: + description: Update request for a Salesforce incident template. + properties: + data: + $ref: "#/components/schemas/SalesforceIncidentsTemplateUpdateData" + required: + - data + type: object + SalesforceIncidentsTemplatesResponse: + description: Response containing a list of Salesforce incident templates. + properties: + data: + description: An array of Salesforce incident templates. + items: + $ref: "#/components/schemas/SalesforceIncidentsTemplateResponseData" + type: array + required: + - data + type: object SampleLogGenerationBulkSubscriptionAttributes: description: The attributes for creating sample log generation subscriptions for multiple content packs. properties: @@ -126710,6 +126993,249 @@ paths: operator: OR permissions: - manage_integrations + /api/v2/integration/salesforce-incidents/incident-templates: + get: + description: Get all Salesforce incident templates configured for your organization. + operationId: GetIncidentTemplates + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + description: An incident was detected by Datadog monitors. + name: production-outage + owner_id: "005000000000000" + priority: High + salesforce_org_id: 596da4af-0563-4097-90ff-07230c3f9db3 + subject: "Datadog Incident: Production Outage" + id: 00000000-0000-0000-0000-000000000001 + type: salesforce-incidents-incident-template + schema: + $ref: "#/components/schemas/SalesforceIncidentsTemplatesResponse" + description: OK + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get all Salesforce incident templates + tags: + - Salesforce Integration + "x-permission": + operator: OR + permissions: + - integrations_read + post: + description: |- + Create a new Salesforce incident template for your organization. Template + names must be unique within an organization. + operationId: CreateIncidentTemplate + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + description: An incident was detected by Datadog monitors. + name: production-outage + owner_id: "005000000000000" + priority: High + salesforce_org_id: 596da4af-0563-4097-90ff-07230c3f9db3 + subject: "Datadog Incident: Production Outage" + type: salesforce-incidents-incident-template + schema: + $ref: "#/components/schemas/SalesforceIncidentsTemplateCreateRequest" + description: Salesforce incident template payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + description: An incident was detected by Datadog monitors. + name: production-outage + owner_id: "005000000000000" + priority: High + salesforce_org_id: 596da4af-0563-4097-90ff-07230c3f9db3 + subject: "Datadog Incident: Production Outage" + id: 00000000-0000-0000-0000-000000000002 + type: salesforce-incidents-incident-template + schema: + $ref: "#/components/schemas/SalesforceIncidentsTemplateResponse" + description: CREATED + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "409": + $ref: "#/components/responses/ConflictResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create a Salesforce incident template + tags: + - Salesforce Integration + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - manage_integrations + /api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id}: + delete: + description: Delete a single Salesforce incident template from your organization. + operationId: DeleteIncidentTemplate + parameters: + - $ref: "#/components/parameters/SalesforceIncidentsTemplateIDPathParameter" + responses: + "204": + description: OK + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a Salesforce incident template + tags: + - Salesforce Integration + "x-permission": + operator: OR + permissions: + - manage_integrations + patch: + description: Update a single Salesforce incident template in your organization. + operationId: UpdateIncidentTemplate + parameters: + - $ref: "#/components/parameters/SalesforceIncidentsTemplateIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: production-outage-renamed + id: 596da4af-0563-4097-90ff-07230c3f9db3 + type: salesforce-incidents-incident-template + schema: + $ref: "#/components/schemas/SalesforceIncidentsTemplateUpdateRequest" + description: Salesforce incident template payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + description: An incident was detected by Datadog monitors. + name: production-outage-renamed + owner_id: "005000000000000" + priority: High + salesforce_org_id: 596da4af-0563-4097-90ff-07230c3f9db3 + subject: "Datadog Incident: Production Outage" + id: 00000000-0000-0000-0000-000000000003 + type: salesforce-incidents-incident-template + schema: + $ref: "#/components/schemas/SalesforceIncidentsTemplateResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "409": + $ref: "#/components/responses/ConflictResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update a Salesforce incident template + tags: + - Salesforce Integration + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - manage_integrations + /api/v2/integration/salesforce-incidents/organizations: + get: + description: |- + Get all Salesforce organizations connected to your Datadog organization + through the Salesforce integration. Salesforce organizations are connected + through the OAuth setup flow in the Datadog Salesforce integration page. + operationId: GetSalesforceOrganizations + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + instance_url: "https://acme.my.salesforce.com" + name: "Acme Production Org" + sfdc_org_id: "00D000000000000" + sfdc_org_type: "Production" + id: 00000000-0000-0000-0000-000000000001 + type: salesforce-incidents-org + schema: + $ref: "#/components/schemas/SalesforceIncidentsOrganizationsResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get all connected Salesforce organizations + tags: + - Salesforce Integration + "x-permission": + operator: OR + permissions: + - integrations_read + /api/v2/integration/salesforce-incidents/organizations/{salesforce_org_id}: + delete: + description: |- + Disconnect a Salesforce organization from your Datadog organization. + This also deletes any incident templates referencing the organization. + operationId: DeleteSalesforceOrganization + parameters: + - $ref: "#/components/parameters/SalesforceIncidentsOrganizationIDPathParameter" + responses: + "204": + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a connected Salesforce organization + tags: + - Salesforce Integration + "x-permission": + operator: OR + permissions: + - manage_integrations /api/v2/integration/servicenow/assignment_groups/{instance_id}: get: description: |- @@ -173003,6 +173529,12 @@ tags: - description: |- Manage retention filters through [Manage Applications](https://app.datadoghq.com/rum/list) of RUM for your organization. name: Rum Retention Filters + - description: |- + Configure your [Datadog Salesforce integration](https://docs.datadoghq.com/integrations/salesforce/) + directly through the Datadog API. + externalDocs: + url: https://docs.datadoghq.com/api/latest/salesforce-integration + name: Salesforce Integration - description: |- API to create and update scorecard rules and outcomes. See [Scorecards](https://docs.datadoghq.com/service_catalog/scorecards) for more information. name: Scorecards diff --git a/api/datadogV2/api_salesforce_integration.go b/api/datadogV2/api_salesforce_integration.go new file mode 100644 index 00000000000..93e9bb5a111 --- /dev/null +++ b/api/datadogV2/api_salesforce_integration.go @@ -0,0 +1,478 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + _context "context" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SalesforceIntegrationApi service type +type SalesforceIntegrationApi datadog.Service + +// CreateIncidentTemplate Create a Salesforce incident template. +// Create a new Salesforce incident template for your organization. Template +// names must be unique within an organization. +func (a *SalesforceIntegrationApi) CreateIncidentTemplate(ctx _context.Context, body SalesforceIncidentsTemplateCreateRequest) (SalesforceIncidentsTemplateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue SalesforceIncidentsTemplateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SalesforceIntegrationApi.CreateIncidentTemplate") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/salesforce-incidents/incident-templates" + + 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 == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 409 || 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 +} + +// DeleteIncidentTemplate Delete a Salesforce incident template. +// Delete a single Salesforce incident template from your organization. +func (a *SalesforceIntegrationApi) DeleteIncidentTemplate(ctx _context.Context, incidentTemplateId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SalesforceIntegrationApi.DeleteIncidentTemplate") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_template_id}", _neturl.PathEscape(datadog.ParameterToString(incidentTemplateId, ""))) + + 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 +} + +// DeleteSalesforceOrganization Delete a connected Salesforce organization. +// Disconnect a Salesforce organization from your Datadog organization. +// This also deletes any incident templates referencing the organization. +func (a *SalesforceIntegrationApi) DeleteSalesforceOrganization(ctx _context.Context, salesforceOrgId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SalesforceIntegrationApi.DeleteSalesforceOrganization") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/salesforce-incidents/organizations/{salesforce_org_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{salesforce_org_id}", _neturl.PathEscape(datadog.ParameterToString(salesforceOrgId, ""))) + + 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 == 400 || 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 +} + +// GetIncidentTemplates Get all Salesforce incident templates. +// Get all Salesforce incident templates configured for your organization. +func (a *SalesforceIntegrationApi) GetIncidentTemplates(ctx _context.Context) (SalesforceIncidentsTemplatesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SalesforceIncidentsTemplatesResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SalesforceIntegrationApi.GetIncidentTemplates") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/salesforce-incidents/incident-templates" + + 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 == 403 || 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 +} + +// GetSalesforceOrganizations Get all connected Salesforce organizations. +// Get all Salesforce organizations connected to your Datadog organization +// through the Salesforce integration. Salesforce organizations are connected +// through the OAuth setup flow in the Datadog Salesforce integration page. +func (a *SalesforceIntegrationApi) GetSalesforceOrganizations(ctx _context.Context) (SalesforceIncidentsOrganizationsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SalesforceIncidentsOrganizationsResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SalesforceIntegrationApi.GetSalesforceOrganizations") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/salesforce-incidents/organizations" + + 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 == 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 +} + +// UpdateIncidentTemplate Update a Salesforce incident template. +// Update a single Salesforce incident template in your organization. +func (a *SalesforceIntegrationApi) UpdateIncidentTemplate(ctx _context.Context, incidentTemplateId string, body SalesforceIncidentsTemplateUpdateRequest) (SalesforceIncidentsTemplateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue SalesforceIncidentsTemplateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SalesforceIntegrationApi.UpdateIncidentTemplate") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_template_id}", _neturl.PathEscape(datadog.ParameterToString(incidentTemplateId, ""))) + + 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 == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 409 || 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 +} + +// NewSalesforceIntegrationApi Returns NewSalesforceIntegrationApi. +func NewSalesforceIntegrationApi(client *datadog.APIClient) *SalesforceIntegrationApi { + return &SalesforceIntegrationApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 4cc44369057..91e6873a404 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -860,6 +860,12 @@ // - [RumRetentionFiltersApi.OrderRetentionFilters] // - [RumRetentionFiltersApi.UpdatePermanentRetentionFilter] // - [RumRetentionFiltersApi.UpdateRetentionFilter] +// - [SalesforceIntegrationApi.CreateIncidentTemplate] +// - [SalesforceIntegrationApi.DeleteIncidentTemplate] +// - [SalesforceIntegrationApi.DeleteSalesforceOrganization] +// - [SalesforceIntegrationApi.GetIncidentTemplates] +// - [SalesforceIntegrationApi.GetSalesforceOrganizations] +// - [SalesforceIntegrationApi.UpdateIncidentTemplate] // - [ScorecardsApi.CreateScorecardCampaign] // - [ScorecardsApi.CreateScorecardOutcomesBatch] // - [ScorecardsApi.CreateScorecardRule] diff --git a/api/datadogV2/model_salesforce_incidents_organization_response_attributes.go b/api/datadogV2/model_salesforce_incidents_organization_response_attributes.go new file mode 100644 index 00000000000..2aa8acccb68 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_organization_response_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" +) + +// SalesforceIncidentsOrganizationResponseAttributes Attributes of a Salesforce organization connected to the Datadog Salesforce integration. +type SalesforceIncidentsOrganizationResponseAttributes struct { + // The Salesforce instance URL used to call this organization's APIs. + InstanceUrl *string `json:"instance_url,omitempty"` + // Human-readable name of the Salesforce organization. + Name *string `json:"name,omitempty"` + // The Salesforce organization identifier (15- or 18-character Salesforce org ID). + SfdcOrgId *string `json:"sfdc_org_id,omitempty"` + // The Salesforce organization type (for example, `Production` or `Sandbox`). + SfdcOrgType *string `json:"sfdc_org_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:"-"` +} + +// NewSalesforceIncidentsOrganizationResponseAttributes instantiates a new SalesforceIncidentsOrganizationResponseAttributes 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 NewSalesforceIncidentsOrganizationResponseAttributes() *SalesforceIncidentsOrganizationResponseAttributes { + this := SalesforceIncidentsOrganizationResponseAttributes{} + return &this +} + +// NewSalesforceIncidentsOrganizationResponseAttributesWithDefaults instantiates a new SalesforceIncidentsOrganizationResponseAttributes 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 NewSalesforceIncidentsOrganizationResponseAttributesWithDefaults() *SalesforceIncidentsOrganizationResponseAttributes { + this := SalesforceIncidentsOrganizationResponseAttributes{} + return &this +} + +// GetInstanceUrl returns the InstanceUrl field value if set, zero value otherwise. +func (o *SalesforceIncidentsOrganizationResponseAttributes) GetInstanceUrl() string { + if o == nil || o.InstanceUrl == nil { + var ret string + return ret + } + return *o.InstanceUrl +} + +// GetInstanceUrlOk returns a tuple with the InstanceUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsOrganizationResponseAttributes) GetInstanceUrlOk() (*string, bool) { + if o == nil || o.InstanceUrl == nil { + return nil, false + } + return o.InstanceUrl, true +} + +// HasInstanceUrl returns a boolean if a field has been set. +func (o *SalesforceIncidentsOrganizationResponseAttributes) HasInstanceUrl() bool { + return o != nil && o.InstanceUrl != nil +} + +// SetInstanceUrl gets a reference to the given string and assigns it to the InstanceUrl field. +func (o *SalesforceIncidentsOrganizationResponseAttributes) SetInstanceUrl(v string) { + o.InstanceUrl = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SalesforceIncidentsOrganizationResponseAttributes) 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 *SalesforceIncidentsOrganizationResponseAttributes) 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 *SalesforceIncidentsOrganizationResponseAttributes) 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 *SalesforceIncidentsOrganizationResponseAttributes) SetName(v string) { + o.Name = &v +} + +// GetSfdcOrgId returns the SfdcOrgId field value if set, zero value otherwise. +func (o *SalesforceIncidentsOrganizationResponseAttributes) GetSfdcOrgId() string { + if o == nil || o.SfdcOrgId == nil { + var ret string + return ret + } + return *o.SfdcOrgId +} + +// GetSfdcOrgIdOk returns a tuple with the SfdcOrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsOrganizationResponseAttributes) GetSfdcOrgIdOk() (*string, bool) { + if o == nil || o.SfdcOrgId == nil { + return nil, false + } + return o.SfdcOrgId, true +} + +// HasSfdcOrgId returns a boolean if a field has been set. +func (o *SalesforceIncidentsOrganizationResponseAttributes) HasSfdcOrgId() bool { + return o != nil && o.SfdcOrgId != nil +} + +// SetSfdcOrgId gets a reference to the given string and assigns it to the SfdcOrgId field. +func (o *SalesforceIncidentsOrganizationResponseAttributes) SetSfdcOrgId(v string) { + o.SfdcOrgId = &v +} + +// GetSfdcOrgType returns the SfdcOrgType field value if set, zero value otherwise. +func (o *SalesforceIncidentsOrganizationResponseAttributes) GetSfdcOrgType() string { + if o == nil || o.SfdcOrgType == nil { + var ret string + return ret + } + return *o.SfdcOrgType +} + +// GetSfdcOrgTypeOk returns a tuple with the SfdcOrgType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsOrganizationResponseAttributes) GetSfdcOrgTypeOk() (*string, bool) { + if o == nil || o.SfdcOrgType == nil { + return nil, false + } + return o.SfdcOrgType, true +} + +// HasSfdcOrgType returns a boolean if a field has been set. +func (o *SalesforceIncidentsOrganizationResponseAttributes) HasSfdcOrgType() bool { + return o != nil && o.SfdcOrgType != nil +} + +// SetSfdcOrgType gets a reference to the given string and assigns it to the SfdcOrgType field. +func (o *SalesforceIncidentsOrganizationResponseAttributes) SetSfdcOrgType(v string) { + o.SfdcOrgType = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsOrganizationResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.InstanceUrl != nil { + toSerialize["instance_url"] = o.InstanceUrl + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.SfdcOrgId != nil { + toSerialize["sfdc_org_id"] = o.SfdcOrgId + } + if o.SfdcOrgType != nil { + toSerialize["sfdc_org_type"] = o.SfdcOrgType + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SalesforceIncidentsOrganizationResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + InstanceUrl *string `json:"instance_url,omitempty"` + Name *string `json:"name,omitempty"` + SfdcOrgId *string `json:"sfdc_org_id,omitempty"` + SfdcOrgType *string `json:"sfdc_org_type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"instance_url", "name", "sfdc_org_id", "sfdc_org_type"}) + } else { + return err + } + o.InstanceUrl = all.InstanceUrl + o.Name = all.Name + o.SfdcOrgId = all.SfdcOrgId + o.SfdcOrgType = all.SfdcOrgType + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_salesforce_incidents_organization_response_data.go b/api/datadogV2/model_salesforce_incidents_organization_response_data.go new file mode 100644 index 00000000000..8ae751e01cf --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_organization_response_data.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" +) + +// SalesforceIncidentsOrganizationResponseData Salesforce organization data from a response. +type SalesforceIncidentsOrganizationResponseData struct { + // Attributes of a Salesforce organization connected to the Datadog Salesforce integration. + Attributes SalesforceIncidentsOrganizationResponseAttributes `json:"attributes"` + // The Datadog-assigned ID of the connected Salesforce organization. + Id string `json:"id"` + // Salesforce organization resource type. + Type SalesforceIncidentsOrganizationType `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:"-"` +} + +// NewSalesforceIncidentsOrganizationResponseData instantiates a new SalesforceIncidentsOrganizationResponseData 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 NewSalesforceIncidentsOrganizationResponseData(attributes SalesforceIncidentsOrganizationResponseAttributes, id string, typeVar SalesforceIncidentsOrganizationType) *SalesforceIncidentsOrganizationResponseData { + this := SalesforceIncidentsOrganizationResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewSalesforceIncidentsOrganizationResponseDataWithDefaults instantiates a new SalesforceIncidentsOrganizationResponseData 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 NewSalesforceIncidentsOrganizationResponseDataWithDefaults() *SalesforceIncidentsOrganizationResponseData { + this := SalesforceIncidentsOrganizationResponseData{} + var typeVar SalesforceIncidentsOrganizationType = SALESFORCEINCIDENTSORGANIZATIONTYPE_SALESFORCE_INCIDENTS_ORG + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *SalesforceIncidentsOrganizationResponseData) GetAttributes() SalesforceIncidentsOrganizationResponseAttributes { + if o == nil { + var ret SalesforceIncidentsOrganizationResponseAttributes + 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 *SalesforceIncidentsOrganizationResponseData) GetAttributesOk() (*SalesforceIncidentsOrganizationResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *SalesforceIncidentsOrganizationResponseData) SetAttributes(v SalesforceIncidentsOrganizationResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *SalesforceIncidentsOrganizationResponseData) 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 *SalesforceIncidentsOrganizationResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *SalesforceIncidentsOrganizationResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *SalesforceIncidentsOrganizationResponseData) GetType() SalesforceIncidentsOrganizationType { + if o == nil { + var ret SalesforceIncidentsOrganizationType + 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 *SalesforceIncidentsOrganizationResponseData) GetTypeOk() (*SalesforceIncidentsOrganizationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SalesforceIncidentsOrganizationResponseData) SetType(v SalesforceIncidentsOrganizationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsOrganizationResponseData) 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 *SalesforceIncidentsOrganizationResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SalesforceIncidentsOrganizationResponseAttributes `json:"attributes"` + Id *string `json:"id"` + Type *SalesforceIncidentsOrganizationType `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.UnmarshalUseNumber(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_salesforce_incidents_organization_type.go b/api/datadogV2/model_salesforce_incidents_organization_type.go new file mode 100644 index 00000000000..b6ccff04333 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_organization_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" +) + +// SalesforceIncidentsOrganizationType Salesforce organization resource type. +type SalesforceIncidentsOrganizationType string + +// List of SalesforceIncidentsOrganizationType. +const ( + SALESFORCEINCIDENTSORGANIZATIONTYPE_SALESFORCE_INCIDENTS_ORG SalesforceIncidentsOrganizationType = "salesforce-incidents-org" +) + +var allowedSalesforceIncidentsOrganizationTypeEnumValues = []SalesforceIncidentsOrganizationType{ + SALESFORCEINCIDENTSORGANIZATIONTYPE_SALESFORCE_INCIDENTS_ORG, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SalesforceIncidentsOrganizationType) GetAllowedValues() []SalesforceIncidentsOrganizationType { + return allowedSalesforceIncidentsOrganizationTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SalesforceIncidentsOrganizationType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SalesforceIncidentsOrganizationType(value) + return nil +} + +// NewSalesforceIncidentsOrganizationTypeFromValue returns a pointer to a valid SalesforceIncidentsOrganizationType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSalesforceIncidentsOrganizationTypeFromValue(v string) (*SalesforceIncidentsOrganizationType, error) { + ev := SalesforceIncidentsOrganizationType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SalesforceIncidentsOrganizationType: valid values are %v", v, allowedSalesforceIncidentsOrganizationTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SalesforceIncidentsOrganizationType) IsValid() bool { + for _, existing := range allowedSalesforceIncidentsOrganizationTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SalesforceIncidentsOrganizationType value. +func (v SalesforceIncidentsOrganizationType) Ptr() *SalesforceIncidentsOrganizationType { + return &v +} diff --git a/api/datadogV2/model_salesforce_incidents_organizations_response.go b/api/datadogV2/model_salesforce_incidents_organizations_response.go new file mode 100644 index 00000000000..6b9b24308d5 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_organizations_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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SalesforceIncidentsOrganizationsResponse Response containing a list of Salesforce organizations connected to the +// Datadog Salesforce integration. +type SalesforceIncidentsOrganizationsResponse struct { + // An array of Salesforce organizations. + Data []SalesforceIncidentsOrganizationResponseData `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:"-"` +} + +// NewSalesforceIncidentsOrganizationsResponse instantiates a new SalesforceIncidentsOrganizationsResponse 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 NewSalesforceIncidentsOrganizationsResponse(data []SalesforceIncidentsOrganizationResponseData) *SalesforceIncidentsOrganizationsResponse { + this := SalesforceIncidentsOrganizationsResponse{} + this.Data = data + return &this +} + +// NewSalesforceIncidentsOrganizationsResponseWithDefaults instantiates a new SalesforceIncidentsOrganizationsResponse 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 NewSalesforceIncidentsOrganizationsResponseWithDefaults() *SalesforceIncidentsOrganizationsResponse { + this := SalesforceIncidentsOrganizationsResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *SalesforceIncidentsOrganizationsResponse) GetData() []SalesforceIncidentsOrganizationResponseData { + if o == nil { + var ret []SalesforceIncidentsOrganizationResponseData + 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 *SalesforceIncidentsOrganizationsResponse) GetDataOk() (*[]SalesforceIncidentsOrganizationResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SalesforceIncidentsOrganizationsResponse) SetData(v []SalesforceIncidentsOrganizationResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsOrganizationsResponse) 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 *SalesforceIncidentsOrganizationsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]SalesforceIncidentsOrganizationResponseData `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.UnmarshalUseNumber(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_salesforce_incidents_template_create_attributes.go b/api/datadogV2/model_salesforce_incidents_template_create_attributes.go new file mode 100644 index 00000000000..011b30205c1 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_template_create_attributes.go @@ -0,0 +1,273 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SalesforceIncidentsTemplateCreateAttributes Salesforce incident template attributes for a create request. +type SalesforceIncidentsTemplateCreateAttributes struct { + // Long-form description body for Salesforce incidents created from this template. + Description string `json:"description"` + // Human-readable name for this incident template. Must be unique within your organization. + Name string `json:"name"` + // The Salesforce user ID that owns incidents created from this template. + OwnerId string `json:"owner_id"` + // Priority of the Salesforce incident created from this template. + Priority SalesforceIncidentsTemplatePriority `json:"priority"` + // The Datadog-assigned ID of the Salesforce organization this template belongs to. + SalesforceOrgId uuid.UUID `json:"salesforce_org_id"` + // Subject line for Salesforce incidents created from this template. + Subject string `json:"subject"` + // 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:"-"` +} + +// NewSalesforceIncidentsTemplateCreateAttributes instantiates a new SalesforceIncidentsTemplateCreateAttributes 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 NewSalesforceIncidentsTemplateCreateAttributes(description string, name string, ownerId string, priority SalesforceIncidentsTemplatePriority, salesforceOrgId uuid.UUID, subject string) *SalesforceIncidentsTemplateCreateAttributes { + this := SalesforceIncidentsTemplateCreateAttributes{} + this.Description = description + this.Name = name + this.OwnerId = ownerId + this.Priority = priority + this.SalesforceOrgId = salesforceOrgId + this.Subject = subject + return &this +} + +// NewSalesforceIncidentsTemplateCreateAttributesWithDefaults instantiates a new SalesforceIncidentsTemplateCreateAttributes 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 NewSalesforceIncidentsTemplateCreateAttributesWithDefaults() *SalesforceIncidentsTemplateCreateAttributes { + this := SalesforceIncidentsTemplateCreateAttributes{} + return &this +} + +// GetDescription returns the Description field value. +func (o *SalesforceIncidentsTemplateCreateAttributes) GetDescription() string { + if o == nil { + var ret string + return ret + } + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsTemplateCreateAttributes) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value. +func (o *SalesforceIncidentsTemplateCreateAttributes) SetDescription(v string) { + o.Description = v +} + +// GetName returns the Name field value. +func (o *SalesforceIncidentsTemplateCreateAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsTemplateCreateAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *SalesforceIncidentsTemplateCreateAttributes) SetName(v string) { + o.Name = v +} + +// GetOwnerId returns the OwnerId field value. +func (o *SalesforceIncidentsTemplateCreateAttributes) GetOwnerId() string { + if o == nil { + var ret string + return ret + } + return o.OwnerId +} + +// GetOwnerIdOk returns a tuple with the OwnerId field value +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsTemplateCreateAttributes) GetOwnerIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OwnerId, true +} + +// SetOwnerId sets field value. +func (o *SalesforceIncidentsTemplateCreateAttributes) SetOwnerId(v string) { + o.OwnerId = v +} + +// GetPriority returns the Priority field value. +func (o *SalesforceIncidentsTemplateCreateAttributes) GetPriority() SalesforceIncidentsTemplatePriority { + if o == nil { + var ret SalesforceIncidentsTemplatePriority + return ret + } + return o.Priority +} + +// GetPriorityOk returns a tuple with the Priority field value +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsTemplateCreateAttributes) GetPriorityOk() (*SalesforceIncidentsTemplatePriority, bool) { + if o == nil { + return nil, false + } + return &o.Priority, true +} + +// SetPriority sets field value. +func (o *SalesforceIncidentsTemplateCreateAttributes) SetPriority(v SalesforceIncidentsTemplatePriority) { + o.Priority = v +} + +// GetSalesforceOrgId returns the SalesforceOrgId field value. +func (o *SalesforceIncidentsTemplateCreateAttributes) GetSalesforceOrgId() uuid.UUID { + if o == nil { + var ret uuid.UUID + return ret + } + return o.SalesforceOrgId +} + +// GetSalesforceOrgIdOk returns a tuple with the SalesforceOrgId field value +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsTemplateCreateAttributes) GetSalesforceOrgIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.SalesforceOrgId, true +} + +// SetSalesforceOrgId sets field value. +func (o *SalesforceIncidentsTemplateCreateAttributes) SetSalesforceOrgId(v uuid.UUID) { + o.SalesforceOrgId = v +} + +// GetSubject returns the Subject field value. +func (o *SalesforceIncidentsTemplateCreateAttributes) GetSubject() string { + if o == nil { + var ret string + return ret + } + return o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsTemplateCreateAttributes) GetSubjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subject, true +} + +// SetSubject sets field value. +func (o *SalesforceIncidentsTemplateCreateAttributes) SetSubject(v string) { + o.Subject = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsTemplateCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["description"] = o.Description + toSerialize["name"] = o.Name + toSerialize["owner_id"] = o.OwnerId + toSerialize["priority"] = o.Priority + toSerialize["salesforce_org_id"] = o.SalesforceOrgId + toSerialize["subject"] = o.Subject + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SalesforceIncidentsTemplateCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Description *string `json:"description"` + Name *string `json:"name"` + OwnerId *string `json:"owner_id"` + Priority *SalesforceIncidentsTemplatePriority `json:"priority"` + SalesforceOrgId *uuid.UUID `json:"salesforce_org_id"` + Subject *string `json:"subject"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Description == nil { + return fmt.Errorf("required field description missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.OwnerId == nil { + return fmt.Errorf("required field owner_id missing") + } + if all.Priority == nil { + return fmt.Errorf("required field priority missing") + } + if all.SalesforceOrgId == nil { + return fmt.Errorf("required field salesforce_org_id missing") + } + if all.Subject == nil { + return fmt.Errorf("required field subject missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"description", "name", "owner_id", "priority", "salesforce_org_id", "subject"}) + } else { + return err + } + + hasInvalidField := false + o.Description = *all.Description + o.Name = *all.Name + o.OwnerId = *all.OwnerId + if !all.Priority.IsValid() { + hasInvalidField = true + } else { + o.Priority = *all.Priority + } + o.SalesforceOrgId = *all.SalesforceOrgId + o.Subject = *all.Subject + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_salesforce_incidents_template_create_data.go b/api/datadogV2/model_salesforce_incidents_template_create_data.go new file mode 100644 index 00000000000..59bfdeb2411 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_template_create_data.go @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SalesforceIncidentsTemplateCreateData Salesforce incident template data for a create request. +type SalesforceIncidentsTemplateCreateData struct { + // Salesforce incident template attributes for a create request. + Attributes SalesforceIncidentsTemplateCreateAttributes `json:"attributes"` + // Salesforce incident template resource type. + Type SalesforceIncidentsTemplateType `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:"-"` +} + +// NewSalesforceIncidentsTemplateCreateData instantiates a new SalesforceIncidentsTemplateCreateData 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 NewSalesforceIncidentsTemplateCreateData(attributes SalesforceIncidentsTemplateCreateAttributes, typeVar SalesforceIncidentsTemplateType) *SalesforceIncidentsTemplateCreateData { + this := SalesforceIncidentsTemplateCreateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewSalesforceIncidentsTemplateCreateDataWithDefaults instantiates a new SalesforceIncidentsTemplateCreateData 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 NewSalesforceIncidentsTemplateCreateDataWithDefaults() *SalesforceIncidentsTemplateCreateData { + this := SalesforceIncidentsTemplateCreateData{} + var typeVar SalesforceIncidentsTemplateType = SALESFORCEINCIDENTSTEMPLATETYPE_SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *SalesforceIncidentsTemplateCreateData) GetAttributes() SalesforceIncidentsTemplateCreateAttributes { + if o == nil { + var ret SalesforceIncidentsTemplateCreateAttributes + 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 *SalesforceIncidentsTemplateCreateData) GetAttributesOk() (*SalesforceIncidentsTemplateCreateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *SalesforceIncidentsTemplateCreateData) SetAttributes(v SalesforceIncidentsTemplateCreateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *SalesforceIncidentsTemplateCreateData) GetType() SalesforceIncidentsTemplateType { + if o == nil { + var ret SalesforceIncidentsTemplateType + 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 *SalesforceIncidentsTemplateCreateData) GetTypeOk() (*SalesforceIncidentsTemplateType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SalesforceIncidentsTemplateCreateData) SetType(v SalesforceIncidentsTemplateType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsTemplateCreateData) 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 *SalesforceIncidentsTemplateCreateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SalesforceIncidentsTemplateCreateAttributes `json:"attributes"` + Type *SalesforceIncidentsTemplateType `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.UnmarshalUseNumber(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_salesforce_incidents_template_create_request.go b/api/datadogV2/model_salesforce_incidents_template_create_request.go new file mode 100644 index 00000000000..dd86e39be4a --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_template_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" +) + +// SalesforceIncidentsTemplateCreateRequest Create request for a Salesforce incident template. +type SalesforceIncidentsTemplateCreateRequest struct { + // Salesforce incident template data for a create request. + Data SalesforceIncidentsTemplateCreateData `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:"-"` +} + +// NewSalesforceIncidentsTemplateCreateRequest instantiates a new SalesforceIncidentsTemplateCreateRequest 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 NewSalesforceIncidentsTemplateCreateRequest(data SalesforceIncidentsTemplateCreateData) *SalesforceIncidentsTemplateCreateRequest { + this := SalesforceIncidentsTemplateCreateRequest{} + this.Data = data + return &this +} + +// NewSalesforceIncidentsTemplateCreateRequestWithDefaults instantiates a new SalesforceIncidentsTemplateCreateRequest 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 NewSalesforceIncidentsTemplateCreateRequestWithDefaults() *SalesforceIncidentsTemplateCreateRequest { + this := SalesforceIncidentsTemplateCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *SalesforceIncidentsTemplateCreateRequest) GetData() SalesforceIncidentsTemplateCreateData { + if o == nil { + var ret SalesforceIncidentsTemplateCreateData + 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 *SalesforceIncidentsTemplateCreateRequest) GetDataOk() (*SalesforceIncidentsTemplateCreateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SalesforceIncidentsTemplateCreateRequest) SetData(v SalesforceIncidentsTemplateCreateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsTemplateCreateRequest) 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 *SalesforceIncidentsTemplateCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *SalesforceIncidentsTemplateCreateData `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.UnmarshalUseNumber(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_salesforce_incidents_template_priority.go b/api/datadogV2/model_salesforce_incidents_template_priority.go new file mode 100644 index 00000000000..954da50e947 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_template_priority.go @@ -0,0 +1,70 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SalesforceIncidentsTemplatePriority Priority of the Salesforce incident created from this template. +type SalesforceIncidentsTemplatePriority string + +// List of SalesforceIncidentsTemplatePriority. +const ( + SALESFORCEINCIDENTSTEMPLATEPRIORITY_CRITICAL SalesforceIncidentsTemplatePriority = "Critical" + SALESFORCEINCIDENTSTEMPLATEPRIORITY_HIGH SalesforceIncidentsTemplatePriority = "High" + SALESFORCEINCIDENTSTEMPLATEPRIORITY_MODERATE SalesforceIncidentsTemplatePriority = "Moderate" + SALESFORCEINCIDENTSTEMPLATEPRIORITY_LOW SalesforceIncidentsTemplatePriority = "Low" +) + +var allowedSalesforceIncidentsTemplatePriorityEnumValues = []SalesforceIncidentsTemplatePriority{ + SALESFORCEINCIDENTSTEMPLATEPRIORITY_CRITICAL, + SALESFORCEINCIDENTSTEMPLATEPRIORITY_HIGH, + SALESFORCEINCIDENTSTEMPLATEPRIORITY_MODERATE, + SALESFORCEINCIDENTSTEMPLATEPRIORITY_LOW, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SalesforceIncidentsTemplatePriority) GetAllowedValues() []SalesforceIncidentsTemplatePriority { + return allowedSalesforceIncidentsTemplatePriorityEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SalesforceIncidentsTemplatePriority) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SalesforceIncidentsTemplatePriority(value) + return nil +} + +// NewSalesforceIncidentsTemplatePriorityFromValue returns a pointer to a valid SalesforceIncidentsTemplatePriority +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSalesforceIncidentsTemplatePriorityFromValue(v string) (*SalesforceIncidentsTemplatePriority, error) { + ev := SalesforceIncidentsTemplatePriority(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SalesforceIncidentsTemplatePriority: valid values are %v", v, allowedSalesforceIncidentsTemplatePriorityEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SalesforceIncidentsTemplatePriority) IsValid() bool { + for _, existing := range allowedSalesforceIncidentsTemplatePriorityEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SalesforceIncidentsTemplatePriority value. +func (v SalesforceIncidentsTemplatePriority) Ptr() *SalesforceIncidentsTemplatePriority { + return &v +} diff --git a/api/datadogV2/model_salesforce_incidents_template_response.go b/api/datadogV2/model_salesforce_incidents_template_response.go new file mode 100644 index 00000000000..cc33f3815a3 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_template_response.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" +) + +// SalesforceIncidentsTemplateResponse Response containing a Salesforce incident template. +type SalesforceIncidentsTemplateResponse struct { + // Salesforce incident template data from a response. + Data SalesforceIncidentsTemplateResponseData `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:"-"` +} + +// NewSalesforceIncidentsTemplateResponse instantiates a new SalesforceIncidentsTemplateResponse 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 NewSalesforceIncidentsTemplateResponse(data SalesforceIncidentsTemplateResponseData) *SalesforceIncidentsTemplateResponse { + this := SalesforceIncidentsTemplateResponse{} + this.Data = data + return &this +} + +// NewSalesforceIncidentsTemplateResponseWithDefaults instantiates a new SalesforceIncidentsTemplateResponse 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 NewSalesforceIncidentsTemplateResponseWithDefaults() *SalesforceIncidentsTemplateResponse { + this := SalesforceIncidentsTemplateResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *SalesforceIncidentsTemplateResponse) GetData() SalesforceIncidentsTemplateResponseData { + if o == nil { + var ret SalesforceIncidentsTemplateResponseData + 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 *SalesforceIncidentsTemplateResponse) GetDataOk() (*SalesforceIncidentsTemplateResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SalesforceIncidentsTemplateResponse) SetData(v SalesforceIncidentsTemplateResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsTemplateResponse) 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 *SalesforceIncidentsTemplateResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *SalesforceIncidentsTemplateResponseData `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.UnmarshalUseNumber(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_salesforce_incidents_template_response_attributes.go b/api/datadogV2/model_salesforce_incidents_template_response_attributes.go new file mode 100644 index 00000000000..2965f8d8562 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_template_response_attributes.go @@ -0,0 +1,289 @@ +// 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/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SalesforceIncidentsTemplateResponseAttributes Salesforce incident template attributes returned by the API. +type SalesforceIncidentsTemplateResponseAttributes struct { + // Long-form description body for Salesforce incidents created from this template. + Description *string `json:"description,omitempty"` + // Human-readable name for this incident template. + Name *string `json:"name,omitempty"` + // The Salesforce user ID that owns incidents created from this template. + OwnerId *string `json:"owner_id,omitempty"` + // Priority of the Salesforce incident created from this template. + Priority *SalesforceIncidentsTemplatePriority `json:"priority,omitempty"` + // The Datadog-assigned ID of the Salesforce organization this template belongs to. + SalesforceOrgId *uuid.UUID `json:"salesforce_org_id,omitempty"` + // Subject line for Salesforce incidents created from this template. + Subject *string `json:"subject,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSalesforceIncidentsTemplateResponseAttributes instantiates a new SalesforceIncidentsTemplateResponseAttributes 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 NewSalesforceIncidentsTemplateResponseAttributes() *SalesforceIncidentsTemplateResponseAttributes { + this := SalesforceIncidentsTemplateResponseAttributes{} + return &this +} + +// NewSalesforceIncidentsTemplateResponseAttributesWithDefaults instantiates a new SalesforceIncidentsTemplateResponseAttributes 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 NewSalesforceIncidentsTemplateResponseAttributesWithDefaults() *SalesforceIncidentsTemplateResponseAttributes { + this := SalesforceIncidentsTemplateResponseAttributes{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SalesforceIncidentsTemplateResponseAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + 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 *SalesforceIncidentsTemplateResponseAttributes) GetDescriptionOk() (*string, 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 *SalesforceIncidentsTemplateResponseAttributes) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SalesforceIncidentsTemplateResponseAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SalesforceIncidentsTemplateResponseAttributes) 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 *SalesforceIncidentsTemplateResponseAttributes) 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 *SalesforceIncidentsTemplateResponseAttributes) 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 *SalesforceIncidentsTemplateResponseAttributes) SetName(v string) { + o.Name = &v +} + +// GetOwnerId returns the OwnerId field value if set, zero value otherwise. +func (o *SalesforceIncidentsTemplateResponseAttributes) GetOwnerId() string { + if o == nil || o.OwnerId == nil { + var ret string + return ret + } + return *o.OwnerId +} + +// GetOwnerIdOk returns a tuple with the OwnerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsTemplateResponseAttributes) GetOwnerIdOk() (*string, bool) { + if o == nil || o.OwnerId == nil { + return nil, false + } + return o.OwnerId, true +} + +// HasOwnerId returns a boolean if a field has been set. +func (o *SalesforceIncidentsTemplateResponseAttributes) HasOwnerId() bool { + return o != nil && o.OwnerId != nil +} + +// SetOwnerId gets a reference to the given string and assigns it to the OwnerId field. +func (o *SalesforceIncidentsTemplateResponseAttributes) SetOwnerId(v string) { + o.OwnerId = &v +} + +// GetPriority returns the Priority field value if set, zero value otherwise. +func (o *SalesforceIncidentsTemplateResponseAttributes) GetPriority() SalesforceIncidentsTemplatePriority { + if o == nil || o.Priority == nil { + var ret SalesforceIncidentsTemplatePriority + 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 *SalesforceIncidentsTemplateResponseAttributes) GetPriorityOk() (*SalesforceIncidentsTemplatePriority, 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 *SalesforceIncidentsTemplateResponseAttributes) HasPriority() bool { + return o != nil && o.Priority != nil +} + +// SetPriority gets a reference to the given SalesforceIncidentsTemplatePriority and assigns it to the Priority field. +func (o *SalesforceIncidentsTemplateResponseAttributes) SetPriority(v SalesforceIncidentsTemplatePriority) { + o.Priority = &v +} + +// GetSalesforceOrgId returns the SalesforceOrgId field value if set, zero value otherwise. +func (o *SalesforceIncidentsTemplateResponseAttributes) GetSalesforceOrgId() uuid.UUID { + if o == nil || o.SalesforceOrgId == nil { + var ret uuid.UUID + return ret + } + return *o.SalesforceOrgId +} + +// GetSalesforceOrgIdOk returns a tuple with the SalesforceOrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsTemplateResponseAttributes) GetSalesforceOrgIdOk() (*uuid.UUID, bool) { + if o == nil || o.SalesforceOrgId == nil { + return nil, false + } + return o.SalesforceOrgId, true +} + +// HasSalesforceOrgId returns a boolean if a field has been set. +func (o *SalesforceIncidentsTemplateResponseAttributes) HasSalesforceOrgId() bool { + return o != nil && o.SalesforceOrgId != nil +} + +// SetSalesforceOrgId gets a reference to the given uuid.UUID and assigns it to the SalesforceOrgId field. +func (o *SalesforceIncidentsTemplateResponseAttributes) SetSalesforceOrgId(v uuid.UUID) { + o.SalesforceOrgId = &v +} + +// GetSubject returns the Subject field value if set, zero value otherwise. +func (o *SalesforceIncidentsTemplateResponseAttributes) GetSubject() string { + if o == nil || o.Subject == nil { + var ret string + return ret + } + return *o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsTemplateResponseAttributes) GetSubjectOk() (*string, bool) { + if o == nil || o.Subject == nil { + return nil, false + } + return o.Subject, true +} + +// HasSubject returns a boolean if a field has been set. +func (o *SalesforceIncidentsTemplateResponseAttributes) HasSubject() bool { + return o != nil && o.Subject != nil +} + +// SetSubject gets a reference to the given string and assigns it to the Subject field. +func (o *SalesforceIncidentsTemplateResponseAttributes) SetSubject(v string) { + o.Subject = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsTemplateResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.OwnerId != nil { + toSerialize["owner_id"] = o.OwnerId + } + if o.Priority != nil { + toSerialize["priority"] = o.Priority + } + if o.SalesforceOrgId != nil { + toSerialize["salesforce_org_id"] = o.SalesforceOrgId + } + if o.Subject != nil { + toSerialize["subject"] = o.Subject + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SalesforceIncidentsTemplateResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + OwnerId *string `json:"owner_id,omitempty"` + Priority *SalesforceIncidentsTemplatePriority `json:"priority,omitempty"` + SalesforceOrgId *uuid.UUID `json:"salesforce_org_id,omitempty"` + Subject *string `json:"subject,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"description", "name", "owner_id", "priority", "salesforce_org_id", "subject"}) + } else { + return err + } + + hasInvalidField := false + o.Description = all.Description + o.Name = all.Name + o.OwnerId = all.OwnerId + if all.Priority != nil && !all.Priority.IsValid() { + hasInvalidField = true + } else { + o.Priority = all.Priority + } + o.SalesforceOrgId = all.SalesforceOrgId + o.Subject = all.Subject + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_salesforce_incidents_template_response_data.go b/api/datadogV2/model_salesforce_incidents_template_response_data.go new file mode 100644 index 00000000000..fe831b0cec8 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_template_response_data.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" +) + +// SalesforceIncidentsTemplateResponseData Salesforce incident template data from a response. +type SalesforceIncidentsTemplateResponseData struct { + // Salesforce incident template attributes returned by the API. + Attributes SalesforceIncidentsTemplateResponseAttributes `json:"attributes"` + // The ID of the Salesforce incident template. + Id string `json:"id"` + // Salesforce incident template resource type. + Type SalesforceIncidentsTemplateType `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:"-"` +} + +// NewSalesforceIncidentsTemplateResponseData instantiates a new SalesforceIncidentsTemplateResponseData 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 NewSalesforceIncidentsTemplateResponseData(attributes SalesforceIncidentsTemplateResponseAttributes, id string, typeVar SalesforceIncidentsTemplateType) *SalesforceIncidentsTemplateResponseData { + this := SalesforceIncidentsTemplateResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewSalesforceIncidentsTemplateResponseDataWithDefaults instantiates a new SalesforceIncidentsTemplateResponseData 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 NewSalesforceIncidentsTemplateResponseDataWithDefaults() *SalesforceIncidentsTemplateResponseData { + this := SalesforceIncidentsTemplateResponseData{} + var typeVar SalesforceIncidentsTemplateType = SALESFORCEINCIDENTSTEMPLATETYPE_SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *SalesforceIncidentsTemplateResponseData) GetAttributes() SalesforceIncidentsTemplateResponseAttributes { + if o == nil { + var ret SalesforceIncidentsTemplateResponseAttributes + 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 *SalesforceIncidentsTemplateResponseData) GetAttributesOk() (*SalesforceIncidentsTemplateResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *SalesforceIncidentsTemplateResponseData) SetAttributes(v SalesforceIncidentsTemplateResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *SalesforceIncidentsTemplateResponseData) 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 *SalesforceIncidentsTemplateResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *SalesforceIncidentsTemplateResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *SalesforceIncidentsTemplateResponseData) GetType() SalesforceIncidentsTemplateType { + if o == nil { + var ret SalesforceIncidentsTemplateType + 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 *SalesforceIncidentsTemplateResponseData) GetTypeOk() (*SalesforceIncidentsTemplateType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SalesforceIncidentsTemplateResponseData) SetType(v SalesforceIncidentsTemplateType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsTemplateResponseData) 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 *SalesforceIncidentsTemplateResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SalesforceIncidentsTemplateResponseAttributes `json:"attributes"` + Id *string `json:"id"` + Type *SalesforceIncidentsTemplateType `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.UnmarshalUseNumber(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_salesforce_incidents_template_type.go b/api/datadogV2/model_salesforce_incidents_template_type.go new file mode 100644 index 00000000000..10dc88d37c4 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_template_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" +) + +// SalesforceIncidentsTemplateType Salesforce incident template resource type. +type SalesforceIncidentsTemplateType string + +// List of SalesforceIncidentsTemplateType. +const ( + SALESFORCEINCIDENTSTEMPLATETYPE_SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE SalesforceIncidentsTemplateType = "salesforce-incidents-incident-template" +) + +var allowedSalesforceIncidentsTemplateTypeEnumValues = []SalesforceIncidentsTemplateType{ + SALESFORCEINCIDENTSTEMPLATETYPE_SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SalesforceIncidentsTemplateType) GetAllowedValues() []SalesforceIncidentsTemplateType { + return allowedSalesforceIncidentsTemplateTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SalesforceIncidentsTemplateType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SalesforceIncidentsTemplateType(value) + return nil +} + +// NewSalesforceIncidentsTemplateTypeFromValue returns a pointer to a valid SalesforceIncidentsTemplateType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSalesforceIncidentsTemplateTypeFromValue(v string) (*SalesforceIncidentsTemplateType, error) { + ev := SalesforceIncidentsTemplateType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SalesforceIncidentsTemplateType: valid values are %v", v, allowedSalesforceIncidentsTemplateTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SalesforceIncidentsTemplateType) IsValid() bool { + for _, existing := range allowedSalesforceIncidentsTemplateTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SalesforceIncidentsTemplateType value. +func (v SalesforceIncidentsTemplateType) Ptr() *SalesforceIncidentsTemplateType { + return &v +} diff --git a/api/datadogV2/model_salesforce_incidents_template_update_attributes.go b/api/datadogV2/model_salesforce_incidents_template_update_attributes.go new file mode 100644 index 00000000000..271fb33cc9d --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_template_update_attributes.go @@ -0,0 +1,289 @@ +// 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/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SalesforceIncidentsTemplateUpdateAttributes Salesforce incident template attributes for an update request. +type SalesforceIncidentsTemplateUpdateAttributes struct { + // Long-form description body for Salesforce incidents created from this template. + Description *string `json:"description,omitempty"` + // Human-readable name for this incident template. + Name *string `json:"name,omitempty"` + // The Salesforce user ID that owns incidents created from this template. + OwnerId *string `json:"owner_id,omitempty"` + // Priority of the Salesforce incident created from this template. + Priority *SalesforceIncidentsTemplatePriority `json:"priority,omitempty"` + // The Datadog-assigned ID of the Salesforce organization this template belongs to. + SalesforceOrgId *uuid.UUID `json:"salesforce_org_id,omitempty"` + // Subject line for Salesforce incidents created from this template. + Subject *string `json:"subject,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSalesforceIncidentsTemplateUpdateAttributes instantiates a new SalesforceIncidentsTemplateUpdateAttributes 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 NewSalesforceIncidentsTemplateUpdateAttributes() *SalesforceIncidentsTemplateUpdateAttributes { + this := SalesforceIncidentsTemplateUpdateAttributes{} + return &this +} + +// NewSalesforceIncidentsTemplateUpdateAttributesWithDefaults instantiates a new SalesforceIncidentsTemplateUpdateAttributes 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 NewSalesforceIncidentsTemplateUpdateAttributesWithDefaults() *SalesforceIncidentsTemplateUpdateAttributes { + this := SalesforceIncidentsTemplateUpdateAttributes{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SalesforceIncidentsTemplateUpdateAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + 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 *SalesforceIncidentsTemplateUpdateAttributes) GetDescriptionOk() (*string, 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 *SalesforceIncidentsTemplateUpdateAttributes) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SalesforceIncidentsTemplateUpdateAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SalesforceIncidentsTemplateUpdateAttributes) 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 *SalesforceIncidentsTemplateUpdateAttributes) 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 *SalesforceIncidentsTemplateUpdateAttributes) 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 *SalesforceIncidentsTemplateUpdateAttributes) SetName(v string) { + o.Name = &v +} + +// GetOwnerId returns the OwnerId field value if set, zero value otherwise. +func (o *SalesforceIncidentsTemplateUpdateAttributes) GetOwnerId() string { + if o == nil || o.OwnerId == nil { + var ret string + return ret + } + return *o.OwnerId +} + +// GetOwnerIdOk returns a tuple with the OwnerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsTemplateUpdateAttributes) GetOwnerIdOk() (*string, bool) { + if o == nil || o.OwnerId == nil { + return nil, false + } + return o.OwnerId, true +} + +// HasOwnerId returns a boolean if a field has been set. +func (o *SalesforceIncidentsTemplateUpdateAttributes) HasOwnerId() bool { + return o != nil && o.OwnerId != nil +} + +// SetOwnerId gets a reference to the given string and assigns it to the OwnerId field. +func (o *SalesforceIncidentsTemplateUpdateAttributes) SetOwnerId(v string) { + o.OwnerId = &v +} + +// GetPriority returns the Priority field value if set, zero value otherwise. +func (o *SalesforceIncidentsTemplateUpdateAttributes) GetPriority() SalesforceIncidentsTemplatePriority { + if o == nil || o.Priority == nil { + var ret SalesforceIncidentsTemplatePriority + 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 *SalesforceIncidentsTemplateUpdateAttributes) GetPriorityOk() (*SalesforceIncidentsTemplatePriority, 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 *SalesforceIncidentsTemplateUpdateAttributes) HasPriority() bool { + return o != nil && o.Priority != nil +} + +// SetPriority gets a reference to the given SalesforceIncidentsTemplatePriority and assigns it to the Priority field. +func (o *SalesforceIncidentsTemplateUpdateAttributes) SetPriority(v SalesforceIncidentsTemplatePriority) { + o.Priority = &v +} + +// GetSalesforceOrgId returns the SalesforceOrgId field value if set, zero value otherwise. +func (o *SalesforceIncidentsTemplateUpdateAttributes) GetSalesforceOrgId() uuid.UUID { + if o == nil || o.SalesforceOrgId == nil { + var ret uuid.UUID + return ret + } + return *o.SalesforceOrgId +} + +// GetSalesforceOrgIdOk returns a tuple with the SalesforceOrgId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsTemplateUpdateAttributes) GetSalesforceOrgIdOk() (*uuid.UUID, bool) { + if o == nil || o.SalesforceOrgId == nil { + return nil, false + } + return o.SalesforceOrgId, true +} + +// HasSalesforceOrgId returns a boolean if a field has been set. +func (o *SalesforceIncidentsTemplateUpdateAttributes) HasSalesforceOrgId() bool { + return o != nil && o.SalesforceOrgId != nil +} + +// SetSalesforceOrgId gets a reference to the given uuid.UUID and assigns it to the SalesforceOrgId field. +func (o *SalesforceIncidentsTemplateUpdateAttributes) SetSalesforceOrgId(v uuid.UUID) { + o.SalesforceOrgId = &v +} + +// GetSubject returns the Subject field value if set, zero value otherwise. +func (o *SalesforceIncidentsTemplateUpdateAttributes) GetSubject() string { + if o == nil || o.Subject == nil { + var ret string + return ret + } + return *o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SalesforceIncidentsTemplateUpdateAttributes) GetSubjectOk() (*string, bool) { + if o == nil || o.Subject == nil { + return nil, false + } + return o.Subject, true +} + +// HasSubject returns a boolean if a field has been set. +func (o *SalesforceIncidentsTemplateUpdateAttributes) HasSubject() bool { + return o != nil && o.Subject != nil +} + +// SetSubject gets a reference to the given string and assigns it to the Subject field. +func (o *SalesforceIncidentsTemplateUpdateAttributes) SetSubject(v string) { + o.Subject = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsTemplateUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.OwnerId != nil { + toSerialize["owner_id"] = o.OwnerId + } + if o.Priority != nil { + toSerialize["priority"] = o.Priority + } + if o.SalesforceOrgId != nil { + toSerialize["salesforce_org_id"] = o.SalesforceOrgId + } + if o.Subject != nil { + toSerialize["subject"] = o.Subject + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SalesforceIncidentsTemplateUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + OwnerId *string `json:"owner_id,omitempty"` + Priority *SalesforceIncidentsTemplatePriority `json:"priority,omitempty"` + SalesforceOrgId *uuid.UUID `json:"salesforce_org_id,omitempty"` + Subject *string `json:"subject,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"description", "name", "owner_id", "priority", "salesforce_org_id", "subject"}) + } else { + return err + } + + hasInvalidField := false + o.Description = all.Description + o.Name = all.Name + o.OwnerId = all.OwnerId + if all.Priority != nil && !all.Priority.IsValid() { + hasInvalidField = true + } else { + o.Priority = all.Priority + } + o.SalesforceOrgId = all.SalesforceOrgId + o.Subject = all.Subject + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_salesforce_incidents_template_update_data.go b/api/datadogV2/model_salesforce_incidents_template_update_data.go new file mode 100644 index 00000000000..f1026fa42a4 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_template_update_data.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" +) + +// SalesforceIncidentsTemplateUpdateData Salesforce incident template data for an update request. +type SalesforceIncidentsTemplateUpdateData struct { + // Salesforce incident template attributes for an update request. + Attributes SalesforceIncidentsTemplateUpdateAttributes `json:"attributes"` + // The ID of the Salesforce incident template being updated. Must match the path parameter. + Id string `json:"id"` + // Salesforce incident template resource type. + Type SalesforceIncidentsTemplateType `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:"-"` +} + +// NewSalesforceIncidentsTemplateUpdateData instantiates a new SalesforceIncidentsTemplateUpdateData 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 NewSalesforceIncidentsTemplateUpdateData(attributes SalesforceIncidentsTemplateUpdateAttributes, id string, typeVar SalesforceIncidentsTemplateType) *SalesforceIncidentsTemplateUpdateData { + this := SalesforceIncidentsTemplateUpdateData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewSalesforceIncidentsTemplateUpdateDataWithDefaults instantiates a new SalesforceIncidentsTemplateUpdateData 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 NewSalesforceIncidentsTemplateUpdateDataWithDefaults() *SalesforceIncidentsTemplateUpdateData { + this := SalesforceIncidentsTemplateUpdateData{} + var typeVar SalesforceIncidentsTemplateType = SALESFORCEINCIDENTSTEMPLATETYPE_SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *SalesforceIncidentsTemplateUpdateData) GetAttributes() SalesforceIncidentsTemplateUpdateAttributes { + if o == nil { + var ret SalesforceIncidentsTemplateUpdateAttributes + 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 *SalesforceIncidentsTemplateUpdateData) GetAttributesOk() (*SalesforceIncidentsTemplateUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *SalesforceIncidentsTemplateUpdateData) SetAttributes(v SalesforceIncidentsTemplateUpdateAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *SalesforceIncidentsTemplateUpdateData) 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 *SalesforceIncidentsTemplateUpdateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *SalesforceIncidentsTemplateUpdateData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *SalesforceIncidentsTemplateUpdateData) GetType() SalesforceIncidentsTemplateType { + if o == nil { + var ret SalesforceIncidentsTemplateType + 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 *SalesforceIncidentsTemplateUpdateData) GetTypeOk() (*SalesforceIncidentsTemplateType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SalesforceIncidentsTemplateUpdateData) SetType(v SalesforceIncidentsTemplateType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsTemplateUpdateData) 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 *SalesforceIncidentsTemplateUpdateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SalesforceIncidentsTemplateUpdateAttributes `json:"attributes"` + Id *string `json:"id"` + Type *SalesforceIncidentsTemplateType `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.UnmarshalUseNumber(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_salesforce_incidents_template_update_request.go b/api/datadogV2/model_salesforce_incidents_template_update_request.go new file mode 100644 index 00000000000..fdfbbbc5008 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_template_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" +) + +// SalesforceIncidentsTemplateUpdateRequest Update request for a Salesforce incident template. +type SalesforceIncidentsTemplateUpdateRequest struct { + // Salesforce incident template data for an update request. + Data SalesforceIncidentsTemplateUpdateData `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:"-"` +} + +// NewSalesforceIncidentsTemplateUpdateRequest instantiates a new SalesforceIncidentsTemplateUpdateRequest 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 NewSalesforceIncidentsTemplateUpdateRequest(data SalesforceIncidentsTemplateUpdateData) *SalesforceIncidentsTemplateUpdateRequest { + this := SalesforceIncidentsTemplateUpdateRequest{} + this.Data = data + return &this +} + +// NewSalesforceIncidentsTemplateUpdateRequestWithDefaults instantiates a new SalesforceIncidentsTemplateUpdateRequest 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 NewSalesforceIncidentsTemplateUpdateRequestWithDefaults() *SalesforceIncidentsTemplateUpdateRequest { + this := SalesforceIncidentsTemplateUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *SalesforceIncidentsTemplateUpdateRequest) GetData() SalesforceIncidentsTemplateUpdateData { + if o == nil { + var ret SalesforceIncidentsTemplateUpdateData + 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 *SalesforceIncidentsTemplateUpdateRequest) GetDataOk() (*SalesforceIncidentsTemplateUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SalesforceIncidentsTemplateUpdateRequest) SetData(v SalesforceIncidentsTemplateUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsTemplateUpdateRequest) 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 *SalesforceIncidentsTemplateUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *SalesforceIncidentsTemplateUpdateData `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.UnmarshalUseNumber(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_salesforce_incidents_templates_response.go b/api/datadogV2/model_salesforce_incidents_templates_response.go new file mode 100644 index 00000000000..41bf59009c1 --- /dev/null +++ b/api/datadogV2/model_salesforce_incidents_templates_response.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SalesforceIncidentsTemplatesResponse Response containing a list of Salesforce incident templates. +type SalesforceIncidentsTemplatesResponse struct { + // An array of Salesforce incident templates. + Data []SalesforceIncidentsTemplateResponseData `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:"-"` +} + +// NewSalesforceIncidentsTemplatesResponse instantiates a new SalesforceIncidentsTemplatesResponse 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 NewSalesforceIncidentsTemplatesResponse(data []SalesforceIncidentsTemplateResponseData) *SalesforceIncidentsTemplatesResponse { + this := SalesforceIncidentsTemplatesResponse{} + this.Data = data + return &this +} + +// NewSalesforceIncidentsTemplatesResponseWithDefaults instantiates a new SalesforceIncidentsTemplatesResponse 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 NewSalesforceIncidentsTemplatesResponseWithDefaults() *SalesforceIncidentsTemplatesResponse { + this := SalesforceIncidentsTemplatesResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *SalesforceIncidentsTemplatesResponse) GetData() []SalesforceIncidentsTemplateResponseData { + if o == nil { + var ret []SalesforceIncidentsTemplateResponseData + 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 *SalesforceIncidentsTemplatesResponse) GetDataOk() (*[]SalesforceIncidentsTemplateResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SalesforceIncidentsTemplatesResponse) SetData(v []SalesforceIncidentsTemplateResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SalesforceIncidentsTemplatesResponse) 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 *SalesforceIncidentsTemplatesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]SalesforceIncidentsTemplateResponseData `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.UnmarshalUseNumber(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/examples/v2/salesforce-integration/CreateIncidentTemplate.go b/examples/v2/salesforce-integration/CreateIncidentTemplate.go new file mode 100644 index 00000000000..e8e728ec4de --- /dev/null +++ b/examples/v2/salesforce-integration/CreateIncidentTemplate.go @@ -0,0 +1,43 @@ +// Create a Salesforce incident template 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" + "github.com/google/uuid" +) + +func main() { + body := datadogV2.SalesforceIncidentsTemplateCreateRequest{ + Data: datadogV2.SalesforceIncidentsTemplateCreateData{ + Attributes: datadogV2.SalesforceIncidentsTemplateCreateAttributes{ + Description: "An incident was detected by Datadog monitors.", + Name: "production-outage", + OwnerId: "005000000000000", + Priority: datadogV2.SALESFORCEINCIDENTSTEMPLATEPRIORITY_HIGH, + SalesforceOrgId: uuid.MustParse("596da4af-0563-4097-90ff-07230c3f9db3"), + Subject: "Datadog Incident: Production Outage", + }, + Type: datadogV2.SALESFORCEINCIDENTSTEMPLATETYPE_SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSalesforceIntegrationApi(apiClient) + resp, r, err := api.CreateIncidentTemplate(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SalesforceIntegrationApi.CreateIncidentTemplate`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SalesforceIntegrationApi.CreateIncidentTemplate`:\n%s\n", responseContent) +} diff --git a/examples/v2/salesforce-integration/DeleteIncidentTemplate.go b/examples/v2/salesforce-integration/DeleteIncidentTemplate.go new file mode 100644 index 00000000000..7378ee7094c --- /dev/null +++ b/examples/v2/salesforce-integration/DeleteIncidentTemplate.go @@ -0,0 +1,25 @@ +// Delete a Salesforce incident template returns "OK" 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.NewSalesforceIntegrationApi(apiClient) + r, err := api.DeleteIncidentTemplate(ctx, "incident_template_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SalesforceIntegrationApi.DeleteIncidentTemplate`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/salesforce-integration/DeleteSalesforceOrganization.go b/examples/v2/salesforce-integration/DeleteSalesforceOrganization.go new file mode 100644 index 00000000000..75e73712244 --- /dev/null +++ b/examples/v2/salesforce-integration/DeleteSalesforceOrganization.go @@ -0,0 +1,25 @@ +// Delete a connected Salesforce organization returns "OK" 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.NewSalesforceIntegrationApi(apiClient) + r, err := api.DeleteSalesforceOrganization(ctx, "salesforce_org_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SalesforceIntegrationApi.DeleteSalesforceOrganization`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/salesforce-integration/GetIncidentTemplates.go b/examples/v2/salesforce-integration/GetIncidentTemplates.go new file mode 100644 index 00000000000..a0ef9d84741 --- /dev/null +++ b/examples/v2/salesforce-integration/GetIncidentTemplates.go @@ -0,0 +1,29 @@ +// Get all Salesforce incident templates 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.NewSalesforceIntegrationApi(apiClient) + resp, r, err := api.GetIncidentTemplates(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SalesforceIntegrationApi.GetIncidentTemplates`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SalesforceIntegrationApi.GetIncidentTemplates`:\n%s\n", responseContent) +} diff --git a/examples/v2/salesforce-integration/GetSalesforceOrganizations.go b/examples/v2/salesforce-integration/GetSalesforceOrganizations.go new file mode 100644 index 00000000000..0c0ec257f93 --- /dev/null +++ b/examples/v2/salesforce-integration/GetSalesforceOrganizations.go @@ -0,0 +1,29 @@ +// Get all connected Salesforce organizations 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.NewSalesforceIntegrationApi(apiClient) + resp, r, err := api.GetSalesforceOrganizations(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SalesforceIntegrationApi.GetSalesforceOrganizations`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SalesforceIntegrationApi.GetSalesforceOrganizations`:\n%s\n", responseContent) +} diff --git a/examples/v2/salesforce-integration/UpdateIncidentTemplate.go b/examples/v2/salesforce-integration/UpdateIncidentTemplate.go new file mode 100644 index 00000000000..6507ca56893 --- /dev/null +++ b/examples/v2/salesforce-integration/UpdateIncidentTemplate.go @@ -0,0 +1,44 @@ +// Update a Salesforce incident template returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" + "github.com/google/uuid" +) + +func main() { + body := datadogV2.SalesforceIncidentsTemplateUpdateRequest{ + Data: datadogV2.SalesforceIncidentsTemplateUpdateData{ + Attributes: datadogV2.SalesforceIncidentsTemplateUpdateAttributes{ + Description: datadog.PtrString("An incident was detected by Datadog monitors."), + Name: datadog.PtrString("production-outage"), + OwnerId: datadog.PtrString("005000000000000"), + Priority: datadogV2.SALESFORCEINCIDENTSTEMPLATEPRIORITY_HIGH.Ptr(), + SalesforceOrgId: datadog.PtrUUID(uuid.MustParse("596da4af-0563-4097-90ff-07230c3f9db3")), + Subject: datadog.PtrString("Datadog Incident: Production Outage"), + }, + Id: "596da4af-0563-4097-90ff-07230c3f9db3", + Type: datadogV2.SALESFORCEINCIDENTSTEMPLATETYPE_SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSalesforceIntegrationApi(apiClient) + resp, r, err := api.UpdateIncidentTemplate(ctx, "incident_template_id", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SalesforceIntegrationApi.UpdateIncidentTemplate`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SalesforceIntegrationApi.UpdateIncidentTemplate`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index f3912505450..0a33f78f4cd 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -102,6 +102,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "MicrosoftTeamsIntegrationApi": reflect.ValueOf(datadogV2.NewMicrosoftTeamsIntegrationApi), "OCIIntegrationApi": reflect.ValueOf(datadogV2.NewOCIIntegrationApi), "OpsgenieIntegrationApi": reflect.ValueOf(datadogV2.NewOpsgenieIntegrationApi), + "SalesforceIntegrationApi": reflect.ValueOf(datadogV2.NewSalesforceIntegrationApi), "ServiceNowIntegrationApi": reflect.ValueOf(datadogV2.NewServiceNowIntegrationApi), "StatuspageIntegrationApi": reflect.ValueOf(datadogV2.NewStatuspageIntegrationApi), "WebhooksIntegrationApi": reflect.ValueOf(datadogV2.NewWebhooksIntegrationApi), diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 63f710c0e91..097f6a07d55 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -698,6 +698,18 @@ "tag": "Opsgenie Integration", "operationId": "CreateOpsgenieService" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"salesforce_org_id\": \"596da4af-0563-4097-90ff-07230c3f9db3\",\n \"name\": \"{{ unique }}\",\n \"subject\": \"Datadog Incident: Production Outage\",\n \"description\": \"An incident was detected by Datadog monitors.\",\n \"owner_id\": \"005000000000000\",\n \"priority\": \"High\"\n },\n \"type\": \"salesforce-incidents-incident-template\"\n }\n}" + } + ], + "step": "there is a valid \"salesforce_incidents_template\" in the system", + "key": "salesforce_incidents_template", + "tag": "Salesforce Integration", + "operationId": "CreateIncidentTemplate" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/salesforce_integration.feature b/tests/scenarios/features/v2/salesforce_integration.feature new file mode 100644 index 00000000000..63b3c068dfd --- /dev/null +++ b/tests/scenarios/features/v2/salesforce_integration.feature @@ -0,0 +1,129 @@ +@endpoint(salesforce-integration) @endpoint(salesforce-integration-v2) +Feature: Salesforce Integration + Configure your [Datadog Salesforce + integration](https://docs.datadoghq.com/integrations/salesforce/) directly + through the Datadog API. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "SalesforceIntegration" API + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Create a Salesforce incident template returns "Bad Request" response + Given new "CreateIncidentTemplate" request + And body with value {"data": {"attributes": {"description": "An incident was detected by Datadog monitors.", "name": "production-outage", "owner_id": "005000000000000", "priority": "High", "salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3", "subject": "Datadog Incident: Production Outage"}, "type": "salesforce-incidents-incident-template"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Create a Salesforce incident template returns "CREATED" response + Given new "CreateIncidentTemplate" request + And body with value {"data": {"attributes": {"description": "An incident was detected by Datadog monitors.", "name": "production-outage", "owner_id": "005000000000000", "priority": "High", "salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3", "subject": "Datadog Incident: Production Outage"}, "type": "salesforce-incidents-incident-template"}} + When the request is sent + Then the response status is 201 CREATED + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Create a Salesforce incident template returns "Conflict" response + Given new "CreateIncidentTemplate" request + And body with value {"data": {"attributes": {"description": "An incident was detected by Datadog monitors.", "name": "production-outage", "owner_id": "005000000000000", "priority": "High", "salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3", "subject": "Datadog Incident: Production Outage"}, "type": "salesforce-incidents-incident-template"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Create a Salesforce incident template returns "Not Found" response + Given new "CreateIncidentTemplate" request + And body with value {"data": {"attributes": {"description": "An incident was detected by Datadog monitors.", "name": "production-outage", "owner_id": "005000000000000", "priority": "High", "salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3", "subject": "Datadog Incident: Production Outage"}, "type": "salesforce-incidents-incident-template"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Delete a Salesforce incident template returns "Not Found" response + Given new "DeleteIncidentTemplate" request + And request contains "incident_template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Delete a Salesforce incident template returns "OK" response + Given new "DeleteIncidentTemplate" request + And request contains "incident_template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 OK + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Delete a connected Salesforce organization returns "Bad Request" response + Given new "DeleteSalesforceOrganization" request + And request contains "salesforce_org_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Delete a connected Salesforce organization returns "Not Found" response + Given new "DeleteSalesforceOrganization" request + And request contains "salesforce_org_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Delete a connected Salesforce organization returns "OK" response + Given new "DeleteSalesforceOrganization" request + And request contains "salesforce_org_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 OK + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Get all Salesforce incident templates returns "OK" response + Given new "GetIncidentTemplates" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Get all connected Salesforce organizations returns "Bad Request" response + Given new "GetSalesforceOrganizations" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Get all connected Salesforce organizations returns "Not Found" response + Given new "GetSalesforceOrganizations" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Get all connected Salesforce organizations returns "OK" response + Given new "GetSalesforceOrganizations" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Update a Salesforce incident template returns "Bad Request" response + Given new "UpdateIncidentTemplate" request + And request contains "incident_template_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "An incident was detected by Datadog monitors.", "name": "production-outage", "owner_id": "005000000000000", "priority": "High", "salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3", "subject": "Datadog Incident: Production Outage"}, "id": "596da4af-0563-4097-90ff-07230c3f9db3", "type": "salesforce-incidents-incident-template"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Update a Salesforce incident template returns "Conflict" response + Given new "UpdateIncidentTemplate" request + And request contains "incident_template_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "An incident was detected by Datadog monitors.", "name": "production-outage", "owner_id": "005000000000000", "priority": "High", "salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3", "subject": "Datadog Incident: Production Outage"}, "id": "596da4af-0563-4097-90ff-07230c3f9db3", "type": "salesforce-incidents-incident-template"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Update a Salesforce incident template returns "Not Found" response + Given new "UpdateIncidentTemplate" request + And request contains "incident_template_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "An incident was detected by Datadog monitors.", "name": "production-outage", "owner_id": "005000000000000", "priority": "High", "salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3", "subject": "Datadog Incident: Production Outage"}, "id": "596da4af-0563-4097-90ff-07230c3f9db3", "type": "salesforce-incidents-incident-template"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:Datadog/collaboration-integrations + Scenario: Update a Salesforce incident template returns "OK" response + Given new "UpdateIncidentTemplate" request + And request contains "incident_template_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "An incident was detected by Datadog monitors.", "name": "production-outage", "owner_id": "005000000000000", "priority": "High", "salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3", "subject": "Datadog Incident: Production Outage"}, "id": "596da4af-0563-4097-90ff-07230c3f9db3", "type": "salesforce-incidents-incident-template"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 3e68f592842..c45aea0fd2c 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -3524,6 +3524,49 @@ "type": "idempotent" } }, + "GetIncidentTemplates": { + "tag": "Salesforce Integration", + "undo": { + "type": "safe" + } + }, + "CreateIncidentTemplate": { + "tag": "Salesforce Integration", + "undo": { + "operationId": "DeleteIncidentTemplate", + "parameters": [ + { + "name": "incident_template_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteIncidentTemplate": { + "tag": "Salesforce Integration", + "undo": { + "type": "idempotent" + } + }, + "UpdateIncidentTemplate": { + "tag": "Salesforce Integration", + "undo": { + "type": "idempotent" + } + }, + "GetSalesforceOrganizations": { + "tag": "Salesforce Integration", + "undo": { + "type": "safe" + } + }, + "DeleteSalesforceOrganization": { + "tag": "Salesforce Integration", + "undo": { + "type": "idempotent" + } + }, "ListServiceNowAssignmentGroups": { "tag": "ServiceNow Integration", "undo": {